types

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	CrossStakeChannel = "crossStake"

	CrossStakeChannelID sdk.ChannelID = 16

	TagCrossStakeChannel      = "CrossStakeChannel"
	TagCrossStakePackageType  = "CrossStakePackageType"
	TagCrossStakeSendSequence = "CrossStakeSendSequence"

	CrossDistributeRewardRelayFee      = "crossDistributeRewardRelayFee"
	CrossDistributeUndelegatedRelayFee = "crossDistributeUndelegatedRelayFee"

	CrossStakeFailed  CrossStakeStatus = 0
	CrossStakeSuccess CrossStakeStatus = 1

	CrossStakeTypeDelegate              CrossStakeEventType = 1
	CrossStakeTypeUndelegate            CrossStakeEventType = 2
	CrossStakeTypeRedelegate            CrossStakeEventType = 3
	CrossStakeTypeDistributeReward      CrossStakeEventType = 4
	CrossStakeTypeDistributeUndelegated CrossStakeEventType = 5

	TransferInType  string = "TI"
	TransferOutType string = "TO"

	DelegateCAoBSalt string = "Delegate"
	RewardCAoBSalt   string = "Reward"

	MinRewardThreshold int64 = 1e8
)
View Source
const (
	EventTypeCompleteUnbonding    = "complete_unbonding"
	EventTypeCompleteRedelegation = "complete_redelegation"
	EventTypeCreateValidator      = "create_validator"
	EventTypeEditValidator        = "edit_validator"
	EventTypeDelegate             = "delegate"
	EventTypeUnbond               = "unbond"
	EventTypeRedelegate           = "redelegate"

	EventTypeCrossStake        = "cross_stake"
	EventTypeTotalDistribution = "total_distribution"

	AttributeKeyValidator         = "validator"
	AttributeKeyCommissionRate    = "commission_rate"
	AttributeKeyMinSelfDelegation = "min_self_delegation"
	AttributeKeySrcValidator      = "source_validator"
	AttributeKeyDstValidator      = "destination_validator"
	AttributeKeyDelegator         = "delegator"
	AttributeKeyCompletionTime    = "completion_time"

	AttributeKeySideChainId = "side_chain_id"

	AttributeKeyRewardSum = "reward_sum"
)
View Source
const (
	MsgTypeCreateSideChainValidator = "side_create_validator"
	MsgTypeEditSideChainValidator   = "side_edit_validator"
	MsgTypeSideChainDelegate        = "side_delegate"
	MsgTypeSideChainRedelegate      = "side_redelegate"
	MsgTypeSideChainUndelegate      = "side_undelegate"
)
View Source
const ChainIDForBeaconChain string = "abc" // short for AXC Beacon Chain
View Source
const DoNotModifyDesc = "[do-not-modify]"

constant used in flags to indicate that description field should not be updated

View Source
const MsgRoute = "stake"

name to identify transaction routes

View Source
const (
	Topic = pubsub.Topic("stake")
)
View Source
const (

	// Delay, in blocks, between when validator updates are returned to Tendermint and when they are applied
	// For example, if this is 0, the validator set at the end of a block will sign the next block, or
	// if this is 1, the validator set at the end of a block will sign the block after the next.
	// Constant as this should not change without a hard fork.
	ValidatorUpdateDelay int64 = 1
)

Variables

View Source
var (
	KeyUnbondingTime               = []byte("UnbondingTime")
	KeyMaxValidators               = []byte("MaxValidators")
	KeyBondDenom                   = []byte("BondDenom")
	KeyMinSelfDelegation           = []byte("MinSelfDelegation")
	KeyMinDelegationChange         = []byte("MinDelegationChanged")
	KeyRewardDistributionBatchSize = []byte("RewardDistributionBatchSize")
	KeyMaxStakeSnapshots           = []byte("MaxStakeSnapshots")
	KeyBaseProposerRewardRatio     = []byte("BaseProposerRewardRatio")
	KeyBonusProposerRewardRatio    = []byte("BonusProposerRewardRatio")
	KeyFeeFromAxcToBcRatio         = []byte("FeeFromAxcToBcRatio")
)

nolint - Keys for parameter access

View Source
var MsgCdc *codec.Codec

generic sealed codec to be used throughout sdk

Functions

func ErrBadDelegationAddr

func ErrBadDelegationAddr(codespace sdk.CodespaceType) sdk.Error

func ErrBadDelegationAmount

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

func ErrBadDelegatorAddr

func ErrBadDelegatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrBadDenom

func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error

func ErrBadRedelegationAddr

func ErrBadRedelegationAddr(codespace sdk.CodespaceType) sdk.Error

func ErrBadRedelegationDst

func ErrBadRedelegationDst(codespace sdk.CodespaceType) sdk.Error

func ErrBadRedelegationSrc

func ErrBadRedelegationSrc(codespace sdk.CodespaceType) sdk.Error

func ErrBadRemoveValidator

func ErrBadRemoveValidator(codespace sdk.CodespaceType) sdk.Error

func ErrBadSharesAmount

func ErrBadSharesAmount(codespace sdk.CodespaceType) sdk.Error

func ErrBadSharesPercent

func ErrBadSharesPercent(codespace sdk.CodespaceType) sdk.Error

func ErrBadValidatorAddr

func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrBothShareMsgsGiven

func ErrBothShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error

func ErrCommissionChangeRateGTMaxRate

func ErrCommissionChangeRateGTMaxRate(codespace sdk.CodespaceType) sdk.Error

func ErrCommissionChangeRateNegative

func ErrCommissionChangeRateNegative(codespace sdk.CodespaceType) sdk.Error

func ErrCommissionGTMaxChangeRate

func ErrCommissionGTMaxChangeRate(codespace sdk.CodespaceType) sdk.Error

func ErrCommissionGTMaxRate

func ErrCommissionGTMaxRate(codespace sdk.CodespaceType) sdk.Error

func ErrCommissionHuge

func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error

func ErrCommissionNegative

func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error

func ErrCommissionUpdateTime

func ErrCommissionUpdateTime(codespace sdk.CodespaceType) sdk.Error

func ErrConflictingRedelegation

func ErrConflictingRedelegation(codespace sdk.CodespaceType) sdk.Error

func ErrDelegationValidatorEmpty

func ErrDelegationValidatorEmpty(codespace sdk.CodespaceType) sdk.Error

func ErrDescriptionLength

func ErrDescriptionLength(codespace sdk.CodespaceType, descriptor string, got, max int) sdk.Error

func ErrDeserializePackageFailed

func ErrDeserializePackageFailed(msg string) sdk.Error

func ErrEmptyMoniker

func ErrEmptyMoniker(codespace sdk.CodespaceType) sdk.Error

func ErrExistingUnbondingDelegation

func ErrExistingUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error

func ErrExpiredCrossStakeSyncPackage

func ErrExpiredCrossStakeSyncPackage(msg string) sdk.Error

func ErrInsufficientShares

