Documentation ¶
Index ¶
- Constants
- Variables
- func BalanceKey(account string) string
- func BlockHeightProposerKey(epochId uint64) string
- func CheckSimContextKeyExist(key string) error
- func CheckSum(beforeSum, part1, part2 *utils.BigInteger) error
- func GasToERC20Balance(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func GetSimContextData(txSimContext protocol.TxSimContext, contractName, key string) ([]byte, error)
- func GetSlashingAddressBalance(context protocol.TxSimContext) (*utils.BigInteger, error)
- func PutSimContextData(txSimContext protocol.TxSimContext, contractName, key string, value []byte) error
- func ReadLatestEpoch(context protocol.TxSimContext) (*syscontract.Epoch, error)
- func SlashingContractAddr() string
- func StakeContractAddr() string
- func ToDelegationKey(delegatorAddress, validatorAddress string) []byte
- func ToDelegationPrefix(delegatorAddress string) []byte
- func ToDelegationSetKey(delegatorAddress, validatorAddress string) []byte
- func ToDelegationSetPrefix(validatorAddress string) []byte
- func ToEpochKey(epochID string) []byte
- func ToNodeIDKey(addr string) []byte
- func ToReverseNodeIDKey(nodeID string) []byte
- func ToUnbondingDelegationKey(epochID uint64, delegatorAddress, validatorAddress string) []byte
- func ToUnbondingDelegationPrefix(epochID uint64) []byte
- func ToValidatorKey(validatorAddress string) []byte
- func ToValidatorPrefix() []byte
- func ValidatorsElection(infos []*dpospb.CandidateInfo, n int, seed []byte, outSort bool) ([]*dpospb.CandidateInfo, error)
- type AmountByRate
- type BlockProposerMap
- type CandidateInfos
- type Collections
- type DPoSDistributionContract
- type DPoSDistributionRuntime
- func (d *DPoSDistributionRuntime) GetDistributionDetail(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) GetDistributionFromSlashing(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) GetDistributionPerBlock(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) GetGasExchangeRate(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) Reward(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) RewordFromSlashing(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) SetDistributionFromSlashing(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) SetDistributionPerBlock(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSDistributionRuntime) SetGasExchangeRate(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- type DPoSERC20Contract
- type DPoSRuntime
- func (r *DPoSRuntime) Allowance(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (r *DPoSRuntime) Approve(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
- func (r *DPoSRuntime) BalanceOf(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (r *DPoSRuntime) Burn(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
- func (r *DPoSRuntime) Decimals(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (r *DPoSRuntime) Mint(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
- func (r *DPoSRuntime) Owner(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
- func (r *DPoSRuntime) Total(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
- func (r *DPoSRuntime) Transfer(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (r *DPoSRuntime) TransferFrom(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (r *DPoSRuntime) TransferOwnership(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- type DPoSSlashingContract
- type DPoSSlashingRuntime
- func (s *DPoSSlashingRuntime) GetSlashingAddress(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSSlashingRuntime) GetSlashingAddressBalance(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSSlashingRuntime) GetSlashingDetail(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSSlashingRuntime) GetSlashingPerBlock(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSSlashingRuntime) Punish(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (d *DPoSSlashingRuntime) SetSlashingPerBlock(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- type DPoSStakeContract
- type DPoSStakeRuntime
- func (s *DPoSStakeRuntime) Delegate(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) GetAllCandidates(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) GetDelegationsByAddress(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) GetDelegationsByValidatorAddress(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) GetNodeID(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) GetUserDelegationByValidator(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) GetValidatorByAddress(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) ReadCompleteUnBoundingEpochNumber(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) ReadEpochBlockNumber(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) ReadEpochByID(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) ReadEpochValidatorNumber(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) ReadLatestEpoch(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) ReadMinSelfDelegation(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) ReadSystemContractAddr(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) SetNodeID(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) UnBounding(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) UnDelegate(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) UpdateEpochBlockNumber(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) UpdateEpochValidatorNumAndBlockNum(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) UpdateEpochValidatorNumber(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- func (s *DPoSStakeRuntime) UpdateMinSelfDelegation(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
- type DelegatorRate
- type EpochAmountDetail
- type KeyConfigCacheMap
- type SlashingDetail
- type SlashingDetailPerValidator
Constants ¶
const ( // KeyDistributionPerBlock for simContext key KeyDistributionPerBlock = "DPB" // KeyDistributionFromSlashing for simContext key KeyDistributionFromSlashing = "DFS" // KeyGasExchangeRate for simContext key KeyGasExchangeRate = "GER" // KeyEpochDistributionDetail for simContext key KeyEpochDistributionDetail = "EDD/%s" // KeyBlockDistributionDetail for simContext key KeyBlockDistributionDetail = "BDD/%s" // DistributionFromSlashing for simContext key DistributionFromSlashing = "true" // DistributionNotFromSlashing for simContext key DistributionNotFromSlashing = "false" // KeyBlockHeight for simContext key KeyBlockHeight = "BH" // KeyConfigCache 修改配置项缓存处,用于下一个世代开始时,读取生效 KeyConfigCache = "DCC" )
const ( // KeyBalanceFormat Balance:map[Account]Value KeyBalanceFormat = "B/%s" // KeyApproveFormat map[sender][to]Value KeyApproveFormat = "A/%s/%s" // KeyTotalSupply The Key of total Supply KeyTotalSupply = "TS" // KeyDecimals The Key of Decimals,value:uint32 KeyDecimals = "DEC" // KeyOwner The Key of owner for contract,value:string KeyOwner = "OWN" )
const ( // KeySlashingPerBlock for simContext KeySlashingPerBlock = "SPB" // KeyEpochSlashingDetail slashing detail KeyEpochSlashingDetail = "KSD/%s" )
const ( // KeyNodeIDFormat comment at next version KeyNodeIDFormat = "N/%s" // KeyRevNodeFormat comment at next version KeyRevNodeFormat = "NR/%s" // KeyValidatorFormat comment at next version KeyValidatorFormat = "V/%s" // KeyDelegationFormat comment at next version KeyDelegationFormat = "D/%s/%s" // KeyDelegationSetFormat comment at next version KeyDelegationSetFormat = "DS/%s/%s" // KeyEpochFormat comment at next version KeyEpochFormat = "E/%s" // KeyUnbondingDelegationFormat comment at next version KeyUnbondingDelegationFormat = "U/%s/%s/%s" // KeyCurrentEpoch comment at next version KeyCurrentEpoch = "CE" // KeyMinSelfDelegation comment at next version KeyMinSelfDelegation = "MSD" // KeyCompletionUnbondingEpochNumber 这个 number 不能改动,若改动,会遇到 unbonding entry 数组中 completionEpochID 不同的情况 KeyCompletionUnbondingEpochNumber = "UEN" // KeyEpochValidatorNumber comment at next version KeyEpochValidatorNumber = "EVN" // KeyEpochBlockNumber comment at next version KeyEpochBlockNumber = "EBN" // KeyEpochMaxValidatorNumber comment at next version KeyEpochMaxValidatorNumber = "EMVN" // KeyEpochMaxBlockNumber comment at next version KeyEpochMaxBlockNumber = "EMBN" // ErrorGetValueByKey comment at next version ErrorGetValueByKey = "get value error, key: %s has not been set or value not exists" )
Variables ¶
var (
// DefaultERC20Decimal for cal rate
DefaultERC20Decimal = "1000000000000000000"
)
Functions ¶
func BlockHeightProposerKey ¶
BlockHeightProposerKey get Block Height Proposer Key
func CheckSimContextKeyExist ¶
CheckSimContextKeyExist check key is exist
func CheckSum ¶
func CheckSum(beforeSum, part1, part2 *utils.BigInteger) error
CheckSum check par1 ana par2 sum equal than beforeSum
func GasToERC20Balance ¶
func GasToERC20Balance(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GasToERC20Balance 将Gas的数额按照汇率转化成ERC20的余额
func GetSimContextData ¶
func GetSimContextData(txSimContext protocol.TxSimContext, contractName, key string) ([]byte, error)
GetSimContextData get config data from simulated execution context return Bytes
func GetSlashingAddressBalance ¶
func GetSlashingAddressBalance(context protocol.TxSimContext) (*utils.BigInteger, error)
GetSlashingAddressBalance Get SlashingAddress balance from TxSimContext
func PutSimContextData ¶
func PutSimContextData(txSimContext protocol.TxSimContext, contractName, key string, value []byte) error
PutSimContextData Set config data to simulated execution context
func ReadLatestEpoch ¶
func ReadLatestEpoch(context protocol.TxSimContext) (*syscontract.Epoch, error)
ReadLatestEpoch 读取当前世代数据 return Epoch
func SlashingContractAddr ¶
func SlashingContractAddr() string
SlashingContractAddr - convert slashing contract name string to address: base58.Encode(sha256(slashing_contract_name))
func StakeContractAddr ¶
func StakeContractAddr() string
StakeContractAddr - convert stake contract name string to address: base58.Encode(sha256(stake_contract_name))
func ToDelegationKey ¶
ToDelegationKey - Key: D + "/" + DelegatorAddress + "/" + ValidatorAddress
func ToDelegationPrefix ¶
ToDelegationPrefix - Key: D + "/" + DelegatorAddress
func ToDelegationSetKey ¶
ToDelegationSetKey - Key: DS + "/" + ValidatorAddress + "/" + DelegatorAddress
func ToDelegationSetPrefix ¶
ToDelegationSetPrefix - Key: D + "/" + validatorAddress
func ToReverseNodeIDKey ¶
ToReverseNodeIDKey - Key:NR + "/" + NodeID
func ToUnbondingDelegationKey ¶
ToUnbondingDelegationKey - Key:U + "/" + BigEndian(EpochID) + "/" + DelegatorAddress + "/" + ValidatorAddress
func ToUnbondingDelegationPrefix ¶
ToUnbondingDelegationPrefix - Key:U + "/" + BigEndian(EpochID)
func ToValidatorKey ¶
ToValidatorKey - Key: V + "/" + ValidatorAddress
func ValidatorsElection ¶
func ValidatorsElection( infos []*dpospb.CandidateInfo, n int, seed []byte, outSort bool) ([]*dpospb.CandidateInfo, error)
ValidatorsElection select validators from Candidates
Types ¶
type BlockProposerMap ¶
BlockProposerMap 用于存储每个区块的提案者信息 map[height]proposerAddress
type DPoSDistributionContract ¶
type DPoSDistributionContract struct { common.BaseContract // contains filtered or unexported fields }
DPoSDistributionContract DPoS Distribution Contract
func NewDPoSDistributionContract ¶
func NewDPoSDistributionContract(log protocol.Logger) *DPoSDistributionContract
NewDPoSDistributionContract comment at next version
type DPoSDistributionRuntime ¶
type DPoSDistributionRuntime struct {
// contains filtered or unexported fields
}
DPoSDistributionRuntime struct
func NewDPoSDistributionRuntime ¶
func NewDPoSDistributionRuntime(log protocol.Logger) *DPoSDistributionRuntime
NewDPoSDistributionRuntime New Distribution Runtime
func (*DPoSDistributionRuntime) GetDistributionDetail ¶
func (d *DPoSDistributionRuntime) GetDistributionDetail(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetDistributionDetail 获取奖励分配明细
func (*DPoSDistributionRuntime) GetDistributionFromSlashing ¶
func (d *DPoSDistributionRuntime) GetDistributionFromSlashing(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetDistributionFromSlashing 获取激励来源,是否从Slashing地址扣除
func (*DPoSDistributionRuntime) GetDistributionPerBlock ¶
func (d *DPoSDistributionRuntime) GetDistributionPerBlock(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetDistributionPerBlock 获取每个块的激励额
func (*DPoSDistributionRuntime) GetGasExchangeRate ¶
func (d *DPoSDistributionRuntime) GetGasExchangeRate(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetGasExchangeRate 获取Gas兑换ERC20余额汇率
func (*DPoSDistributionRuntime) Reward ¶
func (d *DPoSDistributionRuntime) Reward(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
Reward for node Reward entrance,for CoinBase contract call to distribution
func (*DPoSDistributionRuntime) RewordFromSlashing ¶
func (d *DPoSDistributionRuntime) RewordFromSlashing(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
RewordFromSlashing Transfer Balance From Slashing Address For Rewarding Params need paramAmount and paramAddress Return []byte for transfer amount and error
func (*DPoSDistributionRuntime) SetDistributionFromSlashing ¶
func (d *DPoSDistributionRuntime) SetDistributionFromSlashing(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
SetDistributionFromSlashing 设置激励来源,是否从Slashing地址扣除
type DPoSERC20Contract ¶
type DPoSERC20Contract struct { common.BaseContract // contains filtered or unexported fields }
DPoSERC20Contract comment at next version
func NewDPoSERC20Contract ¶
func NewDPoSERC20Contract(log protocol.Logger) *DPoSERC20Contract
NewDPoSERC20Contract comment at next version @param log @return *DPoSERC20Contract
type DPoSRuntime ¶
type DPoSRuntime struct {
// contains filtered or unexported fields
}
DPoSRuntime comment at next version
func NewDPoSRuntime ¶
func NewDPoSRuntime(log protocol.Logger) *DPoSRuntime
NewDPoSRuntime comment at next version
func (*DPoSRuntime) Allowance ¶
func (r *DPoSRuntime) Allowance(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
Allowance params["from"]:${from} params["to"]:${to} return value of approve
func (*DPoSRuntime) Approve ¶
func (r *DPoSRuntime) Approve(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
Approve It is equal with approve(spender string, value uint64) error; for ETH params["to"]:${to} params["value"]:${value} return token value for ${sender} to ${to}
func (*DPoSRuntime) BalanceOf ¶
func (r *DPoSRuntime) BalanceOf(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
BalanceOf return balance(token) of owner params["owner"]:${owner} return balance of ${owner}
func (*DPoSRuntime) Burn ¶
func (r *DPoSRuntime) Burn(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
Burn 交易的发送者燃烧一定数量的代币,最多可燃烧殆尽 params["value"]:${value} return balance of sender after burn
func (*DPoSRuntime) Decimals ¶
func (r *DPoSRuntime) Decimals(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
Decimals return decimals of DPoS
func (*DPoSRuntime) Mint ¶
func (r *DPoSRuntime) Mint(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
Mint 增发 params["to"]:${to} params["value"]:${value} return newest token of ${to} after mint
func (*DPoSRuntime) Owner ¶
func (r *DPoSRuntime) Owner(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
Owner return owner of DPoS
func (*DPoSRuntime) Total ¶
func (r *DPoSRuntime) Total(txSimContext protocol.TxSimContext, params map[string][]byte) (result []byte, err error)
Total return total supply of tokens
func (*DPoSRuntime) Transfer ¶
func (r *DPoSRuntime) Transfer(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
Transfer It is equal with transfer(to string, value uint64) for ETH params["to"]:${to} params["value"]:${value} return token value of ${sender} after transfer
func (*DPoSRuntime) TransferFrom ¶
func (r *DPoSRuntime) TransferFrom(txSimContext protocol.TxSimContext, params map[string][]byte) ([]byte, error)
TransferFrom 交易的发送者,从from的账号中转移指定数目的token给to账户 该操作需要approve,即from已经提前允许当前用户允许转移操作 params["from"]:${from} params["to"]:${to} params["value"]:${value} return token value of ${from} after transfer
type DPoSSlashingContract ¶
type DPoSSlashingContract struct { common.BaseContract // contains filtered or unexported fields }
DPoSSlashingContract DPoS Slashing Contract
func NewDPoSSlashingContract ¶
func NewDPoSSlashingContract(log protocol.Logger) *DPoSSlashingContract
NewDPoSSlashingContract comment next version
type DPoSSlashingRuntime ¶
type DPoSSlashingRuntime struct {
// contains filtered or unexported fields
}
DPoSSlashingRuntime struct
func NewDPoSSlashingRuntime ¶
func NewDPoSSlashingRuntime(log protocol.Logger) *DPoSSlashingRuntime
NewDPoSSlashingRuntime New Slashing Runtime
func (*DPoSSlashingRuntime) GetSlashingAddress ¶
func (s *DPoSSlashingRuntime) GetSlashingAddress(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetSlashingAddress 获取惩罚账户地址
func (*DPoSSlashingRuntime) GetSlashingAddressBalance ¶
func (s *DPoSSlashingRuntime) GetSlashingAddressBalance(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetSlashingAddressBalance 获取惩罚账户地址余额
func (*DPoSSlashingRuntime) GetSlashingDetail ¶
func (s *DPoSSlashingRuntime) GetSlashingDetail(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetSlashingDetail 获取惩罚明细
func (*DPoSSlashingRuntime) GetSlashingPerBlock ¶
func (s *DPoSSlashingRuntime) GetSlashingPerBlock(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetSlashingPerBlock 获取每个块的惩罚额
type DPoSStakeContract ¶
type DPoSStakeContract struct { common.BaseContract // contains filtered or unexported fields }
DPoSStakeContract main implement here
func NewDPoSStakeContract ¶
func NewDPoSStakeContract(log protocol.Logger) *DPoSStakeContract
NewDPoSStakeContract comment at next version @param log @return *DPoSStakeContract
type DPoSStakeRuntime ¶
type DPoSStakeRuntime struct {
// contains filtered or unexported fields
}
DPoSStakeRuntime comment at next version
func NewDPoSStakeRuntime ¶
func NewDPoSStakeRuntime(log protocol.Logger) *DPoSStakeRuntime
NewDPoSStakeRuntime 新建 stake Runtime
func (*DPoSStakeRuntime) Delegate ¶
func (s *DPoSStakeRuntime) Delegate(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
Delegate 创建抵押,更新验证人,如果MsgSender是给自己,即给自己抵押,则创建验证人 @params["to"] 抵押的目标验证人 @params["amount"] 抵押数量,乘上erc20合约 decimal 的结果值,比如用户认知的1USD,系统内是 1 * 10 ^ 18 return Delegation
func (*DPoSStakeRuntime) GetAllCandidates ¶
func (s *DPoSStakeRuntime) GetAllCandidates(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetAllCandidates []CandidateAddress // 返回所有满足最低抵押条件验证人候选人 return CandidateVector
func (*DPoSStakeRuntime) GetDelegationsByAddress ¶
func (s *DPoSStakeRuntime) GetDelegationsByAddress( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetDelegationsByAddress 返回所有 Delegation @params["address"] return DelegationInfo
func (*DPoSStakeRuntime) GetDelegationsByValidatorAddress ¶
func (s *DPoSStakeRuntime) GetDelegationsByValidatorAddress( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetDelegationsByValidatorAddress 根据验证者地址,返回所有 Delegation @params["validator_address"] return DelegationInfo
func (*DPoSStakeRuntime) GetNodeID ¶
func (s *DPoSStakeRuntime) GetNodeID(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetNodeID - 系统节点自身身份查询
func (*DPoSStakeRuntime) GetUserDelegationByValidator ¶
func (s *DPoSStakeRuntime) GetUserDelegationByValidator( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetUserDelegationByValidator // 返回所有 Delegation @params["validator_address"] return Delegation
func (*DPoSStakeRuntime) GetValidatorByAddress ¶
func (s *DPoSStakeRuntime) GetValidatorByAddress( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
GetValidatorByAddress Validator // 通过Address获取验证人的信息 @params["address"] return Validator
func (*DPoSStakeRuntime) ReadCompleteUnBoundingEpochNumber ¶
func (s *DPoSStakeRuntime) ReadCompleteUnBoundingEpochNumber( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
ReadCompleteUnBoundingEpochNumber 读取世代的出块数量 return string
func (*DPoSStakeRuntime) ReadEpochBlockNumber ¶
func (s *DPoSStakeRuntime) ReadEpochBlockNumber( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
ReadEpochBlockNumber 读取世代的出块数量 return string
func (*DPoSStakeRuntime) ReadEpochByID ¶
func (s *DPoSStakeRuntime) ReadEpochByID(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
ReadEpochByID 读取指定ID的世代数据 @params["epoch_id"] 查询的世代ID return Epoch
func (*DPoSStakeRuntime) ReadEpochValidatorNumber ¶
func (s *DPoSStakeRuntime) ReadEpochValidatorNumber( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
ReadEpochValidatorNumber 读取每个世代验证人数量 return string
func (*DPoSStakeRuntime) ReadLatestEpoch ¶
func (s *DPoSStakeRuntime) ReadLatestEpoch(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
ReadLatestEpoch 读取当前世代数据 return Epoch
func (*DPoSStakeRuntime) ReadMinSelfDelegation ¶
func (s *DPoSStakeRuntime) ReadMinSelfDelegation( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
ReadMinSelfDelegation 读取验证人最少抵押token数量 return string
func (*DPoSStakeRuntime) ReadSystemContractAddr ¶
func (s *DPoSStakeRuntime) ReadSystemContractAddr( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
ReadSystemContractAddr 读取stake系统合约的地址 return string
func (*DPoSStakeRuntime) SetNodeID ¶
func (s *DPoSStakeRuntime) SetNodeID(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
SetNodeID - 系统加入节点绑定自身身份
func (*DPoSStakeRuntime) UnBounding ¶
func (s *DPoSStakeRuntime) UnBounding( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
UnBounding 世代结束,解除质押返回到余额
func (*DPoSStakeRuntime) UnDelegate ¶
func (s *DPoSStakeRuntime) UnDelegate(context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
UnDelegate 解除抵押,更新验证人 @params["from"] 解质押的验证人 @params["amount"] 解质押数量,1 * 10 ^ 18 return UnbondingDelegation
func (*DPoSStakeRuntime) UpdateEpochBlockNumber ¶
func (s *DPoSStakeRuntime) UpdateEpochBlockNumber( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
UpdateEpochBlockNumber 更新世代的出块数量 @params["epoch_block_number"] return nil
func (*DPoSStakeRuntime) UpdateEpochValidatorNumAndBlockNum ¶
func (s *DPoSStakeRuntime) UpdateEpochValidatorNumAndBlockNum( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
UpdateEpochValidatorNumAndBlockNum comment next
func (*DPoSStakeRuntime) UpdateEpochValidatorNumber ¶
func (s *DPoSStakeRuntime) UpdateEpochValidatorNumber( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
UpdateEpochValidatorNumber string 更新每个世代验证人数量 条件1: 不能大于当前所有验证人数量 条件2: 世代出快数必须是验证人数量整数倍 @params["epoch_validator_number"] return string
func (*DPoSStakeRuntime) UpdateMinSelfDelegation ¶
func (s *DPoSStakeRuntime) UpdateMinSelfDelegation( context protocol.TxSimContext, params map[string][]byte) ([]byte, error)
UpdateMinSelfDelegation 更新验证人最少抵押token数量,当提高最少抵押门槛时,原先的 validator 状态不会更新,validator 需要尽块增加抵押 @params["min_self_delegation"] return string
type EpochAmountDetail ¶
type EpochAmountDetail map[string]AmountByRate
EpochAmountDetail 一个世代中,每个节点出块奖励总和分配明细
type SlashingDetail ¶
type SlashingDetail struct { EpochId uint64 SlashingBalanceBefore *utils.BigInteger SlashingBalanceAfter *utils.BigInteger Validators []string Details []*SlashingDetailPerValidator }
SlashingDetail 每一个世代的惩罚明细
type SlashingDetailPerValidator ¶
type SlashingDetailPerValidator struct { ValidatorAddress string DelegationRate *DelegatorRate SlashingAmount *utils.BigInteger DelegationBefore []*syscontract.Delegation DelegationAfter []*syscontract.Delegation }
SlashingDetailPerValidator 每一个世代中的,每一个验证者惩罚明细