types

package
v0.0.0-...-64405af Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	TestID                     = "oracleID"
	AlternateTestID            = "altOracleID"
	TestString                 = "{value: 5}"
	AlternateTestString        = "{value: 7}"
	AnotherAlternateTestString = "{value: 9}"
)
View Source
const DefaultCodespace = "oracle"
View Source
const FailedStatusText = "failed"
View Source
const PendingStatusText = "pending"
View Source
const SuccessStatusText = "success"

Variables

View Source
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 MsgMakeEthBridgeClaim struct {
	EthBridgeClaim *types.Any `protobuf:"bytes,1,opt,name=ethBridgeClaim,proto3" json:"eth_bridge_claim"`
}

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

func NewProphecy(id string) Prophecy

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 Prophecy) FindHighestClaim(ctx sdk.Context, stakeKeeper keeper.Keeper) (string, int64, int64)

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

type Status

type Status struct {
	StatusText string `json:"status_text"`
	FinalClaim string `json:"final_claim"`
}

Status is a struct that contains the status of a given prophecy

func NewStatus

func NewStatus(status string, finalClaim string) Status

NewStatus returns a new Status with the given data contained

Jump to

Keyboard shortcuts

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