dex

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: GPL-3.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	StakeForMining = iota + 1
	StakeForVIP
	StakeForSuperVIP
	StakeForPrincipalSuperVIP
)
View Source
const (
	Stake = iota + 1
	CancelStake
)
View Source
const (
	AdminConfigOwner            = 1
	AdminConfigTimeOracle       = 2
	AdminConfigPeriodJobTrigger = 4
	AdminConfigStopDex          = 8
	AdminConfigMakerMiningAdmin = 16
	AdminConfigMaintainer       = 32
)

MethodNameDexFundDexAdminConfig

View Source
const (
	TradeAdminConfigMineMarket     = 1
	TradeAdminConfigNewQuoteToken  = 2
	TradeAdminConfigTradeThreshold = 4
	TradeAdminConfigMineThreshold  = 8
	TradeAdminStartNormalMine      = 16
	TradeAdminBurnExtraVx          = 32
)

MethodNameDexFundTradeAdminConfig

View Source
const (
	MarketOwnerTransferOwner   = 1
	MarketOwnerConfigTakerRate = 2
	MarketOwnerConfigMakerRate = 4
	MarketOwnerStopMarket      = 8
)
View Source
const (
	CommonAdminConfigStableMarket            = 1
	CommonAdminConfigMarketOrderAmtThreshold = 2
)
View Source
const (
	ViteTokenType = iota + 1
	EthTokenType
	BtcTokenType
	UsdTokenType
)
View Source
const (
	MineForMaker = iota + 1
	MineForMaintainer
)
View Source
const (
	FeeDividendJob = iota + 1
	OperatorFeeDividendJob
	MineVxForFeeJob
	MineVxForStakingJob
	MineVxForMakerAndMaintainerJob
	FinishVxUnlock
	FinishCancelMiningStake
)
View Source
const (
	GetTokenForNewMarket = iota + 1
	GetTokenForSetQuote
	GetTokenForTransferOwner
)
View Source
const (
	GrantAgent = iota + 1
	RevokeAgent
)
View Source
const (
	LockVx = iota + 1
	UnlockVx
)
View Source
const (
	StakeSubmitted = iota + 1
	StakeConfirmed
)
View Source
const (
	TransferAssetDeposit = iota + 1
	TransferAssetAgentDeposit
	TransferAssetWithdraw
	TransferAssetAssignedWithdraw
	TransferAssetTransfer
)
View Source
const (
	Pending = iota
	PartialExecuted
	FullyExecuted
	Cancelled
	NewFailed
)
View Source
const (
	Limited = iota
	Market
	PostOnly
	FillOrKill
	ImmediateOrCancel
)
View Source
const (
	AutoLockMinedVx = iota + 1
)
View Source
const (
	BurnForDexViteFee = iota + 1
)
View Source
const CleanExpireOrdersMaxCount = 200
View Source
const OrderIdBytesLength = 22
View Source
const PriceBytesLength = 10

Variables

View Source
var (
	InvalidInputParamErr = errors.New("invalid input param")

	InvalidOrderIdErr       = errors.New("invalid order id")
	InvalidOrderHashErr     = errors.New("invalid order hash")
	InvalidOrderTypeErr     = errors.New("invalid order type")
	InvalidOrderPriceErr    = errors.New("invalid order price format")
	InvalidOrderQuantityErr = errors.New("invalid order quantity")
	OrderNotExistsErr       = errors.New("order not exists")
	OrderAmountTooSmallErr  = errors.New("order amount too small")

	DexStoppedErr                   = errors.New("dex stopped")
	TradeMarketExistsErr            = errors.New("trade market already exists")
	TradeMarketNotExistsErr         = errors.New("trade market not exists")
	TradeMarketsErr                 = errors.New("get trade markets failed")
	TradeMarketStoppedErr           = errors.New("trade market stopped")
	TradeMarketNotGrantedErr        = errors.New("trade market not granted")
	ComposeOrderIdFailErr           = errors.New("compose order id fail")
	DeComposeOrderIdFailErr         = errors.New("decompose order id fail")
	TradeMarketInvalidQuoteTokenErr = errors.New("invalid quote token")
	TradeMarketInvalidTokenPairErr  = errors.New("invalid token pair")
	TradeMarketAllowMineErr         = errors.New("token pair already allow mine")
	TradeMarketNotAllowMineErr      = errors.New("token pair already not allow mine")
	TradeMarketStableMarketErr      = errors.New("already stable currency market")
	TradeMarketNotStableMarketErr   = errors.New("already not stable currency market")

	CancelOrderOwnerInvalidErr  = errors.New("order to cancel not own to initiator")
	CancelOrderInvalidStatusErr = errors.New("order status is invalid to cancel")

	OnlyOwnerAllowErr   = errors.New("only owner allow")
	InvalidOperationErr = errors.New("invalid operation")

	ExceedFundAvailableErr         = errors.New("exceed fund available")
	ExceedFundLockedErr            = errors.New("try release locked amount exceed locked")
	InvalidStakeAmountErr          = errors.New("invalid stake amount")
	InvalidStakeActionTypeErr      = errors.New("invalid stake action type")
	ExceedStakedAvailableErr       = errors.New("exceed staked available")
	StakingAmountLeavedNotValidErr = errors.New("staking amount leaved not valid")
	VIPStakingExistsErr            = errors.New("VIP staking exists")
	VIPStakingNotExistsErr         = errors.New("VIP staking not exists")
	SuperVipStakingExistsErr       = errors.New("super VIP staking exists")
	SuperVIPStakingNotExistsErr    = errors.New("super VIP staking not exists")
	StakingInfoByIdNotExistsErr    = errors.New("staking info by id not exists")

	InvalidSourceAddressErr          = errors.New("invalid source address")
	InvalidAmountForStakeCallbackErr = errors.New("invalid amount for stake callback")
	InvalidIdForStakeCallbackErr     = errors.New("invalid id for stake callback")

	InvalidTokenErr                      = errors.New("invalid token")
	PendingNewMarketInnerConflictErr     = errors.New("pending new market inner conflict")
	GetTokenInfoCallbackInnerConflictErr = errors.New("get token info callback inner conflict")
	InvalidTimestampFromTimeOracleErr    = errors.New("invalid timestamp from time oracle")
	OracleTimestampExceedPeriodGapErr    = errors.New("oracle timestamp exceed period gap")
	InvalidOperatorFeeRateErr            = errors.New("invalid operator fee rate")

	NoDexFeesFoundForValidPeriodErr = errors.New("no fee sum found for valid period")
	NotSetTimestampErr              = errors.New("not set timestamp")
	IterateVmDbFailedErr            = errors.New("iterate vm db failed")
	NotSetMaintainerErr             = errors.New("not set maintainer")
	NotSetMakerMiningAdmin          = errors.New("not set maker mining admin")

	AlreadyIsInviterErr = errors.New("already is inviter")

	InvalidInviteCodeErr     = errors.New("invalid invite code")
	NotBindInviterErr        = errors.New("not bind invite code")
	AlreadyBindInviterErr    = errors.New("already bind inviter")
	NewInviteCodeFailErr     = errors.New("new invite code fail")
	AlreadyQuoteType         = errors.New("already quote type")
	InvalidQuoteTokenTypeErr = errors.New("invalid quote token type")
	FundOwnerNotConfigErr    = errors.New("fund owner not config")

	MultiMarketsInOneActionErr = errors.New("multi markets one action")

	DexFundUserNotExists            = errors.New("fund user doesn't exist.")
	LockedVxAmountLeavedNotValidErr = errors.New("locked vx amount leaved not valid")

	InternalErr = errors.New("internal error")
)
View Source
var (
	VxTokenId, _             = types.HexToTokenTypeId("tti_564954455820434f494e69b5")
	PreheatMinedAmtPerPeriod = new(big.Int).Mul(commonTokenPow, big.NewInt(10000))
	VxMinedAmtFirstPeriod    = new(big.Int).Mul(new(big.Int).Exp(helper.Big10, new(big.Int).SetUint64(uint64(13)), nil), big.NewInt(47703236213)) // 477032.36213

	VxDividendThreshold      = new(big.Int).Mul(commonTokenPow, big.NewInt(10))
	NewMarketFeeAmount       = new(big.Int).Mul(commonTokenPow, big.NewInt(10000))
	NewMarketFeeMineAmount   = new(big.Int).Mul(commonTokenPow, big.NewInt(1000))
	NewMarketFeeDonateAmount = new(big.Int).Mul(commonTokenPow, big.NewInt(4000))
	NewMarketFeeBurnAmount   = new(big.Int).Mul(commonTokenPow, big.NewInt(5000))
	NewInviterFeeAmount      = new(big.Int).Mul(commonTokenPow, big.NewInt(1000))
	// 1000 -> 100 in version 10
	NewInviterFeeAmountForVersion10 = new(big.Int).Mul(commonTokenPow, big.NewInt(100))

	VxLockThreshold = new(big.Int).Set(commonTokenPow)
	SchedulePeriods = 7 // T+7 schedule

	StakeForMiningMinAmount = new(big.Int).Mul(commonTokenPow, big.NewInt(134))
	StakeForVIPAmount       = new(big.Int).Mul(commonTokenPow, big.NewInt(10000))
	StakeForMiningThreshold = new(big.Int).Mul(commonTokenPow, big.NewInt(134))
	StakeForSuperVIPAmount  = new(big.Int).Mul(commonTokenPow, big.NewInt(1000000))

	// RateSumForFeeMine                = "0.6" // 15% * 4
	RateForStakingMine          = "0.2" // 20%
	RateForStakingMineVersion12 = "0.1" // 10%

	ViteTokenDecimals int32 = 18

	QuoteTokenTypeInfos = map[int32]*QuoteTokenTypeInfo{
		ViteTokenType: &QuoteTokenTypeInfo{Decimals: 18, DefaultTradeThreshold: viteMinAmount, DefaultMineThreshold: viteMineThreshold, DefaultMarketOrderAmtThreshold: viteMarketOrderAmtThreshold},
		EthTokenType:  &QuoteTokenTypeInfo{Decimals: 18, DefaultTradeThreshold: ethMinAmount, DefaultMineThreshold: ethMineThreshold, DefaultMarketOrderAmtThreshold: ethMarketOrderAmtThreshold},
		BtcTokenType:  &QuoteTokenTypeInfo{Decimals: 8, DefaultTradeThreshold: bitcoinMinAmount, DefaultMineThreshold: bitcoinMineThreshold, DefaultMarketOrderAmtThreshold: bitcoinMarketOrderAmtThreshold},
		UsdTokenType:  &QuoteTokenTypeInfo{Decimals: 6, DefaultTradeThreshold: usdMinAmount, DefaultMineThreshold: usdMineThreshold, DefaultMarketOrderAmtThreshold: usdMarketOrderAmtThreshold},
	}
)
View Source
var (
	BaseFeeRate        int32 = 200 // 200/100,000 = 0.002
	VipReduceFeeRate   int32 = 100 // 0.001
	MaxOperatorFeeRate int32 = 200 // 0.002

	PerPeriodDividendRate int32 = 1000 // 0.01

	InviterBonusRate int32 = 5000 // 0.05
	InviteeBonusRate int32 = 2500 // 0.025

	RateCardinalNum int32 = 100000 // 100,000
)

