types

package
v1.7.2-beta Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventsMsgPreStaking      = "pre_staking"
	EventMsgStaking          = "staking"
	EventUndelegate          = "undelegate"
	EventTypeRedelegate      = "redelegate"
	EventTypeDeploy          = "deploy"
	EventTypeCreateValidator = "create_validator"

	AttributeKeySrcValidator   = "source_validator"
	AttributeKeyDstValidator   = "destination_validator"
	AttributeKeyCompletionTime = "completion_time"
	AttributeValueCategory     = ModuleName

	AttributeKeyVaultID  = "VaultID"
	AttributeKeyContract = "contract"
)
View Source
const (
	DefaultCodespace = "preStaking"
	RouteKey         = DefaultCodespace
	ModuleName       = DefaultCodespace
	StoreKey         = "preStaking"

	StakingRecordQuery   = "queryStakingRecord"
	PreStakingTokenQuery = "queryPreStakingToken"
)

Variables

View Source
var (
	ErrAccountBalanceNotEnough     = sdkerrors.Register(DefaultCodespace, 1800, "balance of account not enough to pay")
	ErrInvalidAmount               = sdkerrors.Register(DefaultCodespace, 1801, "invalid amount")
	ErrInvalidDelegatorAddress     = sdkerrors.Register(DefaultCodespace, 1802, "invalid delegator address")
	ErrInvalidValidatorAddress     = sdkerrors.Register(DefaultCodespace, 1803, "invalid validator address")
	ErrFromNotEqualDelegator       = sdkerrors.Register(DefaultCodespace, 1804, "from address not equal to delegator address")
	ErrNoExpectedValidator         = sdkerrors.Register(DefaultCodespace, 1805, "no expected validator found")
	ErrInvalidDenom                = sdkerrors.Register(DefaultCodespace, 1806, "invalid denom")
	ErrDelegatorShareExRateInvalid = sdkerrors.Register(DefaultCodespace, 1807, "invalid delegator share exchange rate")
	ErrTimestampProto              = sdkerrors.Register(DefaultCodespace, 1808, "new timestampproto failed")
	ErrRedelegateFailed            = sdkerrors.Register(DefaultCodespace, 1809, "redelegate failed")
	ErrNoExpectedDelegation        = sdkerrors.Register(DefaultCodespace, 1810, "delegation not exist or expired")
	ErrNoEnoughSharesToRedelegate  = sdkerrors.Register(DefaultCodespace, 1811, "no enough shares to redelegate")
	ErrNoBalanceLeft               = sdkerrors.Register(DefaultCodespace, 1812, "no valid balance to undelegate")
	ErrNoEnoughBalanceLeft         = sdkerrors.Register(DefaultCodespace, 1813, "no enough balance to undelegate")
	ErrInvalidVaultID              = sdkerrors.Register(DefaultCodespace, 1814, "invalid vault id")
	ErrInvalidPublicKey            = sdkerrors.Register(DefaultCodespace, 1815, "invalid public key")
	ErrPubkeyHasBonded             = sdkerrors.Register(DefaultCodespace, 1816, "pubkey has been bonded")
	ErrSetValidatorFailed          = sdkerrors.Register(DefaultCodespace, 1817, "set validator failed")
	ErrSetStakingTokenFailed       = sdkerrors.Register(DefaultCodespace, 1818, "no permission change token address")
)
View Source
var (
	PreStakingIDKey  = []byte{0x50}
	StakingRecordKey = []byte{0x51}

	TokenManager      = []byte("tokenManager")
	TokenManagerOwner = []byte("tokenManagerOwner")
)
View Source
var MinPreStakingTime = time.Minute * 1
View Source
var PreStakingCodec *codec.Codec

Functions

func GetStakingRecordID added in v1.6.24

func GetStakingRecordID() []byte

func GetStakingRecordKeyByID added in v1.6.24

func GetStakingRecordKeyByID(id uint64) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type CodeType

type CodeType = sdk.CodeType

type DelegationRecord added in v1.5.53

type DelegationRecord struct {
	StakingRecord []StakingVault `json:"prestaking_record"`
}

