Documentation ¶
Index ¶
- Constants
- Variables
- func BeaconAllTimestampsKey(beaconID uint64) []byte
- func BeaconKey(beaconID uint64) []byte
- func BeaconTimestampKey(beaconID, timestampID uint64) []byte
- func GetBeaconIDBytes(beaconID uint64) (beaconIDBz []byte)
- func GetBeaconIDFromBytes(bz []byte) (beaconID uint64)
- func GetTimestampIDBytes(timestampID uint64) (timestampIDBz []byte)
- func GetTimestampIDFromBytes(bz []byte) (timestampID uint64)
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type Beacon
- type BeaconExport
- type BeaconTimestamp
- type BeaconTimestamps
- type Beacons
- type EnterpriseKeeper
- type GenesisState
- type MsgRecordBeaconTimestamp
- type MsgRegisterBeacon
- type Params
- type QueryBeaconParams
- type QueryBeaconTimestampParams
- type QueryResBeaconTimestampHashes
- type QueryResBeacons
Constants ¶
const ( CodeInvalidGenesis = 101 CodeBeaconDoesNotExist = 201 CodeBeaconAlreadyRegistered = 202 CodeBeaconTimestampAlreadyRecorded = 203 CodeNotBeaconOwner = 204 CodeMissingData = 205 CodeContentTooLarge = 206 CodeBeaconInsufficientFee = 301 CodeBeaconTooMuchFee = 302 CodeBeaconIncorrectFeeDenom = 303 CodeBeaconFeePayerNotOwner = 401 )
const ( // module name ModuleName = "beacon" // StoreKey to be used when creating the KVStore StoreKey = ModuleName DefaultParamspace = ModuleName // QuerierRoute is the querier route for the BEACON store. QuerierRoute = StoreKey )
const ( RouterKey = ModuleName // defined in keys.go file RegisterAction = "register_beacon" RecordAction = "record_beacon_timestamp" )
const ( // BEACON fees, in nano FUND RegFee = 1000000000000 // 1000 FUND - used in init genesis RecordFee = 1000000000 // 1 FUND - used in init genesis FeeDenom = undtypes.DefaultDenomination // used in init genesis DefaultStartingBeaconID uint64 = 1 // used in init genesis )
Variables ¶
var ( // ErrInvalidGenesis error for an invalid beacon GenesisState ErrInvalidGenesis = sdkerrors.Register(ModuleName, CodeInvalidGenesis, "invalid genesis") ErrBeaconDoesNotExist = sdkerrors.Register(ModuleName, CodeBeaconDoesNotExist, "beacon does not exist") ErrNotBeaconOwner = sdkerrors.Register(ModuleName, CodeNotBeaconOwner, "not beacon owner") ErrBeaconAlreadyRegistered = sdkerrors.Register(ModuleName, CodeBeaconAlreadyRegistered, "beacon already registered") ErrBeaconTimestampAlreadyRecorded = sdkerrors.Register(ModuleName, CodeBeaconTimestampAlreadyRecorded, "beacon timestamp already recorded") ErrMissingData = sdkerrors.Register(ModuleName, CodeMissingData, "missing data") ErrInsufficientBeaconFee = sdkerrors.Register(ModuleName, CodeBeaconInsufficientFee, "insufficient beacon fee") ErrTooMuchBeaconFee = sdkerrors.Register(ModuleName, CodeBeaconTooMuchFee, "too much beacon fee") ErrFeePayerNotOwner = sdkerrors.Register(ModuleName, CodeBeaconFeePayerNotOwner, "fee payer is not beacon owner") ErrIncorrectFeeDenomination = sdkerrors.Register(ModuleName, CodeBeaconIncorrectFeeDenom, "incorrect beacon fee denomination") ErrContentTooLarge = sdkerrors.Register(ModuleName, CodeContentTooLarge, "msg content too large") )
var ( EventTypeRegisterBeacon = RegisterAction EventTypeRecordBeaconTimestamp = RecordAction AttributeValueCategory = ModuleName AttributeKeyOwner = "beacon_owner" AttributeKeyBeaconId = "beacon_id" AttributeKeyBeaconMoniker = "beacon_moniker" AttributeKeyBeaconName = "beacon_name" AttributeKeyTimestampID = "beacon_timestamp_id" AttributeKeyTimestampHash = "beacon_timestamp_hash" AttributeKeyTimestampSubmitTime = "beacon_timestamp_submit_time" )
var ( // key used to store the current highest BEACON ID HighestBeaconIDKey = []byte{0x20} // RegisteredBeaconPrefix prefix for registered BEACON store RegisteredBeaconPrefix = []byte{0x01} // RecordedBeaconTimestampPrefix prefix for BEACON Timestamps store RecordedBeaconTimestampPrefix = []byte{0x02} )
var ( KeyFeeRegister = []byte("FeeRegister") KeyFeeRecord = []byte("FeeRecord") KeyDenom = []byte("Denom") )
Parameter store keys
var ModuleCdc = codec.New()
Functions ¶
func BeaconAllTimestampsKey ¶
BeaconAllTimestampsKey gets the key for a specific BEACON's timestamps
func BeaconTimestampKey ¶
BeaconTimestampKey gets the key for a single BEACON's specific timestamp ID
func GetBeaconIDBytes ¶
GetBeaconIDBytes returns the byte representation of the BeaconID used for getting the highest Beacon ID from the database
func GetBeaconIDFromBytes ¶
GetBeaconIDFromBytes returns BeaconID in uint64 format from a byte array used for getting the highest Beacon ID from the database
func GetTimestampIDBytes ¶
func GetTimestampIDFromBytes ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the provided genesis state to ensure the expected invariants holds.
Types ¶
type Beacon ¶
type Beacon struct { BeaconID uint64 `json:"beacon_id"` Moniker string `json:"moniker"` Name string `json:"name"` LastTimestampID uint64 `json:"last_timestamp_id"` Owner sdk.AccAddress `json:"owner"` }
Beacon is a struct that contains all the metadata of a registered BEACON
type BeaconExport ¶
type BeaconExport struct { Beacon Beacon `json:"beacon" yaml:"beacon"` BeaconTimestamps []BeaconTimestamp `json:"timestamps" yaml:"timestamps"` }
type BeaconTimestamp ¶
type BeaconTimestamp struct { BeaconID uint64 `json:"beacon_id"` TimestampID uint64 `json:"timestamp_id"` SubmitTime uint64 `json:"submit_time"` Hash string `json:"hash"` Owner sdk.AccAddress `json:"owner"` }
BeaconTimestamp is a struct that contains a BEACON's recorded timestamp hash
func NewBeaconTimestamp ¶
func NewBeaconTimestamp() BeaconTimestamp
NewBeaconTimestamp returns a new BeaconTimestamp struct
type BeaconTimestamps ¶
type BeaconTimestamps []BeaconTimestamp
BeaconTimestamps is an array of BeaconTimestamp
func (BeaconTimestamps) String ¶
func (b BeaconTimestamps) String() string
String implements stringer interface
type EnterpriseKeeper ¶
type EnterpriseKeeper interface {
GetLockedUndAmountForAccount(ctx sdk.Context, address sdk.AccAddress) sdk.Coin
}
EnterpriseKeeper defines the expected enterprise keeper
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` // beacon params StartingBeaconID uint64 `json:"starting_beacon_id" yaml:"starting_beacon_id"` // should be 1 Beacons []BeaconExport `json:"registered_beacons" yaml:"registered_beacons"` }
GenesisState - beacon state
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState creates a default GenesisState object
func NewGenesisState ¶
func NewGenesisState(params Params, startingBeaconID uint64) GenesisState
NewGenesisState creates a new GenesisState object
func (GenesisState) Equal ¶
func (data GenesisState) Equal(data2 GenesisState) bool
Equal checks whether two beacon GenesisState structs are equivalent
func (GenesisState) IsEmpty ¶
func (data GenesisState) IsEmpty() bool
IsEmpty returns true if a GenesisState is empty
type MsgRecordBeaconTimestamp ¶
type MsgRecordBeaconTimestamp struct { BeaconID uint64 `json:"beacon_id"` Hash string `json:"hash"` SubmitTime uint64 `json:"submit_time"` Owner sdk.AccAddress `json:"owner"` }
MsgRecordBeaconTimestamp defines a RecordBeaconTimestamp message
func NewMsgRecordBeaconTimestamp ¶
func NewMsgRecordBeaconTimestamp( beaconId uint64, hash string, subTime uint64, owner sdk.AccAddress) MsgRecordBeaconTimestamp
NewMsgRecordBeaconTimestamp is a constructor function for MsgRecordBeaconTimestamp
func (MsgRecordBeaconTimestamp) GetSignBytes ¶
func (msg MsgRecordBeaconTimestamp) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgRecordBeaconTimestamp) GetSigners ¶
func (msg MsgRecordBeaconTimestamp) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgRecordBeaconTimestamp) Route ¶
func (msg MsgRecordBeaconTimestamp) Route() string
Route should return the name of the module
func (MsgRecordBeaconTimestamp) Type ¶
func (msg MsgRecordBeaconTimestamp) Type() string
Type should return the action
func (MsgRecordBeaconTimestamp) ValidateBasic ¶
func (msg MsgRecordBeaconTimestamp) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type MsgRegisterBeacon ¶
type MsgRegisterBeacon struct { Moniker string `json:"moniker"` BeaconName string `json:"name"` Owner sdk.AccAddress `json:"owner"` }
MsgRegisterBeacon defines a RegisterBeacon message
func NewMsgRegisterBeacon ¶
func NewMsgRegisterBeacon(moniker string, beaconName string, owner sdk.AccAddress) MsgRegisterBeacon
NewMsgRegisterBeacon is a constructor function for MsgRegisterBeacon
func (MsgRegisterBeacon) GetSignBytes ¶
func (msg MsgRegisterBeacon) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgRegisterBeacon) GetSigners ¶
func (msg MsgRegisterBeacon) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgRegisterBeacon) Route ¶
func (msg MsgRegisterBeacon) Route() string
Route should return the name of the module
func (MsgRegisterBeacon) Type ¶
func (msg MsgRegisterBeacon) Type() string
Type should return the action
func (MsgRegisterBeacon) ValidateBasic ¶
func (msg MsgRegisterBeacon) ValidateBasic() error
ValidateBasic runs stateless checks on the message
type Params ¶
type Params struct { FeeRegister uint64 `json:"fee_register" yaml:"fee_register"` // Fee for registering a BEACON FeeRecord uint64 `json:"fee_record" yaml:"fee_record"` // Fee for recording timestamps for a BEACON Denom string `json:"denom" yaml:"denom"` // Fee denomination }
beacon parameters
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
Implements params.ParamSet
type QueryBeaconParams ¶
type QueryBeaconParams struct { Page int Limit int Moniker string Owner sdk.AccAddress }
QueryBeaconParams Params for query 'custom/beacon/registered'
func NewQueryBeaconParams ¶
func NewQueryBeaconParams(page, limit int, monkker string, owner sdk.AccAddress) QueryBeaconParams
NewQueryBeaconParams creates a new instance of QueryBeaconParams
type QueryBeaconTimestampParams ¶
type QueryBeaconTimestampParams struct { BeaconID uint64 Page int Limit int SubmitTime uint64 Hash string }
QueryBeaconTimestampParams Params for query 'custom/beacon/timestamps'
func NewQueryBeaconTimestampParams ¶
func NewQueryBeaconTimestampParams(page, limit int, beaconID uint64, hash string, submitTime uint64) QueryBeaconTimestampParams
NewQueryBeaconTimestampParams creates a new instance of QueryBeaconTimestampParams
type QueryResBeaconTimestampHashes ¶
type QueryResBeaconTimestampHashes []BeaconTimestamp
QueryResBeaconTimestampHashes Queries Result Payload for a Beacon timestamp Hashes query
func (QueryResBeaconTimestampHashes) String ¶
func (h QueryResBeaconTimestampHashes) String() (out string)
implement fmt.Stringer
type QueryResBeacons ¶
type QueryResBeacons []Beacon
QueryResBeacons Queries BEACONs
func (QueryResBeacons) String ¶
func (wc QueryResBeacons) String() (out string)
implement fmt.Stringer