func ErrInsufficientShares(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidCrosschainPackage

func ErrInvalidCrosschainPackage(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidDelegator

func ErrInvalidDelegator(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidProposal

func ErrInvalidProposal(codespace sdk.CodespaceType, reason string) sdk.Error

func ErrInvalidPubKey

func ErrInvalidPubKey(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidRedelegator

func ErrInvalidRedelegator(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidSideChainId

func ErrInvalidSideChainId(codespace sdk.CodespaceType) sdk.Error

func ErrMissingSignature

func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error

func ErrNeitherShareMsgsGiven

func ErrNeitherShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error

func ErrNilDelegatorAddr

func ErrNilDelegatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrNilLauncherAddr

func ErrNilLauncherAddr(codespace sdk.CodespaceType) sdk.Error

func ErrNilValidatorAddr

func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error

validator

func ErrNilValidatorConsAddr

func ErrNilValidatorConsAddr(codespace sdk.CodespaceType) sdk.Error

func ErrNoBalance

func ErrNoBalance(msg string) sdk.Error

func ErrNoDelegation

func ErrNoDelegation(codespace sdk.CodespaceType) sdk.Error

func ErrNoDelegatorForAddress

func ErrNoDelegatorForAddress(codespace sdk.CodespaceType) sdk.Error

func ErrNoRedelegation

func ErrNoRedelegation(codespace sdk.CodespaceType) sdk.Error

func ErrNoUnbondingDelegation

func ErrNoUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error

func ErrNoValidatorFound

func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error

func ErrNotEnoughBalance

func ErrNotEnoughBalance(msg string) sdk.Error

func ErrNotEnoughDelegationAmount

func ErrNotEnoughDelegationAmount(codespace sdk.CodespaceType) sdk.Error

func ErrNotEnoughDelegationShares

func ErrNotEnoughDelegationShares(codespace sdk.CodespaceType, shares string) sdk.Error

func ErrNotMature

func ErrNotMature(codespace sdk.CodespaceType, operation, descriptor string, got, min time.Time) sdk.Error

func ErrNotSelfDelegate

func ErrNotSelfDelegate(codespace sdk.CodespaceType) sdk.Error

func ErrSelfRedelegation

func ErrSelfRedelegation(codespace sdk.CodespaceType) sdk.Error

func ErrTransitiveRedelegation

func ErrTransitiveRedelegation(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorJailed

func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorOwnerExists

func ErrValidatorOwnerExists(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorPubKeyExists

func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorSideConsAddrExists

func ErrValidatorSideConsAddrExists(codespace sdk.CodespaceType) sdk.Error

func GenerateDistributionAddr

func GenerateDistributionAddr(operator sdk.ValAddress, sideChainId string) sdk.AccAddress

func GetStakeCAoB

func GetStakeCAoB(sourceAddr []byte, salt string) sdk.AccAddress

func MustMarshalDelegation

func MustMarshalDelegation(cdc *codec.Codec, delegation Delegation) []byte

return the delegation without fields contained within the key for the store

func MustMarshalRED

func MustMarshalRED(cdc *codec.Codec, red Redelegation) []byte

return the redelegation without fields contained within the key for the store

func MustMarshalRewards

func MustMarshalRewards(cdc *codec.Codec, rewards []Reward) []byte

func MustMarshalSimplifiedDelegations

func MustMarshalSimplifiedDelegations(cdc *codec.Codec, simDels []SimplifiedDelegation) []byte

func MustMarshalUBD

func MustMarshalUBD(cdc *codec.Codec, ubd UnbondingDelegation) []byte

return the unbonding delegation without fields contained within the key for the store

func MustMarshalValDistAddrs

func MustMarshalValDistAddrs(cdc *codec.Codec, valDistAddrs []StoredValDistAddr) []byte

func MustMarshalValidator

func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte

return the redelegation without fields contained within the key for the store

func MustMarshalValidators

func MustMarshalValidators(cdc *codec.Codec, validators []Validator) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

Types

type ChainDelegateEvent

type ChainDelegateEvent struct {
	DelegateEvent
	ChainId string
}

type ChainRedelegateEvent

type ChainRedelegateEvent struct {
	RedelegateEvent
	ChainId string
}

type ChainUndelegateEvent

type ChainUndelegateEvent struct {
	UndelegateEvent
	ChainId string
}

type CodeType

type CodeType = sdk.CodeType
const (
	DefaultCodespace sdk.CodespaceType = 4

	CodeInvalidValidator             CodeType = 101
	CodeInvalidDelegation            CodeType = 102
	CodeInvalidInput                 CodeType = 103
	CodeValidatorJailed              CodeType = 104
	CodeInvalidProposal              CodeType = 105
	CodeInvalidSideChain             CodeType = 106
	CodeInvalidCrossChainPackage     CodeType = 107
	CodeDeserializePackageFailed     CodeType = 108
	CodeExpiredCrossStakeSyncPackage CodeType = 109
	CodeCrossStakingNoBalance        CodeType = 110
	CodeCrossStakingNotEnoughBalance CodeType = 111
	CodeInvalidAddress               CodeType = sdk.CodeInvalidAddress
	CodeUnauthorized                 CodeType = sdk.CodeUnauthorized
	CodeInternal                     CodeType = sdk.CodeInternal
	CodeUnknownRequest               CodeType = sdk.CodeUnknownRequest
)

type Commission

type Commission struct {
	Rate          sdk.Dec   `json:"rate"`            // the commission rate charged to delegators
	MaxRate       sdk.Dec   `json:"max_rate"`        // maximum commission rate which validator can ever charge
	MaxChangeRate sdk.Dec   `json:"max_change_rate"` // maximum daily increase of the validator commission
	UpdateTime    time.Time `json:"update_time"`     // the last time the commission rate was changed
}

Commission defines a commission parameters for a given validator.

func NewCommission

func NewCommission(rate, maxRate, maxChangeRate sdk.Dec) Commission

NewCommission returns an initialized validator commission.

func NewCommissionWithTime

func NewCommissionWithTime(rate, maxRate, maxChangeRate sdk.Dec, updatedAt time.Time) Commission

NewCommission returns an initialized validator commission with a specified update time which should be the current block BFT time.

func (Commission) Equal

func (c Commission) Equal(c2 Commission) bool

Equal checks if the given Commission object is equal to the receiving Commission object.

func (Commission) String

func (c Commission) String() string

String implements the Stringer interface for a Commission.

func (Commission) Validate

func (c Commission) Validate() sdk.Error

Validate performs basic sanity validation checks of initial commission parameters. If validation fails, an SDK error is returned.

func (Commission) ValidateNewRate

func (c Commission) ValidateNewRate(newRate sdk.Dec, blockTime time.Time) sdk.Error

ValidateNewRate performs basic sanity validation checks of a new commission rate. If validation fails, an SDK error is returned.

type CommissionMsg

type CommissionMsg struct {
	Rate          sdk.Dec `json:"rate"`            // the commission rate charged to delegators
	MaxRate       sdk.Dec `json:"max_rate"`        // maximum commission rate which validator can ever charge
	MaxChangeRate sdk.Dec `json:"max_change_rate"` // maximum daily increase of the validator commission
}

CommissionMsg defines a commission message to be used for creating a validator.

func NewCommissionMsg

func NewCommissionMsg(rate, maxRate, maxChangeRate sdk.Dec) CommissionMsg

NewCommissionMsg returns an initialized validator commission message.

func (CommissionMsg) Equal

func (c CommissionMsg) Equal(c2 CommissionMsg) bool

type CompletedREDEvent

type CompletedREDEvent struct {
	StakeEvent
	ChainId  string
	CompREDs []DVVTriplet
}

completed reDelegation event

type CompletedUBDEvent

type CompletedUBDEvent struct {
	StakeEvent
	ChainId  string
	CompUBDs []UnbondingDelegation
}

completed unBonding event

type CreateValidatorJsonMsg

type CreateValidatorJsonMsg struct {
	Description   Description
	Commission    CommissionMsg
	DelegatorAddr sdk.AccAddress `json:"delegator_address"`
	ValidatorAddr sdk.ValAddress `json:"validator_address"`
	PubKey        []byte         `json:"pubkey"`
	Delegation    sdk.Coin       `json:"delegation"`
}

func (CreateValidatorJsonMsg) ToMsgCreateValidator

func (jsonMsg CreateValidatorJsonMsg) ToMsgCreateValidator() (MsgCreateValidator, error)

type CrossStakeAckPackage

type CrossStakeAckPackage struct {
	Status    CrossStakeStatus
	ErrorCode uint8
	PackBytes []byte
}

type CrossStakeDelegateSynPackage

type CrossStakeDelegateSynPackage struct {
	DelAddr   sdk.SmartChainAddress
	Validator sdk.ValAddress
	Amount    *big.Int
}

type CrossStakeDistributeRewardSynPackage

type CrossStakeDistributeRewardSynPackage struct {
	EventType CrossStakeEventType
	Recipient sdk.SmartChainAddress
	Amount    *big.Int
}

type CrossStakeDistributeUndelegatedSynPackage

type CrossStakeDistributeUndelegatedSynPackage struct {
	EventType CrossStakeEventType
	Recipient sdk.SmartChainAddress
	Validator sdk.ValAddress
	Amount    *big.Int
}

type CrossStakeEventType

type CrossStakeEventType uint8

type CrossStakeInfoResponse

type CrossStakeInfoResponse struct {
	Reward            int64          `json:"reward"`
	DelegationAddress sdk.AccAddress `json:"delegation_address"`
	RewardAddress     sdk.AccAddress `json:"reward_address"`
}

func NewCrossStakeInfoResponse

func NewCrossStakeInfoResponse(
	delAddr sdk.AccAddress, rewardAddr sdk.AccAddress, reward int64,
) CrossStakeInfoResponse

NewCrossStakeInfoResponse creates a new CrossStakeInfoResponse instance

func (CrossStakeInfoResponse) HumanReadableString

func (dr CrossStakeInfoResponse) HumanReadableString() (string, error)

type CrossStakeRedelegateSynPackage

type CrossStakeRedelegateSynPackage struct {
	DelAddr sdk.SmartChainAddress
	ValSrc  sdk.ValAddress
	ValDst  sdk.ValAddress
	Amount  *big.Int
}

type CrossStakeRefundPackage

type CrossStakeRefundPackage struct {
	EventType CrossStakeEventType
	Recipient sdk.SmartChainAddress
	Amount    *big.Int
	ErrorCode RefundError
}

type CrossStakeStatus

type CrossStakeStatus uint8

type CrossStakeUndelegateSynPackage

type CrossStakeUndelegateSynPackage struct {
	DelAddr   sdk.SmartChainAddress
	Validator sdk.ValAddress
	Amount    *big.Int
}

type DVPair

type DVPair struct {
	DelegatorAddr sdk.AccAddress
	ValidatorAddr sdk.ValAddress
}

DVPair is struct that just has a delegator-validator pair with no other data. It is intended to be used as a marshalable pointer. For example, a DVPair can be used to construct the key to getting an UnbondingDelegation from state.

type DVVTriplet

type DVVTriplet struct {
	DelegatorAddr    sdk.AccAddress
	ValidatorSrcAddr sdk.ValAddress
	ValidatorDstAddr sdk.ValAddress
}

DVVTriplet is struct that just has a delegator-validator-validator triplet with no other data. It is intended to be used as a marshalable pointer. For example, a DVVTriplet can be used to construct the key to getting a Redelegation from state.

type DelegateEvent

type DelegateEvent struct {
	StakeEvent
	Delegator  sdk.AccAddress
	Validator  sdk.ValAddress
	Amount     int64
	Denom      string
	TxHash     string
	CrossStake bool
}

delegate event

type Delegation

type Delegation struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
	ValidatorAddr sdk.ValAddress `json:"validator_addr"`
	Shares        sdk.Dec        `json:"shares"`
	Height        int64          `json:"-"` // Last height bond updated
	CrossStake    bool           `json:"cross_stake"`
}

Delegation represents the bond with tokens held by an account. It is owned by one delegator, and is associated with the voting power of one pubKey.

func MustUnmarshalDelegation

func MustUnmarshalDelegation(cdc *codec.Codec, key, value []byte) Delegation

return the delegation without fields contained within the key for the store

func MustUnmarshalDelegationValAsKey

func MustUnmarshalDelegationValAsKey(cdc *codec.Codec, key, value []byte) Delegation

func UnmarshalDelegation

func UnmarshalDelegation(cdc *codec.Codec, key, value []byte) (delegation Delegation, err error)

return the delegation without fields contained within the key for the store

func UnmarshalDelegationValAsKey

func UnmarshalDelegationValAsKey(cdc *codec.Codec, key, value []byte) (realDelegation Delegation, err error)

return the delegation without fields contained within the key for the store. Validator and delegator position in the key need to be exchanged

func (Delegation) Equal

func (d Delegation) Equal(d2 Delegation) bool

nolint

func (Delegation) GetDelegatorAddr

func (d Delegation) GetDelegatorAddr() sdk.AccAddress

nolint - for sdk.Delegation

func (Delegation) GetShares

func (d Delegation) GetShares() sdk.Dec

func (Delegation) GetValidatorAddr

func (d Delegation) GetValidatorAddr() sdk.ValAddress

func (Delegation) HumanReadableString

func (d Delegation) HumanReadableString() (string, error)

HumanReadableString returns a human readable string representation of a Delegation. An error is returned if the Delegation's delegator or validator addresses cannot be Bech32 encoded.

type DelegationRemovedEvent

type DelegationRemovedEvent struct {
	StakeEvent
	DvPair  DVPair
	ChainId string
}

delegation removed

type DelegationResponse

type DelegationResponse struct {
	Delegation
	Balance sdk.Coin `json:"balance"`
}

DelegationResponse is equivalent to Delegation except that it contains a balance in addition to shares which is more suitable for client responses.

func NewDelegationResp

func NewDelegationResp(
	delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec, balance sdk.Coin,
) DelegationResponse

NewDelegationResp creates a new DelegationResponse instance

func (DelegationResponse) HumanReadableString

func (dr DelegationResponse) HumanReadableString() (string, error)

type DelegationUpdateEvent

type DelegationUpdateEvent struct {
	StakeEvent
	Delegation Delegation
	ChainId    string
}

delegation update

type Description

type Description struct {
	Moniker  string `json:"moniker"`  // name
	Identity string `json:"identity"` // optional identity signature (ex. UPort or Keybase)
	Website  string `json:"website"`  // optional website link
	Details  string `json:"details"`  // optional details
}

Description - description fields for a validator

func NewDescription

func NewDescription(moniker, identity, website, details string) Description

NewDescription returns a new Description with the provided values.

func (Description) EnsureLength

func (d Description) EnsureLength() (Description, sdk.Error)

EnsureLength ensures the length of a validator's description.

func (Description) Equals

func (d Description) Equals(d2 Description) bool

func (Description) UpdateDescription

func (d Description) UpdateDescription(d2 Description) (Description, sdk.Error)

UpdateDescription updates the fields of a given description. An error is returned if the resulting description contains an invalid length.

type DistributionData

type DistributionData struct {
	Validator      sdk.ValAddress
	SelfDelegator  sdk.AccAddress
	DistributeAddr sdk.AccAddress
	ValShares      sdk.Dec
	ValTokens      sdk.Dec
	TotalReward    sdk.Dec
	Commission     sdk.Dec
	Rewards        []Reward
}

type DistributionEvent

type DistributionEvent struct {
	StakeEvent
	ChainId string
	Data    []DistributionData
}

chain reward distribution event after BEP128

type ElectedValidatorsEvent

type ElectedValidatorsEvent struct {
	StakeEvent
	Validators []Validator
	ChainId    string
}

type GenesisState

type GenesisState struct {
	Pool       Pool         `json:"pool"`
	Params     Params       `json:"params"`
	Validators []Validator  `json:"validators"`
	Bonds      []Delegation `json:"bonds"`
}

GenesisState - all staking state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func NewGenesisState

func NewGenesisState(pool Pool, params Params, validators []Validator, bonds []Delegation) GenesisState

type IbcValidator

type IbcValidator struct {
	ConsAddr []byte
	FeeAddr  []byte
	DistAddr sdk.AccAddress
	Power    uint64
}

type IbcValidatorSetPackage

type IbcValidatorSetPackage struct {
	Type         PackageType
	ValidatorSet []IbcValidator
}

type MsgBeginUnbonding

type MsgBeginUnbonding struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
	ValidatorAddr sdk.ValAddress `json:"validator_addr"`
	SharesAmount  sdk.Dec        `json:"shares_amount"`
}

MsgBeginUnbonding - struct for unbonding transactions

func NewMsgBeginUnbonding

func NewMsgBeginUnbonding(delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec) MsgBeginUnbonding

func (MsgBeginUnbonding) GetInvolvedAddresses

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

func (MsgBeginUnbonding) GetSignBytes

func (msg MsgBeginUnbonding) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgBeginUnbonding) GetSigners

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

func (MsgBeginUnbonding) Route

func (msg MsgBeginUnbonding) Route() string

nolint

func (MsgBeginUnbonding) Type

func (msg MsgBeginUnbonding) Type() string

func (MsgBeginUnbonding) ValidateBasic

func (msg MsgBeginUnbonding) ValidateBasic() sdk.Error

quick validity check

type MsgCreateSideChainValidator

type MsgCreateSideChainValidator struct {
	Description   Description    `json:"description"`
	Commission    CommissionMsg  `json:"commission"`
	DelegatorAddr sdk.AccAddress `json:"delegator_address"`
	ValidatorAddr sdk.ValAddress `json:"validator_address"`
	Delegation    sdk.Coin       `json:"delegation"`
	SideChainId   string         `json:"side_chain_id"`
	SideConsAddr  []byte         `json:"side_cons_addr"`
	SideFeeAddr   []byte         `json:"side_fee_addr"`
}

func NewMsgCreateSideChainValidator

func NewMsgCreateSideChainValidator(valAddr sdk.ValAddress, delegation sdk.Coin,
	description Description, commission CommissionMsg, sideChainId string, sideConsAddr []byte, sideFeeAddr []byte) MsgCreateSideChainValidator

func NewMsgCreateSideChainValidatorOnBehalfOf

func NewMsgCreateSideChainValidatorOnBehalfOf(delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, delegation sdk.Coin,
	description Description, commission CommissionMsg, sideChainId string, sideConsAddr []byte, sideFeeAddr []byte) MsgCreateSideChainValidator

func (MsgCreateSideChainValidator) GetInvolvedAddresses

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

func (MsgCreateSideChainValidator) GetSideChainId

func (msg MsgCreateSideChainValidator) GetSideChainId() string

func (MsgCreateSideChainValidator) GetSignBytes

func (msg MsgCreateSideChainValidator) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgCreateSideChainValidator) GetSigners

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

Return address(es) that must sign over msg.GetSignBytes()

func (MsgCreateSideChainValidator) Route

func (msg MsgCreateSideChainValidator) Route() string

nolint

func (MsgCreateSideChainValidator) Type

func (MsgCreateSideChainValidator) ValidateBasic

func (msg MsgCreateSideChainValidator) ValidateBasic() sdk.Error

type MsgCreateValidator

type MsgCreateValidator struct {
	Description   Description
	Commission    CommissionMsg
	DelegatorAddr sdk.AccAddress `json:"delegator_address"`
	ValidatorAddr sdk.ValAddress `json:"validator_address"`
	PubKey        crypto.PubKey  `json:"pubkey"`
	Delegation    sdk.Coin       `json:"delegation"`
}

MsgCreateValidator - struct for bonding transactions

func NewMsgCreateValidator

func NewMsgCreateValidator(valAddr sdk.ValAddress, pubkey crypto.PubKey,
	selfDelegation sdk.Coin, description Description, commission CommissionMsg) MsgCreateValidator

Default way to create validator. Delegator address and validator address are the same

func NewMsgCreateValidatorOnBehalfOf

func NewMsgCreateValidatorOnBehalfOf(delAddr sdk.AccAddress, valAddr sdk.ValAddress,
	pubkey crypto.PubKey, delegation sdk.Coin, description Description, commission CommissionMsg) MsgCreateValidator

Creates validator msg by delegator address on behalf of validator address

func (MsgCreateValidator) Equals

func (msg MsgCreateValidator) Equals(other MsgCreateValidator) bool

func (MsgCreateValidator) GetInvolvedAddresses

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

func (MsgCreateValidator) GetSignBytes

func (msg MsgCreateValidator) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgCreateValidator) GetSigners

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

Return address(es) that must sign over msg.GetSignBytes()

func (MsgCreateValidator) Route

func (msg MsgCreateValidator) Route() string

nolint

func (MsgCreateValidator) Type

func (msg MsgCreateValidator) Type() string

func (MsgCreateValidator) ValidateBasic

func (msg MsgCreateValidator) ValidateBasic() sdk.Error

quick validity check

type MsgCreateValidatorOpen

type MsgCreateValidatorOpen struct {
	Description   Description    `json:"description"`
	Commission    CommissionMsg  `json:"commission"`
	DelegatorAddr sdk.AccAddress `json:"delegator_address"`
	ValidatorAddr sdk.ValAddress `json:"validator_address"`
	PubKey        string         `json:"pubkey"`
	Delegation    sdk.Coin       `json:"delegation"`
}

the MsgCreateValidator has been taken by MsgCreateValidatorProposal, use a new Msg for CreateValidatorOpen for open staking, and change pubkey to string(bech32 format) to make it friendly for multi-language implementation.

func (MsgCreateValidatorOpen) Equals

func (MsgCreateValidatorOpen) GetInvolvedAddresses

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

func (MsgCreateValidatorOpen) GetSignBytes

func (msg MsgCreateValidatorOpen) GetSignBytes() []byte

func (MsgCreateValidatorOpen) GetSigners

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

func (MsgCreateValidatorOpen) Route

func (msg MsgCreateValidatorOpen) Route() string

func (MsgCreateValidatorOpen) Type

func (msg MsgCreateValidatorOpen) Type() string

func (MsgCreateValidatorOpen) ValidateBasic

func (msg MsgCreateValidatorOpen) ValidateBasic() sdk.Error

type MsgCreateValidatorProposal

type MsgCreateValidatorProposal struct {
	MsgCreateValidator
	ProposalId int64 `json:"proposal_id"`
}

type MsgDelegate

type MsgDelegate struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
	ValidatorAddr sdk.ValAddress `json:"validator_addr"`
	Delegation    sdk.Coin       `json:"delegation"`
}

MsgDelegate - struct for bonding transactions

func NewMsgDelegate

func NewMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delegation sdk.Coin) MsgDelegate