type GenesisState added in v1.5.53

type GenesisState struct {
	StakingToken string           `json:"staking_token"`
	Owner        string           `json:"owner"`
	Records      DelegationRecord `json:"records"`
}

func DefaultGenesisState added in v1.5.53

func DefaultGenesisState(_ []tmtypes.GenesisValidator) GenesisState

func NewGenesisState added in v1.5.53

func NewGenesisState(records DelegationRecord, addr string, owner string) GenesisState

type MsgPreStaking

type MsgPreStaking struct {
	FromAddress  sdk.AccAddress `json:"from_address"`
	Amount       sdk.Coin       `json:"amount"`
	DelegateTime time.Duration  `json:"delegate_time"`
}

func NewMsgPreStaking

func NewMsgPreStaking(from sdk.AccAddress, amount sdk.Coin, dt time.Duration) *MsgPreStaking

func (MsgPreStaking) Bytes

func (msg MsgPreStaking) Bytes() []byte

func (MsgPreStaking) GetFromAddress

func (msg MsgPreStaking) GetFromAddress() sdk.AccAddress

func (MsgPreStaking) MsgType

func (msg MsgPreStaking) MsgType() string

func (MsgPreStaking) Route

func (msg MsgPreStaking) Route() string

func (MsgPreStaking) ValidateBasic

func (msg MsgPreStaking) ValidateBasic() error

type MsgPrestakingCreateValidator added in v1.5.53

type MsgPrestakingCreateValidator struct {
	FromAddress       types.AccAddress              `json:"from_address"`
	PublicKey         string                        `json:"public_key"`
	ValidatorAddress  types.AccAddress              `json:"validator_address"`
	DelegatorAddress  types.AccAddress              `json:"delegator_address"`
	MinSelfDelegation types.Int                     `json:"min_self_delegation"`
	Commission        stakeingtypes.CommissionRates `json:"commission"`
	Description       stakeingtypes.Description     `json:"description"`
	VaultID           string                        `json:"vault_id"`
}

func NewMsgCreateValidator added in v1.5.53

func NewMsgCreateValidator(from types.AccAddress, minSelfDelegation types.Int, validatorAddr types.AccAddress, delegatorAddr types.AccAddress,
	rate, maxRate, maxChangeRate types.Dec, moniker, identity, website, securityContact, details string, publicKey string, vaultID string) *MsgPrestakingCreateValidator

func (MsgPrestakingCreateValidator) Bytes added in v1.5.53

func (msg MsgPrestakingCreateValidator) Bytes() []byte

func (MsgPrestakingCreateValidator) GetFromAddress added in v1.5.53

func (msg MsgPrestakingCreateValidator) GetFromAddress() types.AccAddress

func (MsgPrestakingCreateValidator) MsgType added in v1.5.53

func (msg MsgPrestakingCreateValidator) MsgType() string

func (MsgPrestakingCreateValidator) Route added in v1.5.53

func (MsgPrestakingCreateValidator) ValidateBasic added in v1.5.53

func (msg MsgPrestakingCreateValidator) ValidateBasic() error

type MsgPrestakingCreateValidatorDirect added in v1.6.21

type MsgPrestakingCreateValidatorDirect struct {
	FromAddress       types.AccAddress              `json:"from_address"`
	PublicKey         string                        `json:"public_key"`
	ValidatorAddress  types.AccAddress              `json:"validator_address"`
	DelegatorAddress  types.AccAddress              `json:"delegator_address"`
	MinSelfDelegation types.Int                     `json:"min_self_delegation"`
	Commission        stakeingtypes.CommissionRates `json:"commission"`
	Description       stakeingtypes.Description     `json:"description"`
	Amount            types.Coin                    `json:"amount"`
	DelegateTime      time.Duration                 `json:"delegate_time"`
}

func NewMsgCreateValidatorDirect added in v1.6.21

func NewMsgCreateValidatorDirect(from types.AccAddress, minSelfDelegation types.Int, validatorAddr types.AccAddress, delegatorAddr types.AccAddress,
	rate, maxRate, maxChangeRate types.Dec, moniker, identity, website, securityContact, details string, publicKey string, amount types.Coin, dt time.Duration) *MsgPrestakingCreateValidatorDirect

