multistaking

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DelegationMethod defines the ABI method name for the staking Delegation
	// query.
	DelegationMethod = "delegation"
	// UnbondingDelegationMethod defines the ABI method name for the staking
	// UnbondingDelegationMethod query.
	UnbondingDelegationMethod = "unbondingDelegation"
	// ValidatorMethod defines the ABI method name for the staking
	// Validator query.
	ValidatorMethod = "validator"
)
View Source
const (
	MultistakingPrecompileAddress = "0x0000000000000000000000000000000000000900"
	// Transactions
	DelegateMethod                  = "delegate"
	UndelegateMethod                = "undelegate"
	RedelegateMethod                = "redelegate"
	CancelUnbondingDelegationMethod = "cancelUnbondingDelegation"
	CreateValidatorMethod           = "createValidator"
)

Variables

This section is empty.

Functions

func FormatConsensusPubkey

func FormatConsensusPubkey(consensusPubkey *codectypes.Any) string

FormatConsensusPubkey format ConsensusPubkey into a base64 string

func LoadABI

func LoadABI() (abi.ABI, error)

func NewDelegationRequest

func NewDelegationRequest(args []interface{}) (*multistakingtypes.QueryMultiStakingLockRequest, error)

func NewUnbondingDelegationRequest

func NewUnbondingDelegationRequest(args []interface{}) (*multistakingtypes.QueryMultiStakingUnlockRequest, error)

func NewValidatorRequest

func NewValidatorRequest(args []interface{}) (*multistakingtypes.QueryValidatorRequest, error)

Types

type DelegationOutput

type DelegationOutput struct {
	Balance cmn.Coin
}

DelegationOutput is a struct to represent the key information from a delegation response.

func (*DelegationOutput) FromResponse

FromResponse populates the DelegationOutput from a QueryDelegationResponse.

func (*DelegationOutput) Pack

func (do *DelegationOutput) Pack(args abi.Arguments) ([]byte, error)

Pack packs a given slice of abi arguments into a byte array.

type Description

type Description = struct {
	Moniker         string "json:\"moniker\""
	Identity        string "json:\"identity\""
	Website         string "json:\"website\""
	SecurityContact string "json:\"securityContact\""
	Details         string "json:\"details\""
}

Description use golang type alias defines a validator description.

type Precompile

type Precompile struct {
	cmn.Precompile
	abi.ABI
	codec.Codec
	// contains filtered or unexported fields
}

Precompile defines the multistaking precompile

func NewPrecompile

func NewPrecompile(
	cdc codec.Codec,
	stakingKeeper stakingkeeper.Keeper,
	multiStakingKeeper multistakingkeeper.Keeper,
	erc20Keeper erc20keeper.Keeper,
	addrCodec address.Codec,
	valAddrCodec address.Codec,
) (*Precompile, error)

NewPrecompile creates a new multistaking Precompile instance implementing the PrecompiledContract interface.

func (Precompile) BeginRedelegateEVM

func (p Precompile) BeginRedelegateEVM(
	ctx sdk.Context,
	origin common.Address,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

BeginRedelegateEVM handles the redelegation of tokens from one validator to another.

func (Precompile) CancelUnbondingEVMDelegation

func (p Precompile) CancelUnbondingEVMDelegation(
	ctx sdk.Context,
	origin common.Address,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

CancelUnbondingEVMDelegation handles the cancellation of an unbonding delegation using erc20 token.

func (Precompile) CreateEVMValidator

func (p Precompile) CreateEVMValidator(
	ctx sdk.Context,
	origin common.Address,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

CreateValidator creates a new erc20 validator using the multistaking module.

func (Precompile) DelegateEVM

func (p Precompile) DelegateEVM(
	ctx sdk.Context,
	sender common.Address,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

Delegate handles the delegation of ERC20 tokens to a validator. This method converts ERC20 tokens to SDK coins and delegates them.

func (Precompile) Delegation

func (p Precompile) Delegation(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

Delegation returns the delegation that a delegator has with a specific validator.

func (Precompile) Execute added in v1.5.0

func (p Precompile) Execute(ctx sdk.Context, contract *vm.Contract, readOnly bool) ([]byte, error)

Execute executes the precompiled contract bank query methods defined in the ABI.

func (Precompile) IsTransaction

func (Precompile) IsTransaction(method *abi.Method) bool

func (Precompile) RequiredGas

func (p Precompile) RequiredGas(input []byte) uint64

RequiredGas calculates the precompiled contract's base gas rate.

func (Precompile) Run

func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz []byte, err error)

Run executes the precompiled contract multistaking methods defined in the ABI.

func (Precompile) UnbondingDelegation

func (p Precompile) UnbondingDelegation(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

UnbondingDelegation returns the delegation currently being unbonded for a delegator from a specific validator.

func (Precompile) UndelegateEVM

func (p Precompile) UndelegateEVM(
	ctx sdk.Context,
	origin common.Address,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

Undelegate handles the undelegation of tokens from a validator. This method undelegates SDK coins and converts them back to ERC20 tokens.

func (Precompile) Validator

func (p Precompile) Validator(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

Validator returns the validator information for a given validator address.

type SelfDelegation

type SelfDelegation struct {
	Token  common.Address
	Amount *big.Int
}

Helper struct for self delegation

type UnbondingDelegationEntry

type UnbondingDelegationEntry struct {
	CreationHeight int64
	Balance        *big.Int
}

UnbondingDelegationEntry is a struct that contains the information about an unbonding delegation entry.

type UnbondingDelegationOutput

type UnbondingDelegationOutput struct {
	UnbondingDelegation UnbondingDelegationResponse
}

UnbondingDelegationOutput is the output response returned by the query method.

func (*UnbondingDelegationOutput) FromResponse

FromResponse populates the DelegationOutput from a QueryDelegationResponse.

type UnbondingDelegationResponse

type UnbondingDelegationResponse struct {
	DelegatorAddress string
	ValidatorAddress string
	Entries          []UnbondingDelegationEntry
}

UnbondingDelegationResponse is a struct that contains the information about an unbonding delegation.

type ValidatorInfo

type ValidatorInfo struct {
	OperatorAddress   string                   `abi:"operatorAddress"`
	ConsensusPubkey   string                   `abi:"consensusPubkey"`
	Jailed            bool                     `abi:"jailed"`
	Status            uint8                    `abi:"status"`
	Tokens            *big.Int                 `abi:"tokens"`
	DelegatorShares   *big.Int                 `abi:"delegatorShares"` // TODO: Decimal
	Description       stakingtypes.Description `abi:"description"`
	UnbondingHeight   int64                    `abi:"unbondingHeight"`
	UnbondingTime     int64                    `abi:"unbondingTime"`
	Commission        *big.Int                 `abi:"commission"`
	MinSelfDelegation *big.Int                 `abi:"minSelfDelegation"`
	BondDenom         string                   `abi:"bondDenom"`
}

ValidatorInfo is a struct to represent the key information from a validator response.

type ValidatorOutput

type ValidatorOutput struct {
	Validator ValidatorInfo
}

func DefaultValidatorOutput

func DefaultValidatorOutput() ValidatorOutput

DefaultValidatorOutput returns a ValidatorOutput with default values.

func (*ValidatorOutput) FromResponse

FromResponse populates the ValidatorOutput from a QueryValidatorResponse.

Jump to

Keyboard shortcuts

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