restricting

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RestrictTxPlanSize = 36
)

Variables

View Source
var (
	RestrictingKeyPrefix         = []byte("RestrictInfo")
	RestrictRecordKeyPrefix      = []byte("RestrictRecord")
	InitialFoundationRestricting = []byte("InitialFoundationRestricting")
)
View Source
var (
	ErrParamEpochInvalid                    = common.NewBizError(304001, "The initial epoch for staking cannot be zero")
	ErrCountRestrictPlansInvalid            = common.NewBizError(304002, fmt.Sprintf("The number of the restricting plan cannot be (0, %d]", RestrictTxPlanSize))
	ErrLockedAmountTooLess                  = common.NewBizError(304003, "Total staking amount shall be more than 1 PHC")
	ErrBalanceNotEnough                     = common.NewBizError(304004, "Create plan,the sender balance is not enough in restrict")
	ErrAccountNotFound                      = common.NewBizError(304005, "Account is not found on restricting contract")
	ErrSlashingTooMuch                      = common.NewBizError(304006, "Slashing amount is larger than staking amount")
	ErrStakingAmountEmpty                   = common.NewBizError(304007, "Staking amount cannot be 0")
	ErrAdvanceLockedFundsAmountLessThanZero = common.NewBizError(304008, "Staking lock funds amount cannot be less than or equal to 0")
	ErrReturnLockFundsAmountLessThanZero    = common.NewBizError(304009, "Return lock funds amount cannot be less than or equal to 0")
	ErrSlashingAmountLessThanZero           = common.NewBizError(304010, "Slashing amount cannot be less than 0")
	ErrCreatePlanAmountLessThanZero         = common.NewBizError(304011, "Create plan each amount cannot be less than or equal to 0")
	ErrStakingAmountInvalid                 = common.NewBizError(304012, "The staking amount is less than the return amount")
	ErrRestrictBalanceNotEnough             = common.NewBizError(304013, "The user restricting balance is not enough for staking lock funds")
	ErrCreatePlanAmountLessThanMiniAmount   = common.NewBizError(304014, "Create plan each amount should greater than mini amount")
	ErrRestrictBalanceAndFreeNotEnough      = common.NewBizError(304015, "The user restricting  and free balance is not enough for staking lock funds")
)

Functions

func GetReleaseAccountKey

func GetReleaseAccountKey(epoch uint64, index uint32) []byte

ReleaseAccountKey used for search the index of the restricting account in the released account list at target epoch. key: prefix + epoch + index

func GetReleaseAmountKey

func GetReleaseAmountKey(epoch uint64, account common.Address) []byte

RestrictingKey used for search restricting entry info. key: prefix + epoch + account

func GetReleaseEpochKey

func GetReleaseEpochKey(epoch uint64) []byte

ReleaseNumberKey used for search records at target epoch. key: prefix + epoch

func GetRestrictingKey

func GetRestrictingKey(account common.Address) []byte

RestrictingKey used for search restricting info. key: prefix + account

Types

type ReleaseAmountInfo

type ReleaseAmountInfo struct {
	Height uint64       `json:"blockNumber"` // blockNumber representation of the block number at the released epoch
	Amount *hexutil.Big `json:"amount"`      // amount representation of the released amount
}

for plugin test

type RestrictingInfo

type RestrictingInfo struct {
	NeedRelease     *big.Int
	AdvanceAmount   *big.Int
	CachePlanAmount *big.Int
	ReleaseList     []uint64 // ReleaseList representation which epoch will release restricting
}

for genesis and plugin test

func (*RestrictingInfo) RemoveEpoch

func (r *RestrictingInfo) RemoveEpoch(epoch uint64)

type RestrictingPlan

type RestrictingPlan struct {
	Epoch  uint64   `json:"epoch"`  // epoch representation of the released epoch at the target blockNumber
	Amount *big.Int `json:"amount"` // amount representation of the released amount
}

for contract, plugin test, byte util

type Result

type Result struct {
	Balance *hexutil.Big        `json:"balance"`
	Debt    *hexutil.Big        `json:"debt"`
	Entry   []ReleaseAmountInfo `json:"plans"`
	Pledge  *hexutil.Big        `json:"Pledge"`
}

for plugin test

Jump to

Keyboard shortcuts

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