func (MsgPrestakingCreateValidatorDirect) Bytes added in v1.6.21

func (MsgPrestakingCreateValidatorDirect) GetFromAddress added in v1.6.21

func (MsgPrestakingCreateValidatorDirect) MsgType added in v1.6.21

func (MsgPrestakingCreateValidatorDirect) Route added in v1.6.21

func (MsgPrestakingCreateValidatorDirect) ValidateBasic added in v1.6.21

func (msg MsgPrestakingCreateValidatorDirect) ValidateBasic() error

type MsgRedelegate added in v1.5.53

type MsgRedelegate struct {
	FromAddress  sdk.AccAddress `json:"from_address"`
	SrcValidator sdk.AccAddress `json:"src_validator"`
	DstValidator sdk.AccAddress `json:"dst_validator"`
	RecordID     uint64         `json:"record_id"`
}

func NewMsgRedelegate added in v1.5.53

func NewMsgRedelegate(from, src, dst sdk.AccAddress, recordID uint64) *MsgRedelegate

func (*MsgRedelegate) Bytes added in v1.5.53

func (msg *MsgRedelegate) Bytes() []byte

func (*MsgRedelegate) GetFromAddress added in v1.5.53

func (msg *MsgRedelegate) GetFromAddress() sdk.AccAddress

func (*MsgRedelegate) MsgType added in v1.5.53

func (msg *MsgRedelegate) MsgType() string

func (*MsgRedelegate) Route added in v1.5.53

func (msg *MsgRedelegate) Route() string

func (*MsgRedelegate) ValidateBasic added in v1.5.53

func (msg *MsgRedelegate) ValidateBasic() error

type MsgSetStakingToken added in v1.6.20

type MsgSetStakingToken struct {
	FromAddress  sdk.AccAddress `json:"from_address"`
	TokenAddress sdk.AccAddress `json:"token_address"`
}

func NewMsgSetStakingToken added in v1.6.20

func NewMsgSetStakingToken(from, token sdk.AccAddress) *MsgSetStakingToken

func (*MsgSetStakingToken) Bytes added in v1.6.20

func (msg *MsgSetStakingToken) Bytes() []byte

func (*MsgSetStakingToken) GetFromAddress added in v1.6.20

func (msg *MsgSetStakingToken) GetFromAddress() sdk.AccAddress

func (*MsgSetStakingToken) MsgType added in v1.6.20

func (msg *MsgSetStakingToken) MsgType() string

func (*MsgSetStakingToken) Route added in v1.6.20

func (msg *MsgSetStakingToken) Route() string

func (*MsgSetStakingToken) ValidateBasic added in v1.6.20

func (msg *MsgSetStakingToken) ValidateBasic() error

type MsgStaking

type MsgStaking struct {
	FromAddress sdk.AccAddress `json:"from_address"`
	Delegator   sdk.AccAddress `json:"delegator"`
	Validator   sdk.AccAddress `json:"validator"`
	VaultID     string         `json:"vault_id"`
}

func NewMsgStaking

func NewMsgStaking(from sdk.AccAddress, delegatorAddr sdk.AccAddress, validatorAddr sdk.AccAddress,
	id string) *MsgStaking

func (*MsgStaking) Bytes

func (msg *MsgStaking) Bytes() []byte

func (*MsgStaking) GetFromAddress

func (msg *MsgStaking) GetFromAddress() sdk.AccAddress

func (*MsgStaking) MsgType

func (msg *MsgStaking) MsgType() string

func (*MsgStaking) Route

func (msg *MsgStaking) Route() string

func (*MsgStaking) ValidateBasic

func (msg *MsgStaking) ValidateBasic() error

type MsgStakingDirect added in v1.6.21

type MsgStakingDirect struct {
	FromAddress  sdk.AccAddress `json:"from_address"`
	Delegator    sdk.AccAddress `json:"delegator"`
	Validator    sdk.AccAddress `json:"validator"`
	Amount       sdk.Coin       `json:"amount"`
	DelegateTime time.Duration  `json:"delegate_time"`
}

