Documentation ¶
Index ¶
- Constants
- Variables
- func AccumulateAmountFromMap(amountMap map[int32]*big.Int) *big.Int
- func AddBigInt(a []byte, b []byte) []byte
- func AddBurnViteEvent(db interfaces.VmDb, bizType int, amount *big.Int)
- func AddCancelStake(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...)
- func AddErrEvent(db interfaces.VmDb, err error)
- func AddFeeDividendEvent(db interfaces.VmDb, address types.Address, feeToken types.TokenTypeId, ...)
- func AddGrantMarketToAgentEvent(db interfaces.VmDb, principal, agent types.Address, marketId int32)
- func AddInviteRelationEvent(db interfaces.VmDb, inviter, invitee types.Address, inviteCode uint32)
- func AddMarketEvent(db interfaces.VmDb, marketInfo *MarketInfo)
- func AddMinedVxForInviteeFeeEvent(db interfaces.VmDb, address types.Address, quoteTokenType int32, ...)
- func AddMinedVxForOperationEvent(db interfaces.VmDb, bizType int32, address types.Address, amount *big.Int)
- func AddMinedVxForStakingEvent(db interfaces.VmDb, address types.Address, stakedAmt, minedAmt *big.Int)
- func AddMinedVxForTradeFeeEvent(db interfaces.VmDb, address types.Address, quoteTokenType int32, ...)
- func AddOperatorFeeDividendEvent(db interfaces.VmDb, address types.Address, ...)
- func AddPeriodWithBizEvent(db interfaces.VmDb, periodId uint64, bizType uint8)
- func AddRevokeMarketFromAgentEvent(db interfaces.VmDb, principal, agent types.Address, marketId int32)
- func AddSettleMakerMinedVxEvent(db interfaces.VmDb, periodId uint64, page int32, finish bool)
- func AddToPendingNewMarkets(db interfaces.VmDb, tradeToken, quoteToken types.TokenTypeId) error
- func AddToPendingSetQuotes(db interfaces.VmDb, token types.TokenTypeId, quoteType uint8)
- func AddToPendingTransferTokenOwners(db interfaces.VmDb, token types.TokenTypeId, origin, new types.Address)
- func AddTokenEvent(db interfaces.VmDb, tokenInfo *TokenInfo)
- func AddTransferAssetEvent(db interfaces.VmDb, bizType int, from, to types.Address, ...)
- func AddVxUnlock(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...)
- func AdjustAmountForDecimalsDiff(amount []byte, decimalsDiff int32) *big.Int
- func AdjustForDecimalsDiff(sourceAmountF *big.Float, decimalsDiff int32) *big.Float
- func BatchUpdateFund(db interfaces.VmDb, address types.Address, ...) error
- func BitwiseNotBytes(bytes []byte)
- func BurnExtraVx(db interfaces.VmDb) ([]*ledger.AccountBlock, error)
- func BytesToPrice(priceBytes []byte) string
- func BytesToUint32(bytes []byte) uint32
- func BytesToUint64(bytes []byte) uint64
- func CalculateAmountForRate(amount []byte, rate int32) []byte
- func CalculateFeeAndExecutedFee(order *Order, amount []byte, feeRate, operatorFeeRate int32, ...) (incBaseFee, executedBaseFee, incOperatorFee, executedOperatorFee []byte)
- func CalculateRawAmount(quantity []byte, price []byte, decimalsDiff int32) []byte
- func CalculateRawAmountF(quantity []byte, price []byte, decimalsDiff int32) *big.Float
- func CalculateRawQuantity(amount []byte, price []byte, decimalsDiff int32) []byte
- func CalculateRawQuantityF(amount []byte, price []byte, decimalsDiff int32) *big.Float
- func CardinalRateToString(rawRate int32) string
- func CheckAndLockFundForNewOrder(db interfaces.VmDb, dexFund *Fund, order *Order, marketInfo *MarketInfo, ...) (err error)
- func CheckCancelAgentOrder(db interfaces.VmDb, sender types.Address, param *ParamCancelOrderByHash) (owner types.Address, err error)
- func CheckMarketParam(marketParam *ParamOpenNewMarket) (err error)
- func CheckMiningStakingsCanBeDelete(miningStakings *MiningStakings) bool
- func CheckSettleActions(actions *dexproto.SettleActions) error
- func CheckUserVxFundsCanBeDelete(vxFunds *VxFunds) bool
- func CmpForBigInt(a []byte, b []byte) int
- func CmpToBigZero(a []byte) int
- func ComposeOrderId(db interfaces.VmDb, marketId int32, side bool, price string) (idBytes []byte)
- func ConfirmDelegateStakeInfo(db interfaces.VmDb, hash types.Hash, info *DelegateStakeInfo, serialNo uint64)
- func DeComposeOrderId(idBytes []byte) (marketId int32, side bool, price []byte, timestamp int64, err error)
- func DeleteDelegateStakeAddressIndex(db interfaces.VmDb, address []byte, serialNo uint64)
- func DeleteDelegateStakeInfo(db interfaces.VmDb, hash []byte)
- func DeleteHashMapOrderId(db interfaces.VmDb, sendHash []byte)
- func DeleteLastSettledMakerMinedVxPage(db interfaces.VmDb)
- func DeleteMakerMiningPoolByPeriodId(db interfaces.VmDb, periodId uint64)
- func DeleteMarketInfo(db interfaces.VmDb, tradeToken, quoteToken types.TokenTypeId)
- func DeleteMiningStakedAmount(db interfaces.VmDb, address types.Address)
- func DeleteMiningStakedV2Amount(db interfaces.VmDb, address types.Address)
- func DeleteMiningStakings(db interfaces.VmDb, address types.Address)
- func DeleteOperatorFeesByKey(db interfaces.VmDb, key []byte)
- func DeletePendingNewMarkets(db interfaces.VmDb)
- func DeletePendingSetQuotes(db interfaces.VmDb)
- func DeletePendingTransferTokenOwners(db interfaces.VmDb)
- func DeleteSuperVIPStaking(db interfaces.VmDb, address types.Address)
- func DeleteUserFees(db interfaces.VmDb, address []byte)
- func DeleteVIPStaking(db interfaces.VmDb, address types.Address)
- func DeleteVxFunds(db interfaces.VmDb, address []byte)
- func DeleteVxFundsWithForkCheck(db interfaces.VmDb, address []byte)
- func DeleteVxLockedFunds(db interfaces.VmDb, address []byte)
- func DepositAccount(db interfaces.VmDb, address types.Address, token types.TokenTypeId, ...) (updatedAcc *dexproto.Account)
- func DivideByProportion(totalReferAmt, partReferAmt, dividedReferAmt, toDivideTotalAmt, ... *big.Int) (proportionAmt *big.Int, finished bool)
- func DoCancelOrder(sendHash types.Hash, owner types.Address) ([]*ledger.AccountBlock, error)
- func DoCancelStakeV1(db interfaces.VmDb, address types.Address, stakeType uint8, amount *big.Int) ([]*ledger.AccountBlock, error)
- func DoCancelStakeV2(db interfaces.VmDb, address types.Address, id types.Hash) ([]*ledger.AccountBlock, error)
- func DoFeesDividend(db interfaces.VmDb, periodId uint64) (blocks []*ledger.AccountBlock, err error)
- func DoFinishCancelMiningStake(db interfaces.VmDb, periodId uint64) error
- func DoFinishVxUnlock(db interfaces.VmDb, periodId uint64) error
- func DoMineVxForFee(db interfaces.VmDb, reader util.ConsensusReader, periodId uint64, ...) (*big.Int, error)
- func DoMineVxForMaintainer(db interfaces.VmDb, reader util.ConsensusReader, amount *big.Int) (err error)
- func DoMineVxForMaker(db interfaces.VmDb, periodId uint64, amount *big.Int)
- func DoMineVxForMakerMineAndMaintainer(db interfaces.VmDb, periodId uint64, reader util.ConsensusReader, ...) (err error)
- func DoMineVxForStaking(db interfaces.VmDb, reader util.ConsensusReader, periodId uint64, ...) (*big.Int, error)
- func DoOperatorFeesDividend(db interfaces.VmDb, periodId uint64) error
- func DoPlaceOrder(db interfaces.VmDb, param *ParamPlaceOrder, ...) ([]*ledger.AccountBlock, error)
- func DoRawCancelStakeV2(id types.Hash) ([]*ledger.AccountBlock, error)
- func DoSettleFund(db interfaces.VmDb, reader util.ConsensusReader, action *dexproto.FundSettle, ...) error
- func DoSettleVxFunds(db interfaces.VmDb, reader util.ConsensusReader, addressBytes []byte, ...) error
- func FilterPendingNewMarkets(db interfaces.VmDb, tradeToken types.TokenTypeId) (quoteTokens [][]byte, err error)
- func FilterPendingSetQuotes(db interfaces.VmDb, token types.TokenTypeId) (action *dexproto.SetQuoteTokenAction, err error)
- func FilterPendingTransferTokenOwners(db interfaces.VmDb, token types.TokenTypeId) (action *dexproto.TransferTokenOwnerAction, err error)
- func FinishCancelStake(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account, err error)
- func FinishVxUnlockForDividend(db interfaces.VmDb, address types.Address, amount *big.Int) (*dexproto.Account, error)
- func FloorQuantity(quantityF *big.Float) *big.Int
- func GenerateHeightPoint(db interfaces.VmDb) upgrade.HeightPoint
- func GetAbs(v int32) (int32, int32)
- func GetAccountByToken(fund *Fund, token types.TokenTypeId) (account *dexproto.Account, exists bool)
- func GetCancelStakesKey(address types.Address) []byte
- func GetCodeByInviter(db interfaces.VmDb, address types.Address) uint32
- func GetCurrentOperatorFeesKey(db interfaces.VmDb, reader util.ConsensusReader, operator []byte) []byte
- func GetCurrentPeriodId(db interfaces.VmDb, reader util.ConsensusReader) uint64
- func GetDelegateStakeAddressIndexKey(address []byte, serialNo uint64) []byte
- func GetDelegateStakeIndexSerialNoKey(address []byte) []byte
- func GetDelegateStakeInfoKey(hash []byte) []byte
- func GetDexFeesKeyByPeriodId(periodId uint64) []byte
- func GetDexFeesLastPeriodIdForRoll(db interfaces.VmDb) uint64
- func GetDexTimestamp(db interfaces.VmDb) int64
- func GetFeeMineRateArr(db interfaces.VmDb) mineRate
- func GetFeeStakingMineRate(db interfaces.VmDb) string
- func GetFirstMinedVxPeriodId(db interfaces.VmDb) uint64
- func GetFundKey(address types.Address) []byte
- func GetGrantedMarketToAgentKey(principal types.Address, marketId int32) []byte
- func GetHashMapOrderIdKey(sendHash []byte) []byte
- func GetInviterByCode(db interfaces.VmDb, inviteCode uint32) (*types.Address, error)
- func GetInviterByInvitee(db interfaces.VmDb, invitee types.Address) (*types.Address, error)
- func GetLastJobPeriodIdByBizType(db interfaces.VmDb, bizType uint8) uint64
- func GetLastJobPeriodIdKey(bizType uint8) []byte
- func GetLastSettledMakerMinedVxPage(db interfaces.VmDb) int32
- func GetLastSettledMakerMinedVxPeriod(db interfaces.VmDb) uint64
- func GetMaintainer(db interfaces.VmDb) *types.Address
- func GetMakerAndMaintainerArr(db interfaces.VmDb) mineRate
- func GetMakerMiningAdmin(db interfaces.VmDb) *types.Address
- func GetMakerMiningPoolByPeriodId(db interfaces.VmDb, periodId uint64) *big.Int
- func GetMarkerMiningPoolByPeriodIdKey(periodId uint64) []byte
- func GetMarketInfoKey(tradeToken, quoteToken types.TokenTypeId) []byte
- func GetMarketInfoKeyById(marketId int32) []byte
- func GetMarketOrderAmtThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int
- func GetMarketOrderAmtThresholdKey(quoteTokenType uint8) []byte
- func GetMineThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int
- func GetMineThresholdKey(quoteTokenType uint8) []byte
- func GetMiningStakedAmount(db interfaces.VmDb, address types.Address) *big.Int
- func GetMiningStakedAmountKey(address types.Address) []byte
- func GetMiningStakedV2Amount(db interfaces.VmDb, address types.Address) *big.Int
- func GetMiningStakedV2AmountKey(address types.Address) []byte
- func GetMiningStakingsKey(address types.Address) []byte
- func GetNotFinishDividendDexFeesByPeriodMap(db interfaces.VmDb, periodId uint64) map[uint64]*DexFeesByPeriod
- func GetOperatorFeesKeyByPeriodIdAndAddress(periodId uint64, address []byte) []byte
- func GetOrderIdByHash(db interfaces.VmDb, sendHash []byte) ([]byte, bool)
- func GetOwner(db interfaces.VmDb) (*types.Address, error)
- func GetPeriodIdByTimestamp(reader util.ConsensusReader, timestamp int64) uint64
- func GetPeriodJobTrigger(db interfaces.VmDb) *types.Address
- func GetStakeForMiningV1ByPage(db abi.StorageDatabase, lastKey []byte, count int) (addresses []*types.Address, newLastKey []byte, err error)
- func GetStakeForMiningV2ByPage(db abi.StorageDatabase, lastKey []byte, count int) (addresses []*types.Address, newLastKey []byte, err error)
- func GetSuperVIPStakingKey(address types.Address) []byte
- func GetTimeOracle(db interfaces.VmDb) *types.Address
- func GetTimestampInt64(db interfaces.VmDb) int64
- func GetTokenInfoKey(token types.TokenTypeId) []byte
- func GetTradeThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int
- func GetTradeThresholdKey(quoteTokenType uint8) []byte
- func GetTradeTimestamp(db interfaces.VmDb) int64
- func GetUserFeesKey(address []byte) []byte
- func GetVIPStakingKey(address types.Address) []byte
- func GetVxAmountByPeriodIndex(periodIndex uint64) *big.Int
- func GetVxAmountToBurn(db interfaces.VmDb, poolAmt *big.Int) (*big.Int, error)
- func GetVxAmountToMine(db interfaces.VmDb, periodId uint64, vxPool *big.Int, rate string) (amount, vxAmtLeaved *big.Int, success bool)
- func GetVxAmountsForEqualItems(db interfaces.VmDb, periodId uint64, vxPool *big.Int, mr mineRate) (amountForItems map[int32]*big.Int, vxAmtLeaved *big.Int, success bool)
- func GetVxAutoLockMinedVxKey(address []byte) []byte
- func GetVxBurnAmount(db interfaces.VmDb) *big.Int
- func GetVxFundsKey(address []byte) []byte
- func GetVxLockedFundsKey(address []byte) []byte
- func GetVxMinePool(db interfaces.VmDb) *big.Int
- func GetVxToMineByPeriodId(db interfaces.VmDb, periodId uint64) *big.Int
- func GetVxUnlocksKey(address types.Address) []byte
- func GrantMarketToAgent(db interfaces.VmDb, principal, agent types.Address, marketId int32)
- func HandleStakeAction(db interfaces.VmDb, stakeType, actionType uint8, ...) ([]*ledger.AccountBlock, error)
- func InitFundOwner(owner types.Address)
- func IsAdvancedLimitOrder(order *Order, enrichOrderFork bool) bool
- func IsAutoLockMinedVx(db interfaces.VmDb, address []byte) bool
- func IsDexFeeFork(db interfaces.VmDb) bool
- func IsDexMiningFork(db interfaces.VmDb) bool
- func IsDexRobotFork(db interfaces.VmDb) bool
- func IsDexStableMarketFork(db interfaces.VmDb) bool
- func IsDexStopped(db interfaces.VmDb) bool
- func IsDustMarketBuyOrder(order *Order, amount []byte, decimalsDiff int32, executedPrice []byte) bool
- func IsDustOrder(order *Order, quantity []byte, decimalsDiff int32, executedPrice []byte) bool
- func IsDustOrderAfterUpgrade12(order *Order, quantity, amount []byte, decimalsDiff int32, ...) bool
- func IsEarthFork(db interfaces.VmDb) bool
- func IsLeafFork(db interfaces.VmDb) bool
- func IsMakerMiningAdmin(db interfaces.VmDb, addr types.Address) bool
- func IsMarketGrantedToAgent(db interfaces.VmDb, principal, agent types.Address, marketId int32) bool
- func IsMarketOrder(order *Order, enrichOrderFork bool) bool
- func IsNormalMiningStarted(db interfaces.VmDb) bool
- func IsOperationValidWithMask(operationCode, mask uint8) bool
- func IsOrderDustForAmount(order *Order, amount []byte, decimalsDiff int32, price []byte) bool
- func IsOrderDustForPrice(order *Order, quantity []byte, decimalsDiff int32, price []byte) bool
- func IsOwner(db interfaces.VmDb, address types.Address) bool
- func IsStemFork(db interfaces.VmDb) bool
- func IsValidFeeForMine(userFee *dexproto.FeeAccount, mineThreshold *big.Int) bool
- func IsValidMiningStakeAmount(amount *big.Int) bool
- func IsValidMiningStakeAmountBytes(amount []byte) bool
- func IsValidVxAmountBytesForDividend(amount []byte) bool
- func IsValidVxAmountForDividend(amount *big.Int) bool
- func IsVersion10Upgrade(db interfaces.VmDb) bool
- func IsVersion11AddTransferAssetEvent(db interfaces.VmDb) bool
- func IsVersion11DeprecateClearingExpiredOrder(db interfaces.VmDb) bool
- func IsVersion11EnrichOrderFork(db interfaces.VmDb) bool
- func IsVersion12Upgrade(db interfaces.VmDb) bool
- func IsVipStakingWithId(staking *VIPStaking) bool
- func LockMinedVx(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account)
- func LockVxForDividend(db interfaces.VmDb, address types.Address, amount *big.Int) (*dexproto.Account, error)
- func MarkDexFeesFinishDividend(db interfaces.VmDb, dexFeesByPeriod *DexFeesByPeriod, periodId uint64)
- func MarkDexFeesFinishMine(db interfaces.VmDb, dexFeesByPeriod *DexFeesByPeriod, periodId uint64)
- func MatchMiningStakingByPeriod(miningStakings *MiningStakings, periodId uint64, checkDelete bool) (bool, []byte, bool, bool)
- func MatchVxFundsByPeriod(vxFunds *VxFunds, periodId uint64, checkDelete bool) (bool, []byte, bool, bool)
- func MaxTotalFeeRate(order Order) int32
- func MinBigInt(a []byte, b []byte) []byte
- func NegativeAmount(amount []byte) *big.Int
- func NewAndSaveMarketId(db interfaces.VmDb) (newId int32)
- func NewAndSaveOrderSerialNo(db interfaces.VmDb, timestamp int64) (newSerialNo int32)
- func NewDelegateStakeIndexSerialNo(db interfaces.VmDb, address []byte) (serialNo uint64)
- func NewInviteCode(db interfaces.VmDb, hash types.Hash) uint32
- func NormalizeToQuoteTokenTypeAmount(amount []byte, tokenDecimals, quoteTokenType int32) []byte
- func OnCancelMiningStakeSuccess(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...) error
- func OnCancelMiningStakeSuccessV2(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...) error
- func OnDepositVx(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...) error
- func OnMiningStakeSuccess(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...) error
- func OnMiningStakeSuccessV2(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...) error
- func OnNewMarketGetTokenInfoFailed(db interfaces.VmDb, tradeTokenId types.TokenTypeId) (err error)
- func OnNewMarketGetTokenInfoSuccess(db interfaces.VmDb, reader util.ConsensusReader, ...) (appendBlocks []*ledger.AccountBlock, err error)
- func OnNewMarketPending(db interfaces.VmDb, param *ParamOpenNewMarket, marketInfo *MarketInfo) (data []byte, err error)
- func OnNewMarketValid(db interfaces.VmDb, reader util.ConsensusReader, marketInfo *MarketInfo, ...) (blocks []*ledger.AccountBlock, err error)
- func OnSetQuoteGetTokenInfoFailed(db interfaces.VmDb, tokenId types.TokenTypeId) (err error)
- func OnSetQuoteGetTokenInfoSuccess(db interfaces.VmDb, tokenInfoRes *ParamGetTokenInfoCallback) error
- func OnSetQuoteTokenPending(db interfaces.VmDb, token types.TokenTypeId, quoteTokenType uint8) []byte
- func OnSettleVx(db interfaces.VmDb, reader util.ConsensusReader, address []byte, ...) error
- func OnTransferOwnerGetTokenInfoFailed(db interfaces.VmDb, tradeTokenId types.TokenTypeId) (err error)
- func OnTransferOwnerGetTokenInfoSuccess(db interfaces.VmDb, param *ParamGetTokenInfoCallback) error
- func OnTransferTokenOwnerPending(db interfaces.VmDb, token types.TokenTypeId, origin, new types.Address) []byte
- func OnVxMined(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...) error
- func OnWithdrawVx(db interfaces.VmDb, reader util.ConsensusReader, address types.Address, ...) error
- func PreCheckOrderParam(orderParam *ParamPlaceOrder, isStemFork bool) error
- func PriceToBytes(price string) []byte
- func ReduceAccount(db interfaces.VmDb, address types.Address, tokenId []byte, amount *big.Int) (*dexproto.Account, error)
- func ReduceVipStakingHash(stakings *VIPStaking, hash types.Hash) bool
- func RenderFeeRate(address types.Address, order *Order, marketInfo *MarketInfo, ...)
- func RenderMarketBuyOrderAmountAndFee(order *Order)
- func RenderMarketInfo(db interfaces.VmDb, marketInfo *MarketInfo, ...) error
- func RevokeMarketFromAgent(db interfaces.VmDb, principal, agent types.Address, marketId int32)
- func RoundAmount(amountF *big.Float) *big.Int
- func RoundQuantity(quantityF *big.Float) *big.Int
- func SafeSubBigInt(amt []byte, sub []byte) (res, actualSub []byte, exceed bool)
- func SaveCodeByInviter(db interfaces.VmDb, address types.Address, inviteCode uint32)
- func SaveCurrentOperatorFees(db interfaces.VmDb, reader util.ConsensusReader, operator []byte, ...)
- func SaveDelegateStakeAddressIndex(db interfaces.VmDb, id types.Hash, stakeType int32, address []byte) uint64
- func SaveDelegateStakeInfo(db interfaces.VmDb, hash types.Hash, stakeType uint8, ...)
- func SaveDexFeesByPeriodId(db interfaces.VmDb, periodId uint64, dexFeesByPeriod *DexFeesByPeriod)
- func SaveDexFeesLastPeriodIdForRoll(db interfaces.VmDb, periodId uint64)
- func SaveDexMiningStakings(db interfaces.VmDb, ms *MiningStakings)
- func SaveDexStopped(db interfaces.VmDb, isStopDex bool)
- func SaveFirstMinedVxPeriodId(db interfaces.VmDb, periodId uint64)
- func SaveFund(db interfaces.VmDb, address types.Address, fund *Fund)
- func SaveHashMapOrderId(db interfaces.VmDb, sendHash []byte, orderId []byte)
- func SaveInviterByCode(db interfaces.VmDb, address types.Address, inviteCode uint32)
- func SaveInviterByInvitee(db interfaces.VmDb, invitee, inviter types.Address)
- func SaveLastJobPeriodIdByBizType(db interfaces.VmDb, periodId uint64, bizType uint8)
- func SaveLastSettledMakerMinedVxPage(db interfaces.VmDb, pageId int32)
- func SaveLastSettledMakerMinedVxPeriod(db interfaces.VmDb, periodId uint64)
- func SaveMaintainer(db interfaces.VmDb, addr types.Address)
- func SaveMakerMiningAdmin(db interfaces.VmDb, addr types.Address)
- func SaveMakerMiningPoolByPeriodId(db interfaces.VmDb, periodId uint64, amount *big.Int)
- func SaveMarketInfo(db interfaces.VmDb, marketInfo *MarketInfo, ...)
- func SaveMarketInfoById(db interfaces.VmDb, marketInfo *MarketInfo)
- func SaveMarketOrderAmtThreshold(db interfaces.VmDb, quoteTokenType uint8, amount *big.Int)
- func SaveMineThreshold(db interfaces.VmDb, quoteTokenType uint8, amount *big.Int)
- func SaveMiningStakedAmount(db interfaces.VmDb, address types.Address, amount *big.Int)
- func SaveMiningStakedV2Amount(db interfaces.VmDb, address types.Address, amount *big.Int)
- func SaveMiningStakings(db interfaces.VmDb, address types.Address, ps *MiningStakings)
- func SavePendingNewMarkets(db interfaces.VmDb, pendingNewMarkets *PendingNewMarkets)
- func SavePendingSetQuotes(db interfaces.VmDb, pendingSetQuotes *PendingSetQuotes)
- func SavePendingTransferTokenOwners(db interfaces.VmDb, pendings *PendingTransferTokenOwnerActions)
- func SaveSuperVIPStaking(db interfaces.VmDb, address types.Address, superVIPStaking *VIPStaking)
- func SaveTokenInfo(db interfaces.VmDb, token types.TokenTypeId, tokenInfo *TokenInfo)
- func SaveTradeThreshold(db interfaces.VmDb, quoteTokenType uint8, amount *big.Int)
- func SaveUserFees(db interfaces.VmDb, address []byte, userFees *UserFees)
- func SaveVIPStaking(db interfaces.VmDb, address types.Address, vipStaking *VIPStaking)
- func SaveVxBurnAmount(db interfaces.VmDb, amount *big.Int)
- func SaveVxFunds(db interfaces.VmDb, address []byte, vxFunds *VxFunds)
- func SaveVxFundsWithForkCheck(db interfaces.VmDb, address []byte, vxFunds *VxFunds)
- func SaveVxLockedFunds(db interfaces.VmDb, address []byte, vxFunds *VxFunds)
- func SaveVxLockedSumFunds(db interfaces.VmDb, vxLockedSumFunds *VxFunds)
- func SaveVxMinePool(db interfaces.VmDb, amount *big.Int)
- func SaveVxSumFunds(db interfaces.VmDb, vxSumFunds *VxFunds)
- func SaveVxSumFundsWithForkCheck(db interfaces.VmDb, vxSumFunds *VxFunds)
- func ScheduleCancelStake(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account, err error)
- func ScheduleVxUnlockForDividend(db interfaces.VmDb, address types.Address, amount *big.Int) (updatedAcc *dexproto.Account, err error)
- func SetAutoLockMinedVx(db interfaces.VmDb, address []byte, enable bool)
- func SetDexTimestamp(db interfaces.VmDb, timestamp int64, reader util.ConsensusReader) error
- func SetOwner(db interfaces.VmDb, address types.Address)
- func SetPeriodJobTrigger(db interfaces.VmDb, address types.Address)
- func SetTimeOracle(db interfaces.VmDb, address types.Address)
- func SetTradeTimestamp(db interfaces.VmDb, timestamp int64)
- func SettleFees(db interfaces.VmDb, reader util.ConsensusReader, allowMining bool, ...)
- func SettleFeesWithTokenId(db interfaces.VmDb, reader util.ConsensusReader, allowMining bool, ...)
- func SettleOperatorFees(db interfaces.VmDb, reader util.ConsensusReader, ...)
- func StartNormalMine(db interfaces.VmDb)
- func SubBigInt(a []byte, b []byte) *big.Int
- func SubBigIntAbs(a []byte, b []byte) []byte
- func TruncateUserFeesToPeriod(userFees *UserFees, periodId uint64) (truncated bool)
- func TryUpdateTimestamp(db interfaces.VmDb, timestamp int64, preHash types.Hash)
- func Uint32ToBytes(value uint32) []byte
- func Uint64ToBytes(value uint64) []byte
- func UpdateCancelStakes(db interfaces.VmDb, address types.Address, cancelStakes *CancelStakes)
- func UpdateVxUnlocks(db interfaces.VmDb, address types.Address, unlocks *VxUnlocks)
- func ValidOperatorFeeRate(feeRate int32) bool
- func ValidPrice(price string, isFork bool) bool
- func ValidTimeOracle(db interfaces.VmDb, address types.Address) bool
- func ValidTriggerAddress(db interfaces.VmDb, address types.Address) bool
- func VerifyNewOrderPriceForRpc(data []byte) (valid bool)
- type Account
- type AccountSettleSorter
- type AmountWithToken
- type AmountWithTokenSorter
- type BurnViteEvent
- type CancelStakes
- type DelegateStakeAddressIndex
- type DelegateStakeInfo
- func GetDelegateStakeInfo(db interfaces.VmDb, hash []byte) (info *DelegateStakeInfo, ok bool)
- func GetStakeInfoList(db interfaces.VmDb, stakeAddr types.Address, ...) ([]*DelegateStakeInfo, *big.Int, error)
- func GetStakeListByPage(db abi.StorageDatabase, lastKey []byte, count int) (infos []*DelegateStakeInfo, newLastKey []byte, err error)
- type DexEvent
- type DexFeesByPeriod
- type ErrEvent
- type FeeDividendEvent
- type FeeSettleSorter
- type Fund
- type FundSettleSorter
- type FundVerifyItem
- type FundVerifyRes
- type GrantMarketToAgentEvent
- type InviteRelationEvent
- type MarketEvent
- type MarketInfo
- func CleanExpireOrders(db interfaces.VmDb, orderIds []byte) (map[types.Address]map[bool]*dexproto.AccountSettle, *MarketInfo, error)
- func GetMarketInfo(db interfaces.VmDb, tradeToken, quoteToken types.TokenTypeId) (marketInfo *MarketInfo, ok bool)
- func GetMarketInfoById(db interfaces.VmDb, marketId int32) (marketInfo *MarketInfo, ok bool)
- func GetMarketInfoByTokens(db interfaces.VmDb, tradeTokenData, quoteTokenData []byte) (marketInfo *MarketInfo, ok bool)
- func GetMarkets(db interfaces.VmDb) (markets []*MarketInfo, ok bool)
- func RenderOrder(order *Order, param *ParamPlaceOrder, db interfaces.VmDb, ...) (*MarketInfo, error)
- type Matcher
- func (mc *Matcher) CancelOrderById(order *Order)
- func (mc *Matcher) GetFees() map[types.Address]*proto.FeeSettle
- func (mc *Matcher) GetFundSettles() map[types.Address]map[bool]*proto.AccountSettle
- func (mc *Matcher) GetOrderById(orderId []byte) (*Order, error)
- func (mc *Matcher) GetOrdersFromMarket(side bool, begin, end int) ([]*Order, int, error)
- func (mc *Matcher) MatchOrder(taker *Order, preHash types.Hash) (err error)
- type MinedVxForInviteeFeeEvent
- type MinedVxForOperationEvent
- type MinedVxForStakingEvent
- type MinedVxForTradeFeeEvent
- type MiningStakings
- type NewOrderEvent
- type OperatorFeeDividendEvent
- type OperatorFeesByPeriod
- type Order
- type OrderTx
- type OrderUpdateEvent
- type ParamAssignedWithdraw
- type ParamCancelOrderByHash
- type ParamCancelStakeById
- type ParamCommonAdminConfig
- type ParamConfigMarketAgents
- type ParamDelegateStakeCallback
- type ParamDelegateStakeCallbackV2
- type ParamDexAdminConfig
- type ParamDexCancelOrder
- type ParamDexInnerCancelOrder
- type ParamGetTokenInfoCallback
- type ParamLockVxForDividend
- type ParamMarketAdminConfig
- type ParamNotifyTime
- type ParamOpenNewMarket
- type ParamPlaceAgentOrder
- type ParamPlaceOrder
- type ParamSerializedData
- type ParamStakeForMining
- type ParamStakeForVIP
- type ParamSwitchConfig
- type ParamTradeAdminConfig
- type ParamTransferConfig
- type ParamTransferTokenOwnership
- type ParamTriggerPeriodJob
- type ParamWithdraw
- type PendingNewMarkets
- type PendingSetQuotes
- type PendingTransferTokenOwnerActions
- type PeriodJobWithBizEvent
- type QuoteTokenTypeInfo
- type RevokeMarketFromAgentEvent
- type SerialNo
- type SerializableDex
- type SettleMakerMinedVxEvent
- type TokenEvent
- type TokenInfo
- type TransactionEvent
- type TransferAssetEvent
- type UserFees
- type VIPStaking
- type VxFunds
- func GetVxFunds(db interfaces.VmDb, address []byte) (vxFunds *VxFunds, ok bool)
- func GetVxFundsWithForkCheck(db interfaces.VmDb, address []byte) (vxFunds *VxFunds, ok bool)
- func GetVxLockedFunds(db interfaces.VmDb, address []byte) (vxFunds *VxFunds, ok bool)
- func GetVxLockedSumFunds(db interfaces.VmDb) (vxLockedSumFunds *VxFunds, ok bool)
- func GetVxSumFunds(db interfaces.VmDb) (vxSumFunds *VxFunds, ok bool)
- func GetVxSumFundsWithForkCheck(db interfaces.VmDb) (vxSumFunds *VxFunds, ok bool)
- type VxUnlocks
Constants ¶
const ( StakeForMining = iota + 1 StakeForVIP StakeForSuperVIP StakeForPrincipalSuperVIP )
const ( Stake = iota + 1 CancelStake )
const ( AdminConfigOwner = 1 AdminConfigTimeOracle = 2 AdminConfigPeriodJobTrigger = 4 AdminConfigStopDex = 8 AdminConfigMakerMiningAdmin = 16 AdminConfigMaintainer = 32 )
MethodNameDexFundDexAdminConfig
const ( TradeAdminConfigMineMarket = 1 TradeAdminConfigNewQuoteToken = 2 TradeAdminConfigTradeThreshold = 4 TradeAdminConfigMineThreshold = 8 TradeAdminStartNormalMine = 16 TradeAdminBurnExtraVx = 32 )
MethodNameDexFundTradeAdminConfig
const ( MarketOwnerTransferOwner = 1 MarketOwnerConfigTakerRate = 2 MarketOwnerConfigMakerRate = 4 MarketOwnerStopMarket = 8 )
const ( CommonAdminConfigStableMarket = 1 CommonAdminConfigMarketOrderAmtThreshold = 2 )
const ( ViteTokenType = iota + 1 EthTokenType BtcTokenType UsdTokenType )
const ( MineForMaker = iota + 1 MineForMaintainer )
const ( FeeDividendJob = iota + 1 OperatorFeeDividendJob MineVxForFeeJob MineVxForStakingJob MineVxForMakerAndMaintainerJob FinishVxUnlock FinishCancelMiningStake )
const ( GetTokenForNewMarket = iota + 1 GetTokenForSetQuote GetTokenForTransferOwner )
const ( GrantAgent = iota + 1 RevokeAgent )
const ( LockVx = iota + 1 UnlockVx )
const ( StakeSubmitted = iota + 1 StakeConfirmed )
const ( TransferAssetDeposit = iota + 1 TransferAssetAgentDeposit TransferAssetWithdraw TransferAssetAssignedWithdraw TransferAssetTransfer )
const ( Pending = iota PartialExecuted FullyExecuted Cancelled NewFailed )
const ( Limited = iota Market PostOnly FillOrKill ImmediateOrCancel )
const (
AutoLockMinedVx = iota + 1
)
const (
BurnForDexViteFee = iota + 1
)
const CleanExpireOrdersMaxCount = 200
const OrderIdBytesLength = 22
const PriceBytesLength = 10
Variables ¶
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") )
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},
}
)
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 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 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 AdjustForDecimalsDiff ¶
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 BytesToUint32 ¶
func BytesToUint64 ¶
func CalculateAmountForRate ¶
func CalculateRawAmount ¶
func CalculateRawAmountF ¶
func CalculateRawQuantity ¶ added in v2.13.0
func CalculateRawQuantityF ¶ added in v2.13.0
func CardinalRateToString ¶
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 CmpForBigInt ¶
func CmpToBigZero ¶
func ComposeOrderId ¶
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 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 DoCancelOrder ¶
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 GenerateHeightPoint ¶ added in v2.13.0
func GenerateHeightPoint(db interfaces.VmDb) upgrade.HeightPoint
func GetAccountByToken ¶
func GetCancelStakesKey ¶
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 GetDelegateStakeInfoKey ¶
func GetDexFeesKeyByPeriodId ¶
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 GetHashMapOrderIdKey ¶
func GetInviterByCode ¶
func GetInviterByInvitee ¶
func GetLastJobPeriodIdByBizType ¶
func GetLastJobPeriodIdByBizType(db interfaces.VmDb, bizType uint8) uint64
func GetLastJobPeriodIdKey ¶
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 GetMarketInfoKey ¶
func GetMarketInfoKey(tradeToken, quoteToken types.TokenTypeId) []byte
func GetMarketInfoKeyById ¶
func GetMarketOrderAmtThreshold ¶
func GetMarketOrderAmtThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int
func GetMineThreshold ¶
func GetMineThreshold(db interfaces.VmDb, quoteTokenType int32) *big.Int
func GetMineThresholdKey ¶
func GetMiningStakedAmount ¶
func GetMiningStakedV2Amount ¶
func GetMiningStakingsKey ¶
func GetNotFinishDividendDexFeesByPeriodMap ¶
func GetNotFinishDividendDexFeesByPeriodMap(db interfaces.VmDb, periodId uint64) map[uint64]*DexFeesByPeriod
get all dexFeeses that not divided yet
func GetOrderIdByHash ¶
func GetOrderIdByHash(db interfaces.VmDb, sendHash []byte) ([]byte, bool)
func GetPeriodIdByTimestamp ¶
func GetPeriodIdByTimestamp(reader util.ConsensusReader, timestamp int64) uint64
func GetPeriodJobTrigger ¶
func GetPeriodJobTrigger(db interfaces.VmDb) *types.Address
func GetSuperVIPStakingKey ¶
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 GetTradeTimestamp ¶
func GetTradeTimestamp(db interfaces.VmDb) int64
func GetUserFeesKey ¶
func GetVIPStakingKey ¶
func GetVxAmountToBurn ¶
func GetVxAmountToMine ¶
func GetVxAutoLockMinedVxKey ¶
func GetVxBurnAmount ¶
func GetVxBurnAmount(db interfaces.VmDb) *big.Int
func GetVxFundsKey ¶
func GetVxLockedFundsKey ¶
func GetVxMinePool ¶
func GetVxMinePool(db interfaces.VmDb) *big.Int
func GetVxToMineByPeriodId ¶
func GetVxToMineByPeriodId(db interfaces.VmDb, periodId uint64) *big.Int
func GetVxUnlocksKey ¶
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 IsAdvancedLimitOrder ¶
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 IsDustOrder ¶
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 IsMarketOrder ¶
func IsNormalMiningStarted ¶
func IsNormalMiningStarted(db interfaces.VmDb) bool
func IsOrderDustForAmount ¶ added in v2.13.0
func IsOrderDustForPrice ¶
func IsStemFork ¶
func IsStemFork(db interfaces.VmDb) bool
func IsValidFeeForMine ¶
func IsValidFeeForMine(userFee *dexproto.FeeAccount, mineThreshold *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 LockVxForDividend ¶
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 MatchVxFundsByPeriod ¶
func MaxTotalFeeRate ¶
func NegativeAmount ¶
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 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 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 PreCheckOrderParam ¶
func PreCheckOrderParam(orderParam *ParamPlaceOrder, isStemFork bool) error
func PriceToBytes ¶
func ReduceAccount ¶
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 SafeSubBigInt ¶
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 SaveDelegateStakeInfo ¶
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 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 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 SetAutoLockMinedVx ¶
func SetAutoLockMinedVx(db interfaces.VmDb, address []byte, enable bool)
func SetDexTimestamp ¶
func SetDexTimestamp(db interfaces.VmDb, timestamp int64, reader util.ConsensusReader) error
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 SettleFeesWithTokenId ¶
func SettleOperatorFees ¶
func SettleOperatorFees(db interfaces.VmDb, reader util.ConsensusReader, feeActions []*dexproto.FeeSettle, marketInfo *MarketInfo)
func StartNormalMine ¶
func StartNormalMine(db interfaces.VmDb)
func SubBigIntAbs ¶
func TryUpdateTimestamp ¶
func TryUpdateTimestamp(db interfaces.VmDb, timestamp int64, preHash types.Hash)
func Uint32ToBytes ¶
func Uint64ToBytes ¶
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 ValidPrice ¶
func ValidTimeOracle ¶
func ValidTimeOracle(db interfaces.VmDb, address types.Address) bool
func ValidTriggerAddress ¶
func ValidTriggerAddress(db interfaces.VmDb, address types.Address) 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 ¶
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 ¶
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 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) GetTopicId ¶
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 ¶
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 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 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 (*Matcher) GetFundSettles ¶
func (*Matcher) GetOrdersFromMarket ¶
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 ¶
func (*Order) DeSerialize ¶
func (*Order) DeSerializeCompact ¶
func (*Order) RenderOrderById ¶
func (*Order) SerializeCompact ¶
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 ParamCancelOrderByHash ¶
type ParamCancelOrderByHash struct { SendHash types.Hash Principal types.Address TradeToken types.TokenTypeId QuoteToken types.TokenTypeId }
type ParamCancelStakeById ¶
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 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 ParamLockVxForDividend ¶
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 ParamStakeForVIP ¶
type ParamStakeForVIP struct {
ActionType uint8 // 1: stake 2: cancel stake
}
type ParamSwitchConfig ¶
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 ParamTransferTokenOwnership ¶
type ParamTransferTokenOwnership struct { Token types.TokenTypeId NewOwner types.Address }
type ParamTriggerPeriodJob ¶
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 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 ¶
func (*SerialNo) DeSerialize ¶
type SerializableDex ¶
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 ¶
func (*TokenEvent) FromBytes ¶
func (te *TokenEvent) FromBytes(data []byte) (err error)
func (*TokenEvent) GetTopicId ¶
func (te *TokenEvent) GetTopicId() types.Hash
type TokenInfo ¶
func GetTokenInfo ¶
func GetTokenInfo(db interfaces.VmDb, token types.TokenTypeId) (tokenInfo *TokenInfo, ok bool)
func (*TokenInfo) DeSerialize ¶
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 ¶
func GetUserFees ¶
func GetUserFees(db interfaces.VmDb, address []byte) (userFees *UserFees, ok bool)
func (*UserFees) DeSerialize ¶
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 ¶
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)