func (MsgDelegate) GetInvolvedAddresses

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

func (MsgDelegate) GetSignBytes

func (msg MsgDelegate) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgDelegate) GetSigners

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

func (MsgDelegate) Route

func (msg MsgDelegate) Route() string

nolint

func (MsgDelegate) Type

func (msg MsgDelegate) Type() string

func (MsgDelegate) ValidateBasic

func (msg MsgDelegate) ValidateBasic() sdk.Error

quick validity check

type MsgEditSideChainValidator

type MsgEditSideChainValidator struct {
	Description   Description    `json:"description"`
	ValidatorAddr sdk.ValAddress `json:"address"`

	// We pass a reference to the new commission rate as it's not mandatory to
	// update. If not updated, the deserialized rate will be zero with no way to
	// distinguish if an update was intended.
	//
	// REF: #2373
	CommissionRate *sdk.Dec `json:"commission_rate"`

	SideChainId string `json:"side_chain_id"`
	// for SideFeeAddr, we do not update the values if they are not provided.
	SideFeeAddr []byte `json:"side_fee_addr"`

	SideConsAddr []byte `json:"side_cons_addr,omitempty"`
}

______________________________________________________________________

func NewMsgEditSideChainValidator

func NewMsgEditSideChainValidator(sideChainId string, validatorAddr sdk.ValAddress, description Description, commissionRate *sdk.Dec, sideFeeAddr, sideConsAddr []byte) MsgEditSideChainValidator

