Versions in this module Expand all Collapse all v1 v1.67.4 Oct 11, 2022 Changes in this version + func BuySellAsset(op int32, left, right *et.ZkAsset) (*et.ZkAsset, *et.ZkAsset) + func CalcActualCost(op int32, amount int64, price, coinPrecision int64) int64 + func CreateNftOrder(payload *et.SpotNftOrder, ty int32) *et.SpotOrder + func CreateNftTakerOrder(payload *et.SpotNftTakerOrder, ty int32, order2 *Order) *et.SpotOrder + func Direction(op int32) int32 + func FindOrderByOrderID(statedb dbm.KV, localdb dbm.KV, dbprefix et.DBprefix, orderID int64) (*et.SpotOrder, error) + func FindOrderByOrderNftID(statedb dbm.KV, localdb dbm.KV, dbprefix et.DBprefix, orderID int64) (*et.SpotOrder, error) + func GetCoinPrecision(ty int32) int64 + func LoadSpotFeeAccountConfig(db dbm.KV) (*et.DexAccount, error) + func NewEvmNftAsset(left uint64) *et.ZkAsset + func NewHistoryOrderTable(kvdb dbm.KV, p et.DBprefix) *table.Table + func NewMarketDepthTable(kvdb dbm.KV, p et.DBprefix) *table.Table + func NewMarketOrderTable(kvdb dbm.KV, p et.DBprefix) *table.Table + func NewZkAsset(left uint64) *et.ZkAsset + func NewZkNftAsset(left uint64) *et.ZkAsset + func OpSwap(op int32) int32 + func ParseCoins(cfg *types.Chain33Config, tradeKey string, height int64) (coins []et.CoinCfg, err error) + func ParseConfig(cfg *types.Chain33Config, height int64) (*et.Econfig, error) + func ParseStrings(cfg *types.Chain33Config, tradeKey string, height int64) (ret []string, err error) + func ParseSymbols(cfg *types.Chain33Config, tradeKey string, height int64) (symbols map[string]*et.Trade, err error) + func QueryHistoryOrderList(localdb dbm.KV, dbprefix et.DBprefix, in *et.SpotQueryHistoryOrderList) (types.Message, error) + func QueryMarketDepth(localdb dbm.KV, dbprefix et.DBprefix, in *et.SpotQueryMarketDepth) (*et.SpotMarketDepthList, error) + func QueryOrderList(localdb dbm.KV, dbprefix et.DBprefix, in *et.SpotQueryOrderList) (types.Message, error) + func SafeAdd(x, y int64) int64 + func SafeMul(x, y, coinPrecision int64) int64 + func SymbolStr(a *et.ZkAsset) string + func SymbolStrL1(i uint64) string + type AccountInfo struct + type AssetAccount interface + CheckBalance func(amount int64) error + Frozen func(amount int64) (*types.Receipt, error) + GetAccountInfo func() AccountInfo + GetCoinPrecision func() int64 + Transfer func(to AssetAccount, amountt int64) (*types.Receipt, error) + TransferFrozen func(to AssetAccount, amountt int64) (*types.Receipt, error) + UnFrozen func(amount int64) (*types.Receipt, error) + type AssetAccounts struct + type DexAccount struct + func LoadSpotAccount(addr string, id uint64, statedb dbm.KV, p et.DBprefix) (*DexAccount, error) + func NewDexAccount(acc *et.DexAccount, db *accountRepo) *DexAccount + func (acc *DexAccount) Active(token uint64, amount uint64) (*types.Receipt, error) + func (acc *DexAccount) Burn(token uint64, amount uint64) (*types.Receipt, error) + func (acc *DexAccount) Frozen(token uint64, amount uint64) (*types.Receipt, error) + func (acc *DexAccount) FrozenTranfer(accTo *DexAccount, token uint64, amount uint64) (*types.Receipt, error) + func (acc *DexAccount) GetBalance(tid uint64) uint64 + func (acc *DexAccount) GetFrozen(tid uint64) uint64 + func (acc *DexAccount) GetKVSet() (kvset []*types.KeyValue) + func (acc *DexAccount) Mint(token uint64, amount uint64) (*types.Receipt, error) + func (acc *DexAccount) Tranfer(accTo *DexAccount, token uint64, amount uint64) (*types.Receipt, error) + type Entrust struct + func NewEntrust(s string, h int64, d dbm.KV) *Entrust + func (a *Entrust) Bind(payload *et.SpotExchangeBind) (*types.Receipt, error) + func (a *Entrust) CheckBind(addr string) error + func (a *Entrust) SetDB(d dbm.KV, prefix et.DBprefix) + type EvmxgoNftAccountRepo struct + func (accdb *EvmxgoNftAccountRepo) NewAccount(addr string, accid uint64, asset *et.ZkAsset) (*NftAccount, error) + type GetFeeAccount func() (*SpotFee, error) + type HistoryOrderRow struct + func NewHistoryOrderRow() *HistoryOrderRow + func (m *HistoryOrderRow) CreateRow() *table.Row + func (m *HistoryOrderRow) Get(key string) ([]byte, error) + func (m *HistoryOrderRow) SetPayload(data types.Message) error + type MarketDepthRow struct + func NewMarketDepthRow() *MarketDepthRow + func (m *MarketDepthRow) CreateRow() *table.Row + func (m *MarketDepthRow) Get(key string) ([]byte, error) + func (m *MarketDepthRow) SetPayload(data types.Message) error + type NftAccount struct + func (acc *NftAccount) CheckBalance(amount int64) error + func (acc *NftAccount) Frozen(amount int64) (*types.Receipt, error) + func (acc *NftAccount) GetAccountInfo() AccountInfo + func (acc *NftAccount) GetCoinPrecision() int64 + func (acc *NftAccount) Transfer(to AssetAccount, amount int64) (*types.Receipt, error) + func (acc *NftAccount) TransferFrozen(to AssetAccount, amountt int64) (*types.Receipt, error) + func (acc *NftAccount) UnFrozen(amount int64) (*types.Receipt, error) + type Order struct + func NewOrder(order *et.SpotOrder, orderdb *orderSRepo) *Order + func PreCreateAssetLimitOrder(payload *et.SpotAssetLimitOrder) *Order + func PreCreateLimitOrder(payload *et.SpotLimitOrder) *Order + func PreCreateNftOrder(payload *et.SpotNftOrder, ty int32) *Order + func PreCreateNftTakerOrder(payload *et.SpotNftTakerOrder, ty int, order2 *Order) *Order + func (o *Order) GetAsset() (*et.ZkAsset, *et.ZkAsset) + func (o *Order) GetOp() int32 + func (o *Order) GetPrice() int64 + func (o *Order) GetZkOrder() *et.ZkOrder + func (o *Order) NeedToken(precision int64) (uint64, int64) + func (o *Order) Revoke(blockTime int64, txhash []byte, txindex int) (*types.Receipt, error) + func (o *Order) Traded(matchDetail *et.MatchInfo, blocktime int64) ([]*types.ReceiptLog, []*types.KeyValue, error) + type OrderRow struct + func NewOrderRow() *OrderRow + func (r *OrderRow) CreateRow() *table.Row + func (r *OrderRow) Get(key string) ([]byte, error) + func (r *OrderRow) SetPayload(data types.Message) error + type Spot struct + func NewSpot(e *drivers.DriverBase, tx *et.TxInfo, dbprefix et.DBprefix) (*Spot, error) + func (a *Spot) CreateEvmxgoNftOrder(fromaddr string, trader *SpotTrader, payload *et.SpotNftOrder, ...) (*et.SpotOrder, error) + func (a *Spot) CreateEvmxgoNftTakerOrder(fromaddr string, acc *SpotTrader, payload *et.SpotNftTakerOrder, ...) (*et.SpotOrder, error) + func (a *Spot) CreateNftOrder(fromaddr string, trader *SpotTrader, payload *et.SpotNftOrder, ...) (*et.SpotOrder, error) + func (a *Spot) CreateNftTakerOrder(fromaddr string, acc *SpotTrader, payload *et.SpotNftTakerOrder, ...) (*et.SpotOrder, error) + func (a *Spot) CreateOrder(acc *SpotTrader, or *et.SpotOrder, left, right *et.ZkAsset, entrustAddr string) (*et.SpotOrder, error) + func (a *Spot) CreateOrder2(acc *SpotTrader, or *Order, entrustAddr string) (*Order, error) + func (a *Spot) ExecLocal(tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error) + func (a *Spot) GetIndex() int64 + func (a *Spot) GetSpotFee(fromaddr string, left, right *et.ZkAsset) (*SpotFee, error) + func (a *Spot) LoadTrader(fromaddr string, zkAccID uint64, buyAsset, sellAsset *et.ZkAsset) (*SpotTrader, error) + func (a *Spot) MatchAssetLimitOrder(taker *SpotTrader) (*types.Receipt, error) + func (a *Spot) NftOrderMarked(taker *SpotTrader) (*types.Receipt, error) + func (a *Spot) NftOrderReceipt(order *Order, matches *et.ReceiptSpotMatch) (*types.Receipt, error) + func (a *Spot) RevokeOrder(fromaddr string, payload *et.SpotRevokeOrder) (*types.Receipt, error) + func (a *Spot) SetFeeAcc(funcGetFeeAccount GetFeeAccount) error + func (a *Spot) TradeNft(fromaddr string, payload *et.SpotNftTakerOrder, entrustAddr string, ...) (*types.Receipt, error) + type SpotFee struct + AccID uint64 + Address string + type SpotTrader struct + AccID uint64 + func (s *SpotTrader) CheckTokenAmountForLimitOrder(tid uint64, total int64) error + func (s *SpotTrader) FrozenForLimitOrder(orderx *Order) (*types.Receipt, error) + func (s *SpotTrader) GetAccout() *AssetAccounts + func (s *SpotTrader) GetOrder() *Order + func (s *SpotTrader) Trade(maker *spotMaker) ([]*types.ReceiptLog, []*types.KeyValue, error) + type TokenAccount struct + func (acc *TokenAccount) CheckBalance(amount int64) error + func (acc *TokenAccount) Frozen(amount int64) (*types.Receipt, error) + func (acc *TokenAccount) GetAccountInfo() AccountInfo + func (acc *TokenAccount) GetCoinPrecision() int64 + func (acc *TokenAccount) Transfer(to AssetAccount, amount int64) (*types.Receipt, error) + func (acc *TokenAccount) TransferFrozen(to AssetAccount, amountt int64) (*types.Receipt, error) + func (acc *TokenAccount) UnFrozen(amount int64) (*types.Receipt, error) + type TokenAccountRepo struct + func (accdb *TokenAccountRepo) NewAccount(addr string, accid uint64, asset *et.ZkAsset) (*TokenAccount, error) + type ZkAccount struct + func (acc *ZkAccount) CheckBalance(amount int64) error + func (acc *ZkAccount) Frozen(amount int64) (*types.Receipt, error) + func (acc *ZkAccount) GetAccountInfo() AccountInfo + func (acc *ZkAccount) GetCoinPrecision() int64 + func (acc *ZkAccount) Transfer(to AssetAccount, amount int64) (*types.Receipt, error) + func (acc *ZkAccount) TransferFrozen(to AssetAccount, amount int64) (*types.Receipt, error) + func (acc *ZkAccount) UnFrozen(amount int64) (*types.Receipt, error)