Documentation
¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags
- func ErrInsufficientCoins(codespace sdk.CodespaceType) sdk.Error
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
- func KeyLock(owner sdk.AccAddress, unlockTime time.Duration) []byte
- func KeyUnlock(unlock TokenUnlock) []byte
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func PrefixUnlockQueueTime(endTime time.Time) []byte
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type AppModule
- func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) sdk.Tags
- func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) ([]abci.ValidatorUpdate, sdk.Tags)
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (AppModule) QuerierRoute() string
- func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
- func (AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- type GenesisState
- type Keeper
- func (keeper Keeper) BeginUnlock(ctx sdk.Context, owner sdk.AccAddress, unlockTime time.Duration, ...) sdk.Error
- func (keeper Keeper) FinishUnlock(ctx sdk.Context, unlock TokenUnlock) sdk.Error
- func (keeper Keeper) GetAllLocks(ctx sdk.Context) (locks []TokenLock)
- func (keeper Keeper) GetAllUnlocks(ctx sdk.Context) (unlocks []TokenUnlock)
- func (keeper Keeper) GetLock(ctx sdk.Context, owner sdk.AccAddress, unlockTime time.Duration) (lock TokenLock)
- func (keeper Keeper) GetOwnerLocks(ctx sdk.Context, owner sdk.AccAddress) (locks []TokenLock)
- func (keeper Keeper) InsertUnlockQueue(ctx sdk.Context, unlock TokenUnlock)
- func (keeper Keeper) LockCoins(ctx sdk.Context, owner sdk.AccAddress, unlockTime time.Duration, ...) sdk.Error
- func (keeper Keeper) Logger(ctx sdk.Context) log.Logger
- func (keeper Keeper) UnlockQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- type MsgLockCoins
- type MsgUnlockCoins
- type QueryUserLocks
- type TokenLock
- type TokenUnlock
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = "tokenlock" CodeInsufficientCoins sdk.CodeType = 1 )
const ( QueryLocks = "locks" QueryUnlocks = "unlocks" QueryOwnerLocks = "ownerlocks" )
query endpoints supported by the governance Querier
const ( RouterKey = ModuleName QuerierRoute = ModuleName )
Defines tokenlock module constants
const ModuleName = "tokenlock"
ModuleName is the name of this module
Variables ¶
var ( KeyDelimiter = []byte(":") PrefixLocks = []byte("locks") PrefixUnlockQueue = []byte("unlocks") )
Key for getting a the next available proposalID from the store
Functions ¶
func EndBlocker ¶
Called every block, process inflation, update validator set
func ErrInsufficientCoins ¶
func ErrInsufficientCoins(codespace sdk.CodespaceType) sdk.Error
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
InitGenesis initializes story state from genesis file
func KeyUnlock ¶
func KeyUnlock(unlock TokenUnlock) []byte
Returns the key for a proposalID in the activeProposalQueue
func NewHandler ¶
NewHandler creates a new handler for tokenlock module
func PrefixUnlockQueueTime ¶
Returns the key for a proposalID in the activeProposalQueue
func RegisterCodec ¶
RegisterCodec registers all the necessary types and interfaces for the module
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the genesis state data
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule defines external data for the module ----------------------------------------------------------------------------
func NewAppModule ¶
NewAppModule creates a new app module
func (AppModule) BeginBlock ¶
BeginBlock runs before a block is processed
func (AppModule) EndBlock ¶
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) ([]abci.ValidatorUpdate, sdk.Tags)
EndBlock runs at the end of each block
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
ExportGenesis enforces exporting this module's data to a genesis file
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis enforces the creation of the genesis state for the tokenlock module
func (AppModule) NewHandler ¶
NewHandler creates the handler for the tokenlock module
func (AppModule) NewQuerierHandler ¶
NewQuerierHandler creates a new querier handler
func (AppModule) QuerierRoute ¶
QuerierRoute defines the querier route
func (AppModule) RegisterInvariants ¶
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
RegisterInvariants enforces registering of invariants
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the internal data for the module ----------------------------------------------------------------------------
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis creates the default genesis state for testing
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
get the root query command of this module
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command
get the root tx command of this module
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
RegisterCodec registers the types needed for amino encoding/decoding
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
register rest routes
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
ValidateGenesis validates the genesis state
type GenesisState ¶
type GenesisState struct { TokenLocks []TokenLock `json:"tokenlocks"` TokenUnlocks []TokenUnlock `json:"tokenunlocks"` }
GenesisState defines genesis data for the module
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
ExportGenesis exports the genesis state
func NewGenesisState ¶
func NewGenesisState() GenesisState
NewGenesisState creates a new genesis state.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper is the model object for the package tokenlock module
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, bk bank.BaseKeeper, codespace sdk.CodespaceType) Keeper
func (Keeper) BeginUnlock ¶
func (Keeper) FinishUnlock ¶
func (Keeper) GetAllUnlocks ¶
func (keeper Keeper) GetAllUnlocks(ctx sdk.Context) (unlocks []TokenUnlock)
func (Keeper) GetOwnerLocks ¶
func (Keeper) InsertUnlockQueue ¶
func (keeper Keeper) InsertUnlockQueue(ctx sdk.Context, unlock TokenUnlock)
Inserts a ProposalID into the active proposal queue at endTime
type MsgLockCoins ¶
MsgLockCoins - struct for locking coins in a timelock
func NewMsgLockCoins ¶
func NewMsgLockCoins(amount sdk.Coins, unlockTime time.Duration, owner sdk.AccAddress) MsgLockCoins
func (MsgLockCoins) GetSignBytes ¶
func (msg MsgLockCoins) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgLockCoins) GetSigners ¶
func (msg MsgLockCoins) GetSigners() []sdk.AccAddress
func (MsgLockCoins) Type ¶
func (msg MsgLockCoins) Type() string
func (MsgLockCoins) ValidateBasic ¶
func (msg MsgLockCoins) ValidateBasic() sdk.Error
quick validity check
type MsgUnlockCoins ¶
MsgUnlockCoins - struct for beginning an unlock procedure for locked coins
func NewMsgUnlockCoins ¶
func NewMsgUnlockCoins(unlockTime time.Duration, amount sdk.Coins, owner sdk.AccAddress) MsgUnlockCoins
func (MsgUnlockCoins) GetSignBytes ¶
func (msg MsgUnlockCoins) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgUnlockCoins) GetSigners ¶
func (msg MsgUnlockCoins) GetSigners() []sdk.AccAddress
func (MsgUnlockCoins) Type ¶
func (msg MsgUnlockCoins) Type() string
func (MsgUnlockCoins) ValidateBasic ¶
func (msg MsgUnlockCoins) ValidateBasic() sdk.Error
quick validity check
type QueryUserLocks ¶
type QueryUserLocks struct {
Owner sdk.AccAddress
}
type TokenUnlock ¶
Tokenlock stores data about a tokenlock