func (MsgEditSideChainValidator) GetInvolvedAddresses

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

func (MsgEditSideChainValidator) GetSideChainId

func (msg MsgEditSideChainValidator) GetSideChainId() string

func (MsgEditSideChainValidator) GetSignBytes

func (msg MsgEditSideChainValidator) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgEditSideChainValidator) GetSigners

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

func (MsgEditSideChainValidator) Route

func (msg MsgEditSideChainValidator) Route() string

nolint

func (MsgEditSideChainValidator) Type

func (msg MsgEditSideChainValidator) Type() string

func (MsgEditSideChainValidator) ValidateBasic

func (msg MsgEditSideChainValidator) ValidateBasic() sdk.Error

type MsgEditValidator

type MsgEditValidator struct {
	Description   Description    `json:"description"`
	ValidatorAddr sdk.ValAddress `json:"address"`

	// We pass a reference to the new commission rate as it's not mandatory to
	// update. If not updated, the deserialized rate will be zero with no way to
	// distinguish if an update was intended.
	//
	// REF: #2373
	CommissionRate *sdk.Dec `json:"commission_rate"`
	PubKey         string   `json:"pubkey"`
}

MsgEditValidator - struct for editing a validator

func NewMsgEditValidator

func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec, pubkey string) MsgEditValidator

