Documentation ¶
Index ¶
Constants ¶
const ( // ModuleName is the name of the oracle module ModuleName = "oracle" // StoreKey is the string store representation StoreKey = ModuleName // QuerierRoute is the querier route for the oracle module QuerierRoute = ModuleName // RouterKey is the msg router key for the oracle module RouterKey = ModuleName )
const ( TestID = "oracleID" AlternateTestID = "altOracleID" TestString = "{value: 5}" AlternateTestString = "{value: 7}" AnotherAlternateTestString = "{value: 9}" )
const DefaultCodespace = "oracle"
const FailedStatusText = "failed"
const PendingStatusText = "pending"
const SuccessStatusText = "success"
Variables ¶
var ( ErrProphecyNotFound = sdkerrors.Register(ModuleName, 1, "prophecy with given id not found") ErrMinimumConsensusNeededInvalid = sdkerrors.Register(ModuleName, 2, "minimum consensus proportion of validator staking power must be > 0 and <= 1") ErrNoClaims = sdkerrors.Register(ModuleName, 3, "cannot create prophecy without initial claim") ErrInvalidIdentifier = sdkerrors.Register(ModuleName, 4, "invalid identifier provided, must be a nonempty string") ErrProphecyFinalized = sdkerrors.Register(ModuleName, 5, "Prophecy already finalized") ErrDuplicateMessage = sdkerrors.Register(ModuleName, 6, "Already processed message from validator for this id") ErrInvalidClaim = sdkerrors.Register(ModuleName, 7, "Claim cannot be empty string") ErrInvalidValidator = sdkerrors.Register(ModuleName, 8, "Claim must be made by actively bonded validator") ErrInternalDB = sdkerrors.Register(ModuleName, 9, "Internal error serializing/deserializing prophecy: ") )
Functions ¶
This section is empty.
Types ¶
type DBProphecy ¶
type DBProphecy struct { ID string `json:"id"` Status Status `json:"status"` ClaimValidators []byte `json:"claim_validators"` //This is a mapping from a claim to the list of validators that made that claim ValidatorClaims []byte `json:"validator_claims"` //This is a mapping from a validator bech32 address to their claim }
DBProphecy is what the prophecy becomes when being saved to the database. Tendermint/Amino does not support maps so we must serialize those variables into bytes.
func (DBProphecy) DeserializeFromDB ¶
func (dbProphecy DBProphecy) DeserializeFromDB() (Prophecy, error)
DeserializeFromDB deserializes a DBProphecy into a prophecy
type MsgClient ¶
type MsgClient interface { }
MsgClient is the client API for Msg service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewMsgClient ¶
func NewMsgClient(cc grpc1.ClientConn) MsgClient
type MsgMakeEthBridgeClaim ¶
type MsgMakeEthBridgeClaimResponse ¶
type MsgMakeEthBridgeClaimResponse struct { }
type MsgServer ¶
type MsgServer interface { // Send defines a method for sending coins from one account to another account. MakeEthBridgeClaim(context.Context, *MsgMakeEthBridgeClaim) (*MsgMakeEthBridgeClaimResponse, error) }
MsgServer is the server API for Msg service.
type Prophecy ¶
type Prophecy struct { ID string `json:"id"` Status Status `json:"status"` ClaimValidators map[string][]sdk.ValAddress `json:"claim_validators"` //This is a mapping from a claim to the list of validators that made that claim ValidatorClaims map[string]string `json:"validator_claims"` //This is a mapping from a validator bech32 address to their claim }
func NewEmptyProphecy ¶
func NewEmptyProphecy() Prophecy
NewEmptyProphecy returns a blank prophecy, used with errors
func NewProphecy ¶
NewProphecy returns a new Prophecy, initialized in pending status with an initial claim
func (Prophecy) AddClaim ¶
func (prophecy Prophecy) AddClaim(validator sdk.ValAddress, claim string)
AddClaim adds a given claim to this prophecy
func (Prophecy) FindHighestClaim ¶
func (Prophecy) SerializeForDB ¶
func (prophecy Prophecy) SerializeForDB() (DBProphecy, error)
SerializeForDB serializes a prophecy into a DBProphecy TODO: Using gob here may mean that different tendermint clients in different languages may serialize/store prophecies in their db in different ways - check with @codereviewer if this is ok or if it introduces a risk of creating forks. Or maybe using a slower json serializer or Amino:JSON would be ok