Functions

func AccumulateAmountFromMap

func AccumulateAmountFromMap(amountMap map[int32]*big.Int) *big.Int

func AddBigInt

func AddBigInt(a []byte, b []byte) []byte

func AddBurnViteEvent

func AddBurnViteEvent(db interfaces.VmDb, bizType int, amount *big.Int)

func AddCancelStake

func AddCancelStake(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, amount *big.Int)

func AddErrEvent

func AddErrEvent(db interfaces.VmDb, err error)

func AddFeeDividendEvent

func AddFeeDividendEvent(db interfaces.VmDb, address types.Address, feeToken types.TokenTypeId, vxAmount, feeDividend *big.Int)

func AddGrantMarketToAgentEvent

func AddGrantMarketToAgentEvent(db interfaces.VmDb, principal, agent types.Address, marketId int32)

func AddInviteRelationEvent

func AddInviteRelationEvent(db interfaces.VmDb, inviter, invitee types.Address, inviteCode uint32)

func AddMarketEvent

func AddMarketEvent(db interfaces.VmDb, marketInfo *MarketInfo)

func AddMinedVxForInviteeFeeEvent

func AddMinedVxForInviteeFeeEvent(db interfaces.VmDb, address types.Address, quoteTokenType int32, feeAmount []byte, vxMined *big.Int)

func AddMinedVxForOperationEvent

func AddMinedVxForOperationEvent(db interfaces.VmDb, bizType int32, address types.Address, amount *big.Int)

func AddMinedVxForStakingEvent

func AddMinedVxForStakingEvent(db interfaces.VmDb, address types.Address, stakedAmt, minedAmt *big.Int)

func AddMinedVxForTradeFeeEvent

func AddMinedVxForTradeFeeEvent(db interfaces.VmDb, address types.Address, quoteTokenType int32, feeAmount []byte, vxMined *big.Int)

func AddOperatorFeeDividendEvent

func AddOperatorFeeDividendEvent(db interfaces.VmDb, address types.Address, operatorMarketFee *dexproto.OperatorMarketFee)

func AddPeriodWithBizEvent

func AddPeriodWithBizEvent(db interfaces.VmDb, periodId uint64, bizType uint8)

func AddRevokeMarketFromAgentEvent

func AddRevokeMarketFromAgentEvent(db interfaces.VmDb, principal, agent types.Address, marketId int32)

func AddSettleMakerMinedVxEvent

func AddSettleMakerMinedVxEvent(db interfaces.VmDb, periodId uint64, page int32, finish bool)

func AddToPendingNewMarkets

func AddToPendingNewMarkets(db interfaces.VmDb, tradeToken, quoteToken types.TokenTypeId) error

func AddToPendingSetQuotes

func AddToPendingSetQuotes(db interfaces.VmDb, token types.TokenTypeId, quoteType uint8)

func AddToPendingTransferTokenOwners

func AddToPendingTransferTokenOwners(db interfaces.VmDb, token types.TokenTypeId, origin, new types.Address)

func AddTokenEvent

func AddTokenEvent(db interfaces.VmDb, tokenInfo *TokenInfo)

func AddTransferAssetEvent

func AddTransferAssetEvent(db interfaces.VmDb, bizType int, from, to types.Address, token types.TokenTypeId, amount *big.Int, extra []byte)

func AddVxUnlock

func AddVxUnlock(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, amount *big.Int)

func AdjustAmountForDecimalsDiff

func AdjustAmountForDecimalsDiff(amount []byte, decimalsDiff int32) *big.Int

func AdjustForDecimalsDiff

func AdjustForDecimalsDiff(sourceAmountF *big.Float, decimalsDiff int32) *big.Float

func BatchUpdateFund

func BatchUpdateFund(db interfaces.VmDb, address types.Address, accounts map[types.TokenTypeId]*big.Int) error

func BitwiseNotBytes

func BitwiseNotBytes(bytes []byte)

func BurnExtraVx

func BurnExtraVx(db interfaces.VmDb) ([]*ledger.AccountBlock, error)

func BytesToPrice

func BytesToPrice(priceBytes []byte) string

func BytesToUint32

func BytesToUint32(bytes []byte) uint32

func BytesToUint64

func BytesToUint64(bytes []byte) uint64

func CalculateAmountForRate

func CalculateAmountForRate(amount []byte, rate int32) []byte

func CalculateFeeAndExecutedFee

func CalculateFeeAndExecutedFee(order *Order, amount []byte, feeRate, operatorFeeRate int32, heightPoint upgrade.HeightPoint) (incBaseFee, executedBaseFee, incOperatorFee, executedOperatorFee []byte)

func CalculateRawAmount

func CalculateRawAmount(quantity []byte, price []byte, decimalsDiff int32) []byte

func CalculateRawAmountF

func CalculateRawAmountF(quantity []byte, price []byte, decimalsDiff int32) *big.Float

func CalculateRawQuantity added in v2.13.0

func CalculateRawQuantity(amount []byte, price []byte, decimalsDiff int32) []byte

func CalculateRawQuantityF added in v2.13.0

func CalculateRawQuantityF(amount []byte, price []byte, decimalsDiff int32) *big.Float

func CardinalRateToString

func CardinalRateToString(rawRate int32) string

func CheckAndLockFundForNewOrder

func CheckAndLockFundForNewOrder(db interfaces.VmDb, dexFund *Fund, order *Order, marketInfo *MarketInfo, enrichOrderFork bool) (err error)

func CheckCancelAgentOrder

func CheckCancelAgentOrder(db interfaces.VmDb, sender types.Address, param *ParamCancelOrderByHash) (owner types.Address, err error)

func CheckMarketParam

func CheckMarketParam(marketParam *ParamOpenNewMarket) (err error)

func CheckMiningStakingsCanBeDelete

func CheckMiningStakingsCanBeDelete(miningStakings *MiningStakings) bool

func CheckSettleActions

func CheckSettleActions(actions *dexproto.SettleActions) error

func CheckUserVxFundsCanBeDelete

func CheckUserVxFundsCanBeDelete(vxFunds *VxFunds) bool

func CmpForBigInt

func CmpForBigInt(a []byte, b []byte) int

func CmpToBigZero

func CmpToBigZero(a []byte) int

func ComposeOrderId

func ComposeOrderId(db interfaces.VmDb, marketId int32, side bool, price string) (idBytes []byte)

MarketId[0..2]Side[3]Price[4..13]timestamp[14..18]serialNo[19..21] = 22

func ConfirmDelegateStakeInfo

func ConfirmDelegateStakeInfo(db interfaces.VmDb, hash types.Hash, info *DelegateStakeInfo, serialNo uint64)

func DeComposeOrderId

func DeComposeOrderId(idBytes []byte) (marketId int32, side bool, price []byte, timestamp int64, err error)

func DeleteDelegateStakeAddressIndex

func DeleteDelegateStakeAddressIndex(db interfaces.VmDb, address []byte, serialNo uint64)

func DeleteDelegateStakeInfo

func DeleteDelegateStakeInfo(db interfaces.VmDb, hash []byte)

func DeleteHashMapOrderId

func DeleteHashMapOrderId(db interfaces.VmDb, sendHash []byte)

func DeleteLastSettledMakerMinedVxPage

func DeleteLastSettledMakerMinedVxPage(db interfaces.VmDb)

func DeleteMakerMiningPoolByPeriodId

func DeleteMakerMiningPoolByPeriodId(db interfaces.VmDb, periodId uint64)

func DeleteMarketInfo

func DeleteMarketInfo(db interfaces.VmDb, tradeToken, quoteToken types.TokenTypeId)

func DeleteMiningStakedAmount

func DeleteMiningStakedAmount(db interfaces.VmDb, address types.Address)

func DeleteMiningStakedV2Amount

func DeleteMiningStakedV2Amount(db interfaces.VmDb, address types.Address)

func DeleteMiningStakings

func DeleteMiningStakings(db interfaces.VmDb, address types.Address)

func DeleteOperatorFeesByKey

func DeleteOperatorFeesByKey(db interfaces.VmDb, key []byte)

func DeletePendingNewMarkets

func DeletePendingNewMarkets(db interfaces.VmDb)

func DeletePendingSetQuotes

func DeletePendingSetQuotes(db interfaces.VmDb)

func DeletePendingTransferTokenOwners

func DeletePendingTransferTokenOwners(db interfaces.VmDb)

func DeleteSuperVIPStaking

func DeleteSuperVIPStaking(db interfaces.VmDb, address types.Address)

func DeleteUserFees

func DeleteUserFees(db interfaces.VmDb, address []byte)

func DeleteVIPStaking

func DeleteVIPStaking(db interfaces.VmDb, address types.Address)

func DeleteVxFunds

func DeleteVxFunds(db interfaces.VmDb, address []byte)

func DeleteVxFundsWithForkCheck

func DeleteVxFundsWithForkCheck(db interfaces.VmDb, address []byte)

func DeleteVxLockedFunds

func DeleteVxLockedFunds(db interfaces.VmDb, address []byte)

func DepositAccount