func (MsgEditValidator) GetInvolvedAddresses

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

func (MsgEditValidator) GetSignBytes

func (msg MsgEditValidator) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgEditValidator) GetSigners

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

func (MsgEditValidator) Route

func (msg MsgEditValidator) Route() string

nolint

func (MsgEditValidator) Type

func (msg MsgEditValidator) Type() string

func (MsgEditValidator) ValidateBasic

func (msg MsgEditValidator) ValidateBasic() sdk.Error

quick validity check

type MsgRedelegate

type MsgRedelegate struct {
	DelegatorAddr    sdk.AccAddress `json:"delegator_addr"`
	ValidatorSrcAddr sdk.ValAddress `json:"validator_src_addr"`
	ValidatorDstAddr sdk.ValAddress `json:"validator_dst_addr"`
	Amount           sdk.Coin       `json:"amount"`
}

MsgDelegate - struct for bonding transactions

func NewMsgRedelegate

func NewMsgRedelegate(delAddr sdk.AccAddress, valSrcAddr,
	valDstAddr sdk.ValAddress, amount sdk.Coin) MsgRedelegate

func (MsgRedelegate) GetInvolvedAddresses

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

func (MsgRedelegate) GetSignBytes

func (msg MsgRedelegate) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgRedelegate) GetSigners

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

func (MsgRedelegate) Route

func (msg MsgRedelegate) Route() string

nolint

func (MsgRedelegate) Type

func (msg MsgRedelegate) Type() string

func (MsgRedelegate) ValidateBasic

func (msg MsgRedelegate) ValidateBasic() sdk.Error

ValidateBasic is used to quickly disqualify obviously invalid messages quickly

type MsgRemoveValidator

type MsgRemoveValidator struct {
	LauncherAddr sdk.AccAddress  `json:"launcher_addr"`
	ValAddr      sdk.ValAddress  `json:"val_addr"`
	ValConsAddr  sdk.ConsAddress `json:"val_cons_addr"`
	ProposalId   int64           `json:"proposal_id"`
}

func NewMsgRemoveValidator

func NewMsgRemoveValidator(launcherAddr sdk.AccAddress, valAddr sdk.ValAddress,
	valConsAddr sdk.ConsAddress, proposalId int64) MsgRemoveValidator

func (MsgRemoveValidator) GetInvolvedAddresses

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

func (MsgRemoveValidator) GetSignBytes

func (msg MsgRemoveValidator) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgRemoveValidator) GetSigners

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

func (MsgRemoveValidator) Route

func (msg MsgRemoveValidator) Route() string

nolint

func (MsgRemoveValidator) Type

func (msg MsgRemoveValidator) Type() string

func (MsgRemoveValidator) ValidateBasic

func (msg MsgRemoveValidator) ValidateBasic() sdk.Error

quick validity check

type MsgSideChainDelegate

type MsgSideChainDelegate struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
	ValidatorAddr sdk.ValAddress `json:"validator_addr"`
	Delegation    sdk.Coin       `json:"delegation"`

	SideChainId string `json:"side_chain_id"`
}

______________________________________________________________________

func NewMsgSideChainDelegate

func NewMsgSideChainDelegate(sideChainId string, delAddr sdk.AccAddress, valAddr sdk.ValAddress, delegation sdk.Coin) MsgSideChainDelegate

func (MsgSideChainDelegate) GetInvolvedAddresses

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

