Documentation ¶
Index ¶
- Constants
- func GetKeyForLongBook(longBook types.LongBook) []byte
- func GetKeyForPrice(price sdk.Dec) []byte
- func GetKeyForShortBook(shortBook types.ShortBook) []byte
- func GetKeyForTs(ts uint64) []byte
- type Keeper
- func (k Keeper) AddRegisteredPair(ctx sdk.Context, contractAddr string, pair types.Pair) bool
- func (k Keeper) ChargeRentForGas(ctx sdk.Context, contractAddr string, gasUsed uint64, gasAllowance uint64) error
- func (k Keeper) ClearDependenciesForContract(ctx sdk.Context, removedContract types.ContractInfoV2)
- func (k Keeper) CreateModuleAccount(ctx sdk.Context)
- func (k Keeper) DecreaseOrderCount(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) error
- func (k Keeper) DeleteAllRegisteredPairsForContract(ctx sdk.Context, contractAddr string)
- func (k Keeper) DeleteContract(ctx sdk.Context, contractAddr string)
- func (k Keeper) DeleteMatchResultState(ctx sdk.Context, contractAddr string)
- func (k Keeper) DeleteNextOrderID(ctx sdk.Context, contractAddr string)
- func (k Keeper) DeletePriceStateBefore(ctx sdk.Context, contractAddr string, timestamp uint64, pair types.Pair)
- func (k Keeper) DoUnregisterContract(ctx sdk.Context, contract types.ContractInfoV2)
- func (k Keeper) DoUnregisterContractWithRefund(ctx sdk.Context, contract types.ContractInfoV2) error
- func (k Keeper) GetAllAssetMetadata(ctx sdk.Context) []types.AssetMetadata
- func (k Keeper) GetAllContractInfo(ctx sdk.Context) []types.ContractInfoV2
- func (k Keeper) GetAllLongBook(ctx sdk.Context, contractAddr string) (list []types.LongBook)
- func (k Keeper) GetAllLongBookForPair(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string) (list []types.OrderBookEntry)
- func (k Keeper) GetAllLongBookForPairPaginated(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (list []types.LongBook, pageRes *query.PageResponse, err error)
- func (k Keeper) GetAllPrices(ctx sdk.Context, contractAddr string, pair types.Pair) (list []*types.Price)
- func (k Keeper) GetAllProcessableContractInfo(ctx sdk.Context) []types.ContractInfoV2
- func (k Keeper) GetAllRegisteredPairs(ctx sdk.Context, contractAddr string) []types.Pair
- func (k Keeper) GetAllShortBook(ctx sdk.Context, contractAddr string) (list []types.ShortBook)
- func (k Keeper) GetAllShortBookForPair(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string) (list []types.OrderBookEntry)
- func (k Keeper) GetAllShortBookForPairPaginated(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (list []types.ShortBook, pageRes *query.PageResponse, err error)
- func (k Keeper) GetAssetMetadataByDenom(ctx sdk.Context, assetDenom string) (val types.AssetMetadata, found bool)
- func (k Keeper) GetContract(ctx sdk.Context, contractAddr string) (types.ContractInfoV2, error)
- func (k Keeper) GetContractGasLimit(ctx sdk.Context, contractAddr sdk.AccAddress) (uint64, error)
- func (k Keeper) GetContractUnsuspendCost(ctx sdk.Context) uint64
- func (k Keeper) GetContractWithoutGasCharge(ctx sdk.Context, contractAddr string) (types.ContractInfoV2, error)
- func (k Keeper) GetLongAllocationForOrderID(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (*types.Allocation, bool)
- func (k Keeper) GetLongBookByPrice(ctx sdk.Context, contractAddr string, price sdk.Dec, priceDenom string, ...) (val types.LongBook, found bool)
- func (k Keeper) GetLongOrderBookEntryByPrice(ctx sdk.Context, contractAddr string, price sdk.Dec, priceDenom string, ...) (types.OrderBookEntry, bool)
- func (k Keeper) GetMatchResultState(ctx sdk.Context, contractAddr string) (*types.MatchResult, bool)
- func (k Keeper) GetMaxOrderPerPrice(ctx sdk.Context) uint64
- func (k Keeper) GetMaxPairsPerContract(ctx sdk.Context) uint64
- func (k Keeper) GetMemStoreKey() sdk.StoreKey
- func (k Keeper) GetMinProcessableRent(ctx sdk.Context) uint64
- func (k Keeper) GetNextOrderID(ctx sdk.Context, contractAddr string) uint64
- func (k Keeper) GetOrderBookEntriesPerLoad(ctx sdk.Context) uint64
- func (k Keeper) GetOrderCountState(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) uint64
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPriceKeysToDelete(store sdk.KVStore, timestamp uint64) [][]byte
- func (k Keeper) GetPriceState(ctx sdk.Context, contractAddr string, timestamp uint64, pair types.Pair) (types.Price, bool)
- func (k Keeper) GetPriceTickSizeForPair(ctx sdk.Context, contractAddr string, pair types.Pair) (sdk.Dec, bool)
- func (k Keeper) GetPricesForTwap(ctx sdk.Context, contractAddr string, pair types.Pair, lookback uint64) (list []*types.Price)
- func (k Keeper) GetQuantityTickSizeForPair(ctx sdk.Context, contractAddr string, pair types.Pair) (sdk.Dec, bool)
- func (k Keeper) GetRegisteredPair(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string) (types.Pair, bool)
- func (k Keeper) GetRentsForContracts(ctx sdk.Context, contractAddrs []string) map[string]uint64
- func (k Keeper) GetSettlementGasAllowance(ctx sdk.Context, numSettlements int) uint64
- func (k Keeper) GetShortAllocationForOrderID(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (*types.Allocation, bool)
- func (k Keeper) GetShortBookByPrice(ctx sdk.Context, contractAddr string, price sdk.Dec, priceDenom string, ...) (val types.ShortBook, found bool)
- func (k Keeper) GetShortOrderBookEntryByPrice(ctx sdk.Context, contractAddr string, price sdk.Dec, priceDenom string, ...) (types.OrderBookEntry, bool)
- func (k Keeper) GetStoreKey() sdk.StoreKey
- func (k Keeper) GetTopNLongBooksForPair(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (list []types.OrderBookEntry)
- func (k Keeper) GetTopNLongBooksForPairStarting(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (list []types.OrderBookEntry)
- func (k Keeper) GetTopNShortBooksForPair(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (list []types.OrderBookEntry)
- func (k Keeper) GetTopNShortBooksForPairStarting(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) (list []types.OrderBookEntry)
- func (k Keeper) HasRegisteredPair(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string) bool
- func (k Keeper) IncreaseOrderCount(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) error
- func (k Keeper) IsNewEpoch(ctx sdk.Context) (bool, uint64)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) RemoveAllLongBooksForContract(ctx sdk.Context, contractAddr string)
- func (k Keeper) RemoveAllPricesForContract(ctx sdk.Context, contractAddr string)
- func (k Keeper) RemoveAllShortBooksForContract(ctx sdk.Context, contractAddr string)
- func (k Keeper) RemoveLongBookByPrice(ctx sdk.Context, contractAddr string, price sdk.Dec, priceDenom string, ...)
- func (k Keeper) RemoveShortBookByPrice(ctx sdk.Context, contractAddr string, price sdk.Dec, priceDenom string, ...)
- func (k Keeper) SetAssetMetadata(ctx sdk.Context, assetMetadata types.AssetMetadata)
- func (k Keeper) SetContract(ctx sdk.Context, contract *types.ContractInfoV2) error
- func (k Keeper) SetEpoch(ctx sdk.Context, epoch uint64)
- func (k Keeper) SetLongBook(ctx sdk.Context, contractAddr string, longBook types.LongBook)
- func (k Keeper) SetLongOrderBookEntry(ctx sdk.Context, contractAddr string, longBook types.OrderBookEntry)
- func (k Keeper) SetMatchResult(ctx sdk.Context, contractAddr string, result *types.MatchResult)
- func (k Keeper) SetNextOrderID(ctx sdk.Context, contractAddr string, nextID uint64)
- func (k Keeper) SetOrderCount(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, ...) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPriceState(ctx sdk.Context, price types.Price, contractAddr string)
- func (k Keeper) SetPriceTickSizeForPair(ctx sdk.Context, contractAddr string, pair types.Pair, ticksize sdk.Dec) error
- func (k Keeper) SetQuantityTickSizeForPair(ctx sdk.Context, contractAddr string, pair types.Pair, ticksize sdk.Dec) error
- func (k Keeper) SetShortBook(ctx sdk.Context, contractAddr string, shortBook types.ShortBook)
- func (k Keeper) SetShortOrderBookEntry(ctx sdk.Context, contractAddr string, shortBook types.OrderBookEntry)
- func (k *Keeper) SetWasmKeeper(wasmKeeper *wasm.Keeper)
- func (k Keeper) SuspendContract(ctx sdk.Context, contractAddress string, reason string) error
Constants ¶
const ContractPrefixKey = "x-wasm-contract"
const EpochKey = "epoch"
const MatchResultKey = "match-result"
Variables ¶
This section is empty.
Functions ¶
func GetKeyForLongBook ¶
func GetKeyForPrice ¶
func GetKeyForShortBook ¶
func GetKeyForTs ¶
Types ¶
type Keeper ¶
type Keeper struct { Cdc codec.BinaryCodec Paramstore paramtypes.Subspace AccountKeeper authkeeper.AccountKeeper EpochKeeper epochkeeper.Keeper BankKeeper bankkeeper.Keeper WasmKeeper wasm.Keeper MemState *dexcache.MemState // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey, ps paramtypes.Subspace, epochKeeper epochkeeper.Keeper, bankKeeper bankkeeper.Keeper, accountKeeper authkeeper.AccountKeeper, ) *Keeper
func (Keeper) AddRegisteredPair ¶
func (Keeper) ChargeRentForGas ¶
func (k Keeper) ChargeRentForGas(ctx sdk.Context, contractAddr string, gasUsed uint64, gasAllowance uint64) error
Reduce `RentBalance` of a contract if `userProvidedGas` cannot cover `gasUsed`
func (Keeper) ClearDependenciesForContract ¶
func (k Keeper) ClearDependenciesForContract(ctx sdk.Context, removedContract types.ContractInfoV2)
func (Keeper) CreateModuleAccount ¶
func (Keeper) DecreaseOrderCount ¶
func (Keeper) DeleteAllRegisteredPairsForContract ¶
func (Keeper) DeleteMatchResultState ¶
func (Keeper) DeleteNextOrderID ¶
func (Keeper) DeletePriceStateBefore ¶
func (Keeper) DoUnregisterContract ¶
func (k Keeper) DoUnregisterContract(ctx sdk.Context, contract types.ContractInfoV2)
Contract unregistration will remove all orderbook data stored for the contract
func (Keeper) DoUnregisterContractWithRefund ¶
func (k Keeper) DoUnregisterContractWithRefund(ctx sdk.Context, contract types.ContractInfoV2) error
Unregistrate and refund the creator
func (Keeper) GetAllAssetMetadata ¶
func (k Keeper) GetAllAssetMetadata(ctx sdk.Context) []types.AssetMetadata
func (Keeper) GetAllContractInfo ¶
func (k Keeper) GetAllContractInfo(ctx sdk.Context) []types.ContractInfoV2
func (Keeper) GetAllLongBook ¶
GetAllLongBook returns all longBook
func (Keeper) GetAllLongBookForPair ¶
func (Keeper) GetAllLongBookForPairPaginated ¶
func (Keeper) GetAllPrices ¶
func (Keeper) GetAllProcessableContractInfo ¶
func (k Keeper) GetAllProcessableContractInfo(ctx sdk.Context) []types.ContractInfoV2
func (Keeper) GetAllRegisteredPairs ¶
func (Keeper) GetAllShortBook ¶
GetAllShortBook returns all shortBook
func (Keeper) GetAllShortBookForPair ¶
func (Keeper) GetAllShortBookForPairPaginated ¶
func (Keeper) GetAssetMetadataByDenom ¶
func (Keeper) GetContract ¶
func (Keeper) GetContractGasLimit ¶
func (Keeper) GetContractUnsuspendCost ¶
func (Keeper) GetContractWithoutGasCharge ¶
func (Keeper) GetLongAllocationForOrderID ¶
func (Keeper) GetLongBookByPrice ¶
func (Keeper) GetLongOrderBookEntryByPrice ¶
func (Keeper) GetMatchResultState ¶
func (Keeper) GetMaxPairsPerContract ¶
func (Keeper) GetMemStoreKey ¶
func (Keeper) GetNextOrderID ¶
func (Keeper) GetOrderBookEntriesPerLoad ¶
func (Keeper) GetOrderCountState ¶
func (Keeper) GetPriceKeysToDelete ¶
func (Keeper) GetPriceState ¶
func (Keeper) GetPriceTickSizeForPair ¶
func (Keeper) GetPricesForTwap ¶
func (Keeper) GetQuantityTickSizeForPair ¶
func (Keeper) GetRegisteredPair ¶
func (Keeper) GetRentsForContracts ¶
func (Keeper) GetSettlementGasAllowance ¶
func (Keeper) GetShortAllocationForOrderID ¶
func (Keeper) GetShortBookByPrice ¶
func (Keeper) GetShortOrderBookEntryByPrice ¶
func (Keeper) GetStoreKey ¶
func (Keeper) GetTopNLongBooksForPair ¶
func (Keeper) GetTopNLongBooksForPairStarting ¶
func (k Keeper) GetTopNLongBooksForPairStarting(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, n int, startExclusive sdk.Dec) (list []types.OrderBookEntry)
Load the first (up to) N long book entries whose price are smaller than the specified limit in reverse sorted order. Parameters:
n: the largest number of entries to load startExclusive: the price limit
func (Keeper) GetTopNShortBooksForPair ¶
func (Keeper) GetTopNShortBooksForPairStarting ¶
func (k Keeper) GetTopNShortBooksForPairStarting(ctx sdk.Context, contractAddr string, priceDenom string, assetDenom string, n int, startExclusive sdk.Dec) (list []types.OrderBookEntry)
Load the first (up to) N short book entries whose price are larger than the specified limit in sorted order. Parameters:
n: the largest number of entries to load startExclusive: the price limit
func (Keeper) HasRegisteredPair ¶
func (Keeper) IncreaseOrderCount ¶
func (Keeper) RemoveAllLongBooksForContract ¶
func (Keeper) RemoveAllPricesForContract ¶
func (Keeper) RemoveAllShortBooksForContract ¶
func (Keeper) RemoveLongBookByPrice ¶
func (Keeper) RemoveShortBookByPrice ¶
func (Keeper) SetAssetMetadata ¶
func (k Keeper) SetAssetMetadata(ctx sdk.Context, assetMetadata types.AssetMetadata)
func (Keeper) SetContract ¶
func (Keeper) SetLongBook ¶
SetLongBook set a specific longBook in the store
func (Keeper) SetLongOrderBookEntry ¶
func (Keeper) SetMatchResult ¶
func (Keeper) SetNextOrderID ¶
func (Keeper) SetOrderCount ¶
func (Keeper) SetPriceState ¶
func (Keeper) SetPriceTickSizeForPair ¶
func (k Keeper) SetPriceTickSizeForPair(ctx sdk.Context, contractAddr string, pair types.Pair, ticksize sdk.Dec) error
contract_addr, pair -> tick size
func (Keeper) SetQuantityTickSizeForPair ¶
func (k Keeper) SetQuantityTickSizeForPair(ctx sdk.Context, contractAddr string, pair types.Pair, ticksize sdk.Dec) error
contract_addr, pair -> tick size
func (Keeper) SetShortBook ¶
SetShortBook set a specific shortBook in the store