func DepositAccount(db interfaces.VmDb, address types.Address, token types.TokenTypeId, amount *big.Int) (updatedAcc *dexproto.Account)

func DivideByProportion

func DivideByProportion(totalReferAmt, partReferAmt, dividedReferAmt, toDivideTotalAmt, toDivideLeaveAmt *big.Int) (proportionAmt *big.Int, finished bool)

func DoCancelOrder

func DoCancelOrder(sendHash types.Hash, owner types.Address) ([]*ledger.AccountBlock, error)

func DoCancelStakeV1

func DoCancelStakeV1(db interfaces.VmDb, address types.Address, stakeType uint8, amount *big.Int) ([]*ledger.AccountBlock, error)

func DoCancelStakeV2

func DoCancelStakeV2(db interfaces.VmDb, address types.Address, id types.Hash) ([]*ledger.AccountBlock, error)

func DoFeesDividend

func DoFeesDividend(db interfaces.VmDb, periodId uint64) (blocks []*ledger.AccountBlock, err error)

Note: allow dividend from specify periodId, former periods will be divided at that period

func DoFinishCancelMiningStake

func DoFinishCancelMiningStake(db interfaces.VmDb, periodId uint64) error

periodId is finish period

func DoFinishVxUnlock

func DoFinishVxUnlock(db interfaces.VmDb, periodId uint64) error

periodId is finish period

func DoMineVxForFee

func DoMineVxForFee(db interfaces.VmDb, reader util.ConsensusReader, periodId uint64, amtForMarkets map[int32]*big.Int, fundLogger log15.Logger) (*big.Int, error)

Note: allow mine from specify periodId, former periods will be ignore

func DoMineVxForMaintainer

func DoMineVxForMaintainer(db interfaces.VmDb, reader util.ConsensusReader, amount *big.Int) (err error)

func DoMineVxForMaker

func DoMineVxForMaker(db interfaces.VmDb, periodId uint64, amount *big.Int)

func DoMineVxForMakerMineAndMaintainer

func DoMineVxForMakerMineAndMaintainer(db interfaces.VmDb, periodId uint64, reader util.ConsensusReader, amtForMakerAndMaintainer map[int32]*big.Int) (err error)

func DoMineVxForStaking

func DoMineVxForStaking(db interfaces.VmDb, reader util.ConsensusReader, periodId uint64, amountToMine *big.Int) (*big.Int, error)

func DoOperatorFeesDividend

func DoOperatorFeesDividend(db interfaces.VmDb, periodId uint64) error

func DoPlaceOrder

func DoPlaceOrder(db interfaces.VmDb, param *ParamPlaceOrder, accountAddress, agent *types.Address, sendHash types.Hash) ([]*ledger.AccountBlock, error)

func DoRawCancelStakeV2

func DoRawCancelStakeV2(id types.Hash) ([]*ledger.AccountBlock, error)

func DoSettleFund

func DoSettleFund(db interfaces.VmDb, reader util.ConsensusReader, action *dexproto.FundSettle, marketInfo *MarketInfo, fundLogger log15.Logger) error

func DoSettleVxFunds

func DoSettleVxFunds(db interfaces.VmDb, reader util.ConsensusReader, addressBytes []byte, amtChange *big.Int, updatedVxAccount *dexproto.Account) error

only settle validAmount and amount changed from previous period

func FilterPendingNewMarkets

func FilterPendingNewMarkets(db interfaces.VmDb, tradeToken types.TokenTypeId) (quoteTokens [][]byte, err error)

handle case on duplicate callback for getTokenInfo

func FilterPendingSetQuotes

func FilterPendingSetQuotes(db interfaces.VmDb, token types.TokenTypeId) (action *dexproto.SetQuoteTokenAction, err error)

handle case on duplicate callback for getTokenInfo

func FilterPendingTransferTokenOwners

func FilterPendingTransferTokenOwners(db interfaces.VmDb, token types.TokenTypeId) (action *dexproto.TransferTokenOwnerAction, err error)

handle case on duplicate callback for getTokenInfo

func FinishCancelStake

func FinishCancelStake(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account, err error)

func FinishVxUnlockForDividend

func FinishVxUnlockForDividend(db interfaces.VmDb, address types.Address, amount *big.Int) (*dexproto.Account, error)

func FloorQuantity added in v2.13.0

func FloorQuantity(quantityF *big.Float) *big.Int

func GenerateHeightPoint added in v2.13.0

func GenerateHeightPoint(db interfaces.VmDb) upgrade.HeightPoint

func GetAbs

func GetAbs(v int32) (int32, int32)

func GetAccountByToken

func GetAccountByToken(fund *Fund, token types.TokenTypeId) (account *dexproto.Account, exists bool)

func GetCancelStakesKey

func GetCancelStakesKey(address types.Address) []byte

func GetCodeByInviter

func GetCodeByInviter(db interfaces.VmDb, address types.Address) uint32

func GetCurrentOperatorFeesKey

func GetCurrentOperatorFeesKey(db interfaces.VmDb, reader util.ConsensusReader, operator []byte) []byte

func GetCurrentPeriodId

func GetCurrentPeriodId(db interfaces.VmDb, reader util.ConsensusReader) uint64

func GetDelegateStakeAddressIndexKey

func GetDelegateStakeAddressIndexKey(address []byte, serialNo uint64) []byte

func GetDelegateStakeIndexSerialNoKey

func GetDelegateStakeIndexSerialNoKey(address []byte) []byte

func GetDelegateStakeInfoKey

func GetDelegateStakeInfoKey(hash []byte) []byte

func GetDexFeesKeyByPeriodId

func GetDexFeesKeyByPeriodId(periodId uint64) []byte

func GetDexFeesLastPeriodIdForRoll

func GetDexFeesLastPeriodIdForRoll(db interfaces.VmDb) uint64

func GetDexTimestamp

func GetDexTimestamp(db interfaces.VmDb) int64

func GetFeeMineRateArr

func GetFeeMineRateArr(db interfaces.VmDb) mineRate

func GetFeeStakingMineRate added in v2.13.0

func GetFeeStakingMineRate(db interfaces.VmDb) string

func GetFirstMinedVxPeriodId

func GetFirstMinedVxPeriodId(db interfaces.VmDb) uint64

func GetFundKey

func GetFundKey(address types.Address) []byte

func GetGrantedMarketToAgentKey

func GetGrantedMarketToAgentKey(principal types.Address, marketId int32) []byte

func GetHashMapOrderIdKey

func GetHashMapOrderIdKey(sendHash []byte) []byte

func GetInviterByCode

func GetInviterByCode(db interfaces.VmDb, inviteCode uint32) (*types.Address, error)

func GetInviterByInvitee

func GetInviterByInvitee(db interfaces.VmDb, invitee types.Address) (*types.Address, error)

func GetLastJobPeriodIdByBizType

func GetLastJobPeriodIdByBizType(db interfaces.VmDb, bizType uint8) uint64

func GetLastJobPeriodIdKey

func GetLastJobPeriodIdKey(bizType uint8) []byte

func GetLastSettledMakerMinedVxPage

func GetLastSettledMakerMinedVxPage(db interfaces.VmDb) int32

func GetLastSettledMakerMinedVxPeriod

func GetLastSettledMakerMinedVxPeriod(db interfaces.VmDb) uint64

func GetMaintainer

func GetMaintainer(db interfaces.VmDb) *types.Address

func GetMakerAndMaintainerArr

func GetMakerAndMaintainerArr(db interfaces.VmDb) mineRate

func GetMakerMiningAdmin

func GetMakerMiningAdmin(db interfaces.VmDb) *types.Address

func GetMakerMiningPoolByPeriodId

func GetMakerMiningPoolByPeriodId(db interfaces.VmDb, periodId uint64) *big.Int

func GetMarkerMiningPoolByPeriodIdKey

func GetMarkerMiningPoolByPeriodIdKey(periodId uint64) []byte

func GetMarketInfoKey

func GetMarketInfoKey(tradeToken, quoteToken types.TokenTypeId) []byte

func GetMarketInfoKeyById

func GetMarketInfoKeyById(marketId int32) []byte

func GetMarketOrderAmtThreshold

func GetMarketOrderAmtThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int

func GetMarketOrderAmtThresholdKey

func GetMarketOrderAmtThresholdKey(quoteTokenType uint8) []byte

func GetMineThreshold

func GetMineThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int

func GetMineThresholdKey

func GetMineThresholdKey(quoteTokenType uint8) []byte

func GetMiningStakedAmount

func GetMiningStakedAmount(db interfaces.VmDb, address types.Address) *big.Int

func GetMiningStakedAmountKey

func GetMiningStakedAmountKey(address types.Address) []byte

func GetMiningStakedV2Amount

func GetMiningStakedV2Amount(db interfaces.VmDb, address types.Address) *big.Int

func GetMiningStakedV2AmountKey

func GetMiningStakedV2AmountKey(address types.Address) []byte

func GetMiningStakingsKey

func GetMiningStakingsKey(address types.Address) []byte

func GetNotFinishDividendDexFeesByPeriodMap

func GetNotFinishDividendDexFeesByPeriodMap(db interfaces.VmDb, periodId uint64) map[uint64]*DexFeesByPeriod

get all dexFeeses that not divided yet

func GetOperatorFeesKeyByPeriodIdAndAddress

func GetOperatorFeesKeyByPeriodIdAndAddress(periodId uint64, address []byte) []byte

func GetOrderIdByHash

func GetOrderIdByHash(db interfaces.VmDb, sendHash []byte) ([]byte, bool)

func GetOwner

func GetOwner(db interfaces.VmDb) (*types.Address, error)

func GetPeriodIdByTimestamp

func GetPeriodIdByTimestamp(reader util.ConsensusReader, timestamp int64) uint64

func GetPeriodJobTrigger

func GetPeriodJobTrigger(db interfaces.VmDb) *types.Address

func GetStakeForMiningV1ByPage

func GetStakeForMiningV1ByPage(db abi.StorageDatabase, lastKey []byte, count int) (addresses []*types.Address, newLastKey []byte, err error)

func GetStakeForMiningV2ByPage

func GetStakeForMiningV2ByPage(db abi.StorageDatabase, lastKey []byte, count int) (addresses []*types.Address, newLastKey []byte, err error)

