restricting

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 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")
	EpochPrefix                  = []byte("RestrictEpoch")
	InitialFoundationRestricting = []byte("InitialFoundationRestricting")
)
View Source
var (
	ErrParamEpochInvalid                 = common.NewBizError(304001, "param epoch can't be zero")
	ErrCountRestrictPlansInvalid         = common.NewBizError(304002, fmt.Sprintf("the number of the restricting plan can't be zero or more than %d", RestrictTxPlanSize))
	ErrLockedAmountTooLess               = common.NewBizError(304003, "total restricting amount need more than 1 LAT")
	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 is 0")
	ErrPledgeLockFundsAmountLessThanZero = common.NewBizError(304008, "pledge lock funds amount can't less than 0")
	ErrReturnLockFundsAmountLessThanZero = common.NewBizError(304009, "return lock funds amount can't less than 0")
	ErrSlashingAmountLessThanZero        = common.NewBizError(304010, "slashing amount can't less than 0")
	ErrCreatePlanAmountLessThanZero      = common.NewBizError(304011, "create plan each amount can't less than 0")
	ErrStakingAmountInvalid              = common.NewBizError(304012, "staking return amount is wrong")
	ErrRestrictBalanceNotEnough          = common.NewBizError(304013, "the user restricting balance is not enough for pledge lock funds")
)

Functions

func GetLatestEpochKey

func GetLatestEpochKey() []byte

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
	StakingAmount   *big.Int
	CachePlanAmount *big.Int

	//Balance     *big.Int // Balance representation all locked amount
	//Debt        *big.Int // Debt representation will released amount.
	//DebtSymbol  bool     // Debt is owed to release in the past while symbol is true, else Debt can be used instead of release
	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