oracle

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "ORA"

	CodeNotValidator   sdk.CodeType = 1
	CodeNotEnoughVotes sdk.CodeType = 2
	CodeUnknownRequest sdk.CodeType = sdk.CodeUnknownRequest
)

Oracle errors reserve 1101-1199

Variables

View Source
var (
	PrefixVote  = []byte{0x00}
	PrefixElect = []byte{0x01}
)

nolint

Functions

func EndBlocker

func EndBlocker(ctx sdk.Context, k Keeper) (resTags sdk.Tags)

func ErrNotEnoughVotes

func ErrNotEnoughVotes(codespace sdk.CodespaceType) sdk.Error

ErrAlreadyProcessed called when a payload is already processed

func ErrNotValidator

func ErrNotValidator(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error

ErrNotValidator called when the signer of a Msg is not a validator

func ErrWrongDenomination

func ErrWrongDenomination(codespace sdk.CodespaceType, denom string) sdk.Error

ErrWrongDenomination called when the signer of a Msg is not a validator

func GetElectKey

func GetElectKey(denom string) []byte

GetElectKey is in format of PrefixElect||denom

func GetVoteKey

func GetVoteKey(denom string, voter sdk.AccAddress) []byte

GetVoteKey Key is in format of PrefixVote||denom||voter.AccAddress

func GetVotePrefix

func GetVotePrefix(denom string) []byte

GetVotePrefix is in format of prefix||denom

func NewEndBlocker

func NewEndBlocker(k Keeper) sdk.EndBlocker

NewEndBlocker checks proposals and generates a EndBlocker

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler returns a handler for "bank" type messages.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper of the oracle store

func NewKeeper

func NewKeeper(key sdk.StoreKey, cdc *codec.Codec, valset sdk.ValidatorSet, supermajority sdk.Dec, timeout int64) Keeper

NewKeeper constructs a new keeper

func (Keeper) AddVote

func (keeper Keeper) AddVote(ctx sdk.Context, vote PriceVote)

func (Keeper) Elect

func (keeper Keeper) Elect(ctx sdk.Context, denom string) (PriceVote, sdk.Error)

func (Keeper) GetElect

func (keeper Keeper) GetElect(ctx sdk.Context, denom string) (res PriceVote)

nolint

type PriceFeedMsg

type PriceFeedMsg struct {
	Denom  string
	Price  sdk.Dec
	Feeder sdk.AccAddress
}

PriceFeedMsg - struct for voting on payloads

func NewPriceFeedMsg

func NewPriceFeedMsg(denom string, price sdk.Dec, feederAddress sdk.AccAddress) PriceFeedMsg

NewPriceFeedMsg creates a PriceFeedMsg instance

func (PriceFeedMsg) GetSignBytes

func (msg PriceFeedMsg) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (PriceFeedMsg) GetSigners

func (msg PriceFeedMsg) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (PriceFeedMsg) Route

func (msg PriceFeedMsg) Route() string

Route Implements Msg

func (PriceFeedMsg) String

func (msg PriceFeedMsg) String() string

String Implements sdk.Msg

func (PriceFeedMsg) Type

func (msg PriceFeedMsg) Type() string

Type implements sdk.Msg

func (PriceFeedMsg) ValidateBasic

func (msg PriceFeedMsg) ValidateBasic() sdk.Error

ValidateBasic Implements sdk.Msg

type PriceVote

type PriceVote struct {
	Denom  string
	Price  sdk.Dec
	Feeder sdk.AccAddress
	Power  sdk.Dec
}

PriceVote - struct to store a validator's vote on the price

func NewPriceVote

func NewPriceVote(feedMsg PriceFeedMsg, power sdk.Dec) PriceVote

NewPriceVote creates a PriceVote instance

type PriceVotes

type PriceVotes []PriceVote

PriceVotes are a collection of Price Votes

func (PriceVotes) Len

func (pv PriceVotes) Len() int

func (PriceVotes) Less

func (pv PriceVotes) Less(i, j int) bool

func (PriceVotes) Swap

func (pv PriceVotes) Swap(i, j int)

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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