func GetSuperVIPStakingKey

func GetSuperVIPStakingKey(address types.Address) []byte

func GetTimeOracle

func GetTimeOracle(db interfaces.VmDb) *types.Address

func GetTimestampInt64

func GetTimestampInt64(db interfaces.VmDb) int64

func GetTokenInfoKey

func GetTokenInfoKey(token types.TokenTypeId) []byte

func GetTradeThreshold

func GetTradeThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int

func GetTradeThresholdKey

func GetTradeThresholdKey(quoteTokenType uint8) []byte

func GetTradeTimestamp

func GetTradeTimestamp(db interfaces.VmDb) int64

func GetUserFeesKey

func GetUserFeesKey(address []byte) []byte

func GetVIPStakingKey

func GetVIPStakingKey(address types.Address) []byte

func GetVxAmountByPeriodIndex

func GetVxAmountByPeriodIndex(periodIndex uint64) *big.Int

func GetVxAmountToBurn

func GetVxAmountToBurn(db interfaces.VmDb, poolAmt *big.Int) (*big.Int, error)

func GetVxAmountToMine

func GetVxAmountToMine(db interfaces.VmDb, periodId uint64, vxPool *big.Int, rate string) (amount, vxAmtLeaved *big.Int, success bool)

func GetVxAmountsForEqualItems

func GetVxAmountsForEqualItems(db interfaces.VmDb, periodId uint64, vxPool *big.Int, mr mineRate) (amountForItems map[int32]*big.Int, vxAmtLeaved *big.Int, success bool)

func GetVxAutoLockMinedVxKey

func GetVxAutoLockMinedVxKey(address []byte) []byte

func GetVxBurnAmount

func GetVxBurnAmount(db interfaces.VmDb) *big.Int

func GetVxFundsKey

func GetVxFundsKey(address []byte) []byte

func GetVxLockedFundsKey

func GetVxLockedFundsKey(address []byte) []byte

func GetVxMinePool

func GetVxMinePool(db interfaces.VmDb) *big.Int

func GetVxToMineByPeriodId

func GetVxToMineByPeriodId(db interfaces.VmDb, periodId uint64) *big.Int

func GetVxUnlocksKey

func GetVxUnlocksKey(address types.Address) []byte

func GrantMarketToAgent

func GrantMarketToAgent(db interfaces.VmDb, principal, agent types.Address, marketId int32)

func HandleStakeAction

func HandleStakeAction(db interfaces.VmDb, stakeType, actionType uint8, address, principal types.Address, amount *big.Int, stakeHeight uint64, block *ledger.AccountBlock) ([]*ledger.AccountBlock, error)

func InitFundOwner

func InitFundOwner(owner types.Address)

func IsAdvancedLimitOrder

func IsAdvancedLimitOrder(order *Order, enrichOrderFork bool) bool

func IsAutoLockMinedVx

func IsAutoLockMinedVx(db interfaces.VmDb, address []byte) bool

func IsDexFeeFork

func IsDexFeeFork(db interfaces.VmDb) bool

func IsDexMiningFork

func IsDexMiningFork(db interfaces.VmDb) bool

func IsDexRobotFork

func IsDexRobotFork(db interfaces.VmDb) bool

func IsDexStableMarketFork

func IsDexStableMarketFork(db interfaces.VmDb) bool

func IsDexStopped

func IsDexStopped(db interfaces.VmDb) bool

func IsDustMarketBuyOrder added in v2.13.0

func IsDustMarketBuyOrder(order *Order, amount []byte, decimalsDiff int32, executedPrice []byte) bool

func IsDustOrder

func IsDustOrder(order *Order, quantity []byte, decimalsDiff int32, executedPrice []byte) bool

leave quantity is too small for calculate precision

func IsDustOrderAfterUpgrade12 added in v2.13.0

func IsDustOrderAfterUpgrade12(order *Order, quantity, amount []byte, decimalsDiff int32, executedPrice []byte) bool

leave amount is too small for calculate precision

func IsEarthFork

func IsEarthFork(db interfaces.VmDb) bool

func IsLeafFork

func IsLeafFork(db interfaces.VmDb) bool

func IsMakerMiningAdmin

func IsMakerMiningAdmin(db interfaces.VmDb, addr types.Address) bool

func IsMarketGrantedToAgent

func IsMarketGrantedToAgent(db interfaces.VmDb, principal, agent types.Address, marketId int32) bool

func IsMarketOrder

func IsMarketOrder(order *Order, enrichOrderFork bool) bool

func IsNormalMiningStarted

func IsNormalMiningStarted(db interfaces.VmDb) bool

func IsOperationValidWithMask

func IsOperationValidWithMask(operationCode, mask uint8) bool

func IsOrderDustForAmount added in v2.13.0

func IsOrderDustForAmount(order *Order, amount []byte, decimalsDiff int32, price []byte) bool

func IsOrderDustForPrice

func IsOrderDustForPrice(order *Order, quantity []byte, decimalsDiff int32, price []byte) bool

func IsOwner

func IsOwner(db interfaces.VmDb, address types.Address) bool

func IsStemFork

func IsStemFork(db interfaces.VmDb) bool

func IsValidFeeForMine

func IsValidFeeForMine(userFee *dexproto.FeeAccount, mineThreshold *big.Int) bool

func IsValidMiningStakeAmount

func IsValidMiningStakeAmount(amount *big.Int) bool

func IsValidMiningStakeAmountBytes

func IsValidMiningStakeAmountBytes(amount []byte) bool

func IsValidVxAmountBytesForDividend

func IsValidVxAmountBytesForDividend(amount []byte) bool

func IsValidVxAmountForDividend

func IsValidVxAmountForDividend(amount *big.Int) bool

func IsVersion10Upgrade

func IsVersion10Upgrade(db interfaces.VmDb) bool

func IsVersion11AddTransferAssetEvent added in v2.11.3

func IsVersion11AddTransferAssetEvent(db interfaces.VmDb) bool

func IsVersion11DeprecateClearingExpiredOrder added in v2.11.3

func IsVersion11DeprecateClearingExpiredOrder(db interfaces.VmDb) bool

func IsVersion11EnrichOrderFork added in v2.11.3

func IsVersion11EnrichOrderFork(db interfaces.VmDb) bool

func IsVersion12Upgrade added in v2.13.0

func IsVersion12Upgrade(db interfaces.VmDb) bool

func IsVipStakingWithId

func IsVipStakingWithId(staking *VIPStaking) bool

func LockMinedVx

func LockMinedVx(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account)

func LockVxForDividend

func LockVxForDividend(db interfaces.VmDb, address types.Address, amount *big.Int) (*dexproto.Account, error)

func MarkDexFeesFinishDividend

func MarkDexFeesFinishDividend(db interfaces.VmDb, dexFeesByPeriod *DexFeesByPeriod, periodId uint64)

dexFees used both by fee dividend and mined vx dividend

func MarkDexFeesFinishMine

func MarkDexFeesFinishMine(db interfaces.VmDb, dexFeesByPeriod *DexFeesByPeriod, periodId uint64)

func MatchMiningStakingByPeriod

func MatchMiningStakingByPeriod(miningStakings *MiningStakings, periodId uint64, checkDelete bool) (bool, []byte, bool, bool)

func MatchVxFundsByPeriod

func MatchVxFundsByPeriod(vxFunds *VxFunds, periodId uint64, checkDelete bool) (bool, []byte, bool, bool)

func MaxTotalFeeRate

func MaxTotalFeeRate(order Order) int32

func MinBigInt

func MinBigInt(a []byte, b []byte) []byte

func NegativeAmount

func NegativeAmount(amount []byte) *big.Int

func NewAndSaveMarketId

func NewAndSaveMarketId(db interfaces.VmDb) (newId int32)

func NewAndSaveOrderSerialNo

func NewAndSaveOrderSerialNo(db interfaces.VmDb, timestamp int64) (newSerialNo int32)

func NewDelegateStakeIndexSerialNo

func NewDelegateStakeIndexSerialNo(db interfaces.VmDb, address []byte) (serialNo uint64)

func NewInviteCode

func NewInviteCode(db interfaces.VmDb, hash types.Hash) uint32

func NormalizeToQuoteTokenTypeAmount

func NormalizeToQuoteTokenTypeAmount(amount []byte, tokenDecimals, quoteTokenType int32) []byte

func OnCancelMiningStakeSuccess

func OnCancelMiningStakeSuccess(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, amount, updatedAmount *big.Int) error

func OnCancelMiningStakeSuccessV2

func OnCancelMiningStakeSuccessV2(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, amount, updatedAmountV2 *big.Int) error

func OnDepositVx

func OnDepositVx(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, depositAmount *big.Int, updatedVxAccount *dexproto.Account) error

func OnMiningStakeSuccess

func OnMiningStakeSuccess(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, amount, updatedAmount *big.Int) error

func OnMiningStakeSuccessV2

func OnMiningStakeSuccessV2(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, amount, updatedAmountV2 *big.Int) error

func OnNewMarketGetTokenInfoFailed

func OnNewMarketGetTokenInfoFailed(db interfaces.VmDb, tradeTokenId types.TokenTypeId) (err error)

func OnNewMarketGetTokenInfoSuccess

func OnNewMarketGetTokenInfoSuccess(db interfaces.VmDb, reader util.ConsensusReader, tradeTokenId types.TokenTypeId, tokenInfoRes *ParamGetTokenInfoCallback) (appendBlocks []*ledger.AccountBlock, err error)

func OnNewMarketPending

func OnNewMarketPending(db interfaces.VmDb, param *ParamOpenNewMarket, marketInfo *MarketInfo) (data []byte, err error)

func OnNewMarketValid

func OnNewMarketValid(db interfaces.VmDb, reader util.ConsensusReader, marketInfo *MarketInfo, tradeToken, quoteToken types.TokenTypeId, address *types.Address) (blocks []*ledger.AccountBlock, err error)

func OnSetQuoteGetTokenInfoFailed

func OnSetQuoteGetTokenInfoFailed(db interfaces.VmDb, tokenId types.TokenTypeId) (err error)

func OnSetQuoteGetTokenInfoSuccess

