timelock

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MPL-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = 7

	CodeInvalidDescription         sdk.CodeType = 1
	CodeInvalidLockTime            sdk.CodeType = 2
	CodeInvalidRelock              sdk.CodeType = 3
	CodeInvalidTimeLockId          sdk.CodeType = 4
	CodeTimeLockRecordDoesNotExist sdk.CodeType = 5
	CodeInvalidLockAmount          sdk.CodeType = 6
	CodeCanNotUnlock               sdk.CodeType = 7
	CodeUnknownTimeLock            sdk.CodeType = 8
	CodeTimeLockRecordAlreadyExist sdk.CodeType = 9
)
View Source
const (
	MsgRoute = "timelock"

	MaxDescriptionLength       = 128
	MinLockTime                = 60 * time.Second
	MaxLockTime          int64 = 253402300800 //seconds of 10000-01-01, which is required by amino
)
View Source
const (
	QueryTimeLocks = "timelocks"
	QueryTimeLock  = "timelock"
)
View Source
const InitialRecordId = 1

Variables

View Source
var (
	// axc prefix address:  axc1hn8ym9xht925jkncjpf7lhjnax6z8nv24fv2yq
	// taxc prefix address: taxc1hn8ym9xht925jkncjpf7lhjnax6z8nv2mu9wy3
	TimeLockCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("AximchainTimeLockCoins")))
)

Functions

func ErrCanNotUnlock