func (MsgSideChainDelegate) GetSideChainId

func (msg MsgSideChainDelegate) GetSideChainId() string

func (MsgSideChainDelegate) GetSignBytes

func (msg MsgSideChainDelegate) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgSideChainDelegate) GetSigners

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

func (MsgSideChainDelegate) Route

func (msg MsgSideChainDelegate) Route() string

nolint

func (MsgSideChainDelegate) Type

func (msg MsgSideChainDelegate) Type() string

func (MsgSideChainDelegate) ValidateBasic

func (msg MsgSideChainDelegate) ValidateBasic() sdk.Error

ValidateBasic is used to quickly disqualify obviously invalid messages quickly

type MsgSideChainRedelegate

type MsgSideChainRedelegate struct {
	DelegatorAddr    sdk.AccAddress `json:"delegator_addr"`
	ValidatorSrcAddr sdk.ValAddress `json:"validator_src_addr"`
	ValidatorDstAddr sdk.ValAddress `json:"validator_dst_addr"`
	Amount           sdk.Coin       `json:"amount"`
	SideChainId      string         `json:"side_chain_id"`
}

______________________________________________________________________

func NewMsgSideChainRedelegate

func NewMsgSideChainRedelegate(sideChainId string, delegatorAddr sdk.AccAddress, valSrcAddr sdk.ValAddress, valDstAddr sdk.ValAddress, amount sdk.Coin) MsgSideChainRedelegate

func (MsgSideChainRedelegate) GetInvolvedAddresses

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

func (MsgSideChainRedelegate) GetSideChainId

func (msg MsgSideChainRedelegate) GetSideChainId() string

func (MsgSideChainRedelegate) GetSignBytes

func (msg MsgSideChainRedelegate) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgSideChainRedelegate) GetSigners

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

func (MsgSideChainRedelegate) Route

func (msg MsgSideChainRedelegate) Route() string

nolint

func (MsgSideChainRedelegate) Type

func (msg MsgSideChainRedelegate) Type() string

func (MsgSideChainRedelegate) ValidateBasic

func (msg MsgSideChainRedelegate) ValidateBasic() sdk.Error

type MsgSideChainUndelegate

type MsgSideChainUndelegate struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
	ValidatorAddr sdk.ValAddress `json:"validator_addr"`
	Amount        sdk.Coin       `json:"amount"`
	SideChainId   string         `json:"side_chain_id"`
}

______________________________________________________________________

func NewMsgSideChainUndelegate

func NewMsgSideChainUndelegate(sideChainId string, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgSideChainUndelegate

func (MsgSideChainUndelegate) GetInvolvedAddresses

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

func (MsgSideChainUndelegate) GetSideChainId

func (msg MsgSideChainUndelegate) GetSideChainId() string

func (MsgSideChainUndelegate) GetSignBytes

func (msg MsgSideChainUndelegate) GetSignBytes() []byte

func (MsgSideChainUndelegate) GetSigners

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

func (MsgSideChainUndelegate) Route

func (msg MsgSideChainUndelegate) Route() string

nolint

func (MsgSideChainUndelegate) Type

func (msg MsgSideChainUndelegate) Type() string

func (MsgSideChainUndelegate) ValidateBasic

func (msg MsgSideChainUndelegate) ValidateBasic() sdk.Error

ValidateBasic implements the sdk.Msg interface.

type MsgUndelegate

type MsgUndelegate struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
	ValidatorAddr sdk.ValAddress `json:"validator_addr"`
	Amount        sdk.Coin       `json:"amount"`
}

func NewMsgUndelegate

func NewMsgUndelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgUndelegate

func (MsgUndelegate) GetInvolvedAddresses

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

func (MsgUndelegate) GetSignBytes

func (msg MsgUndelegate) GetSignBytes() []byte

get the bytes for the message signer to sign on

func (MsgUndelegate) GetSigners

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

func (MsgUndelegate) Route

func (msg MsgUndelegate) Route() string

nolint

func (MsgUndelegate) Type

func (msg MsgUndelegate) Type() string

func (MsgUndelegate) ValidateBasic

func (msg MsgUndelegate) ValidateBasic() sdk.Error

quick validity check

type OracleRelayer

type OracleRelayer struct {
	Address sdk.ValAddress `json:"address"`
	Power   int64          `json:"power"`
}

type PackageType

type PackageType uint8
const (
	StakePackageType PackageType = 0x00
	JailPackageType  PackageType = 0x01
)

type Params

type Params struct {
	UnbondingTime time.Duration `json:"unbonding_time"`

	MaxValidators               uint16 `json:"max_validators"`                 // maximum number of validators
	BondDenom                   string `json:"bond_denom"`                     // bondable coin denomination
	MinSelfDelegation           int64  `json:"min_self_delegation"`            // the minimal self-delegation amount
	MinDelegationChange         int64  `json:"min_delegation_change"`          // the minimal delegation amount changed
	RewardDistributionBatchSize int64  `json:"reward_distribution_batch_size"` // the batch size for distributing rewards in blocks
	// added in BEP159
	MaxStakeSnapshots        uint16    `json:"max_stake_snapshots"`         // maximum number of stake snapshots, also used as the accumulated stake duration
	BaseProposerRewardRatio  types.Dec `json:"base_proposer_reward_ratio"`  // the base proposer reward ratio
	BonusProposerRewardRatio types.Dec `json:"bonus_proposer_reward_ratio"` // the bonus proposer reward ratio
	FeeFromAxcToBcRatio      types.Dec `json:"fee_from_axc_to_bc_ratio"`    // the fee from axc to bc ratio
}

Params defines the high level settings for staking

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current staking params value from store key or panic

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current staking params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical.

func (*Params) GetBCParamAttribute

func (p *Params) GetBCParamAttribute() string

func (*Params) GetParamAttribute

func (p *Params) GetParamAttribute() (string, bool)

func (Params) HumanReadableString

func (p Params) HumanReadableString() string

HumanReadableString returns a human readable string representation of the parameters.

func (*Params) KeyValuePairs

func (p *Params) KeyValuePairs() params.KeyValuePairs

Implements params.ParamSet

func (*Params) UpdateCheck

func (p *Params) UpdateCheck() error

type Pool

type Pool struct {
	LooseTokens  sdk.Dec `json:"loose_tokens"`  // tokens which are not bonded in a validator
	BondedTokens sdk.Dec `json:"bonded_tokens"` // reserve of bonded tokens
}

Pool - dynamic parameters of the current state

func InitialPool

func InitialPool() Pool

initial pool for testing

func MustUnmarshalPool

func MustUnmarshalPool(cdc *codec.Codec, value []byte) Pool

unmarshal the current pool value from store key or panics

func UnmarshalPool

func UnmarshalPool(cdc *codec.Codec, value []byte) (pool Pool, err error)

unmarshal the current pool value from store key

func (Pool) BondedRatio

func (p Pool) BondedRatio() sdk.Dec

get the bond ratio of the global state

func (Pool) Equal

func (p Pool) Equal(p2 Pool) bool

nolint

func (Pool) HumanReadableString

func (p Pool) HumanReadableString() string

HumanReadableString returns a human readable string representation of a pool.

func (Pool) TokenSupply