func OnSetQuoteGetTokenInfoSuccess(db interfaces.VmDb, tokenInfoRes *ParamGetTokenInfoCallback) error

func OnSetQuoteTokenPending

func OnSetQuoteTokenPending(db interfaces.VmDb, token types.TokenTypeId, quoteTokenType uint8) []byte

func OnSettleVx

func OnSettleVx(db interfaces.VmDb, reader util.ConsensusReader, address []byte, fundSettle *dexproto.AccountSettle, updatedVxAccount *dexproto.Account) error

func OnTransferOwnerGetTokenInfoFailed

func OnTransferOwnerGetTokenInfoFailed(db interfaces.VmDb, tradeTokenId types.TokenTypeId) (err error)

func OnTransferOwnerGetTokenInfoSuccess

func OnTransferOwnerGetTokenInfoSuccess(db interfaces.VmDb, param *ParamGetTokenInfoCallback) error

func OnTransferTokenOwnerPending

func OnTransferTokenOwnerPending(db interfaces.VmDb, token types.TokenTypeId, origin, new types.Address) []byte

func OnVxMined

func OnVxMined(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, amount *big.Int) error

func OnWithdrawVx

func OnWithdrawVx(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, withdrawAmount *big.Int, updatedVxAccount *dexproto.Account) error

func PreCheckOrderParam

func PreCheckOrderParam(orderParam *ParamPlaceOrder, isStemFork bool) error

func PriceToBytes

func PriceToBytes(price string) []byte

func ReduceAccount

func ReduceAccount(db interfaces.VmDb, address types.Address, tokenId []byte, amount *big.Int) (*dexproto.Account, error)

func ReduceVipStakingHash

func ReduceVipStakingHash(stakings *VIPStaking, hash types.Hash) bool

func RenderFeeRate

func RenderFeeRate(address types.Address, order *Order, marketInfo *MarketInfo, db interfaces.VmDb)

func RenderMarketBuyOrderAmountAndFee

func RenderMarketBuyOrderAmountAndFee(order *Order)

marketOrder lockByFee will be simply set to maxFeeRate, regardless sell or buy feeRate difference, this will simplify the matcher logic

func RenderMarketInfo

func RenderMarketInfo(db interfaces.VmDb, marketInfo *MarketInfo, tradeToken, quoteToken types.TokenTypeId, tradeTokenInfo *TokenInfo, creator *types.Address) error

func RevokeMarketFromAgent

func RevokeMarketFromAgent(db interfaces.VmDb, principal, agent types.Address, marketId int32)

func RoundAmount

func RoundAmount(amountF *big.Float) *big.Int

func RoundQuantity added in v2.13.0

func RoundQuantity(quantityF *big.Float) *big.Int

func SafeSubBigInt

func SafeSubBigInt(amt []byte, sub []byte) (res, actualSub []byte, exceed bool)

func SaveCodeByInviter

func SaveCodeByInviter(db interfaces.VmDb, address types.Address, inviteCode uint32)

func SaveCurrentOperatorFees

func SaveCurrentOperatorFees(db interfaces.VmDb, reader util.ConsensusReader, operator []byte, operatorFeesByPeriod *OperatorFeesByPeriod)

func SaveDelegateStakeAddressIndex

func SaveDelegateStakeAddressIndex(db interfaces.VmDb, id types.Hash, stakeType int32, address []byte) uint64

func SaveDelegateStakeInfo

func SaveDelegateStakeInfo(db interfaces.VmDb, hash types.Hash, stakeType uint8, address, principal types.Address, amount *big.Int)

func SaveDexFeesByPeriodId

func SaveDexFeesByPeriodId(db interfaces.VmDb, periodId uint64, dexFeesByPeriod *DexFeesByPeriod)

func SaveDexFeesLastPeriodIdForRoll

func SaveDexFeesLastPeriodIdForRoll(db interfaces.VmDb, periodId uint64)

func SaveDexMiningStakings

func SaveDexMiningStakings(db interfaces.VmDb, ms *MiningStakings)

func SaveDexStopped

func SaveDexStopped(db interfaces.VmDb, isStopDex bool)

func SaveFirstMinedVxPeriodId

func SaveFirstMinedVxPeriodId(db interfaces.VmDb, periodId uint64)

func SaveFund

func SaveFund(db interfaces.VmDb, address types.Address, fund *Fund)

func SaveHashMapOrderId

func SaveHashMapOrderId(db interfaces.VmDb, sendHash []byte, orderId []byte)

func SaveInviterByCode

func SaveInviterByCode(db interfaces.VmDb, address types.Address, inviteCode uint32)

func SaveInviterByInvitee

func SaveInviterByInvitee(db interfaces.VmDb, invitee, inviter types.Address)

func SaveLastJobPeriodIdByBizType

func SaveLastJobPeriodIdByBizType(db interfaces.VmDb, periodId uint64, bizType uint8)

func SaveLastSettledMakerMinedVxPage

func SaveLastSettledMakerMinedVxPage(db interfaces.VmDb, pageId int32)

func SaveLastSettledMakerMinedVxPeriod

func SaveLastSettledMakerMinedVxPeriod(db interfaces.VmDb, periodId uint64)

func SaveMaintainer

func SaveMaintainer(db interfaces.VmDb, addr types.Address)

func SaveMakerMiningAdmin

func SaveMakerMiningAdmin(db interfaces.VmDb, addr types.Address)

func SaveMakerMiningPoolByPeriodId

func SaveMakerMiningPoolByPeriodId(db interfaces.VmDb, periodId uint64, amount *big.Int)

func SaveMarketInfo

func SaveMarketInfo(db interfaces.VmDb, marketInfo *MarketInfo, tradeToken, quoteToken types.TokenTypeId)

func SaveMarketInfoById

func SaveMarketInfoById(db interfaces.VmDb, marketInfo *MarketInfo)

func SaveMarketOrderAmtThreshold

func SaveMarketOrderAmtThreshold(db interfaces.VmDb, quoteTokenType uint8, amount *big.Int)

func SaveMineThreshold

func SaveMineThreshold(db interfaces.VmDb, quoteTokenType uint8, amount *big.Int)

func SaveMiningStakedAmount

func SaveMiningStakedAmount(db interfaces.VmDb, address types.Address, amount *big.Int)

func SaveMiningStakedV2Amount

func SaveMiningStakedV2Amount(db interfaces.VmDb, address types.Address, amount *big.Int)

func SaveMiningStakings

func SaveMiningStakings(db interfaces.VmDb, address types.Address, ps *MiningStakings)

func SavePendingNewMarkets

func SavePendingNewMarkets(db interfaces.VmDb, pendingNewMarkets *PendingNewMarkets)

func SavePendingSetQuotes

func SavePendingSetQuotes(db interfaces.VmDb, pendingSetQuotes *PendingSetQuotes)

func SavePendingTransferTokenOwners

func SavePendingTransferTokenOwners(db interfaces.VmDb, pendings *PendingTransferTokenOwnerActions)

func SaveSuperVIPStaking

func SaveSuperVIPStaking(db interfaces.VmDb, address types.Address, superVIPStaking *VIPStaking)

func SaveTokenInfo

func SaveTokenInfo(db interfaces.VmDb, token types.TokenTypeId, tokenInfo *TokenInfo)

func SaveTradeThreshold

func SaveTradeThreshold(db interfaces.VmDb, quoteTokenType uint8, amount *big.Int)

func SaveUserFees

func SaveUserFees(db interfaces.VmDb, address []byte, userFees *UserFees)

func SaveVIPStaking

func SaveVIPStaking(db interfaces.VmDb, address types.Address, vipStaking *VIPStaking)

func SaveVxBurnAmount

func SaveVxBurnAmount(db interfaces.VmDb, amount *big.Int)

func SaveVxFunds

func SaveVxFunds(db interfaces.VmDb, address []byte, vxFunds *VxFunds)

func SaveVxFundsWithForkCheck

func SaveVxFundsWithForkCheck(db interfaces.VmDb, address []byte, vxFunds *VxFunds)

func SaveVxLockedFunds

func SaveVxLockedFunds(db interfaces.VmDb, address []byte, vxFunds *VxFunds)

func SaveVxLockedSumFunds

func SaveVxLockedSumFunds(db interfaces.VmDb, vxLockedSumFunds *VxFunds)

func SaveVxMinePool

func SaveVxMinePool(db interfaces.VmDb, amount *big.Int)

func SaveVxSumFunds

func SaveVxSumFunds(db interfaces.VmDb, vxSumFunds *VxFunds)

func SaveVxSumFundsWithForkCheck

func SaveVxSumFundsWithForkCheck(db interfaces.VmDb, vxSumFunds *VxFunds)

func ScheduleCancelStake

func ScheduleCancelStake(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account, err error)

func ScheduleVxUnlockForDividend

func ScheduleVxUnlockForDividend(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account, err error)

func SetAutoLockMinedVx

func SetAutoLockMinedVx(db interfaces.VmDb, address []byte, enable bool)

func SetDexTimestamp

func SetDexTimestamp(db interfaces.VmDb, timestamp int64, reader util.ConsensusReader) error

func SetOwner

func SetOwner(db interfaces.VmDb, address types.Address)

func SetPeriodJobTrigger

func SetPeriodJobTrigger(db interfaces.VmDb, address types.Address)

func SetTimeOracle

func SetTimeOracle(db interfaces.VmDb, address types.Address)

func SetTradeTimestamp

func SetTradeTimestamp(db interfaces.VmDb, timestamp int64)

func SettleFees

func SettleFees(db interfaces.VmDb, reader util.ConsensusReader, allowMining bool, feeToken []byte, feeTokenDecimals, quoteTokenType int32, feeActions []*dexproto.FeeSettle, feeForDividend *big.Int, inviteRelations map[types.Address]*types.Address)

func SettleFeesWithTokenId

func SettleFeesWithTokenId(db interfaces.VmDb, reader util.ConsensusReader, allowMining bool, tokenId types.TokenTypeId, feeTokenDecimals, quoteTokenType int32, feeActions []*dexproto.FeeSettle, feeForDividend *big.Int, inviteRelations map[types.Address]*types.Address)

func SettleOperatorFees