func NewMsgStakingDirect added in v1.6.21

func NewMsgStakingDirect(from sdk.AccAddress, delegatorAddr sdk.AccAddress, validatorAddr sdk.AccAddress,
	amount sdk.Coin, dt time.Duration) *MsgStakingDirect

func (*MsgStakingDirect) Bytes added in v1.6.21

func (msg *MsgStakingDirect) Bytes() []byte

func (*MsgStakingDirect) GetFromAddress added in v1.6.21

func (msg *MsgStakingDirect) GetFromAddress() sdk.AccAddress

func (*MsgStakingDirect) MsgType added in v1.6.21

func (msg *MsgStakingDirect) MsgType() string

func (*MsgStakingDirect) Route added in v1.6.21

func (msg *MsgStakingDirect) Route() string

func (*MsgStakingDirect) ValidateBasic added in v1.6.21

func (msg *MsgStakingDirect) ValidateBasic() error

type MsgUndelegate added in v1.5.53

type MsgUndelegate struct {
	FromAddress sdk.AccAddress `json:"from_address"`
	VaultID     string         `json:"vault_id"`
}

func NewMsgUndelegate added in v1.5.53

func NewMsgUndelegate(from sdk.AccAddress, id string) *MsgUndelegate

func (*MsgUndelegate) Bytes added in v1.5.53

func (msg *MsgUndelegate) Bytes() []byte

func (*MsgUndelegate) GetFromAddress added in v1.5.53

func (msg *MsgUndelegate) GetFromAddress() sdk.AccAddress

func (*MsgUndelegate) MsgType added in v1.5.53

func (msg *MsgUndelegate) MsgType() string

func (*MsgUndelegate) Route added in v1.5.53

func (msg *MsgUndelegate) Route() string

func (*MsgUndelegate) ValidateBasic added in v1.5.53

func (msg *MsgUndelegate) ValidateBasic() error

type QueryPreStakingRecord

type QueryPreStakingRecord struct {
	Delegator sdk.AccAddress `json:"delegator"`
}

type QueryPreStakingResult

type QueryPreStakingResult struct {
	Amount string `json:"amount"`
}

type QueryStakingRecord

type QueryStakingRecord struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
}

type StakingVault added in v1.6.24

type StakingVault struct {
	ID          uint64         `json:"id"`
	StartTime   time.Time      `json:"start_time"`
	StorageTime time.Duration  `json:"storage_time"`
	EndTime     time.Time      `json:"end_time"`
	Amount      sdk.Coin       `json:"amount"`
	Validator   sdk.AccAddress `json:"validator"`
	Delegator   sdk.AccAddress `json:"delegator"`
	TransLogs   []TransLog     `json:"trans_logs"`
	Processed   bool           `json:"processed"`
}

func NewStakingVault added in v1.6.24

func NewStakingVault(id uint64, sta, et time.Time, st time.Duration, amount sdk.Coin, val, del sdk.AccAddress) StakingVault

func StakingVaultFrom added in v1.6.31

func StakingVaultFrom(svo StakingVaultOld) StakingVault

type StakingVaultOld added in v1.6.31

type StakingVaultOld struct {
	ID          uint64           `json:"id"`
	StartTime   time.Time        `json:"start_time"`
	StorageTime time.Duration    `json:"storage_time"`
	EndTime     time.Time        `json:"end_time"`
	Amount      sdk.Coin         `json:"amount"`
	Validator   sdk.AccAddress   `json:"validator"`
	Delegator   sdk.AccAddress   `json:"delegator"`
	TransLogs   []sdk.AccAddress `json:"trans_logs"`
	Processed   bool             `json:"processed"`
}

type TransLog added in v1.6.31

type TransLog struct {
	Src     sdk.AccAddress `json:"src"`
	Dst     sdk.AccAddress `json:"dst"`
	LogTime time.Time      `json:"log_time"`
}

func NewTransLog added in v1.6.31

func NewTransLog(src, dst sdk.AccAddress, logTime time.Time) TransLog

Jump to

Keyboard shortcuts

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