Documentation ¶
Index ¶
- Constants
- Variables
- func AppendTokenID(oldIDList []byte, tokenID types.TokenTypeId) []byte
- func DeleteTokenID(oldIDList []byte, tokenID types.TokenTypeId) []byte
- func GetAllRegistrationList(db StorageDatabase, gid types.Gid) ([]*types.Registration, error)
- func GetCandidateList(db StorageDatabase, gid types.Gid) ([]*types.Registration, error)
- func GetConsensusGroup(db StorageDatabase, gid types.Gid) (*types.ConsensusGroupInfo, error)
- func GetConsensusGroupInfoKey(gid types.Gid) []byte
- func GetConsensusGroupList(db StorageDatabase) ([]*types.ConsensusGroupInfo, error)
- func GetHisNameKey(addr types.Address, gid types.Gid) []byte
- func GetIndexFromStakeInfoKey(key []byte) uint64
- func GetNextTokenIndexKey(tokenSymbol string) []byte
- func GetRegistration(db StorageDatabase, gid types.Gid, name string) (*types.Registration, error)
- func GetRegistrationInfoKey(name string, gid types.Gid) []byte
- func GetRegistrationList(db StorageDatabase, gid types.Gid, stakeAddr types.Address) ([]*types.Registration, error)
- func GetRegistrationListByRewardWithdrawAddr(db StorageDatabase, gid types.Gid, rewardWithdrawAddr types.Address) ([]*types.Registration, error)
- func GetStakeAddrFromStakeInfoKey(key []byte) types.Address
- func GetStakeBeneficialAmount(db StorageDatabase, beneficiary types.Address) (*big.Int, error)
- func GetStakeBeneficialKey(beneficial types.Address) []byte
- func GetStakeExpirationHeight(db StorageDatabase, list []*types.StakeInfo) ([]*types.StakeInfo, error)
- func GetStakeInfo(db StorageDatabase, stakeAddr, beneficiary, delegateAddr types.Address, ...) (*types.StakeInfo, error)
- func GetStakeInfoById(db StorageDatabase, id []byte) (*types.StakeInfo, error)
- func GetStakeInfoByKey(db StorageDatabase, stakeInfoKey []byte) (*types.StakeInfo, error)
- func GetStakeInfoKey(addr types.Address, index uint64) []byte
- func GetStakeInfoKeyPrefix(addr types.Address) []byte
- func GetStakeInfoList(db StorageDatabase, stakeAddr types.Address) ([]*types.StakeInfo, *big.Int, error)
- func GetStakeListByPage(db StorageDatabase, lastKey []byte, count uint64) ([]*types.StakeInfo, []byte, error)
- func GetTokenByID(db StorageDatabase, tokenID types.TokenTypeId) (*types.TokenInfo, error)
- func GetTokenIDListKey(owner types.Address) []byte
- func GetTokenIdFromTokenInfoKey(key []byte) types.TokenTypeId
- func GetTokenInfoKey(tokenID types.TokenTypeId) []byte
- func GetTokenMap(db StorageDatabase) (map[types.TokenTypeId]*types.TokenInfo, error)
- func GetTokenMapByOwner(db StorageDatabase, owner types.Address) (tokenInfoMap map[types.TokenTypeId]*types.TokenInfo, err error)
- func GetVote(db StorageDatabase, gid types.Gid, addr types.Address) (*types.VoteInfo, error)
- func GetVoteInfoKey(addr types.Address, gid types.Gid) []byte
- func GetVoteList(db StorageDatabase, gid types.Gid) ([]*types.VoteInfo, error)
- func IsActiveRegistration(db StorageDatabase, name string, gid types.Gid) (bool, error)
- func IsStakeInfoKey(key []byte) bool
- func UnpackRegistration(value []byte) (*types.Registration, error)
- func UnpackStakeInfo(value []byte) (*types.StakeInfo, error)
- type ParamCancelDelegateStake
- type ParamCancelRegister
- type ParamCancelStake
- type ParamDelegateStake
- type ParamGetTokenInfo
- type ParamIssue
- type ParamReIssue
- type ParamRegister
- type ParamReward
- type ParamStakeV3
- type ParamTransferOwnership
- type ParamVote
- type StorageDatabase
- type VariableRegisterStakeParam
- type VariableStakeBeneficial
Constants ¶
const ( MethodNameIssue = "Mint" MethodNameIssueV2 = "IssueToken" MethodNameReIssue = "Issue" MethodNameReIssueV2 = "ReIssue" MethodNameBurn = "Burn" MethodNameBurnV2 = "Burn2" MethodNameTransferOwnership = "TransferOwner" MethodNameTransferOwnershipV2 = "TransferOwnership" MethodNameDisableReIssue = "ChangeTokenType" MethodNameDisableReIssueV2 = "DisableReIssue" MethodNameGetTokenInfo = "GetTokenInfo" MethodNameGetTokenInfoV3 = "GetTokenInformation" VariableNameTokenInfo = "tokenInfo" VariableNameTokenIndex = "tokenIndex" )
const ( // deprecated version MethodNameDexFundUserDeposit = "DexFundUserDeposit" MethodNameDexFundUserWithdraw = "DexFundUserWithdraw" MethodNameDexFundNewMarket = "DexFundNewMarket" MethodNameDexFundNewOrder = "DexFundNewOrder" MethodNameDexFundSettleOrders = "DexFundSettleOrders" MethodNameDexFundPeriodJob = "DexFundPeriodJob" MethodNameDexFundPledgeForVx = "DexFundPledgeForVx" MethodNameDexFundPledgeForVip = "DexFundPledgeForVip" MethodNameDexFundPledgeCallback = "AgentPledgeCallback" MethodNameDexFundCancelPledgeCallback = "AgentCancelPledgeCallback" MethodNameDexFundOwnerConfig = "DexFundOwnerConfig" MethodNameDexFundOwnerConfigTrade = "DexFundOwnerConfigTrade" MethodNameDexFundMarketOwnerConfig = "DexFundMarketOwnerConfig" MethodNameDexFundTransferTokenOwner = "DexFundTransferTokenOwner" MethodNameDexFundNewInviter = "DexFundNewInviter" MethodNameDexFundBindInviteCode = "DexFundBindInviteCode" MethodNameDexFundEndorseVxMinePool = "DexFundEndorseVx" MethodNameDexFundSettleMakerMinedVx = "DexFundSettleMakerMinedVx" MethodNameDexFundStakeForSuperVip = "DexFundPledgeForSuperVip" MethodNameDexFundConfigMarketsAgent = "DexFundConfigMarketsAgent" MethodNameDexFundNewAgentOrder = "DexFundNewAgentOrder" // reused MethodNameDexFundGetTokenInfoCallback = "GetTokenInfoCallback" MethodNameDexFundNotifyTime = "NotifyTime" // new version MethodNameDexFundDeposit = "Deposit" MethodNameDexFundWithdraw = "Withdraw" MethodNameDexFundOpenNewMarket = "OpenNewMarket" MethodNameDexFundPlaceOrder = "PlaceOrder" MethodNameDexFundSettleOrdersV2 = "SettleOrders" MethodNameDexFundTriggerPeriodJob = "TriggerPeriodJob" MethodNameDexFundStakeForMining = "StakeForMining" MethodNameDexFundStakeForVIP = "StakeForVIP" MethodNameDexFundDelegateStakeCallback = "DelegateStakeCallback" MethodNameDexFundCancelDelegateStakeCallback = "CancelDelegateStakeCallback" MethodNameDexFundDexAdminConfig = "DexAdminConfig" MethodNameDexFundTradeAdminConfig = "TradeAdminConfig" MethodNameDexFundMarketAdminConfig = "MarketAdminConfig" MethodNameDexFundTransferTokenOwnership = "TransferTokenOwnership" MethodNameDexFundCreateNewInviter = "CreateNewInviter" MethodNameDexFundBindInviteCodeV2 = "BindInviteCode" MethodNameDexFundEndorseVxV2 = "EndorseVx" MethodNameDexFundSettleMakerMinedVxV2 = "SettleMakerMinedVx" MethodNameDexFundStakeForSVIP = "StakeForSVIP" MethodNameDexFundConfigMarketAgents = "ConfigMarketAgents" MethodNameDexFundPlaceAgentOrder = "PlaceAgentOrder" //v1.1 MethodNameDexFundLockVxForDividend = "LockVxForDividend" MethodNameDexFundSwitchConfig = "SwitchConfig" MethodNameDexFundStakeForPrincipalSVIP = "StakeForPrincipalSVIP" MethodNameDexFundCancelStakeById = "CancelStakeById" MethodNameDexFundDelegateStakeCallbackV2 = "StakeForQuotaWithCallbackCallback" MethodNameDexFundCancelDelegateStakeCallbackV2 = "CancelQuotaStakingWithCallbackCallback" MethodNameDexFundCancelOrderBySendHash = "CancelOrderBySendHash" MethodNameDexFundCommonAdminConfig = "CommonAdminConfig" MethodNameDexFundTransfer = "Transfer" MethodNameDexFundAgentDeposit = "AgentDeposit" MethodNameDexFundAssignedWithdraw = "AssignedWithdraw" )
const ( MethodNameDexTradeNewOrder = "DexTradeNewOrder" MethodNameDexTradeCancelOrder = "DexTradeCancelOrder" MethodNameDexTradeNotifyNewMarket = "DexTradeNotifyNewMarket" MethodNameDexTradeCleanExpireOrders = "DexTradeCleanExpireOrders" MethodNameDexTradeCancelOrderByHash = "DexTradeCancelOrderByHash" MethodNameDexTradePlaceOrder = "PlaceOrder" MethodNameDexTradeCancelOrderV2 = "CancelOrder" MethodNameDexTradeSyncNewMarket = "SyncNewMarket" MethodNameDexTradeClearExpiredOrders = "ClearExpiredOrders" MethodNameDexTradeCancelOrderByTransactionHash = "CancelOrderByTransactionHash" MethodNameDexTradeInnerCancelOrderBySendHash = "InnerCancelOrderBySendHash" )
const ( VariableNameConsensusGroupInfo = "consensusGroupInfo" VariableNameRegisterStakeParam = "registerStakeParam" MethodNameRegister = "Register" MethodNameRegisterV3 = "RegisterSBP" MethodNameRevoke = "CancelRegister" MethodNameRevokeV2 = "Revoke" MethodNameRevokeV3 = "RevokeSBP" MethodNameWithdrawReward = "Reward" MethodNameWithdrawRewardV2 = "WithdrawReward" MethodNameWithdrawRewardV3 = "WithdrawSBPReward" MethodNameUpdateBlockProducingAddress = "UpdateRegistration" MethodNameUpdateBlockProducintAddressV2 = "UpdateBlockProducingAddress" MethodNameUpdateBlockProducintAddressV3 = "UpdateSBPBlockProducingAddress" MethodNameUpdateSBPRewardWithdrawAddress = "UpdateSBPRewardWithdrawAddress" VariableNameRegistrationInfo = "registrationInfo" VariableNameRegistrationInfoV2 = "registrationInfoV2" VariableNameRegisteredHisName = "registeredHisName" MethodNameVote = "Vote" MethodNameVoteV3 = "VoteForSBP" MethodNameCancelVote = "CancelVote" MethodNameCancelVoteV3 = "CancelSBPVoting" VariableNameVoteInfo = "voteInfo" WithdrawRewardAddressSeparation = "," )
const ( MethodNameStake = "Pledge" MethodNameStakeV2 = "Stake" MethodNameStakeV3 = "StakeForQuota" MethodNameCancelStake = "CancelPledge" MethodNameCancelStakeV2 = "CancelStake" MethodNameCancelStakeV3 = "CancelQuotaStaking" MethodNameDelegateStake = "AgentPledge" MethodNameDelegateStakeV2 = "DelegateStake" MethodNameCancelDelegateStake = "AgentCancelPledge" MethodNameCancelDelegateStakeV2 = "CancelDelegateStake" MethodNameStakeWithCallback = "StakeForQuotaWithCallback" MethodNameCancelStakeWithCallback = "CancelQuotaStakingWithCallback" VariableNameStakeInfo = "stakeInfo" VariableNameStakeInfoV2 = "stakeInfoV2" VariableNameStakeBeneficial = "stakeBeneficial" )
Variables ¶
var (
// ABIAsset is abi definition of asset contract
ABIAsset, _ = abi.JSONToABIContract(strings.NewReader(jsonAsset))
// AssetBurnEventID see Trustless Bridge
AssetBurnEventID = assetBurnEventID()
)
var (
ABIDexFund, _ = abi.JSONToABIContract(strings.NewReader(jsonDexFund))
)
var (
ABIDexTrade, _ = abi.JSONToABIContract(strings.NewReader(jsonDexTrade))
)
var (
// ABIGovernance is abi definition of governance contract
ABIGovernance, _ = abi.JSONToABIContract(strings.NewReader(jsonGovernance))
)
var (
// ABIQuota is abi definition of quota contract
ABIQuota, _ = abi.JSONToABIContract(strings.NewReader(jsonQuota))
)
Functions ¶
func AppendTokenID ¶
func AppendTokenID(oldIDList []byte, tokenID types.TokenTypeId) []byte
AppendTokenID add token id into id list
func DeleteTokenID ¶
func DeleteTokenID(oldIDList []byte, tokenID types.TokenTypeId) []byte
DeleteTokenID remove token id from id list
func GetAllRegistrationList ¶
func GetAllRegistrationList(db StorageDatabase, gid types.Gid) ([]*types.Registration, error)
GetAllRegistrationList query all registration info
func GetCandidateList ¶
func GetCandidateList(db StorageDatabase, gid types.Gid) ([]*types.Registration, error)
GetCandidateList query all registration info which is not canceled
func GetConsensusGroup ¶
func GetConsensusGroup(db StorageDatabase, gid types.Gid) (*types.ConsensusGroupInfo, error)
GetConsensusGroup query consensus group info by id
func GetConsensusGroupInfoKey ¶
GetConsensusGroupInfoKey generate db key for consensus group info
func GetConsensusGroupList ¶
func GetConsensusGroupList(db StorageDatabase) ([]*types.ConsensusGroupInfo, error)
GetConsensusGroupList query all consensus group info list
func GetHisNameKey ¶
GetHisNameKey generate db key for registered history name of block producing address
func GetIndexFromStakeInfoKey ¶
GetIndexFromStakeInfoKey decode index from a stake info key
func GetNextTokenIndexKey ¶
GetNextTokenIndexKey generate db key for next token index
func GetRegistration ¶
func GetRegistration(db StorageDatabase, gid types.Gid, name string) (*types.Registration, error)
GetRegistration query registration info by consensus group id and sbp name
func GetRegistrationInfoKey ¶
GetRegistrationInfoKey generate db key for registration info
func GetRegistrationList ¶
func GetRegistrationList(db StorageDatabase, gid types.Gid, stakeAddr types.Address) ([]*types.Registration, error)
GetRegistrationList query registration info list staked by certain address
func GetRegistrationListByRewardWithdrawAddr ¶
func GetRegistrationListByRewardWithdrawAddr(db StorageDatabase, gid types.Gid, rewardWithdrawAddr types.Address) ([]*types.Registration, error)
func GetStakeAddrFromStakeInfoKey ¶
GetStakeAddrFromStakeInfoKey decode stake address from a stake info key
func GetStakeBeneficialAmount ¶
GetStakeBeneficialAmount query stake amount of beneficiary
func GetStakeBeneficialKey ¶
GetStakeBeneficialKey generate db key for stake beneficial amount
func GetStakeInfo ¶
func GetStakeInfo(db StorageDatabase, stakeAddr, beneficiary, delegateAddr types.Address, isDelegated bool, bid uint8) (*types.StakeInfo, error)
GetStakeInfo query exact stake info by stake address, delegate address, delegate type and bid
func GetStakeInfoById ¶
func GetStakeInfoById(db StorageDatabase, id []byte) (*types.StakeInfo, error)
func GetStakeInfoByKey ¶
func GetStakeInfoByKey(db StorageDatabase, stakeInfoKey []byte) (*types.StakeInfo, error)
func GetStakeInfoKey ¶
GetStakeInfoKey generate db key for stake info
func GetStakeInfoKeyPrefix ¶
GetStakeInfoKeyPrefix is used for db iterator
func GetStakeInfoList ¶
func GetStakeInfoList(db StorageDatabase, stakeAddr types.Address) ([]*types.StakeInfo, *big.Int, error)
GetStakeInfoList query stake info list by stake address, excluding delegate stake
func GetStakeListByPage ¶
func GetStakeListByPage(db StorageDatabase, lastKey []byte, count uint64) ([]*types.StakeInfo, []byte, error)
GetStakeListByPage batch query stake info under certain snapshot block status continuously by last query key
func GetTokenByID ¶
func GetTokenByID(db StorageDatabase, tokenID types.TokenTypeId) (*types.TokenInfo, error)
GetTokenByID query token info by id
func GetTokenIDListKey ¶
GetTokenIDListKey generate db key for token id list
func GetTokenIdFromTokenInfoKey ¶
func GetTokenIdFromTokenInfoKey(key []byte) types.TokenTypeId
GetTokenIdFromTokenInfoKey decode token id from token info key
func GetTokenInfoKey ¶
func GetTokenInfoKey(tokenID types.TokenTypeId) []byte
GetTokenInfoKey generate db key for token info
func GetTokenMap ¶
func GetTokenMap(db StorageDatabase) (map[types.TokenTypeId]*types.TokenInfo, error)
GetTokenMap query all token info map
func GetTokenMapByOwner ¶
func GetTokenMapByOwner(db StorageDatabase, owner types.Address) (tokenInfoMap map[types.TokenTypeId]*types.TokenInfo, err error)
GetTokenMapByOwner query token info map by owner
func GetVoteInfoKey ¶
GetVoteInfoKey generate db key for vote info
func GetVoteList ¶
GetVoteList query vote info list by consensus group id
func IsActiveRegistration ¶
IsActiveRegistration checks whether a sbp name is exist and is not canceled
func IsStakeInfoKey ¶
IsStakeInfoKey check whether a db key is stake info key
func UnpackRegistration ¶
func UnpackRegistration(value []byte) (*types.Registration, error)
Types ¶
type ParamCancelDelegateStake ¶
type ParamCancelDelegateStake struct { StakeAddress types.Address Beneficiary types.Address Amount *big.Int Bid uint8 }
ParamCancelDelegateStake defines parameters of cancel delegate stake method in quota contract
type ParamCancelRegister ¶
type ParamCancelStake ¶
ParamCancelStake defines parameters of cancel stake method in quota contract
type ParamDelegateStake ¶
type ParamDelegateStake struct { StakeAddress types.Address Beneficiary types.Address Bid uint8 StakeHeight uint64 }
ParamDelegateStake defines parameters of delegate stake method in quota contract
type ParamGetTokenInfo ¶
type ParamGetTokenInfo struct { TokenId types.TokenTypeId Bid uint8 }
type ParamIssue ¶
type ParamReIssue ¶
type ParamRegister ¶
type ParamReward ¶
type ParamStakeV3 ¶
type ParamTransferOwnership ¶
type ParamTransferOwnership struct { TokenId types.TokenTypeId NewOwner types.Address }
type StorageDatabase ¶
type StorageDatabase interface { GetValue(key []byte) ([]byte, error) NewStorageIterator(prefix []byte) (interfaces.StorageIterator, error) Address() *types.Address }
StorageDatabase define db interfaces for querying built-in contract
type VariableRegisterStakeParam ¶
type VariableRegisterStakeParam struct { StakeAmount *big.Int StakeToken types.TokenTypeId StakeHeight uint64 }
func GetRegisterStakeParamOfConsensusGroup ¶
func GetRegisterStakeParamOfConsensusGroup(data []byte) (*VariableRegisterStakeParam, error)
GetRegisterStakeParamOfConsensusGroup decode stake param of register sbp
type VariableStakeBeneficial ¶
VariableStakeBeneficial defines variable of stake beneficial amount in quota contract