v04

package
v0.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

DONTCOVER nolint

Index

Constants

View Source
const (
	// ModuleName nolint
	ModuleName = "oracle"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateExchangeRatePrevote

type AggregateExchangeRatePrevote struct {
	Hash        VoteHash       `json:"hash"`  // Vote hex hash to protect centralize data source problem
	Voter       sdk.ValAddress `json:"voter"` // Voter val address
	SubmitBlock int64          `json:"submit_block"`
}

AggregateExchangeRatePrevote - struct to store a validator's aggregate prevote on the rate of Luna in the denom asset

type AggregateExchangeRateVote

type AggregateExchangeRateVote struct {
	ExchangeRateTuples ExchangeRateTuples `json:"exchange_rate_tuples"` // ExchangeRates of Luna in target fiat currencies
	Voter              sdk.ValAddress     `json:"voter"`                // voter val address of validator
}

AggregateExchangeRateVote - struct to store a validator's aggregate vote on the rate of Luna in the denom asset

type Denom

type Denom struct {
	Name     string  `json:"name" yaml:"name"`
	TobinTax sdk.Dec `json:"tobin_tax" yaml:"tobin_tax"`
}

Denom is the object to hold configurations of each denom

type DenomList

type DenomList []Denom

DenomList is array of Denom

type ExchangeRatePrevote

type ExchangeRatePrevote struct {
	Hash        VoteHash       `json:"hash"`  // Vote hex hash to protect centralize data source problem
	Denom       string         `json:"denom"` // Ticker name of target fiat currency
	Voter       sdk.ValAddress `json:"voter"` // Voter val address
	SubmitBlock int64          `json:"submit_block"`
}

ExchangeRatePrevote - struct to store a validator's prevote on the rate of Luna in the denom asset

type ExchangeRateTuple

type ExchangeRateTuple struct {
	Denom        string  `json:"denom"`
	ExchangeRate sdk.Dec `json:"exchange_rate"`
}

ExchangeRateTuple - struct to represent a exchange rate of Luna in the denom asset

type ExchangeRateTuples

type ExchangeRateTuples []ExchangeRateTuple

ExchangeRateTuples - array of ExchangeRateTuple

type ExchangeRateVote

type ExchangeRateVote struct {
	ExchangeRate sdk.Dec        `json:"exchange_rate"` // ExchangeRate of Luna in target fiat currency
	Denom        string         `json:"denom"`         // Ticker name of target fiat currency
	Voter        sdk.ValAddress `json:"voter"`         // voter val address of validator
}

ExchangeRateVote - struct to store a validator's vote on the rate of Luna in the denom asset

type GenesisState

type GenesisState struct {
	Params                        Params                         `json:"params" yaml:"params"`
	FeederDelegations             map[string]sdk.AccAddress      `json:"feeder_delegations" yaml:"feeder_delegations"`
	ExchangeRates                 map[string]sdk.Dec             `json:"exchange_rates" yaml:"exchange_rates"`
	ExchangeRatePrevotes          []ExchangeRatePrevote          `json:"exchange_rate_prevotes" yaml:"exchange_rate_prevotes"`
	ExchangeRateVotes             []ExchangeRateVote             `json:"exchange_rate_votes" yaml:"exchange_rate_votes"`
	MissCounters                  map[string]int64               `json:"miss_counters" yaml:"miss_counters"`
	AggregateExchangeRatePrevotes []AggregateExchangeRatePrevote `json:"aggregate_exchange_rate_prevotes" yaml:"aggregate_exchange_rate_prevotes"`
	AggregateExchangeRateVotes    []AggregateExchangeRateVote    `json:"aggregate_exchange_rate_votes" yaml:"aggregate_exchange_rate_votes"`
	TobinTaxes                    map[string]sdk.Dec             `json:"tobin_taxes" yaml:"tobin_taxes"`
}

GenesisState - all oracle state that must be provided at genesis

type Params

type Params struct {
	VotePeriod               int64     `json:"vote_period" yaml:"vote_period"`                               // the number of blocks during which voting takes place.
	VoteThreshold            sdk.Dec   `json:"vote_threshold" yaml:"vote_threshold"`                         // the minimum percentage of votes that must be received for a ballot to pass.
	RewardBand               sdk.Dec   `json:"reward_band" yaml:"reward_band"`                               // the ratio of allowable exchange rate error that can be rewarded.
	RewardDistributionWindow int64     `json:"reward_distribution_window" yaml:"reward_distribution_window"` // the number of blocks during which seigniorage reward comes in and then is distributed.
	Whitelist                DenomList `json:"whitelist" yaml:"whitelist"`                                   // the denom list that can be activated,
	SlashFraction            sdk.Dec   `json:"slash_fraction" yaml:"slash_fraction"`                         // the ratio of penalty on bonded tokens
	SlashWindow              int64     `json:"slash_window" yaml:"slash_window"`                             // the number of blocks for slashing tallying
	MinValidPerWindow        sdk.Dec   `json:"min_valid_per_window" yaml:"min_valid_per_window"`             // the ratio of minimum valid oracle votes per slash window to avoid slashing
}

Params oracle parameters

type VoteHash

type VoteHash []byte

VoteHash is hash value to hide vote exchange rate which is formatted as hex string in SHA256("{salt}:{exchange_rate}:{denom}:{voter}")

func VoteHashFromHexString

func VoteHashFromHexString(s string) (VoteHash, error)

VoteHashFromHexString convert hex string to VoteHash

func (VoteHash) Marshal

func (h VoteHash) Marshal() ([]byte, error)

Marshal returns the raw address bytes. It is needed for protobuf compatibility.

func (VoteHash) MarshalJSON

func (h VoteHash) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON using Bech32.

func (VoteHash) MarshalYAML

func (h VoteHash) MarshalYAML() (interface{}, error)

MarshalYAML marshals to YAML using Bech32.

func (VoteHash) String

func (h VoteHash) String() string

String implements fmt.Stringer interface

func (*VoteHash) Unmarshal

func (h *VoteHash) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*VoteHash) UnmarshalJSON

func (h *VoteHash) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL