common

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidMsg = "address length = 40, expecting 41: invalid address"
)

Variables

View Source
var (
	ErrInvalidCallData  = errors.New("invalid call binary data")
	ErrInvalidCallSig   = errors.New("invalid call sig")
	ErrConvertBigNumber = errors.New("convert big number error")
	ErrDecodeFailure    = errors.New("decode data error")
)

Functions

func EncodeBucketTypeListToEth

func EncodeBucketTypeListToEth(outputs abi.Arguments, bucketTypes *iotextypes.ContractStakingBucketTypeList) (string, error)

func EncodeVoteBucketListToEth

func EncodeVoteBucketListToEth(outputs abi.Arguments, buckets *iotextypes.VoteBucketList) (string, error)

Types

type BucketEth

type BucketEth struct {
	Index                        uint64
	CandidateAddress             common.Address
	StakedAmount                 *big.Int
	StakedDuration               uint32
	CreateTime                   int64
	StakeStartTime               int64
	UnstakeStartTime             int64
	AutoStake                    bool
	Owner                        common.Address
	ContractAddress              common.Address
	StakedDurationBlockNumber    uint64
	CreateBlockHeight            uint64
	StakeStartBlockHeight        uint64
	UnstakeStartBlockHeight      uint64
	EndorsementExpireBlockHeight uint64
}

BucketEth struct for eth

type BucketTypeEth

type BucketTypeEth struct {
	StakedAmount   *big.Int
	StakedDuration uint32
}

BucketTypeEth struct for eth

type BucketsByCandidateStateContext

type BucketsByCandidateStateContext struct {
	*protocol.BaseStateContext
}

BucketsByCandidateStateContext context for BucketsByCandidate

func NewBucketsByCandidateStateContext

func NewBucketsByCandidateStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name) (*BucketsByCandidateStateContext, error)

func (*BucketsByCandidateStateContext) EncodeToEth

EncodeToEth encode proto to eth

type BucketsByIndexesStateContext

type BucketsByIndexesStateContext struct {
	*protocol.BaseStateContext
}

BucketsByIndexesStateContext context for BucketsByIndexes

func NewBucketsByIndexesStateContext

func NewBucketsByIndexesStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name) (*BucketsByIndexesStateContext, error)

func (*BucketsByIndexesStateContext) EncodeToEth

EncodeToEth encode proto to eth

type BucketsByVoterStateContext

type BucketsByVoterStateContext struct {
	*protocol.BaseStateContext
}

BucketsByVoterStateContext context for BucketsByVoter

func NewBucketsByVoterStateContext

func NewBucketsByVoterStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name) (*BucketsByVoterStateContext, error)

func (*BucketsByVoterStateContext) EncodeToEth

EncodeToEth encode proto to eth

type BucketsCountStateContext

type BucketsCountStateContext struct {
	*protocol.BaseStateContext
}

BucketsCountStateContext context for BucketsCount

func NewBucketsCountStateContext

func NewBucketsCountStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name) (*BucketsCountStateContext, error)

func (*BucketsCountStateContext) EncodeToEth

EncodeToEth encode proto to eth

type BucketsStateContext

type BucketsStateContext struct {
	*protocol.BaseStateContext
}

BucketsStateContext context for Buckets

func NewBucketsStateContext

func NewBucketsStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name) (*BucketsStateContext, error)

func (*BucketsStateContext) EncodeToEth

func (r *BucketsStateContext) EncodeToEth(resp *iotexapi.ReadStateResponse) (string, error)

EncodeToEth encode proto to eth

type CandidateByAddressStateContext

type CandidateByAddressStateContext struct {
	*protocol.BaseStateContext
	// contains filtered or unexported fields
}

CandidateByAddressStateContext context for candidateByAddress

func NewCandidateByAddressStateContext

func NewCandidateByAddressStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name, opts ...OptionCandidate) (*CandidateByAddressStateContext, error)

func (*CandidateByAddressStateContext) EncodeToEth

EncodeToEth encode proto to eth

type CandidateByNameStateContext

type CandidateByNameStateContext struct {
	*protocol.BaseStateContext
	// contains filtered or unexported fields
}

CandidateByNameStateContext context for CandidateByName

func NewCandidateByNameStateContext

func NewCandidateByNameStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name, opts ...OptionCandidate) (*CandidateByNameStateContext, error)

func (*CandidateByNameStateContext) EncodeToEth

EncodeToEth encode proto to eth

type CandidateEth

type CandidateEth struct {
	Id                 common.Address
	OwnerAddress       common.Address
	OperatorAddress    common.Address
	RewardAddress      common.Address
	Name               string
	TotalWeightedVotes *big.Int
	SelfStakeBucketIdx uint64
	SelfStakingTokens  *big.Int
}

CandidateEth struct for eth

func EncodeCandidateToEth

func EncodeCandidateToEth(candidate *iotextypes.CandidateV2) (*CandidateEth, error)

type CandidatesStateContext

type CandidatesStateContext struct {
	*protocol.BaseStateContext
	// contains filtered or unexported fields
}

CandidatesStateContext context for Candidates

func NewCandidatesStateContext

func NewCandidatesStateContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name, opts ...OptionCandidate) (*CandidatesStateContext, error)

func (*CandidatesStateContext) EncodeToEth

EncodeToEth encode proto to eth

type OptionCandidate

type OptionCandidate func(*candidateConfig)

OptionCandidate option for candidate

func WithNoSelfStakeBucketIndexAsMaxUint32

func WithNoSelfStakeBucketIndexAsMaxUint32() OptionCandidate

WithNoSelfStakeBucketIndexAsMaxUint32 set noSelfStakeBucketIndex as MaxUint32

type TotalStakingAmountStateContext

type TotalStakingAmountStateContext struct {
	*protocol.BaseStateContext
}

TotalStakingAmountStateContext context for TotalStakingAmount

func NewTotalStakingAmountContext

func NewTotalStakingAmountContext(data []byte, methodABI *abi.Method, apiMethod iotexapi.ReadStakingDataMethod_Name) (*TotalStakingAmountStateContext, error)

func (*TotalStakingAmountStateContext) EncodeToEth

EncodeToEth encode proto to eth

Jump to

Keyboard shortcuts

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