Documentation ¶
Index ¶
- Constants
- func ErrDuplicateMessage(codespace sdk.CodespaceType) sdk.Error
- func ErrInternalDB(codespace sdk.CodespaceType, err error) sdk.Error
- func ErrInvalidClaim(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidIdentifier(codespace sdk.CodespaceType) sdk.Error
- func ErrInvalidValidator(codespace sdk.CodespaceType) sdk.Error
- func ErrMinimumConsensusNeededInvalid(codespace sdk.CodespaceType) sdk.Error
- func ErrNoClaims(codespace sdk.CodespaceType) sdk.Error
- func ErrProphecyFinalized(codespace sdk.CodespaceType) sdk.Error
- func ErrProphecyNotFound(codespace sdk.CodespaceType) sdk.Error
- type CodeType
- type DBProphecy
- type Prophecy
- type Status
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 FailedStatusText = "failed"
const PendingStatusText = "pending"
const SuccessStatusText = "success"
Variables ¶
This section is empty.
Functions ¶
func ErrDuplicateMessage ¶
func ErrDuplicateMessage(codespace sdk.CodespaceType) sdk.Error
func ErrInternalDB ¶
func ErrInternalDB(codespace sdk.CodespaceType, err error) sdk.Error
func ErrInvalidClaim ¶
func ErrInvalidClaim(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidIdentifier ¶
func ErrInvalidIdentifier(codespace sdk.CodespaceType) sdk.Error
func ErrInvalidValidator ¶
func ErrInvalidValidator(codespace sdk.CodespaceType) sdk.Error
func ErrMinimumConsensusNeededInvalid ¶
func ErrMinimumConsensusNeededInvalid(codespace sdk.CodespaceType) sdk.Error
func ErrNoClaims ¶
func ErrNoClaims(codespace sdk.CodespaceType) sdk.Error
func ErrProphecyFinalized ¶
func ErrProphecyFinalized(codespace sdk.CodespaceType) sdk.Error
func ErrProphecyNotFound ¶
func ErrProphecyNotFound(codespace sdk.CodespaceType) sdk.Error
Types ¶
type CodeType ¶
Local code type
const ( DefaultCodespace sdk.CodespaceType = "oracle" CodeProphecyNotFound CodeType = 1 CodeMinimumConsensusNeededInvalid CodeType = 2 CodeNoClaims CodeType = 3 CodeInvalidIdentifier CodeType = 4 CodeProphecyFinalized CodeType = 5 CodeDuplicateMessage CodeType = 6 CodeInvalidClaim CodeType = 7 CodeInvalidValidator CodeType = 8 CodeInternalDB CodeType = 9 )
Exported code type numbers
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 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