func (p Pool) TokenSupply() sdk.Dec

Sum total of all staking tokens in the pool

type PreReward

type PreReward struct {
	AccAddr sdk.AccAddress
	Shares  sdk.Dec
	Amount  int64
}

reward model before BEP128 upgrade

type REDUpdateEvent

type REDUpdateEvent struct {
	StakeEvent
	RED     Redelegation
	ChainId string
}

RED update

type RedelegateEvent

type RedelegateEvent struct {
	StakeEvent
	Delegator    sdk.AccAddress
	SrcValidator sdk.ValAddress
	DstValidator sdk.ValAddress
	Amount       int64
	Denom        string
	TxHash       string
}

redelegate

type Redelegation

type Redelegation struct {
	DelegatorAddr    sdk.AccAddress `json:"delegator_addr"`     // delegator
	ValidatorSrcAddr sdk.ValAddress `json:"validator_src_addr"` // validator redelegation source operator addr
	ValidatorDstAddr sdk.ValAddress `json:"validator_dst_addr"` // validator redelegation destination operator addr
	CreationHeight   int64          `json:"creation_height"`    // height which the redelegation took place
	MinTime          time.Time      `json:"min_time"`           // unix time for redelegation completion
	InitialBalance   sdk.Coin       `json:"initial_balance"`    // initial balance when redelegation started
	Balance          sdk.Coin       `json:"balance"`            // current balance
	SharesSrc        sdk.Dec        `json:"shares_src"`         // amount of source shares redelegating
	SharesDst        sdk.Dec        `json:"shares_dst"`         // amount of destination shares redelegating
}

Redelegation reflects a delegation's passive re-delegation queue.

func MustUnmarshalRED

func MustUnmarshalRED(cdc *codec.Codec, key, value []byte) Redelegation

unmarshal a redelegation from a store key and value

func UnmarshalRED

func UnmarshalRED(cdc *codec.Codec, key, value []byte) (red Redelegation, err error)

unmarshal a redelegation from a store key and value

func (Redelegation) Equal

func (d Redelegation) Equal(d2 Redelegation) bool

nolint

func (Redelegation) HumanReadableString

func (d Redelegation) HumanReadableString() (string, error)

HumanReadableString returns a human readable string representation of a Redelegation. An error is returned if the UnbondingDelegation's delegator or validator addresses cannot be Bech32 encoded.

type RefundError

type RefundError uint32
const (
	DecodeFailed      RefundError = 100
	WithdrawAXCFailed RefundError = 101
)

type Reward

type Reward struct {
	ValAddr    sdk.ValAddress // Validator will be published for downstream usage
	AccAddr    sdk.AccAddress
	Tokens     sdk.Dec // delegator Tokens will be published for downstream usage
	Amount     int64
	CrossStake bool
}

reward model after BEP128 upgrade

func MustUnmarshalRewards

func MustUnmarshalRewards(cdc *codec.Codec, value []byte) (rewards []Reward)

type Sharer

type Sharer struct {
	AccAddr sdk.AccAddress
	Shares  sdk.Dec
}

type SideChainIder

type SideChainIder interface {
	GetSideChainId() string
}

type SimplifiedDelegation

type SimplifiedDelegation struct {
	DelegatorAddr sdk.AccAddress `json:"delegator_addr"`
	Shares        sdk.Dec        `json:"shares"`
	CrossStake    bool           `json:"cross_stake"`
}

func MustUnmarshalSimplifiedDelegations

func MustUnmarshalSimplifiedDelegations(cdc *codec.Codec, value []byte) (simDels []SimplifiedDelegation)

type StakeEvent

type StakeEvent struct {
	IsFromTx bool
}

func (StakeEvent) FromTx

func (event StakeEvent) FromTx() bool

func (StakeEvent) GetTopic

func (event StakeEvent) GetTopic() pubsub.Topic

type StoredValDistAddr

type StoredValDistAddr struct {
	Validator      sdk.ValAddress
	DistributeAddr sdk.AccAddress
}

func MustUnmarshalValDistAddrs

func MustUnmarshalValDistAddrs(cdc *codec.Codec, value []byte) (valDistAddrs []StoredValDistAddr)

type UBDUpdateEvent

type UBDUpdateEvent struct {
	StakeEvent
	UBD     UnbondingDelegation
	ChainId string
}

UBDs update

type UnbondingDelegation

type UnbondingDelegation struct {
	DelegatorAddr  sdk.AccAddress `json:"delegator_addr"`  // delegator
	ValidatorAddr  sdk.ValAddress `json:"validator_addr"`  // validator unbonding from operator addr
	CreationHeight int64          `json:"creation_height"` // height which the unbonding took place
	MinTime        time.Time      `json:"min_time"`        // unix time for unbonding completion
	InitialBalance sdk.Coin       `json:"initial_balance"` // atoms initially scheduled to receive at completion
	Balance        sdk.Coin       `json:"balance"`         // atoms to receive at completion
	CrossStake     bool           `json:"cross_stake"`     // native staking or cross-chain staking
}

UnbondingDelegation reflects a delegation's passive unbonding queue.

func MustUnmarshalUBD

func MustUnmarshalUBD(cdc *codec.Codec, key, value []byte) UnbondingDelegation

unmarshal a unbonding delegation from a store key and value

func UnmarshalUBD

func UnmarshalUBD(cdc *codec.Codec, key, value []byte) (ubd UnbondingDelegation, err error)

unmarshal a unbonding delegation from a store key and value

func (UnbondingDelegation) Equal

nolint

func (UnbondingDelegation) HumanReadableString

func (d UnbondingDelegation) HumanReadableString() (string, error)

HumanReadableString returns a human readable string representation of an UnbondingDelegation. An error is returned if the UnbondingDelegation's delegator or validator addresses cannot be Bech32 encoded.

type UndelegateEvent

type UndelegateEvent struct {
	StakeEvent
	Delegator sdk.AccAddress
	Validator sdk.ValAddress
	Amount    int64
	Denom     string
	TxHash    string
}

undelegate

type Validator

