abi

package
v2.11.3-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
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"
)
View Source
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"
)
View Source
const (
	MethodNameDexTradeNewOrder          = "DexTradeNewOrder"
	MethodNameDexTradeCancelOrder       = "DexTradeCancelOrder"
	MethodNameDexTradeNotifyNewMarket   = "DexTradeNotifyNewMarket"
	MethodNameDexTradeCleanExpireOrders = "DexTradeCleanExpireOrders"
	MethodNameDexTradeCancelOrderByHash = "DexTradeCancelOrderByHash"

	MethodNameDexTradePlaceOrder                   = "PlaceOrder"
	MethodNameDexTradeCancelOrderV2                = "CancelOrder"
	MethodNameDexTradeSyncNewMarket                = "SyncNewMarket"
	MethodNameDexTradeClearExpiredOrders           = "ClearExpiredOrders"
	MethodNameDexTradeCancelOrderByTransactionHash = "CancelOrderByTransactionHash"

	MethodNameDexTradeInnerCancelOrderBySendHash = "InnerCancelOrderBySendHash"
)
View Source
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 = ","
)
View Source
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

View Source
var (
	// ABIAsset is abi definition of asset contract
	ABIAsset, _ = abi.JSONToABIContract(strings.NewReader(jsonAsset))

	// AssetBurnEventID see Trustless Bridge
	AssetBurnEventID = assetBurnEventID()
)
View Source
var (
	ABIDexFund, _ = abi.JSONToABIContract(strings.NewReader(jsonDexFund))
)
View Source
var (
	ABIDexTrade, _ = abi.JSONToABIContract(strings.NewReader(jsonDexTrade))
)
View Source
var (
	// ABIGovernance is abi definition of governance contract
	ABIGovernance, _ = abi.JSONToABIContract(strings.NewReader(jsonGovernance))
)
View Source
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

func GetConsensusGroupInfoKey(gid types.Gid) []byte

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

func GetHisNameKey(addr types.Address, gid types.Gid) []byte

GetHisNameKey generate db key for registered history name of block producing address

func GetIndexFromStakeInfoKey

func GetIndexFromStakeInfoKey(key []byte) uint64

GetIndexFromStakeInfoKey decode index from a stake info key

func GetNextTokenIndexKey

func GetNextTokenIndexKey(tokenSymbol string) []byte

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

func GetRegistrationInfoKey(name string, gid types.Gid) []byte

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

func GetStakeAddrFromStakeInfoKey(key []byte) types.Address

GetStakeAddrFromStakeInfoKey decode stake address from a stake info key

func GetStakeBeneficialAmount

func GetStakeBeneficialAmount(db StorageDatabase, beneficiary types.Address) (*big.Int, error)

GetStakeBeneficialAmount query stake amount of beneficiary

func GetStakeBeneficialKey

func GetStakeBeneficialKey(beneficial types.Address) []byte

GetStakeBeneficialKey generate db key for stake beneficial amount

func GetStakeExpirationHeight

func GetStakeExpirationHeight(db StorageDatabase, list []*types.StakeInfo) ([]*types.StakeInfo, error)

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

func GetStakeInfoKey(addr types.Address, index uint64) []byte

GetStakeInfoKey generate db key for stake info

func GetStakeInfoKeyPrefix

func GetStakeInfoKeyPrefix(addr types.Address) []byte

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

func GetTokenIDListKey(owner types.Address) []byte

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 GetVote

func GetVote(db StorageDatabase, gid types.Gid, addr types.Address) (*types.VoteInfo, error)

GetVote query vote info by consensus group id and vote address

func GetVoteInfoKey

func GetVoteInfoKey(addr types.Address, gid types.Gid) []byte

GetVoteInfoKey generate db key for vote info

func GetVoteList

func GetVoteList(db StorageDatabase, gid types.Gid) ([]*types.VoteInfo, error)

GetVoteList query vote info list by consensus group id

func IsActiveRegistration

func IsActiveRegistration(db StorageDatabase, name string, gid types.Gid) (bool, error)

IsActiveRegistration checks whether a sbp name is exist and is not canceled

func IsStakeInfoKey

func IsStakeInfoKey(key []byte) bool

IsStakeInfoKey check whether a db key is stake info key

func UnpackRegistration

func UnpackRegistration(value []byte) (*types.Registration, error)

func UnpackStakeInfo

func UnpackStakeInfo(value []byte) (*types.StakeInfo, 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 ParamCancelRegister struct {
	Gid     types.Gid
	SbpName string
}

type ParamCancelStake

type ParamCancelStake struct {
	Beneficiary types.Address
	Amount      *big.Int
}

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 ParamIssue struct {
	TokenName       string
	TokenSymbol     string
	TotalSupply     *big.Int
	Decimals        uint8
	MaxSupply       *big.Int
	IsOwnerBurnOnly bool
	IsReIssuable    bool
}

type ParamReIssue

type ParamReIssue struct {
	TokenId        types.TokenTypeId
	Amount         *big.Int
	ReceiveAddress types.Address
}

type ParamRegister

type ParamRegister struct {
	Gid                   types.Gid
	SbpName               string
	BlockProducingAddress types.Address
	RewardWithdrawAddress types.Address
}

type ParamReward

type ParamReward struct {
	Gid            types.Gid
	SbpName        string
	ReceiveAddress types.Address
}

type ParamStakeV3

type ParamStakeV3 struct {
	StakeAddress types.Address
	Beneficiary  types.Address
	StakeHeight  uint64
}

type ParamTransferOwnership

type ParamTransferOwnership struct {
	TokenId  types.TokenTypeId
	NewOwner types.Address
}

type ParamVote

type ParamVote struct {
	Gid     types.Gid
	SbpName string
}

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

type VariableStakeBeneficial struct {
	Amount *big.Int
}

VariableStakeBeneficial defines variable of stake beneficial amount in quota contract

Jump to

Keyboard shortcuts

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