tokenlock

package
v0.0.0-...-8790121 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "tokenlock"

	CodeInsufficientCoins sdk.CodeType = 1
)
View Source
const (
	QueryLocks      = "locks"
	QueryUnlocks    = "unlocks"
	QueryOwnerLocks = "ownerlocks"
)

query endpoints supported by the governance Querier

View Source
const (
	RouterKey    = ModuleName
	QuerierRoute = ModuleName
)

Defines tokenlock module constants

View Source
const ModuleName = "tokenlock"

ModuleName is the name of this module

Variables

View Source
var (
	KeyDelimiter = []byte(":")

	PrefixLocks       = []byte("locks")
	PrefixUnlockQueue = []byte("unlocks")
)

Key for getting a the next available proposalID from the store

Functions

func EndBlocker

func EndBlocker(ctx sdk.Context, keeper Keeper) sdk.Tags

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 KeyLock

func KeyLock(owner sdk.AccAddress, unlockTime time.Duration) []byte

func KeyUnlock

func KeyUnlock(unlock TokenUnlock) []byte

Returns the key for a proposalID in the activeProposalQueue

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

NewHandler creates a new handler for tokenlock module

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier creates a new querier

func PrefixUnlockQueueTime

func PrefixUnlockQueueTime(endTime time.Time) []byte

Returns the key for a proposalID in the activeProposalQueue

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

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

func NewAppModule(keeper Keeper) AppModule

NewAppModule creates a new app module

func (AppModule) BeginBlock

func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) sdk.Tags

BeginBlock runs before a block is processed

func (AppModule) EndBlock

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

func (am AppModule) NewHandler() sdk.Handler

NewHandler creates the handler for the tokenlock module

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler creates a new querier handler

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute defines the querier route

func (AppModule) RegisterInvariants

func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

RegisterInvariants enforces registering of invariants

func (AppModule) Route

func (AppModule) Route() string

Route defines the key for the route

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) Name

func (AppModuleBasic) Name() string

Name define the name of the 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 Keeper) BeginUnlock(ctx sdk.Context, owner sdk.AccAddress, unlockTime time.Duration, amount sdk.Coins) sdk.Error

func (Keeper) FinishUnlock

func (keeper Keeper) FinishUnlock(ctx sdk.Context, unlock TokenUnlock) sdk.Error

func (Keeper) GetAllLocks

func (keeper Keeper) GetAllLocks(ctx sdk.Context) (locks []TokenLock)

func (Keeper) GetAllUnlocks

func (keeper Keeper) GetAllUnlocks(ctx sdk.Context) (unlocks []TokenUnlock)

func (Keeper) GetLock

func (keeper Keeper) GetLock(ctx sdk.Context, owner sdk.AccAddress, unlockTime time.Duration) (lock TokenLock)

func (Keeper) GetOwnerLocks

func (keeper Keeper) GetOwnerLocks(ctx sdk.Context, owner sdk.AccAddress) (locks []TokenLock)

func (Keeper) InsertUnlockQueue

func (keeper Keeper) InsertUnlockQueue(ctx sdk.Context, unlock TokenUnlock)

Inserts a ProposalID into the active proposal queue at endTime

func (Keeper) LockCoins

func (keeper Keeper) LockCoins(ctx sdk.Context, owner sdk.AccAddress, unlockTime time.Duration, amount sdk.Coins) sdk.Error

func (Keeper) Logger

func (keeper Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) UnlockQueueIterator

func (keeper Keeper) UnlockQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns an iterator for all the unlocks in the Unlock Queue that expire by endTime

type MsgLockCoins

type MsgLockCoins struct {
	Amount     sdk.Coins
	UnlockTime time.Duration
	Owner      sdk.AccAddress
}

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) Route

func (msg MsgLockCoins) Route() string

nolint

func (MsgLockCoins) Type

func (msg MsgLockCoins) Type() string

func (MsgLockCoins) ValidateBasic

func (msg MsgLockCoins) ValidateBasic() sdk.Error

quick validity check

type MsgUnlockCoins

type MsgUnlockCoins struct {
	Amount     sdk.Coins
	UnlockTime time.Duration
	Owner      sdk.AccAddress
}

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) Route

func (msg MsgUnlockCoins) Route() string

nolint

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 TokenLock

type TokenLock struct {
	Amount     sdk.Coins
	UnlockTime time.Duration
	Owner      sdk.AccAddress
}

Tokenlock stores data about a tokenlock

type TokenUnlock

type TokenUnlock struct {
	Amount         sdk.Coins
	CompletionTime time.Time
	Owner          sdk.AccAddress
}

Tokenlock stores data about a tokenlock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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