type Validator struct {
	FeeAddr      sdk.AccAddress `json:"fee_addr"`                   // address for fee collection
	OperatorAddr sdk.ValAddress `json:"operator_address"`           // address of the validator's operator; bech encoded in JSON
	ConsPubKey   crypto.PubKey  `json:"consensus_pubkey,omitempty"` // the consensus public key of the validator; bech encoded in JSON
	Jailed       bool           `json:"jailed"`                     // has the validator been jailed from bonded status?

	Status          sdk.BondStatus `json:"status"`           // validator status (bonded/unbonding/unbonded)
	Tokens          sdk.Dec        `json:"tokens"`           // delegated tokens (incl. self-delegation)
	DelegatorShares sdk.Dec        `json:"delegator_shares"` // total shares issued to a validator's delegators

	Description        Description `json:"description"`           // description terms for the validator
	BondHeight         int64       `json:"bond_height"`           // earliest height as a bonded validator
	BondIntraTxCounter int16       `json:"bond_intra_tx_counter"` // block-local tx index of validator change

	UnbondingHeight  int64     `json:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding
	UnbondingMinTime time.Time `json:"unbonding_time"`   // if unbonding, min time for the validator to complete unbonding

	Commission Commission `json:"commission"` // commission parameters

	DistributionAddr sdk.AccAddress `json:"distribution_addr,omitempty"` // the address receives rewards from the side address, and distribute rewards to delegators. It's auto generated
	SideChainId      string         `json:"side_chain_id,omitempty"`     // side chain id to distinguish different side chains
	SideConsAddr     []byte         `json:"side_cons_addr,omitempty"`    // consensus address of the side chain validator, this replaces the `ConsPubKey`
	SideFeeAddr      []byte         `json:"side_fee_addr,omitempty"`     // fee address on the side chain

	StakeSnapshots   []sdk.Dec `json:"stake_snapshots,omitempty"`   // staked tokens snapshot over a period of time, e.g. 30 days
	AccumulatedStake sdk.Dec   `json:"accumulated_stake,omitempty"` // accumulated stake, sum of StakeSnapshots
}

Validator defines the total amount of bond shares and their exchange rate to coins. Accumulation of interest is modelled as an in increase in the exchange rate, and slashing as a decrease. When coins are delegated to this validator, the validator is credited with a Delegation whose number of bond shares is based on the amount of coins delegated divided by the current exchange rate. Voting power can be calculated as total bonds multiplied by exchange rate.

func MustUnmarshalValidator

func MustUnmarshalValidator(cdc *codec.Codec, value []byte) Validator

unmarshal a redelegation from a store key and value

func MustUnmarshalValidators

func MustUnmarshalValidators(cdc *codec.Codec, value []byte) []Validator

func NewSideChainValidator

func NewSideChainValidator(feeAddr sdk.AccAddress, operator sdk.ValAddress, description Description, sideChainId string, sideConsAddr, sideFeeAddr []byte) Validator

func NewValidator

func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description) Validator

NewValidator - initialize a new validator

func NewValidatorWithFeeAddr

func NewValidatorWithFeeAddr(feeAddr sdk.AccAddress, operator sdk.ValAddress, pubKey crypto.PubKey, description Description) Validator

Note a few fields are initialized with default value. They will be updated later

func UnmarshalValidator

func UnmarshalValidator(cdc *codec.Codec, value []byte) (validator Validator, err error)

func UnmarshalValidators

func UnmarshalValidators(cdc *codec.Codec, value []byte) (validators []Validator, err error)

func (Validator) ABCIValidatorUpdate

func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate

ABCIValidatorUpdate returns an abci.ValidatorUpdate from a staked validator type with the full validator power

func (Validator) ABCIValidatorUpdateZero

func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate

ABCIValidatorUpdateZero returns an abci.ValidatorUpdate from a staked validator type with zero power used for validator updates.

func (Validator) AddTokensFromDel

func (v Validator) AddTokensFromDel(pool Pool, amount int64) (Validator, Pool, sdk.Dec)

AddTokensFromDel adds tokens to a validator

func (Validator) BondedTokens

func (v Validator) BondedTokens() sdk.Dec

Get the bonded tokens which the validator holds

func (Validator) ConsAddress

func (v Validator) ConsAddress() sdk.ConsAddress

return the TM validator address

func (Validator) DelegatorShareExRate

func (v Validator) DelegatorShareExRate() sdk.Dec

DelegatorShareExRate gets the exchange rate of tokens over delegator shares. UNITS: tokens/delegator-shares

func (Validator) Equal

func (v Validator) Equal(v2 Validator) bool

only the vitals - does not check bond height of IntraTxCounter

func (Validator) GetBondHeight

func (v Validator) GetBondHeight() int64

func (Validator) GetCommission

func (v Validator) GetCommission() sdk.Dec

func (Validator) GetConsAddr

func (v Validator) GetConsAddr() sdk.ConsAddress

func (Validator) GetConsPubKey

func (v Validator) GetConsPubKey() crypto.PubKey

func (Validator) GetDelegatorShares

func (v Validator) GetDelegatorShares() sdk.Dec

func (Validator) GetFeeAddr

func (v Validator) GetFeeAddr() sdk.AccAddress

func (Validator) GetJailed

func (v Validator) GetJailed() bool

nolint - for sdk.Validator

func (Validator) GetMoniker

func (v Validator) GetMoniker() string

func (Validator) GetOperator

func (v Validator) GetOperator() sdk.ValAddress

func (Validator) GetPower

func (v Validator) GetPower() sdk.Dec

func (Validator) GetSideChainConsAddr

func (v Validator) GetSideChainConsAddr() []byte

func (Validator) GetStatus

func (v Validator) GetStatus() sdk.BondStatus

func (Validator) GetTokens

func (v Validator) GetTokens() sdk.Dec

func (Validator) HumanReadableString

func (v Validator) HumanReadableString() (string, error)

HumanReadableString returns a human readable string representation of a validator. An error is returned if the operator or the operator's public key cannot be converted to Bech32 format.

func (Validator) IsBonded

func (v Validator) IsBonded() bool

IsBonded checks if the validator status equals Bonded

func (Validator) IsSelfDelegator

func (v Validator) IsSelfDelegator(address sdk.AccAddress) bool

func (Validator) IsSideChainValidator

func (v Validator) IsSideChainValidator() bool

func (Validator) IsUnbonded

func (v Validator) IsUnbonded() bool

IsUnbonded checks if the validator status equals Unbonded

func (Validator) IsUnbonding

func (v Validator) IsUnbonding() bool

IsUnbonding checks if the validator status equals Unbonding

func (Validator) MarshalJSON

func (v Validator) MarshalJSON() ([]byte, error)

MarshalJSON marshals the validator to JSON using Bech32

func (Validator) RemoveDelShares

func (v Validator) RemoveDelShares(pool Pool, delShares sdk.Dec) (Validator, Pool, sdk.Dec)

RemoveDelShares removes delegator shares from a validator.

func (Validator) RemoveTokens

func (v Validator) RemoveTokens(pool Pool, tokens sdk.Dec) (Validator, Pool)

removes tokens from a validator

func (Validator) SetInitialCommission

func (v Validator) SetInitialCommission(commission Commission) (Validator, sdk.Error)

SetInitialCommission attempts to set a validator's initial commission. An error is returned if the commission is invalid.

func (Validator) SharesFromTokens

func (v Validator) SharesFromTokens(amt sdk.Dec) sdk.Dec

SharesFromTokens returns the shares of a delegation given a bond amount. It returns an error if the validator has no tokens.

func (Validator) TokensFromShares

func (v Validator) TokensFromShares(shares sdk.Dec) sdk.Dec

calculate the token worth of provided shares

func (*Validator) UnmarshalJSON

func (v *Validator) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the validator from JSON using Bech32

func (Validator) UpdateStatus

func (v Validator) UpdateStatus(pool Pool, NewStatus sdk.BondStatus) (Validator, Pool)

UpdateStatus updates the location of the shares within a validator to reflect the new status

type ValidatorRemovedEvent

type ValidatorRemovedEvent struct {
	StakeEvent
	Operator sdk.ValAddress
	ChainId  string
}

validator removed event

type ValidatorUpdateEvent

type ValidatorUpdateEvent struct {
	StakeEvent
	Validator Validator
}

validator update event

Jump to

Keyboard shortcuts

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