func ErrCanNotUnlock(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidDescription

func ErrInvalidDescription(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidLockAmount

func ErrInvalidLockAmount(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidLockTime

func ErrInvalidLockTime(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidRelock

func ErrInvalidRelock(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidTimeLockId

func ErrInvalidTimeLockId(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrTimeLockRecordAlreadyExist

func ErrTimeLockRecordAlreadyExist(codespace sdk.CodespaceType, addr sdk.AccAddress, id int64) sdk.Error

func ErrTimeLockRecordDoesNotExist

func ErrTimeLockRecordDoesNotExist(codespace sdk.CodespaceType, addr sdk.AccAddress, id int64) sdk.Error

func ErrUnknownTimeLock

func ErrUnknownTimeLock(codespace sdk.CodespaceType, addr sdk.AccAddress, id int64) sdk.Error

func KeyRecord

func KeyRecord(addr sdk.AccAddress, id int64) []byte

func KeyRecordSubSpace

func KeyRecordSubSpace(addr sdk.AccAddress) []byte

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, ck bank.Keeper, ak auth.AccountKeeper, codespace sdk.CodespaceType) Keeper

func (Keeper) GetTimeLockRecord

func (keeper Keeper) GetTimeLockRecord(ctx sdk.Context, addr sdk.AccAddress, recordId int64) (TimeLockRecord, bool)

func (Keeper) GetTimeLockRecords

func (keeper Keeper) GetTimeLockRecords(ctx sdk.Context, addr sdk.AccAddress) []TimeLockRecord

func (Keeper) TimeLock

func (keeper Keeper) TimeLock(ctx sdk.Context, from sdk.AccAddress, description string, amount sdk.Coins, lockTime time.Time) (TimeLockRecord, sdk.Error)

func (Keeper) TimeRelock

func (keeper Keeper) TimeRelock(ctx sdk.Context, from sdk.AccAddress, recordId int64, newRecord TimeLockRecord) sdk.Error

func (Keeper) TimeUnlock

func (keeper Keeper) TimeUnlock(ctx sdk.Context, from sdk.AccAddress, recordId int64) sdk.Error

type QueryTimeLockParams

type QueryTimeLockParams struct {
	Account sdk.AccAddress
	Id      int64
}

Params for query 'custom/timelock/timelock'

type QueryTimeLocksParams

type QueryTimeLocksParams struct {
	Account sdk.AccAddress
}

Params for query 'custom/timelock/timelocks'

type TimeLockMsg

type TimeLockMsg struct {
	From        sdk.AccAddress `json:"from"`
	Description string         `json:"description"`
	Amount      sdk.Coins      `json:"amount"`
	LockTime    int64          `json:"lock_time"`
}

func NewTimeLockMsg

func NewTimeLockMsg(from sdk.AccAddress, description string, amount sdk.Coins, lockTime int64) TimeLockMsg

func (TimeLockMsg) GetInvolvedAddresses

func (msg TimeLockMsg) GetInvolvedAddresses() []sdk.AccAddress

func (TimeLockMsg) GetSignBytes

func (msg TimeLockMsg) GetSignBytes() []byte

func (TimeLockMsg) GetSigners

func (msg TimeLockMsg) GetSigners() []sdk.AccAddress

func (TimeLockMsg) Route

func (msg TimeLockMsg) Route() string

func (TimeLockMsg) String

func (msg TimeLockMsg) String() string

func (TimeLockMsg) Type

func (msg TimeLockMsg) Type() string

func (TimeLockMsg) ValidateBasic

func (msg TimeLockMsg) ValidateBasic() sdk.Error

type TimeLockRecord

type TimeLockRecord struct {
	Id          int64     `json:"id"`
	Description string    `json:"description"`
	Amount      sdk.Coins `json:"amount"`
	LockTime    time.Time `json:"lock_time"`
}

type TimeLockRecords

type TimeLockRecords []TimeLockRecord

func (TimeLockRecords) Len

func (a TimeLockRecords) Len() int

func (TimeLockRecords) Less

func (a TimeLockRecords) Less(i, j int) bool

func (TimeLockRecords) Swap

func (a TimeLockRecords) Swap(i, j int)

type TimeRelockMsg

type TimeRelockMsg struct {
	From        sdk.AccAddress `json:"from"`
	Id          int64          `json:"time_lock_id"`
	Description string         `json:"description"`
	Amount      sdk.Coins      `json:"amount"`
	LockTime    int64          `json:"lock_time"`
}

func NewTimeRelockMsg

func NewTimeRelockMsg(from sdk.AccAddress, id int64, description string, amount sdk.Coins, lockTime int64) TimeRelockMsg

func (TimeRelockMsg) GetInvolvedAddresses

func (msg TimeRelockMsg) GetInvolvedAddresses() []sdk.AccAddress

func (TimeRelockMsg) GetSignBytes

func (msg TimeRelockMsg) GetSignBytes() []byte

func (TimeRelockMsg) GetSigners

func (msg TimeRelockMsg) GetSigners() []sdk.AccAddress

func (TimeRelockMsg) Route

func (msg TimeRelockMsg) Route() string

func (TimeRelockMsg) String

func (msg TimeRelockMsg) String() string

func (TimeRelockMsg) Type

func (msg TimeRelockMsg) Type() string

func (TimeRelockMsg) ValidateBasic

func (msg TimeRelockMsg) ValidateBasic() sdk.Error

type TimeUnlockMsg

type TimeUnlockMsg struct {
	From sdk.AccAddress `json:"from"`
	Id   int64          `json:"time_lock_id"`
}

func NewTimeUnlockMsg

func NewTimeUnlockMsg(from sdk.AccAddress, id int64) TimeUnlockMsg

func (TimeUnlockMsg) GetInvolvedAddresses

func (msg TimeUnlockMsg) GetInvolvedAddresses() []sdk.AccAddress

func (TimeUnlockMsg) GetSignBytes

func (msg TimeUnlockMsg) GetSignBytes() []byte

func (TimeUnlockMsg) GetSigners

func (msg TimeUnlockMsg) GetSigners() []sdk.AccAddress

func (TimeUnlockMsg) Route

func (msg TimeUnlockMsg) Route() string

func (TimeUnlockMsg) String

func (msg TimeUnlockMsg) String() string

func (TimeUnlockMsg) Type

func (msg TimeUnlockMsg) Type() string

func (TimeUnlockMsg) ValidateBasic

func (msg TimeUnlockMsg) ValidateBasic() sdk.Error

Jump to

Keyboard shortcuts

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