func SettleOperatorFees(db interfaces.VmDb, reader util.ConsensusReader, feeActions []*dexproto.FeeSettle, marketInfo *MarketInfo)

func StartNormalMine

func StartNormalMine(db interfaces.VmDb)

func SubBigInt

func SubBigInt(a []byte, b []byte) *big.Int

func SubBigIntAbs

func SubBigIntAbs(a []byte, b []byte) []byte

func TruncateUserFeesToPeriod

func TruncateUserFeesToPeriod(userFees *UserFees, periodId uint64) (truncated bool)

func TryUpdateTimestamp

func TryUpdateTimestamp(db interfaces.VmDb, timestamp int64, preHash types.Hash)

func Uint32ToBytes

func Uint32ToBytes(value uint32) []byte

func Uint64ToBytes

func Uint64ToBytes(value uint64) []byte

func UpdateCancelStakes

func UpdateCancelStakes(db interfaces.VmDb, address types.Address, cancelStakes *CancelStakes)

func UpdateVxUnlocks

func UpdateVxUnlocks(db interfaces.VmDb, address types.Address, unlocks *VxUnlocks)

func ValidOperatorFeeRate

func ValidOperatorFeeRate(feeRate int32) bool

func ValidPrice

func ValidPrice(price string, isFork bool) bool

func ValidTimeOracle

func ValidTimeOracle(db interfaces.VmDb, address types.Address) bool

func ValidTriggerAddress

func ValidTriggerAddress(db interfaces.VmDb, address types.Address) bool

func VerifyNewOrderPriceForRpc

func VerifyNewOrderPriceForRpc(data []byte) (valid bool)

Types

type Account

type Account struct {
	Token           types.TokenTypeId
	Available       *big.Int
	Locked          *big.Int
	VxLocked        *big.Int
	VxUnlocking     *big.Int
	CancellingStake *big.Int
}

func GetAccounts

func GetAccounts(fund *Fund, tokenId *types.TokenTypeId) ([]*Account, error)

func (*Account) Deserialize

func (account *Account) Deserialize(pb *dexProto.Account)

func (*Account) Serialize

func (account *Account) Serialize() *dexProto.Account

type AccountSettleSorter

type AccountSettleSorter []*dexproto.AccountSettle

func (AccountSettleSorter) Len

func (st AccountSettleSorter) Len() int

func (AccountSettleSorter) Less

func (st AccountSettleSorter) Less(i, j int) bool

func (AccountSettleSorter) Swap

func (st AccountSettleSorter) Swap(i, j int)

type AmountWithToken

type AmountWithToken struct {
	Token   types.TokenTypeId
	Amount  *big.Int
	Deleted bool
}

func MapToAmountWithTokens

func MapToAmountWithTokens(mp map[types.TokenTypeId]*big.Int) []*AmountWithToken

type AmountWithTokenSorter

type AmountWithTokenSorter []*AmountWithToken

func (AmountWithTokenSorter) Len

func (st AmountWithTokenSorter) Len() int

func (AmountWithTokenSorter) Less

func (st AmountWithTokenSorter) Less(i, j int) bool

func (AmountWithTokenSorter) Swap

func (st AmountWithTokenSorter) Swap(i, j int)

type BurnViteEvent

type BurnViteEvent struct {
	dexproto.BurnVite
}

func (*BurnViteEvent) FromBytes

func (bv *BurnViteEvent) FromBytes(data []byte) (err error)

func (*BurnViteEvent) GetTopicId

func (bv *BurnViteEvent) GetTopicId() types.Hash

type CancelStakes

type CancelStakes struct {
	dexproto.CancelStakes
}

func GetCancelStakes

func GetCancelStakes(db interfaces.VmDb, address types.Address) (cancelStakes *CancelStakes, ok bool)

func (*CancelStakes) DeSerialize

func (cs *CancelStakes) DeSerialize(data []byte) error

func (*CancelStakes) Serialize

func (cs *CancelStakes) Serialize() (data []byte, err error)

type DelegateStakeAddressIndex

type DelegateStakeAddressIndex struct {
	dexproto.DelegateStakeAddressIndex
}

func (*DelegateStakeAddressIndex) DeSerialize

func (dsi *DelegateStakeAddressIndex) DeSerialize(data []byte) error

func (*DelegateStakeAddressIndex) Serialize

func (dsi *DelegateStakeAddressIndex) Serialize() (data []byte, err error)

type DelegateStakeInfo

type DelegateStakeInfo struct {
	dexproto.DelegateStakeInfo
}

func GetDelegateStakeInfo

func GetDelegateStakeInfo(db interfaces.VmDb, hash []byte) (info *DelegateStakeInfo, ok bool)

func GetStakeInfoList

func GetStakeInfoList(db interfaces.VmDb, stakeAddr types.Address, filter func(*DelegateStakeAddressIndex) bool) ([]*DelegateStakeInfo, *big.Int, error)

func GetStakeListByPage

func GetStakeListByPage(db abi.StorageDatabase, lastKey []byte, count int) (infos []*DelegateStakeInfo, newLastKey []byte, err error)

func (*DelegateStakeInfo) DeSerialize

func (dsi *DelegateStakeInfo) DeSerialize(data []byte) error

func (*DelegateStakeInfo) Serialize

func (dsi *DelegateStakeInfo) Serialize() (data []byte, err error)

type DexEvent

type DexEvent interface {
	GetTopicId() types.Hash

	FromBytes([]byte) error
	// contains filtered or unexported methods
}

type DexFeesByPeriod

type DexFeesByPeriod struct {
	dexproto.DexFeesByPeriod
}

func GetCurrentDexFees

func GetCurrentDexFees(db interfaces.VmDb, reader util.ConsensusReader) (*DexFeesByPeriod, bool)

func GetDexFeesByPeriodId

func GetDexFeesByPeriodId(db interfaces.VmDb, periodId uint64) (*DexFeesByPeriod, bool)

func RollAndGentNewDexFeesByPeriod

func RollAndGentNewDexFeesByPeriod(db interfaces.VmDb, periodId uint64) (rolledDexFeesByPeriod *DexFeesByPeriod)

func (*DexFeesByPeriod) DeSerialize

func (df *DexFeesByPeriod) DeSerialize(data []byte) (err error)

func (*DexFeesByPeriod) Serialize

func (df *DexFeesByPeriod) Serialize() (data []byte, err error)

type ErrEvent

type ErrEvent struct {
	// contains filtered or unexported fields
}

func (*ErrEvent) FromBytes

func (err *ErrEvent) FromBytes(data []byte) (errRes error)

func (*ErrEvent) GetTopicId

func (err *ErrEvent) GetTopicId() types.Hash

type FeeDividendEvent

type FeeDividendEvent struct {
	dexproto.FeeDividendForVxHolder
}

func (*FeeDividendEvent) FromBytes

func (fde *FeeDividendEvent) FromBytes(data []byte) (err error)

func (*FeeDividendEvent) GetTopicId

func (fde *FeeDividendEvent) GetTopicId() types.Hash

type FeeSettleSorter

type FeeSettleSorter []*dexproto.FeeSettle

func (FeeSettleSorter) Len

func (st FeeSettleSorter) Len() int

func (FeeSettleSorter) Less

func (st FeeSettleSorter) Less(i, j int) bool

func (FeeSettleSorter) Swap

func (st FeeSettleSorter) Swap(i, j int)

type Fund

type Fund struct {
	dexproto.Fund
}

func GetFund

func GetFund(db interfaces.VmDb, address types.Address) (fund *Fund, ok bool)

func GetUserFundsByPage

func GetUserFundsByPage(db abi.StorageDatabase, lastAddress types.Address, count int) (funds []*Fund, err error)

func (*Fund) DeSerialize

func (df *Fund) DeSerialize(fundData []byte) (err error)

func (*Fund) Serialize

func (df *Fund) Serialize() (data []byte, err error)

type FundSettleSorter

type FundSettleSorter []*dexproto.FundSettle

func (FundSettleSorter) Len

func (st FundSettleSorter) Len() int

func (FundSettleSorter) Less

func (st FundSettleSorter) Less(i, j int) bool

func (FundSettleSorter) Swap

func (st FundSettleSorter) Swap(i, j int)

type FundVerifyItem

type FundVerifyItem struct {
	TokenId        types.TokenTypeId `json:"tokenId"`
	Balance        string            `json:"balance"`
	Amount         string            `json:"amount"`
	UserAmount     string            `json:"userAmount"`
	FeeAmount      string            `json:"feeAmount"`
	FeeOccupy      string            `json:"feeOccupy"`
	BalanceMatched bool              `json:"balanceMatched"`
}

type FundVerifyRes

type FundVerifyRes struct {
	UserCount      int                                   `json:"userCount"`
	BalanceMatched bool                                  `json:"balanceMatched"`
	VerifyItems    map[types.TokenTypeId]*FundVerifyItem `json:"balances"`
}

func VerifyDexFundBalance

func VerifyDexFundBalance(db interfaces.VmDb, reader *util.VMConsensusReader) *FundVerifyRes

type GrantMarketToAgentEvent

type GrantMarketToAgentEvent struct {
	dexproto.MarketAgentRelation
}

func (*GrantMarketToAgentEvent) FromBytes

func (gmta *GrantMarketToAgentEvent) FromBytes(data []byte) (err error)

func (*GrantMarketToAgentEvent) GetTopicId

func (gmta *GrantMarketToAgentEvent) GetTopicId() types.Hash

type InviteRelationEvent

type InviteRelationEvent struct {
	dexproto.InviteRelation
}

func (*InviteRelationEvent) FromBytes

func (ir *InviteRelationEvent) FromBytes(data []byte) (err error)

func (*InviteRelationEvent) GetTopicId

func (ir *InviteRelationEvent) GetTopicId() types.Hash

type MarketEvent

type MarketEvent struct {
	dexproto.MarketInfo
}

func (*MarketEvent) FromBytes

func (me *MarketEvent) FromBytes(data []byte) (err error)

func (*MarketEvent) GetTopicId

func (me *MarketEvent) GetTopicId() types.Hash

type MarketInfo

type MarketInfo struct {
	dexproto.MarketInfo
}

func CleanExpireOrders

func CleanExpireOrders(db interfaces.VmDb, orderIds []byte) (map[types.Address]map[bool]*dexproto.AccountSettle, *MarketInfo, error)

func GetMarketInfo

func GetMarketInfo(db interfaces.VmDb, tradeToken, quoteToken types.TokenTypeId) (marketInfo *MarketInfo, ok bool)

func GetMarketInfoById

func GetMarketInfoById(db interfaces.VmDb, marketId int32) (marketInfo *MarketInfo, ok bool)

func GetMarketInfoByTokens

func GetMarketInfoByTokens(db interfaces.VmDb, tradeTokenData, quoteTokenData []byte) (marketInfo *MarketInfo, ok bool)

func GetMarkets added in v2.11.3

func GetMarkets(db interfaces.VmDb) (markets []*MarketInfo, ok bool)

func RenderOrder

func RenderOrder(order *Order, param *ParamPlaceOrder, db interfaces.VmDb, accountAddress, agent *types.Address, sendHash types.Hash, enrichOrderFork bool) (*MarketInfo, error)

func (*MarketInfo) DeSerialize

func (mi *MarketInfo) DeSerialize(data []byte) error

func (*MarketInfo) Serialize

func (mi *MarketInfo) Serialize() (data []byte, err error)

type Matcher

type Matcher struct {
	MarketInfo *MarketInfo
	// contains filtered or unexported fields
}

func NewMatcher

func NewMatcher(db interfaces.VmDb, marketId int32) (mc *Matcher, err error)

func NewMatcherWithMarketInfo

func NewMatcherWithMarketInfo(db interfaces.VmDb, marketInfo *MarketInfo) (mc *Matcher)

func NewRawMatcher

func NewRawMatcher(db interfaces.VmDb) (mc *Matcher)

func (*Matcher) CancelOrderById

func (mc *Matcher) CancelOrderById(order *Order)

func (*Matcher) GetFees

func (mc *Matcher) GetFees() map[types.Address]*proto.FeeSettle

func (*Matcher) GetFundSettles

func (mc *Matcher) GetFundSettles() map[types.Address]map[bool]*proto.AccountSettle

func (*Matcher) GetOrderById

func (mc *Matcher) GetOrderById(orderId []byte) (*Order, error)

func (*Matcher) GetOrdersFromMarket

func (mc *Matcher) GetOrdersFromMarket(side bool, begin, end int) ([]*Order, int, error)

func (*Matcher) MatchOrder

func (mc *Matcher) MatchOrder(taker *Order, preHash types.Hash) (err error)

type MinedVxForInviteeFeeEvent

type MinedVxForInviteeFeeEvent struct {
	dexproto.MinedVxForFee
}

func (*MinedVxForInviteeFeeEvent) FromBytes

func (mif *MinedVxForInviteeFeeEvent) FromBytes(data []byte) (err error)

func (*MinedVxForInviteeFeeEvent) GetTopicId

func (mif *MinedVxForInviteeFeeEvent) GetTopicId() types.Hash

type MinedVxForOperationEvent

type MinedVxForOperationEvent struct {
	dexproto.MinedVxForOperation
}

func (*MinedVxForOperationEvent) FromBytes

func (mo *MinedVxForOperationEvent) FromBytes(data []byte) (err error)

func (*MinedVxForOperationEvent) GetTopicId

func (mo *MinedVxForOperationEvent) GetTopicId() types.Hash

type MinedVxForStakingEvent

type MinedVxForStakingEvent struct {
	dexproto.MinedVxForStaking
}

func (*MinedVxForStakingEvent) FromBytes

func (mp *MinedVxForStakingEvent) FromBytes(data []byte) (err error)

func (*MinedVxForStakingEvent) GetTopicId

func (mp *MinedVxForStakingEvent) GetTopicId() types.Hash

type MinedVxForTradeFeeEvent

type MinedVxForTradeFeeEvent struct {
	dexproto.MinedVxForFee
}

func (*MinedVxForTradeFeeEvent) FromBytes

func (mtf *MinedVxForTradeFeeEvent) FromBytes(data []byte) (err error)

func (*MinedVxForTradeFeeEvent) GetTopicId

func (mtf *MinedVxForTradeFeeEvent) GetTopicId() types.Hash

type MiningStakings

type MiningStakings struct {
	dexproto.MiningStakings
}

func GetDexMiningStakings

func GetDexMiningStakings(db interfaces.VmDb) (dexMiningStakings *MiningStakings, ok bool)

func GetMiningStakings

func GetMiningStakings(db interfaces.VmDb, address types.Address) (miningStakings *MiningStakings, ok bool)

func (*MiningStakings) DeSerialize

func (mss *MiningStakings) DeSerialize(data []byte) error

func (*MiningStakings) Serialize

func (mss *MiningStakings) Serialize() (data []byte, err error)

type NewOrderEvent

type NewOrderEvent struct {
	dexproto.NewOrderInfo
}

func (*NewOrderEvent) FromBytes

func (od *NewOrderEvent) FromBytes(data []byte) (err error)

func (*NewOrderEvent) GetTopicId

func (od *NewOrderEvent) GetTopicId() types.Hash

type OperatorFeeDividendEvent

type OperatorFeeDividendEvent struct {
	dexproto.OperatorFeeDividend
}

func (*OperatorFeeDividendEvent) FromBytes

func (bfd *OperatorFeeDividendEvent) FromBytes(data []byte) (err error)

func (*OperatorFeeDividendEvent) GetTopicId

func (bfd *OperatorFeeDividendEvent) GetTopicId() types.Hash

type OperatorFeesByPeriod

type OperatorFeesByPeriod struct {
	dexproto.OperatorFeesByPeriod
}

func GetCurrentOperatorFees

func GetCurrentOperatorFees(db interfaces.VmDb, reader util.ConsensusReader, operator []byte) (*OperatorFeesByPeriod, bool)

func GetOperatorFeesByPeriodId

func GetOperatorFeesByPeriodId(db interfaces.VmDb, operator []byte, periodId uint64) (*OperatorFeesByPeriod, bool)

func (*OperatorFeesByPeriod) DeSerialize

func (bfs *OperatorFeesByPeriod) DeSerialize(data []byte) (err error)

func (*OperatorFeesByPeriod) Serialize

func (bfs *OperatorFeesByPeriod) Serialize() (data []byte, err error)

type Order

type Order struct {
	dexproto.Order
}

func (*Order) DeSerialize

func (od *Order) DeSerialize(orderData []byte) error

func (*Order) DeSerializeCompact

func (od *Order) DeSerializeCompact(orderData []byte, orderId []byte) error

func (*Order) RenderOrderById

func (od *Order) RenderOrderById(orderId []byte) error

func (*Order) Serialize

func (od *Order) Serialize() ([]byte, error)

func (*Order) SerializeCompact

func (od *Order) SerializeCompact() ([]byte, error)

type OrderTx

type OrderTx struct {
	proto.Transaction
	// contains filtered or unexported fields
}

type OrderUpdateEvent

type OrderUpdateEvent struct {
	dexproto.OrderUpdateInfo
}

func (*OrderUpdateEvent) FromBytes

func (od *OrderUpdateEvent) FromBytes(data []byte) (err error)

func (*OrderUpdateEvent) GetTopicId

func (od *OrderUpdateEvent) GetTopicId() types.Hash

type ParamAssignedWithdraw

type ParamAssignedWithdraw struct {
	Target types.Address
	Token  types.TokenTypeId
	Amount *big.Int
	Label  []byte
}

type ParamCancelOrderByHash

type ParamCancelOrderByHash struct {
	SendHash   types.Hash
	Principal  types.Address
	TradeToken types.TokenTypeId
	QuoteToken types.TokenTypeId
}

type ParamCancelStakeById

type ParamCancelStakeById struct {
	Id types.Hash
}

type ParamCommonAdminConfig

type ParamCommonAdminConfig struct {
	OperationCode uint8             // 1 stableMarket, 2 marketOrderAmtThreshold
	TradeToken    types.TokenTypeId // 1 stableMarket
	QuoteToken    types.TokenTypeId // 1 stableMarket, 2 marketOrderAmtThreshold
	Enable        bool              // 1 stableMarket
	Value         int32
	Amount        *big.Int // 2 marketOrderAmtThreshold
	Address       types.Address
}

type ParamConfigMarketAgents

type ParamConfigMarketAgents struct {
	ActionType  uint8 // 1: grant 2: revoke
	Agent       types.Address
	TradeTokens []types.TokenTypeId
	QuoteTokens []types.TokenTypeId
}

type ParamDelegateStakeCallback

type ParamDelegateStakeCallback struct {
	StakeAddress types.Address
	Beneficiary  types.Address
	Amount       *big.Int
	Bid          uint8
	Success      bool
}

type ParamDelegateStakeCallbackV2

type ParamDelegateStakeCallbackV2 struct {
	Id      types.Hash
	Success bool
}

type ParamDexAdminConfig

type ParamDexAdminConfig struct {
	OperationCode    uint8
	Owner            types.Address // 1 owner
	TimeOracle       types.Address // 2 timeOracle
	PeriodJobTrigger types.Address // 4 periodJobTrigger
	StopDex          bool          // 8 stopDex
	MakerMiningAdmin types.Address // 16 maker mining admin
	Maintainer       types.Address // 32 maintainer
}

type ParamDexCancelOrder

type ParamDexCancelOrder struct {
	OrderId []byte
}

type ParamDexInnerCancelOrder

type ParamDexInnerCancelOrder struct {
	SendHash types.Hash
	Owner    types.Address
}

type ParamGetTokenInfoCallback

type ParamGetTokenInfoCallback struct {
	TokenId     types.TokenTypeId
	Bid         uint8
	Exist       bool
	Decimals    uint8
	TokenSymbol string
	Index       uint16
	Owner       types.Address
}

type ParamLockVxForDividend

type ParamLockVxForDividend struct {
	ActionType uint8 // 1: lockVx 2: unlockVx
	Amount     *big.Int
}

type ParamMarketAdminConfig

type ParamMarketAdminConfig struct {
	OperationCode uint8 // 1 owner, 2 takerRate, 4 makerRate, 8 stopMarket
	TradeToken    types.TokenTypeId
	QuoteToken    types.TokenTypeId
	MarketOwner   types.Address
	TakerFeeRate  int32
	MakerFeeRate  int32
	StopMarket    bool
}

type ParamNotifyTime

type ParamNotifyTime struct {
	Timestamp int64
}

type ParamOpenNewMarket

type ParamOpenNewMarket struct {
	TradeToken types.TokenTypeId
	QuoteToken types.TokenTypeId
}

type ParamPlaceAgentOrder

type ParamPlaceAgentOrder struct {
	Principal types.Address
	ParamPlaceOrder
}

type ParamPlaceOrder

type ParamPlaceOrder struct {
	TradeToken types.TokenTypeId
	QuoteToken types.TokenTypeId
	Side       bool
	OrderType  uint8
	Price      string
	Quantity   *big.Int
}

type ParamSerializedData

type ParamSerializedData struct {
	Data []byte
}

type ParamStakeForMining

type ParamStakeForMining struct {
	ActionType uint8 // 1: stake 2: cancel stake
	Amount     *big.Int
}

type ParamStakeForVIP

type ParamStakeForVIP struct {
	ActionType uint8 // 1: stake 2: cancel stake
}

type ParamSwitchConfig

type ParamSwitchConfig struct {
	SwitchType uint8 // 1: autoLockMinedVx
	Enable     bool
}

type ParamTradeAdminConfig

type ParamTradeAdminConfig struct {
	OperationCode               uint8
	TradeToken                  types.TokenTypeId // 1 mineMarket
	QuoteToken                  types.TokenTypeId // 1 mineMarket
	AllowMining                 bool              // 1 mineMarket
	NewQuoteToken               types.TokenTypeId // 2 new quote token
	QuoteTokenType              uint8             // 2 new quote token
	TokenTypeForTradeThreshold  uint8             // 4 tradeThreshold
	MinTradeThreshold           *big.Int          // 4 tradeThreshold
	TokenTypeForMiningThreshold uint8             // 8 miningThreshold
	MinMiningThreshold          *big.Int          // 8 miningThreshold
}

type ParamTransferConfig

type ParamTransferConfig struct {
	Target types.Address
	Token  types.TokenTypeId
	Amount *big.Int
}

type ParamTransferTokenOwnership

type ParamTransferTokenOwnership struct {
	Token    types.TokenTypeId
	NewOwner types.Address
}

type ParamTriggerPeriodJob

type ParamTriggerPeriodJob struct {
	PeriodId uint64
	BizType  uint8
}

type ParamWithdraw

type ParamWithdraw struct {
	Token  types.TokenTypeId
	Amount *big.Int
}

type PendingNewMarkets

type PendingNewMarkets struct {
	dexproto.PendingNewMarkets
}

func GetPendingNewMarkets

func GetPendingNewMarkets(db interfaces.VmDb) (pendingNewMarkets *PendingNewMarkets, ok bool)

func (*PendingNewMarkets) DeSerialize

func (pnm *PendingNewMarkets) DeSerialize(data []byte) error

func (*PendingNewMarkets) Serialize

func (pnm *PendingNewMarkets) Serialize() (data []byte, err error)

type PendingSetQuotes

type PendingSetQuotes struct {
	dexproto.PendingSetQuoteTokenActions
}

func GetPendingSetQuotes

func GetPendingSetQuotes(db interfaces.VmDb) (pendingSetQuotes *PendingSetQuotes, ok bool)

func (*PendingSetQuotes) DeSerialize

func (psq *PendingSetQuotes) DeSerialize(data []byte) error

func (*PendingSetQuotes) Serialize

func (psq *PendingSetQuotes) Serialize() (data []byte, err error)

type PendingTransferTokenOwnerActions

type PendingTransferTokenOwnerActions struct {
	dexproto.PendingTransferTokenOwnerActions
}

func GetPendingTransferTokenOwners

func GetPendingTransferTokenOwners(db interfaces.VmDb) (pendings *PendingTransferTokenOwnerActions, ok bool)

func (*PendingTransferTokenOwnerActions) DeSerialize

func (psq *PendingTransferTokenOwnerActions) DeSerialize(data []byte) error

func (*PendingTransferTokenOwnerActions) Serialize

func (psq *PendingTransferTokenOwnerActions) Serialize() (data []byte, err error)

type PeriodJobWithBizEvent

type PeriodJobWithBizEvent struct {
	dexproto.PeriodJobForBiz
}

func (*PeriodJobWithBizEvent) FromBytes

func (pb *PeriodJobWithBizEvent) FromBytes(data []byte) (err error)

func (*PeriodJobWithBizEvent) GetTopicId

func (pb *PeriodJobWithBizEvent) GetTopicId() types.Hash

type QuoteTokenTypeInfo

type QuoteTokenTypeInfo struct {
	Decimals                       int32
	DefaultTradeThreshold          *big.Int
	DefaultMineThreshold           *big.Int
	DefaultMarketOrderAmtThreshold *big.Int
}

type RevokeMarketFromAgentEvent

type RevokeMarketFromAgentEvent struct {
	dexproto.MarketAgentRelation
}

func (*RevokeMarketFromAgentEvent) FromBytes

func (rmfa *RevokeMarketFromAgentEvent) FromBytes(data []byte) (err error)

func (*RevokeMarketFromAgentEvent) GetTopicId

func (rmfa *RevokeMarketFromAgentEvent) GetTopicId() types.Hash

type SerialNo

type SerialNo struct {
	dexproto.SerialNo
}

func (*SerialNo) DeSerialize

func (osn *SerialNo) DeSerialize(data []byte) error

func (*SerialNo) Serialize

func (osn *SerialNo) Serialize() (data []byte, err error)

type SerializableDex

type SerializableDex interface {
	Serialize() ([]byte, error)
	DeSerialize([]byte) error
}

type SettleMakerMinedVxEvent

type SettleMakerMinedVxEvent struct {
	dexproto.SettleMakerMinedVx
}

func (*SettleMakerMinedVxEvent) FromBytes

func (smmv *SettleMakerMinedVxEvent) FromBytes(data []byte) (err error)

func (*SettleMakerMinedVxEvent) GetTopicId

func (smmv *SettleMakerMinedVxEvent) GetTopicId() types.Hash

type TokenEvent

type TokenEvent struct {
	dexproto.TokenInfo
}

func (*TokenEvent) FromBytes

func (te *TokenEvent) FromBytes(data []byte) (err error)

func (*TokenEvent) GetTopicId

func (te *TokenEvent) GetTopicId() types.Hash

type TokenInfo

type TokenInfo struct {
	dexproto.TokenInfo
}

func GetTokenInfo

func GetTokenInfo(db interfaces.VmDb, token types.TokenTypeId) (tokenInfo *TokenInfo, ok bool)

func (*TokenInfo) DeSerialize

func (tk *TokenInfo) DeSerialize(data []byte) error

func (*TokenInfo) Serialize

func (tk *TokenInfo) Serialize() (data []byte, err error)

type TransactionEvent

type TransactionEvent struct {
	dexproto.Transaction
}

func (*TransactionEvent) FromBytes

func (tx *TransactionEvent) FromBytes(data []byte) (err error)

func (*TransactionEvent) GetTopicId

func (tx *TransactionEvent) GetTopicId() types.Hash

type TransferAssetEvent

type TransferAssetEvent struct {
	dexproto.TransferAsset
}

func (*TransferAssetEvent) FromBytes

func (tfa *TransferAssetEvent) FromBytes(data []byte) (err error)

func (*TransferAssetEvent) GetTopicId

func (tfa *TransferAssetEvent) GetTopicId() types.Hash

type UserFees

type UserFees struct {
	dexproto.UserFees
}

func GetUserFees

func GetUserFees(db interfaces.VmDb, address []byte) (userFees *UserFees, ok bool)

func (*UserFees) DeSerialize

func (ufs *UserFees) DeSerialize(userFeesData []byte) error

func (*UserFees) Serialize

func (ufs *UserFees) Serialize() (data []byte, err error)

type VIPStaking

type VIPStaking struct {
	dexproto.VIPStaking
}

func GetSuperVIPStaking

func GetSuperVIPStaking(db interfaces.VmDb, address types.Address) (superVIPStaking *VIPStaking, ok bool)

func GetVIPStaking

func GetVIPStaking(db interfaces.VmDb, address types.Address) (vipStaking *VIPStaking, ok bool)

func (*VIPStaking) DeSerialize

func (pv *VIPStaking) DeSerialize(data []byte) error

func (*VIPStaking) Serialize

func (pv *VIPStaking) Serialize() (data []byte, err error)

type VxFunds

type VxFunds struct {
	dexproto.VxFunds
}

func GetVxFunds

func GetVxFunds(db interfaces.VmDb, address []byte) (vxFunds *VxFunds, ok bool)

func GetVxFundsWithForkCheck

func GetVxFundsWithForkCheck(db interfaces.VmDb, address []byte) (vxFunds *VxFunds, ok bool)

func GetVxLockedFunds

func GetVxLockedFunds(db interfaces.VmDb, address []byte) (vxFunds *VxFunds, ok bool)

func GetVxLockedSumFunds

func GetVxLockedSumFunds(db interfaces.VmDb) (vxLockedSumFunds *VxFunds, ok bool)

func GetVxSumFunds

func GetVxSumFunds(db interfaces.VmDb) (vxSumFunds *VxFunds, ok bool)

func GetVxSumFundsWithForkCheck

func GetVxSumFundsWithForkCheck(db interfaces.VmDb) (vxSumFunds *VxFunds, ok bool)

func (*VxFunds) DeSerialize

func (dvf *VxFunds) DeSerialize(vxFundsData []byte) error

func (*VxFunds) Serialize

func (dvf *VxFunds) Serialize() (data []byte, err error)

type VxUnlocks

type VxUnlocks struct {
	dexproto.VxUnlocks
}

func GetVxUnlocks

func GetVxUnlocks(db interfaces.VmDb, address types.Address) (unlocks *VxUnlocks, ok bool)

func (*VxUnlocks) DeSerialize

func (vu *VxUnlocks) DeSerialize(data []byte) error

func (*VxUnlocks) Serialize

func (vu *VxUnlocks) Serialize() (data []byte, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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