Documentation ¶
Index ¶
- Constants
- Variables
- func GetFeeRatioStoreValue(ratio exchange.FeeRatio) []byte
- func GetIndexKeyPrefixAddressToOrder(addr sdk.AccAddress) []byte
- func GetIndexKeyPrefixAssetToOrder(assetDenom string) []byte
- func GetIndexKeyPrefixMarketToOrder(marketID uint32) []byte
- func GetKeyPrefixCommitments() []byte
- func GetKeyPrefixCommitmentsToMarket(marketID uint32) []byte
- func GetKeyPrefixKnownMarketID() []byte
- func GetKeyPrefixMarket(marketID uint32) []byte
- func GetKeyPrefixMarketBuyerSettlementFlatFee(marketID uint32) []byte
- func GetKeyPrefixMarketBuyerSettlementRatio(marketID uint32) []byte
- func GetKeyPrefixMarketBuyerSettlementRatioForPriceDenom(marketID uint32, priceDenom string) []byte
- func GetKeyPrefixMarketCreateAskFlatFee(marketID uint32) []byte
- func GetKeyPrefixMarketCreateBidFlatFee(marketID uint32) []byte
- func GetKeyPrefixMarketCreateCommitmentFlatFee(marketID uint32) []byte
- func GetKeyPrefixMarketPermissions(marketID uint32) []byte
- func GetKeyPrefixMarketPermissionsForAddress(marketID uint32, addr sdk.AccAddress) []byte
- func GetKeyPrefixMarketSellerSettlementFlatFee(marketID uint32) []byte
- func GetKeyPrefixMarketSellerSettlementRatio(marketID uint32) []byte
- func GetKeyPrefixOrder() []byte
- func GetKeyPrefixParamsSplit() []byte
- func GetKeySuffixSettlementRatio(ratio exchange.FeeRatio) []byte
- func MakeIndexKeyAddressToOrder(addr sdk.AccAddress, orderID uint64) []byte
- func MakeIndexKeyAssetToOrder(assetDenom string, orderID uint64) []byte
- func MakeIndexKeyMarketExternalIDToOrder(marketID uint32, externalID string) []byte
- func MakeIndexKeyMarketToOrder(marketID uint32, orderID uint64) []byte
- func MakeKeyCommitment(marketID uint32, addr sdk.AccAddress) []byte
- func MakeKeyKnownMarketID(marketID uint32) []byte
- func MakeKeyLastMarketID() []byte
- func MakeKeyLastOrderID() []byte
- func MakeKeyMarketAcceptingCommitments(marketID uint32) []byte
- func MakeKeyMarketBuyerSettlementFlatFee(marketID uint32, denom string) []byte
- func MakeKeyMarketBuyerSettlementRatio(marketID uint32, ratio exchange.FeeRatio) []byte
- func MakeKeyMarketCommitmentSettlementBips(marketID uint32) []byte
- func MakeKeyMarketCreateAskFlatFee(marketID uint32, denom string) []byte
- func MakeKeyMarketCreateBidFlatFee(marketID uint32, denom string) []byte
- func MakeKeyMarketCreateCommitmentFlatFee(marketID uint32, denom string) []byte
- func MakeKeyMarketIntermediaryDenom(marketID uint32) []byte
- func MakeKeyMarketNotAcceptingOrders(marketID uint32) []byte
- func MakeKeyMarketPermissions(marketID uint32, addr sdk.AccAddress, permission exchange.Permission) []byte
- func MakeKeyMarketReqAttrAsk(marketID uint32) []byte
- func MakeKeyMarketReqAttrBid(marketID uint32) []byte
- func MakeKeyMarketReqAttrCommitment(marketID uint32) []byte
- func MakeKeyMarketSellerSettlementFlatFee(marketID uint32, denom string) []byte
- func MakeKeyMarketSellerSettlementRatio(marketID uint32, ratio exchange.FeeRatio) []byte
- func MakeKeyMarketUserSettle(marketID uint32) []byte
- func MakeKeyOrder(orderID uint64) []byte
- func MakeKeyParamsSplit(denom string) []byte
- func NewMsgServer(k Keeper) exchange.MsgServer
- func NewQueryServer(k Keeper) exchange.QueryServer
- func ParseFeeRatioStoreValue(value []byte) (priceAmount, feeAmount sdkmath.Int, err error)
- func ParseIndexKeyAddressToOrder(key []byte) (sdk.AccAddress, uint64, error)
- func ParseIndexKeyAssetToOrder(key []byte) (string, uint64, error)
- func ParseIndexKeyMarketToOrder(key []byte) (uint32, uint64, error)
- func ParseIndexKeySuffixOrderID(key []byte) (uint64, bool)
- func ParseKeyCommitment(key []byte) (uint32, sdk.AccAddress, error)
- func ParseKeyOrder(key []byte) (uint64, bool)
- func ParseKeySuffixCommitment(suffix []byte) (sdk.AccAddress, error)
- func ParseKeySuffixKnownMarketID(suffix []byte) (uint32, bool)
- func ParseKeySuffixMarketPermissions(suffix []byte) (sdk.AccAddress, exchange.Permission, error)
- func ParseKeySuffixSettlementRatio(suffix []byte) (priceDenom, feeDenom string, err error)
- func ParseReqAttrStoreValue(value []byte) []string
- type Keeper
- func (k Keeper) AddCommitment(ctx sdk.Context, marketID uint32, addr sdk.AccAddress, amount sdk.Coins, ...) error
- func (k Keeper) CalculateBuyerSettlementRatioFeeOptions(ctx sdk.Context, marketID uint32, price sdk.Coin) ([]sdk.Coin, error)
- func (k Keeper) CalculateCommitmentSettlementFee(ctx sdk.Context, req *exchange.MsgMarketCommitmentSettleRequest) (*exchange.QueryCommitmentSettlementFeeCalcResponse, error)
- func (k Keeper) CalculateExchangeSplit(ctx sdk.Context, feeAmt sdk.Coins) sdk.Coins
- func (k Keeper) CalculateSellerSettlementRatioFee(ctx sdk.Context, marketID uint32, price sdk.Coin) (*sdk.Coin, error)
- func (k Keeper) CanCancelOrdersForMarket(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanCreateAsk(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) bool
- func (k Keeper) CanCreateBid(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) bool
- func (k Keeper) CanCreateCommitment(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) bool
- func (k Keeper) CanManagePermissions(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanManageReqAttrs(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanReleaseCommitmentsForMarket(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanSetIDs(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanSettleCommitments(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanSettleOrders(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanUpdateMarket(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CanWithdrawMarketFunds(ctx sdk.Context, marketID uint32, admin string) bool
- func (k Keeper) CancelAllOrdersForMarket(ctx sdk.Context, marketID uint32, signer string)
- func (k Keeper) CancelOrder(ctx sdk.Context, orderID uint64, signer string) error
- func (k Keeper) CloseMarket(ctx sdk.Context, marketID uint32, signer string)
- func (k Keeper) CollectFee(ctx sdk.Context, marketID uint32, payer sdk.AccAddress, fee sdk.Coins) error
- func (k Keeper) CollectFees(ctx sdk.Context, marketID uint32, inputs []banktypes.Input) error
- func (k Keeper) CreateAskOrder(ctx sdk.Context, askOrder exchange.AskOrder, creationFee *sdk.Coin) (uint64, error)
- func (k Keeper) CreateBidOrder(ctx sdk.Context, bidOrder exchange.BidOrder, creationFee *sdk.Coin) (uint64, error)
- func (k Keeper) CreateMarket(ctx sdk.Context, market exchange.Market) (uint32, error)
- func (k Keeper) DoTransfer(ctxIn sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *exchange.GenesisState
- func (k Keeper) FillAsks(ctx sdk.Context, msg *exchange.MsgFillAsksRequest) error
- func (k Keeper) FillBids(ctx sdk.Context, msg *exchange.MsgFillBidsRequest) error
- func (k Keeper) GetAccessGrants(ctx sdk.Context, marketID uint32) []exchange.AccessGrant
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBuyerSettlementFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin
- func (k Keeper) GetBuyerSettlementRatios(ctx sdk.Context, marketID uint32) []exchange.FeeRatio
- func (k Keeper) GetCommitmentAmount(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) sdk.Coins
- func (k Keeper) GetCommitmentSettlementBips(ctx sdk.Context, marketID uint32) uint32
- func (k Keeper) GetCreateAskFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin
- func (k Keeper) GetCreateBidFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin
- func (k Keeper) GetCreateCommitmentFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin
- func (k Keeper) GetExchangeSplit(ctx sdk.Context, denom string) uint16
- func (k Keeper) GetFeeCollectorName() string
- func (k Keeper) GetIntermediaryDenom(ctx sdk.Context, marketID uint32) string
- func (k Keeper) GetMarket(ctx sdk.Context, marketID uint32) *exchange.Market
- func (k Keeper) GetMarketAccount(ctx sdk.Context, marketID uint32) *exchange.MarketAccount
- func (k Keeper) GetMarketBrief(ctx sdk.Context, marketID uint32) *exchange.MarketBrief
- func (k Keeper) GetMarketDetails(ctx sdk.Context, marketID uint32) *exchange.MarketDetails
- func (k Keeper) GetNav(ctx sdk.Context, assetsDenom, priceDenom string) *exchange.NetAssetPrice
- func (k Keeper) GetOrder(ctx sdk.Context, orderID uint64) (*exchange.Order, error)
- func (k Keeper) GetOrderByExternalID(ctx sdk.Context, marketID uint32, externalID string) (*exchange.Order, error)
- func (k Keeper) GetParams(ctx sdk.Context) *exchange.Params
- func (k Keeper) GetParamsOrDefaults(ctx sdk.Context) *exchange.Params
- func (k Keeper) GetReqAttrsAsk(ctx sdk.Context, marketID uint32) []string
- func (k Keeper) GetReqAttrsBid(ctx sdk.Context, marketID uint32) []string
- func (k Keeper) GetReqAttrsCommitment(ctx sdk.Context, marketID uint32) []string
- func (k Keeper) GetSellerSettlementFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin
- func (k Keeper) GetSellerSettlementRatios(ctx sdk.Context, marketID uint32) []exchange.FeeRatio
- func (k Keeper) GetUserPermissions(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) []exchange.Permission
- func (k Keeper) HasPermission(ctx sdk.Context, marketID uint32, address string, ...) bool
- func (k Keeper) InitGenesis(ctx sdk.Context, genState *exchange.GenesisState)
- func (k Keeper) IsAuthority(addr string) bool
- func (k Keeper) IsMarketAcceptingCommitments(ctx sdk.Context, marketID uint32) bool
- func (k Keeper) IsMarketAcceptingOrders(ctx sdk.Context, marketID uint32) bool
- func (k Keeper) IsMarketKnown(ctx sdk.Context, marketID uint32) bool
- func (k Keeper) IsUserSettlementAllowed(ctx sdk.Context, marketID uint32) bool
- func (k Keeper) IterateAddressOrders(ctx sdk.Context, addr sdk.AccAddress, ...)
- func (k Keeper) IterateAssetOrders(ctx sdk.Context, assetDenom string, ...)
- func (k Keeper) IterateCommitments(ctx sdk.Context, cb func(commitment exchange.Commitment) bool)
- func (k Keeper) IterateKnownMarketIDs(ctx sdk.Context, cb func(marketID uint32) bool)
- func (k Keeper) IterateMarketOrders(ctx sdk.Context, marketID uint32, ...)
- func (k Keeper) IterateMarkets(ctx sdk.Context, cb func(market *exchange.Market) bool)
- func (k Keeper) IterateOrders(ctx sdk.Context, cb func(order *exchange.Order) bool) error
- func (k Keeper) ReleaseAllCommitmentsForMarket(ctx sdk.Context, marketID uint32)
- func (k Keeper) ReleaseCommitment(ctx sdk.Context, marketID uint32, addr sdk.AccAddress, amount sdk.Coins, ...) error
- func (k Keeper) ReleaseCommitments(ctx sdk.Context, marketID uint32, toRelease []exchange.AccountAmount, ...) error
- func (k Keeper) SetOrderExternalID(ctx sdk.Context, marketID uint32, orderID uint64, newExternalID string) error
- func (k Keeper) SetParams(ctx sdk.Context, params *exchange.Params)
- func (k Keeper) SettleCommitments(ctx sdk.Context, req *exchange.MsgMarketCommitmentSettleRequest) error
- func (k Keeper) SettleOrders(ctx sdk.Context, req *exchange.MsgMarketSettleRequest) error
- func (k Keeper) UpdateFees(ctx sdk.Context, msg *exchange.MsgGovManageFeesRequest)
- func (k Keeper) UpdateIntermediaryDenom(ctx sdk.Context, marketID uint32, denom string, updatedBy string)
- func (k Keeper) UpdateMarketAcceptingCommitments(ctx sdk.Context, marketID uint32, accepting bool, updatedBy string) error
- func (k Keeper) UpdateMarketAcceptingOrders(ctx sdk.Context, marketID uint32, accepting bool, updatedBy string) error
- func (k Keeper) UpdateMarketDetails(ctx sdk.Context, marketID uint32, marketDetails exchange.MarketDetails, ...) error
- func (k Keeper) UpdatePermissions(ctx sdk.Context, msg *exchange.MsgMarketManagePermissionsRequest) error
- func (k Keeper) UpdateReqAttrs(ctx sdk.Context, msg *exchange.MsgMarketManageReqAttrsRequest) error
- func (k Keeper) UpdateUserSettlementAllowed(ctx sdk.Context, marketID uint32, allow bool, updatedBy string) error
- func (k Keeper) ValidateAndCollectCommitmentCreationFee(ctx sdk.Context, marketID uint32, addr sdk.AccAddress, fee *sdk.Coin) error
- func (k Keeper) ValidateAskPrice(ctx sdk.Context, marketID uint32, price sdk.Coin, settlementFlatFee *sdk.Coin) error
- func (k Keeper) ValidateAuthority(addr string) error
- func (k Keeper) ValidateBuyerSettlementFee(ctx sdk.Context, marketID uint32, price sdk.Coin, fee sdk.Coins) error
- func (k Keeper) ValidateCreateAskFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error
- func (k Keeper) ValidateCreateBidFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error
- func (k Keeper) ValidateCreateCommitmentFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error
- func (k Keeper) ValidateMarket(ctx sdk.Context, marketID uint32) error
- func (k Keeper) ValidateSellerSettlementFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error
- func (k Keeper) WithdrawMarketFunds(ctx sdk.Context, marketID uint32, toAddr sdk.AccAddress, amount sdk.Coins, ...) error
- type MsgServer
- func (k MsgServer) CancelOrder(goCtx context.Context, msg *exchange.MsgCancelOrderRequest) (*exchange.MsgCancelOrderResponse, error)
- func (k MsgServer) CommitFunds(goCtx context.Context, msg *exchange.MsgCommitFundsRequest) (*exchange.MsgCommitFundsResponse, error)
- func (k MsgServer) CreateAsk(goCtx context.Context, msg *exchange.MsgCreateAskRequest) (*exchange.MsgCreateAskResponse, error)
- func (k MsgServer) CreateBid(goCtx context.Context, msg *exchange.MsgCreateBidRequest) (*exchange.MsgCreateBidResponse, error)
- func (k MsgServer) FillAsks(goCtx context.Context, msg *exchange.MsgFillAsksRequest) (*exchange.MsgFillAsksResponse, error)
- func (k MsgServer) FillBids(goCtx context.Context, msg *exchange.MsgFillBidsRequest) (*exchange.MsgFillBidsResponse, error)
- func (k MsgServer) GovCloseMarket(goCtx context.Context, msg *exchange.MsgGovCloseMarketRequest) (*exchange.MsgGovCloseMarketResponse, error)
- func (k MsgServer) GovCreateMarket(goCtx context.Context, msg *exchange.MsgGovCreateMarketRequest) (*exchange.MsgGovCreateMarketResponse, error)
- func (k MsgServer) GovManageFees(goCtx context.Context, msg *exchange.MsgGovManageFeesRequest) (*exchange.MsgGovManageFeesResponse, error)
- func (k MsgServer) GovUpdateParams(goCtx context.Context, msg *exchange.MsgGovUpdateParamsRequest) (*exchange.MsgGovUpdateParamsResponse, error)
- func (k MsgServer) MarketCommitmentSettle(goCtx context.Context, msg *exchange.MsgMarketCommitmentSettleRequest) (*exchange.MsgMarketCommitmentSettleResponse, error)
- func (k MsgServer) MarketManagePermissions(goCtx context.Context, msg *exchange.MsgMarketManagePermissionsRequest) (*exchange.MsgMarketManagePermissionsResponse, error)
- func (k MsgServer) MarketManageReqAttrs(goCtx context.Context, msg *exchange.MsgMarketManageReqAttrsRequest) (*exchange.MsgMarketManageReqAttrsResponse, error)
- func (k MsgServer) MarketReleaseCommitments(goCtx context.Context, msg *exchange.MsgMarketReleaseCommitmentsRequest) (*exchange.MsgMarketReleaseCommitmentsResponse, error)
- func (k MsgServer) MarketSetOrderExternalID(goCtx context.Context, msg *exchange.MsgMarketSetOrderExternalIDRequest) (*exchange.MsgMarketSetOrderExternalIDResponse, error)
- func (k MsgServer) MarketSettle(goCtx context.Context, msg *exchange.MsgMarketSettleRequest) (*exchange.MsgMarketSettleResponse, error)
- func (k MsgServer) MarketUpdateAcceptingCommitments(goCtx context.Context, ...) (*exchange.MsgMarketUpdateAcceptingCommitmentsResponse, error)
- func (k MsgServer) MarketUpdateAcceptingOrders(goCtx context.Context, msg *exchange.MsgMarketUpdateAcceptingOrdersRequest) (*exchange.MsgMarketUpdateAcceptingOrdersResponse, error)
- func (k MsgServer) MarketUpdateDetails(goCtx context.Context, msg *exchange.MsgMarketUpdateDetailsRequest) (*exchange.MsgMarketUpdateDetailsResponse, error)
- func (k MsgServer) MarketUpdateEnabled(_ context.Context, _ *exchange.MsgMarketUpdateEnabledRequest) (*exchange.MsgMarketUpdateEnabledResponse, error)
- func (k MsgServer) MarketUpdateIntermediaryDenom(goCtx context.Context, msg *exchange.MsgMarketUpdateIntermediaryDenomRequest) (*exchange.MsgMarketUpdateIntermediaryDenomResponse, error)
- func (k MsgServer) MarketUpdateUserSettle(goCtx context.Context, msg *exchange.MsgMarketUpdateUserSettleRequest) (*exchange.MsgMarketUpdateUserSettleResponse, error)
- func (k MsgServer) MarketWithdraw(goCtx context.Context, msg *exchange.MsgMarketWithdrawRequest) (*exchange.MsgMarketWithdrawResponse, error)
- type QueryServer
- func (k QueryServer) CommitmentSettlementFeeCalc(goCtx context.Context, req *exchange.QueryCommitmentSettlementFeeCalcRequest) (*exchange.QueryCommitmentSettlementFeeCalcResponse, error)
- func (k QueryServer) GetAccountCommitments(goCtx context.Context, req *exchange.QueryGetAccountCommitmentsRequest) (*exchange.QueryGetAccountCommitmentsResponse, error)
- func (k QueryServer) GetAllCommitments(goCtx context.Context, req *exchange.QueryGetAllCommitmentsRequest) (*exchange.QueryGetAllCommitmentsResponse, error)
- func (k QueryServer) GetAllMarkets(goCtx context.Context, req *exchange.QueryGetAllMarketsRequest) (*exchange.QueryGetAllMarketsResponse, error)
- func (k QueryServer) GetAllOrders(goCtx context.Context, req *exchange.QueryGetAllOrdersRequest) (*exchange.QueryGetAllOrdersResponse, error)
- func (k QueryServer) GetAssetOrders(goCtx context.Context, req *exchange.QueryGetAssetOrdersRequest) (*exchange.QueryGetAssetOrdersResponse, error)
- func (k QueryServer) GetCommitment(goCtx context.Context, req *exchange.QueryGetCommitmentRequest) (*exchange.QueryGetCommitmentResponse, error)
- func (k QueryServer) GetMarket(goCtx context.Context, req *exchange.QueryGetMarketRequest) (*exchange.QueryGetMarketResponse, error)
- func (k QueryServer) GetMarketCommitments(goCtx context.Context, req *exchange.QueryGetMarketCommitmentsRequest) (*exchange.QueryGetMarketCommitmentsResponse, error)
- func (k QueryServer) GetMarketOrders(goCtx context.Context, req *exchange.QueryGetMarketOrdersRequest) (*exchange.QueryGetMarketOrdersResponse, error)
- func (k QueryServer) GetOrder(goCtx context.Context, req *exchange.QueryGetOrderRequest) (*exchange.QueryGetOrderResponse, error)
- func (k QueryServer) GetOrderByExternalID(goCtx context.Context, req *exchange.QueryGetOrderByExternalIDRequest) (*exchange.QueryGetOrderByExternalIDResponse, error)
- func (k QueryServer) GetOwnerOrders(goCtx context.Context, req *exchange.QueryGetOwnerOrdersRequest) (*exchange.QueryGetOwnerOrdersResponse, error)
- func (k QueryServer) OrderFeeCalc(goCtx context.Context, req *exchange.QueryOrderFeeCalcRequest) (*exchange.QueryOrderFeeCalcResponse, error)
- func (k QueryServer) Params(goCtx context.Context, _ *exchange.QueryParamsRequest) (*exchange.QueryParamsResponse, error)
- func (k QueryServer) ValidateCreateMarket(goCtx context.Context, req *exchange.QueryValidateCreateMarketRequest) (*exchange.QueryValidateCreateMarketResponse, error)
- func (k QueryServer) ValidateManageFees(goCtx context.Context, req *exchange.QueryValidateManageFeesRequest) (*exchange.QueryValidateManageFeesResponse, error)
- func (k QueryServer) ValidateMarket(goCtx context.Context, req *exchange.QueryValidateMarketRequest) (*exchange.QueryValidateMarketResponse, error)
Constants ¶
const ( // KeyTypeParams is the type byte for params entries. KeyTypeParams = byte(0x00) // KeyTypeLastMarketID is the type byte for the last auto-selected market id. KeyTypeLastMarketID = byte(0x06) // KeyTypeKnownMarketID is the type byte for known market id entries. KeyTypeKnownMarketID = byte(0x07) // KeyTypeLastOrderID is the type byte for the id of the last order created. KeyTypeLastOrderID = byte(0x08) // KeyTypeMarket is the type byte for market entries. KeyTypeMarket = byte(0x01) // KeyTypeOrder is the type byte for order entries. KeyTypeOrder = byte(0x02) // KeyTypeMarketToOrderIndex is the type byte for entries in the market to order index. KeyTypeMarketToOrderIndex = byte(0x03) // KeyTypeAddressToOrderIndex is the type byte for entries in the address to order index. KeyTypeAddressToOrderIndex = byte(0x04) // KeyTypeAssetToOrderIndex is the type byte for entries in the asset to order index. KeyTypeAssetToOrderIndex = byte(0x05) // KeyTypeMarketExternalIDToOrderIndex is the type byte for entries in the market and uuid to order index. KeyTypeMarketExternalIDToOrderIndex = byte(0x09) // KeyTypeCommitment is the type byte for commitments. KeyTypeCommitment = byte(0x63) // MarketKeyTypeCreateAskFlat is the market-specific type byte for the create-ask flat fees. MarketKeyTypeCreateAskFlat = byte(0x00) // MarketKeyTypeCreateBidFlat is the market-specific type byte for the create-bid flat fees. MarketKeyTypeCreateBidFlat = byte(0x01) // MarketKeyTypeSellerSettlementFlat is the market-specific type byte for the seller settlement flat fees. MarketKeyTypeSellerSettlementFlat = byte(0x02) // MarketKeyTypeSellerSettlementRatio is the market-specific type byte for the seller settlement ratios. MarketKeyTypeSellerSettlementRatio = byte(0x03) // MarketKeyTypeBuyerSettlementFlat is the market-specific type byte for the buyer settlement flat fees. MarketKeyTypeBuyerSettlementFlat = byte(0x04) // MarketKeyTypeBuyerSettlementRatio is the market-specific type byte for the buyer settlement ratios. MarketKeyTypeBuyerSettlementRatio = byte(0x05) // MarketKeyTypeNotAcceptingOrders is the market-specific type byte for the the accepting-orders anti-indicators. MarketKeyTypeNotAcceptingOrders = byte(0x06) // MarketKeyTypeUserSettle is the market-specific type byte for the user-settle indicators. MarketKeyTypeUserSettle = byte(0x07) // MarketKeyTypePermissions is the market-specific type byte for the market permissions. MarketKeyTypePermissions = byte(0x08) // MarketKeyTypeReqAttr is the market-specific type byte for the market's required attributes lists. MarketKeyTypeReqAttr = byte(0x09) // MarketKeyTypeAcceptingCommitments is the market-specific type byte for the accepting-commitments indicators. MarketKeyTypeAcceptingCommitments = byte(0x10) // MarketKeyTypeCreateCommitmentFlat is the market-specific type byte for the create-commitment flat fees. MarketKeyTypeCreateCommitmentFlat = byte(0x11) // MarketKeyTypeCommitmentSettlementBips is the market-specific type byte for the bips the market is charged for commitment settlements. MarketKeyTypeCommitmentSettlementBips = byte(0x12) // MarketKeyTypeIntermediaryDenom is the market-specific type byte for the intermediary denom used in fee calcs. MarketKeyTypeIntermediaryDenom = byte(0x13) // OrderKeyTypeAsk is the order-specific type byte for ask orders. OrderKeyTypeAsk = exchange.OrderTypeByteAsk // OrderKeyTypeBid is the order-specific type byte for bid orders. OrderKeyTypeBid = exchange.OrderTypeByteBid // RecordSeparator is the RE ascii control char used to separate records in a byte slice. RecordSeparator = byte(0x1E) )
Variables ¶
var ( // TenKInt is an sdkmath.Int of 10,000. TenKInt = sdkmath.NewInt(10_000) // TwentyKInt is an sdkmath.Int of 20,000. TwentyKInt = sdkmath.NewInt(20_000) )
Functions ¶
func GetFeeRatioStoreValue ¶
GetFeeRatioStoreValue creates the byte slice to set in the store for a fee ratio's value. Result has the format <price amount><RS><fee amount> where both amounts are strings (of digits). E.g. "100\\1E3" (for a price amount of 100, and fee amount of 3).
func GetIndexKeyPrefixAddressToOrder ¶
func GetIndexKeyPrefixAddressToOrder(addr sdk.AccAddress) []byte
GetIndexKeyPrefixAddressToOrder creates a key prefix for the address to order index limited to the given address.
func GetIndexKeyPrefixAssetToOrder ¶
GetIndexKeyPrefixAssetToOrder creates a key prefix for the asset to order index limited to the given asset.
func GetIndexKeyPrefixMarketToOrder ¶
GetIndexKeyPrefixMarketToOrder creates the prefix for the market to order index limited ot the given market id.
func GetKeyPrefixCommitments ¶ added in v1.18.0
func GetKeyPrefixCommitments() []byte
GetKeyPrefixCommitments gets the key prefix for all commitments.
func GetKeyPrefixCommitmentsToMarket ¶ added in v1.18.0
GetKeyPrefixCommitmentsToMarket gets the key prefix for all commitments in a market.
func GetKeyPrefixKnownMarketID ¶
func GetKeyPrefixKnownMarketID() []byte
GetKeyPrefixKnownMarketID creates the key prefix for all known market id entries.
func GetKeyPrefixMarket ¶
GetKeyPrefixMarket creates the key prefix for all of a market's entries.
func GetKeyPrefixMarketBuyerSettlementFlatFee ¶
GetKeyPrefixMarketBuyerSettlementFlatFee creates the key prefix for a market's buyer settlement flat fees.
func GetKeyPrefixMarketBuyerSettlementRatio ¶
GetKeyPrefixMarketBuyerSettlementRatio creates the key prefix for a market's buyer settlement fee ratios.
func GetKeyPrefixMarketBuyerSettlementRatioForPriceDenom ¶
GetKeyPrefixMarketBuyerSettlementRatioForPriceDenom creates the key prefix for a market's buyer settlement fee ratios that have the provided price denom.
func GetKeyPrefixMarketCreateAskFlatFee ¶
GetKeyPrefixMarketCreateAskFlatFee creates the key prefix for the create-ask flat fees for the provided market.
func GetKeyPrefixMarketCreateBidFlatFee ¶
GetKeyPrefixMarketCreateBidFlatFee creates the key prefix for the create-bid flat fees for the provided market.
func GetKeyPrefixMarketCreateCommitmentFlatFee ¶ added in v1.18.0
GetKeyPrefixMarketCreateCommitmentFlatFee creates the key prefix for the create-commitment flat fees for the provided market.
func GetKeyPrefixMarketPermissions ¶
GetKeyPrefixMarketPermissions creates the key prefix for a market's permissions.
func GetKeyPrefixMarketPermissionsForAddress ¶
func GetKeyPrefixMarketPermissionsForAddress(marketID uint32, addr sdk.AccAddress) []byte
GetKeyPrefixMarketPermissionsForAddress creates the key prefix for an address' permissions in a given market.
func GetKeyPrefixMarketSellerSettlementFlatFee ¶
GetKeyPrefixMarketSellerSettlementFlatFee creates the key prefix for a market's seller settlement flat fees.
func GetKeyPrefixMarketSellerSettlementRatio ¶
GetKeyPrefixMarketSellerSettlementRatio creates the key prefix for a market's seller settlement fee ratios.
func GetKeyPrefixOrder ¶
func GetKeyPrefixOrder() []byte
GetKeyPrefixOrder gets the key prefix for all orders.
func GetKeyPrefixParamsSplit ¶
func GetKeyPrefixParamsSplit() []byte
GetKeyPrefixParamsSplit creates the key prefix for all params splits entries.
func GetKeySuffixSettlementRatio ¶
GetKeySuffixSettlementRatio gets the key suffix bytes to represent the provided fee ratio. Result has the format <price denom><RS><fee denom>
func MakeIndexKeyAddressToOrder ¶
func MakeIndexKeyAddressToOrder(addr sdk.AccAddress, orderID uint64) []byte
MakeIndexKeyAddressToOrder creates the key to use for the address to order index with the given values.
func MakeIndexKeyAssetToOrder ¶
MakeIndexKeyAssetToOrder creates the key to use for the asset to order index for the provided values.
func MakeIndexKeyMarketExternalIDToOrder ¶
MakeIndexKeyMarketExternalIDToOrder creates the key to use for the market and uuid to order index for the provided values.
func MakeIndexKeyMarketToOrder ¶
MakeIndexKeyMarketToOrder creates the key to use for the market to order index with the given ids.
func MakeKeyCommitment ¶ added in v1.18.0
func MakeKeyCommitment(marketID uint32, addr sdk.AccAddress) []byte
MakeKeyCommitment creates the key to use for a commitment
func MakeKeyKnownMarketID ¶
MakeKeyKnownMarketID creates the key for a market's known market id entry.
func MakeKeyLastMarketID ¶
func MakeKeyLastMarketID() []byte
MakeKeyLastMarketID creates the key for the last auto-selected market id.
func MakeKeyLastOrderID ¶
func MakeKeyLastOrderID() []byte
MakeKeyLastOrderID creates the key for the id of the last order created.
func MakeKeyMarketAcceptingCommitments ¶ added in v1.18.0
MakeKeyMarketAcceptingCommitments creates the key to use to indicate that a market allows commitments.
func MakeKeyMarketBuyerSettlementFlatFee ¶
MakeKeyMarketBuyerSettlementFlatFee creates the key for a market's buyer settlement flat fee with the given denom.
func MakeKeyMarketBuyerSettlementRatio ¶
MakeKeyMarketBuyerSettlementRatio creates the key to use for the given buyer settlement fee ratio in the given market.
func MakeKeyMarketCommitmentSettlementBips ¶ added in v1.18.0
MakeKeyMarketCommitmentSettlementBips creates the key to use to for a market's commitment settlement bips.
func MakeKeyMarketCreateAskFlatFee ¶
MakeKeyMarketCreateAskFlatFee creates the key to use for a create-ask flat fee for the given market and denom.
func MakeKeyMarketCreateBidFlatFee ¶
MakeKeyMarketCreateBidFlatFee creates the key to use for a create-bid flat fee for the given denom.
func MakeKeyMarketCreateCommitmentFlatFee ¶ added in v1.18.0
MakeKeyMarketCreateCommitmentFlatFee creates the key to use for a create-commitment flat fee for the given denom.
func MakeKeyMarketIntermediaryDenom ¶ added in v1.18.0
MakeKeyMarketIntermediaryDenom creates the key to use to for a market's commitment intermediary denom.
func MakeKeyMarketNotAcceptingOrders ¶ added in v1.18.0
MakeKeyMarketNotAcceptingOrders creates the key to use to indicate that a market is not accepting orders.
func MakeKeyMarketPermissions ¶
func MakeKeyMarketPermissions(marketID uint32, addr sdk.AccAddress, permission exchange.Permission) []byte
MakeKeyMarketPermissions creates the key to use for a permission granted to an address for a market.
func MakeKeyMarketReqAttrAsk ¶
MakeKeyMarketReqAttrAsk creates the key to use for a market's attributes required to create an ask order.
func MakeKeyMarketReqAttrBid ¶
MakeKeyMarketReqAttrBid creates the key to use for a market's attributes required to create a bid order.
func MakeKeyMarketReqAttrCommitment ¶ added in v1.18.0
MakeKeyMarketReqAttrCommitment creates the key to use for a market's attributes required to create a commitment.
func MakeKeyMarketSellerSettlementFlatFee ¶
MakeKeyMarketSellerSettlementFlatFee creates the key for a market's seller settlement flat fee with the given denom.
func MakeKeyMarketSellerSettlementRatio ¶
MakeKeyMarketSellerSettlementRatio creates the key to use for the given seller settlement fee ratio in the given market.
func MakeKeyMarketUserSettle ¶
MakeKeyMarketUserSettle creates the key to use to indicate that a market allows settlement by users.
func MakeKeyOrder ¶
MakeKeyOrder creates the key to use for an order ID.
func MakeKeyParamsSplit ¶
MakeKeyParamsSplit creates the key to use for the params defining the splits. A denom of "" is used for the default split value.
func NewMsgServer ¶
func NewQueryServer ¶
func NewQueryServer(k Keeper) exchange.QueryServer
func ParseFeeRatioStoreValue ¶
ParseFeeRatioStoreValue parses a fee ratio's store value back into the amounts. Input is expected to have the format <price amount><RS><fee amount> where both amounts are strings (of digits). E.g. "100\\1E3" (for a price amount of 100, and fee amount of 3).
func ParseIndexKeyAddressToOrder ¶
func ParseIndexKeyAddressToOrder(key []byte) (sdk.AccAddress, uint64, error)
ParseIndexKeyAddressToOrder will extract what it can from an address to order index key. The input can have the following formats:
- <key type byte> | <addr length byte> | <addr> | <order id>
- <addr length byte> | <addr> | <order id>
- <order id>
In the case where just the <order id> is provided, the returned address will be empty.
func ParseIndexKeyAssetToOrder ¶
ParseIndexKeyAssetToOrder extracts the denom, type byte, and order id from an asset to order index key. The input can have the following formats:
- <type byte> | <denom> | <order id>
- <denom> | <order id>
- <order id>
In the case where just the <order id> is provided, the returned denom will be "", and type byte will be 0. In the case where just the <order type byte> and <order id> are provided, the returned denom will be "".
func ParseIndexKeyMarketToOrder ¶
ParseIndexKeyMarketToOrder will extract the market id and order id from a market to order index key. The input can have the following formats:
- <type byte> | <market id> (4 bytes) | <order id> (8 bytes)
- <market id> (4 bytes) | <order id> (8 bytes)
- <order id> (8 bytes)
In the case where just the <order id> is provided, the returned market id will be 0.
func ParseIndexKeySuffixOrderID ¶
ParseIndexKeySuffixOrderID converts the last 8 bytes of the provided key into a uint64. The returned bool will be false only if the key has fewer than 8 bytes.
func ParseKeyCommitment ¶ added in v1.18.0
func ParseKeyCommitment(key []byte) (uint32, sdk.AccAddress, error)
ParseKeyCommitment extracts the market id and address from a commitment key. The input must have the format: <type byte> | <market id> | <addr length byte> | <addr>.
func ParseKeyOrder ¶
ParseKeyOrder will extract the order id from the provided order key. The returned bool is whether parsing was successful (true = ok).
The input can have the following formats:
- <type byte> | <order id> (8 bytes)
- <order id> (8 bytes)
func ParseKeySuffixCommitment ¶ added in v1.18.0
func ParseKeySuffixCommitment(suffix []byte) (sdk.AccAddress, error)
ParseKeySuffixCommitment parses the addr portion of a commitment key. The input must have the format: <addr length byte> | <addr>.
func ParseKeySuffixKnownMarketID ¶
ParseKeySuffixKnownMarketID parses the market id out of a known market id key that doesn't have the type byte. Input is expected to have the format <market id bytes>. Returned boolean indicates whether parsing was successful (true = okay).
func ParseKeySuffixMarketPermissions ¶
func ParseKeySuffixMarketPermissions(suffix []byte) (sdk.AccAddress, exchange.Permission, error)
ParseKeySuffixMarketPermissions parses the <addr length byte><addr><permission byte> portion of a market permissions key.
func ParseKeySuffixSettlementRatio ¶
ParseKeySuffixSettlementRatio parses the <price denom><RS><fee denom> portion of a settlement ratio key back into the denom strings.
func ParseReqAttrStoreValue ¶
ParseReqAttrStoreValue parses a required attribute store value into it's string slice.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper provides the exchange module's state store interactions.
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, feeCollectorName string, accountKeeper exchange.AccountKeeper, attrKeeper exchange.AttributeKeeper, bankKeeper exchange.BankKeeper, holdKeeper exchange.HoldKeeper, markerKeeper exchange.MarkerKeeper, ) Keeper
func (Keeper) AddCommitment ¶ added in v1.18.0
func (k Keeper) AddCommitment(ctx sdk.Context, marketID uint32, addr sdk.AccAddress, amount sdk.Coins, eventTag string) error
AddCommitment commits the provided amount by the addr to the given market, and places a hold on them. If the addr already has funds committed to the market, the provided amount is added to that. Otherwise a new commitment record is created.
func (Keeper) CalculateBuyerSettlementRatioFeeOptions ¶
func (k Keeper) CalculateBuyerSettlementRatioFeeOptions(ctx sdk.Context, marketID uint32, price sdk.Coin) ([]sdk.Coin, error)
CalculateBuyerSettlementRatioFeeOptions calculates the buyer settlement ratio fee options available for the given price.
func (Keeper) CalculateCommitmentSettlementFee ¶ added in v1.18.0
func (k Keeper) CalculateCommitmentSettlementFee(ctx sdk.Context, req *exchange.MsgMarketCommitmentSettleRequest) (*exchange.QueryCommitmentSettlementFeeCalcResponse, error)
CalculateCommitmentSettlementFee calculates the fee that the exchange must be paid (by the market) for the provided commitment settlement request. If the market does not have a bips defined, an empty result is returned (without error). If no inputs are given, the result will only have the ToFeeNav field (if it exists).
func (Keeper) CalculateExchangeSplit ¶
CalculateExchangeSplit calculates the amount that the exchange will keep of the provided fee.
func (Keeper) CalculateSellerSettlementRatioFee ¶
func (k Keeper) CalculateSellerSettlementRatioFee(ctx sdk.Context, marketID uint32, price sdk.Coin) (*sdk.Coin, error)
CalculateSellerSettlementRatioFee calculates the seller settlement fee required for the given price.
func (Keeper) CanCancelOrdersForMarket ¶
CanCancelOrdersForMarket returns true if the provided admin bech32 address has permission to cancel orders for a market. Also returns true if the provided address is the authority address.
func (Keeper) CanCreateAsk ¶
CanCreateAsk returns true if the provided address is allowed to create an ask order in the given market.
func (Keeper) CanCreateBid ¶
CanCreateBid returns true if the provided address is allowed to create a bid order in the given market.
func (Keeper) CanCreateCommitment ¶ added in v1.18.0
CanCreateCommitment returns true if the provided address is allowed to create a commitment in the given market.
func (Keeper) CanManagePermissions ¶
CanManagePermissions returns true if the provided admin bech32 address has permission to manage user permissions for a given market. Also returns true if the provided address is the authority address.
func (Keeper) CanManageReqAttrs ¶
CanManageReqAttrs returns true if the provided admin bech32 address has permission to manage required attributes for a given market. Also returns true if the provided address is the authority address.
func (Keeper) CanReleaseCommitmentsForMarket ¶ added in v1.18.0
CanReleaseCommitmentsForMarket returns true if the provided admin bech32 address has permission to release commitments for a market. Also returns true if the provided address is the authority address.
func (Keeper) CanSetIDs ¶
CanSetIDs returns true if the provided admin bech32 address has permission to set UUIDs on orders for a market. Also returns true if the provided address is the authority address.
func (Keeper) CanSettleCommitments ¶ added in v1.18.0
CanSettleCommitments returns true if the provided admin bech32 address has permission to settle commitments for a market. Also returns true if the provided address is the authority address.
func (Keeper) CanSettleOrders ¶
CanSettleOrders returns true if the provided admin bech32 address has permission to settle orders for a market. Also returns true if the provided address is the authority address.
func (Keeper) CanUpdateMarket ¶
CanUpdateMarket returns true if the provided admin bech32 address has permission to update market details and settings. Also returns true if the provided address is the authority address.
func (Keeper) CanWithdrawMarketFunds ¶
CanWithdrawMarketFunds returns true if the provided admin bech32 address has permission to withdraw funds from the given market's account. Also returns true if the provided address is the authority address.
func (Keeper) CancelAllOrdersForMarket ¶ added in v1.18.0
CancelAllOrdersForMarket cancels all orders for a market, deleting them and releasing their holds.
func (Keeper) CancelOrder ¶
CancelOrder releases an order's held funds and deletes it.
func (Keeper) CloseMarket ¶ added in v1.18.0
CloseMarket disables order and commitment creation in a market, cancels all its existing orders, and releases all its commitments.
func (Keeper) CollectFee ¶
func (k Keeper) CollectFee(ctx sdk.Context, marketID uint32, payer sdk.AccAddress, fee sdk.Coins) error
CollectFee will transfer the fee amount to the market account, then the exchange's cut from the market to the fee collector. If you have fees to collect from multiple payers, consider using CollectFees.
func (Keeper) CollectFees ¶
CollectFees will transfer the inputs to the market account, then the exchange's cut from the market to the fee collector. If there is only one input, CollectFee is used.
func (Keeper) CreateAskOrder ¶
func (k Keeper) CreateAskOrder(ctx sdk.Context, askOrder exchange.AskOrder, creationFee *sdk.Coin) (uint64, error)
CreateAskOrder creates an ask order, collects the creation fee, and places all needed holds.
func (Keeper) CreateBidOrder ¶
func (k Keeper) CreateBidOrder(ctx sdk.Context, bidOrder exchange.BidOrder, creationFee *sdk.Coin) (uint64, error)
CreateBidOrder creates a bid order, collects the creation fee, and places all needed holds.
func (Keeper) CreateMarket ¶
CreateMarket saves a new market to the store with all the info provided. If the marketId is zero, the next available one will be used.
func (Keeper) DoTransfer ¶
func (k Keeper) DoTransfer(ctxIn sdk.Context, inputs []banktypes.Input, outputs []banktypes.Output) error
DoTransfer facilitates a transfer of things using the bank module.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *exchange.GenesisState
ExportGenesis creates a genesis state from the current state store.
func (Keeper) GetAccessGrants ¶
GetAccessGrants gets all the access grants for a market.
func (Keeper) GetAuthority ¶
GetAuthority gets the address (as bech32) that has governance authority.
func (Keeper) GetBuyerSettlementFlatFees ¶
GetBuyerSettlementFlatFees gets the buyer settlement flat fee options for a market.
func (Keeper) GetBuyerSettlementRatios ¶
GetBuyerSettlementRatios gets the buyer settlement fee ratios for a market.
func (Keeper) GetCommitmentAmount ¶ added in v1.18.0
func (k Keeper) GetCommitmentAmount(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) sdk.Coins
GetCommitmentAmount gets the amount the given address has committed to the provided market.
func (Keeper) GetCommitmentSettlementBips ¶ added in v1.18.0
GetCommitmentSettlementBips gets the commitment settlement bips for the given market.
func (Keeper) GetCreateAskFlatFees ¶
GetCreateAskFlatFees gets the create-ask flat fee options for a market.
func (Keeper) GetCreateBidFlatFees ¶
GetCreateBidFlatFees gets the create-bid flat fee options for a market.
func (Keeper) GetCreateCommitmentFlatFees ¶ added in v1.18.0
GetCreateCommitmentFlatFees gets the create-commitment flat fee options for a market.
func (Keeper) GetExchangeSplit ¶
GetExchangeSplit gets the split amount for the provided denom. If the denom is "", the default is returned. If there isn't a specific entry for the provided denom, the default is returned.
func (Keeper) GetFeeCollectorName ¶
GetFeeCollectorName gets the name of the fee collector.
func (Keeper) GetIntermediaryDenom ¶ added in v1.18.0
GetIntermediaryDenom gets a market's intermediary denom.
func (Keeper) GetMarket ¶
GetMarket reads all the market info from state and returns it. Returns nil if the market account doesn't exist or it's not a market account.
func (Keeper) GetMarketAccount ¶
GetMarketAccount gets a market's account from the account module.
func (Keeper) GetMarketBrief ¶
GetMarketBrief gets the MarketBrief for the given market id.
func (Keeper) GetMarketDetails ¶
GetMarketDetails gets a market's details.
func (Keeper) GetNav ¶ added in v1.18.0
GetNav looks up a NAV from the marker module and returns it as a NetAssetPrice.
func (Keeper) GetOrderByExternalID ¶
func (k Keeper) GetOrderByExternalID(ctx sdk.Context, marketID uint32, externalID string) (*exchange.Order, error)
GetOrderByExternalID gets an order by its market id and UUID.
func (Keeper) GetParams ¶
GetParams gets the exchange module params. If there aren't any params in state, nil is returned.
func (Keeper) GetParamsOrDefaults ¶
GetParamsOrDefaults gets the exchange module params from state if there are any. If state doesn't have any param info, the defaults are returned.
func (Keeper) GetReqAttrsAsk ¶
GetReqAttrsAsk gets the attributes required to create an ask order.
func (Keeper) GetReqAttrsBid ¶
GetReqAttrsBid gets the attributes required to create a bid order.
func (Keeper) GetReqAttrsCommitment ¶ added in v1.18.0
GetReqAttrsCommitment gets the attributes required to create a commitment.
func (Keeper) GetSellerSettlementFlatFees ¶
GetSellerSettlementFlatFees gets the seller settlement flat fee options for a market.
func (Keeper) GetSellerSettlementRatios ¶
GetSellerSettlementRatios gets the seller settlement fee ratios for a market.
func (Keeper) GetUserPermissions ¶
func (k Keeper) GetUserPermissions(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) []exchange.Permission
GetUserPermissions gets all permissions that have been granted to a user in a market.
func (Keeper) HasPermission ¶
func (k Keeper) HasPermission(ctx sdk.Context, marketID uint32, address string, permission exchange.Permission) bool
HasPermission returns true if the provided address has the permission in question for a given market. Also returns true if the provided address is the authority address.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState *exchange.GenesisState)
InitGenesis writes the provided genesis state to the state store.
func (Keeper) IsAuthority ¶
IsAuthority returns true if the provided address bech32 string is the authority address.
func (Keeper) IsMarketAcceptingCommitments ¶ added in v1.18.0
IsMarketAcceptingCommitments gets whether commitments are allowed for a market.
func (Keeper) IsMarketAcceptingOrders ¶ added in v1.18.0
IsMarketAcceptingOrders returns true if the provided market is accepting orders.
func (Keeper) IsMarketKnown ¶
IsMarketKnown returns true if the provided market id is a known market's id.
func (Keeper) IsUserSettlementAllowed ¶
IsUserSettlementAllowed gets whether user-settlement is allowed for a market.
func (Keeper) IterateAddressOrders ¶
func (k Keeper) IterateAddressOrders(ctx sdk.Context, addr sdk.AccAddress, cb func(orderID uint64, orderTypeByte byte) bool)
IterateAddressOrders iterates over all orders for an address. The callback takes in the order id and order type byte and should return whether to stop iterating.
func (Keeper) IterateAssetOrders ¶
func (k Keeper) IterateAssetOrders(ctx sdk.Context, assetDenom string, cb func(orderID uint64, orderTypeByte byte) bool)
IterateAssetOrders iterates over all orders for a given asset denom. The callback takes in the order id and order type byte and should return whether to stop iterating.
func (Keeper) IterateCommitments ¶ added in v1.18.0
IterateCommitments iterates over all commitment entries in the store.
func (Keeper) IterateKnownMarketIDs ¶
IterateKnownMarketIDs iterates over all known market ids.
func (Keeper) IterateMarketOrders ¶
func (k Keeper) IterateMarketOrders(ctx sdk.Context, marketID uint32, cb func(orderID uint64, orderTypeByte byte) bool)
IterateMarketOrders iterates over all orders for a market. The callback takes in the order id and order type byte and should return whether to stop iterating.
func (Keeper) IterateMarkets ¶
IterateMarkets iterates over all markets. The callback should return whether to stop, i.e. true = stop iterating, false = keep going.
func (Keeper) IterateOrders ¶
IterateOrders iterates over all orders. An error is returned if there was a problem reading an entry along the way. Such a problem does not interrupt iteration. The callback takes in the order and should return whether to stop iterating.
func (Keeper) ReleaseAllCommitmentsForMarket ¶ added in v1.18.0
ReleaseAllCommitmentsForMarket releases all the commitments (and related holds) that have been made to the market.
func (Keeper) ReleaseCommitment ¶ added in v1.18.0
func (k Keeper) ReleaseCommitment(ctx sdk.Context, marketID uint32, addr sdk.AccAddress, amount sdk.Coins, eventTag string) error
ReleaseCommitment reduces the funds committed by an address to a market and releases the hold on those funds. If an amount is provided, just that amount is released. If the provided amount is zero, all funds committed by the address to the market are released.
func (Keeper) ReleaseCommitments ¶ added in v1.18.0
func (k Keeper) ReleaseCommitments(ctx sdk.Context, marketID uint32, toRelease []exchange.AccountAmount, eventTag string) error
ReleaseCommitments calls ReleaseCommitment for several entries.
func (Keeper) SetOrderExternalID ¶
func (k Keeper) SetOrderExternalID(ctx sdk.Context, marketID uint32, orderID uint64, newExternalID string) error
SetOrderExternalID updates an order's external id. The caller is responsible for making sure this update should be allowed (e.g. by calling CanSetIDs first).
func (Keeper) SetParams ¶
SetParams updates the params to match those provided. If nil is provided, all params are deleted.
func (Keeper) SettleCommitments ¶ added in v1.18.0
func (k Keeper) SettleCommitments(ctx sdk.Context, req *exchange.MsgMarketCommitmentSettleRequest) error
SettleCommitments orchestrates the transfer of committed funds and collection of fees by the market.
func (Keeper) SettleOrders ¶
SettleOrders attempts to settle all the provided orders.
func (Keeper) UpdateFees ¶
func (k Keeper) UpdateFees(ctx sdk.Context, msg *exchange.MsgGovManageFeesRequest)
UpdateFees updates all the fees as provided in the MsgGovManageFeesRequest.
func (Keeper) UpdateIntermediaryDenom ¶ added in v1.18.0
func (k Keeper) UpdateIntermediaryDenom(ctx sdk.Context, marketID uint32, denom string, updatedBy string)
UpdateIntermediaryDenom sets the market's intermediary denom to the one provided.
func (Keeper) UpdateMarketAcceptingCommitments ¶ added in v1.18.0
func (k Keeper) UpdateMarketAcceptingCommitments(ctx sdk.Context, marketID uint32, accepting bool, updatedBy string) error
UpdateMarketAcceptingCommitments updates the accepting-commitments flag for a market. An error is returned if the setting is already what is provided.
func (Keeper) UpdateMarketAcceptingOrders ¶ added in v1.18.0
func (k Keeper) UpdateMarketAcceptingOrders(ctx sdk.Context, marketID uint32, accepting bool, updatedBy string) error
UpdateMarketAcceptingOrders updates the accepting orders flag for a market. An error is returned if the setting is already what is provided.
func (Keeper) UpdateMarketDetails ¶
func (k Keeper) UpdateMarketDetails(ctx sdk.Context, marketID uint32, marketDetails exchange.MarketDetails, updatedBy string) error
UpdateMarketDetails updates a market's details. It returns an error if the market account isn't found or if there aren't any changes provided.
func (Keeper) UpdatePermissions ¶
func (k Keeper) UpdatePermissions(ctx sdk.Context, msg *exchange.MsgMarketManagePermissionsRequest) error
UpdatePermissions updates users permissions in the store using the provided changes. The caller is responsible for making sure this update should be allowed (e.g. by calling CanManagePermissions first).
func (Keeper) UpdateReqAttrs ¶
UpdateReqAttrs updates the required attributes in the store using the provided changes. The caller is responsible for making sure this update should be allowed (e.g. by calling CanManageReqAttrs first).
func (Keeper) UpdateUserSettlementAllowed ¶
func (k Keeper) UpdateUserSettlementAllowed(ctx sdk.Context, marketID uint32, allow bool, updatedBy string) error
UpdateUserSettlementAllowed updates the allow-user-settlement flag for a market. An error is returned if the setting is already what is provided.
func (Keeper) ValidateAndCollectCommitmentCreationFee ¶ added in v1.18.0
func (k Keeper) ValidateAndCollectCommitmentCreationFee(ctx sdk.Context, marketID uint32, addr sdk.AccAddress, fee *sdk.Coin) error
ValidateAndCollectCommitmentCreationFee verifies that the provided commitment creation fee is sufficient and collects it.
func (Keeper) ValidateAskPrice ¶
func (k Keeper) ValidateAskPrice(ctx sdk.Context, marketID uint32, price sdk.Coin, settlementFlatFee *sdk.Coin) error
ValidateAskPrice validates that the provided ask price is acceptable.
func (Keeper) ValidateAuthority ¶
ValidateAuthority returns an error if the provided address is not the authority.
func (Keeper) ValidateBuyerSettlementFee ¶
func (k Keeper) ValidateBuyerSettlementFee(ctx sdk.Context, marketID uint32, price sdk.Coin, fee sdk.Coins) error
ValidateBuyerSettlementFee returns an error if the provided fee is not enough to cover both the buyer settlement flat and percent fees for the given price.
func (Keeper) ValidateCreateAskFlatFee ¶
ValidateCreateAskFlatFee returns an error if the provided fee is not a sufficient create-ask flat fee.
func (Keeper) ValidateCreateBidFlatFee ¶
ValidateCreateBidFlatFee returns an error if the provided fee is not a sufficient create-bid flat fee.
func (Keeper) ValidateCreateCommitmentFlatFee ¶ added in v1.18.0
func (k Keeper) ValidateCreateCommitmentFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error
ValidateCreateCommitmentFlatFee returns an error if the provided fee is not a sufficient create-commitment flat fee.
func (Keeper) ValidateMarket ¶
ValidateMarket checks the setup of the provided market, making sure there aren't any possibly problematic settings.
func (Keeper) ValidateSellerSettlementFlatFee ¶
func (k Keeper) ValidateSellerSettlementFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error
ValidateSellerSettlementFlatFee returns an error if the provided fee is not a sufficient seller settlement flat fee.
func (Keeper) WithdrawMarketFunds ¶
func (k Keeper) WithdrawMarketFunds(ctx sdk.Context, marketID uint32, toAddr sdk.AccAddress, amount sdk.Coins, withdrawnBy string) error
WithdrawMarketFunds transfers funds from a market account to another account. The caller is responsible for making sure this withdrawal should be allowed (e.g. by calling CanWithdrawMarketFunds first).
type MsgServer ¶
type MsgServer struct {
Keeper
}
MsgServer is an alias for a Keeper that implements the exchange.MsgServer interface.
func (MsgServer) CancelOrder ¶
func (k MsgServer) CancelOrder(goCtx context.Context, msg *exchange.MsgCancelOrderRequest) (*exchange.MsgCancelOrderResponse, error)
CancelOrder cancels an order.
func (MsgServer) CommitFunds ¶ added in v1.18.0
func (k MsgServer) CommitFunds(goCtx context.Context, msg *exchange.MsgCommitFundsRequest) (*exchange.MsgCommitFundsResponse, error)
CommitFunds marks funds in an account as manageable by a market.
func (MsgServer) CreateAsk ¶
func (k MsgServer) CreateAsk(goCtx context.Context, msg *exchange.MsgCreateAskRequest) (*exchange.MsgCreateAskResponse, error)
CreateAsk creates an ask order (to sell something you own).
func (MsgServer) CreateBid ¶
func (k MsgServer) CreateBid(goCtx context.Context, msg *exchange.MsgCreateBidRequest) (*exchange.MsgCreateBidResponse, error)
CreateBid creates a bid order (to buy something you want).
func (MsgServer) FillAsks ¶
func (k MsgServer) FillAsks(goCtx context.Context, msg *exchange.MsgFillAsksRequest) (*exchange.MsgFillAsksResponse, error)
FillAsks uses the funds in your account to fulfill one or more asks (similar to a fill-or-cancel bid).
func (MsgServer) FillBids ¶
func (k MsgServer) FillBids(goCtx context.Context, msg *exchange.MsgFillBidsRequest) (*exchange.MsgFillBidsResponse, error)
FillBids uses the assets in your account to fulfill one or more bids (similar to a fill-or-cancel ask).
func (MsgServer) GovCloseMarket ¶ added in v1.18.0
func (k MsgServer) GovCloseMarket(goCtx context.Context, msg *exchange.MsgGovCloseMarketRequest) (*exchange.MsgGovCloseMarketResponse, error)
GovCloseMarket is a governance proposal endpoint that will disable order and commitment creation, cancel all orders, and release all commitments.
func (MsgServer) GovCreateMarket ¶
func (k MsgServer) GovCreateMarket(goCtx context.Context, msg *exchange.MsgGovCreateMarketRequest) (*exchange.MsgGovCreateMarketResponse, error)
GovCreateMarket is a governance proposal endpoint for creating a market.
func (MsgServer) GovManageFees ¶
func (k MsgServer) GovManageFees(goCtx context.Context, msg *exchange.MsgGovManageFeesRequest) (*exchange.MsgGovManageFeesResponse, error)
GovManageFees is a governance proposal endpoint for updating a market's fees.
func (MsgServer) GovUpdateParams ¶
func (k MsgServer) GovUpdateParams(goCtx context.Context, msg *exchange.MsgGovUpdateParamsRequest) (*exchange.MsgGovUpdateParamsResponse, error)
GovUpdateParams is a governance proposal endpoint for updating the exchange module's params.
func (MsgServer) MarketCommitmentSettle ¶ added in v1.18.0
func (k MsgServer) MarketCommitmentSettle(goCtx context.Context, msg *exchange.MsgMarketCommitmentSettleRequest) (*exchange.MsgMarketCommitmentSettleResponse, error)
MarketCommitmentSettle is a market endpoint to transfer committed funds.
func (MsgServer) MarketManagePermissions ¶
func (k MsgServer) MarketManagePermissions(goCtx context.Context, msg *exchange.MsgMarketManagePermissionsRequest) (*exchange.MsgMarketManagePermissionsResponse, error)
MarketManagePermissions is a market endpoint to manage a market's user permissions.
func (MsgServer) MarketManageReqAttrs ¶
func (k MsgServer) MarketManageReqAttrs(goCtx context.Context, msg *exchange.MsgMarketManageReqAttrsRequest) (*exchange.MsgMarketManageReqAttrsResponse, error)
MarketManageReqAttrs is a market endpoint to manage the attributes required to interact with it.
func (MsgServer) MarketReleaseCommitments ¶ added in v1.18.0
func (k MsgServer) MarketReleaseCommitments(goCtx context.Context, msg *exchange.MsgMarketReleaseCommitmentsRequest) (*exchange.MsgMarketReleaseCommitmentsResponse, error)
MarketReleaseCommitments is a market endpoint return control of funds back to the account owner(s).
func (MsgServer) MarketSetOrderExternalID ¶
func (k MsgServer) MarketSetOrderExternalID(goCtx context.Context, msg *exchange.MsgMarketSetOrderExternalIDRequest) (*exchange.MsgMarketSetOrderExternalIDResponse, error)
MarketSetOrderExternalID updates an order's external id field.
func (MsgServer) MarketSettle ¶
func (k MsgServer) MarketSettle(goCtx context.Context, msg *exchange.MsgMarketSettleRequest) (*exchange.MsgMarketSettleResponse, error)
MarketSettle is a market endpoint to trigger the settlement of orders.
func (MsgServer) MarketUpdateAcceptingCommitments ¶ added in v1.18.0
func (k MsgServer) MarketUpdateAcceptingCommitments(goCtx context.Context, msg *exchange.MsgMarketUpdateAcceptingCommitmentsRequest) (*exchange.MsgMarketUpdateAcceptingCommitmentsResponse, error)
MarketUpdateAcceptingCommitments is a market endpoint to update whether it accepts commitments.
func (MsgServer) MarketUpdateAcceptingOrders ¶ added in v1.18.0
func (k MsgServer) MarketUpdateAcceptingOrders(goCtx context.Context, msg *exchange.MsgMarketUpdateAcceptingOrdersRequest) (*exchange.MsgMarketUpdateAcceptingOrdersResponse, error)
MarketUpdateAcceptingOrders is a market endpoint to update whether its accepting orders.
func (MsgServer) MarketUpdateDetails ¶
func (k MsgServer) MarketUpdateDetails(goCtx context.Context, msg *exchange.MsgMarketUpdateDetailsRequest) (*exchange.MsgMarketUpdateDetailsResponse, error)
MarketUpdateDetails is a market endpoint to update its details.
func (MsgServer) MarketUpdateEnabled ¶
func (k MsgServer) MarketUpdateEnabled(_ context.Context, _ *exchange.MsgMarketUpdateEnabledRequest) (*exchange.MsgMarketUpdateEnabledResponse, error)
MarketUpdateEnabled is a market endpoint to update whether its accepting orders.
func (MsgServer) MarketUpdateIntermediaryDenom ¶ added in v1.18.0
func (k MsgServer) MarketUpdateIntermediaryDenom(goCtx context.Context, msg *exchange.MsgMarketUpdateIntermediaryDenomRequest) (*exchange.MsgMarketUpdateIntermediaryDenomResponse, error)
MarketUpdateIntermediaryDenom sets a market's intermediary denom.
func (MsgServer) MarketUpdateUserSettle ¶
func (k MsgServer) MarketUpdateUserSettle(goCtx context.Context, msg *exchange.MsgMarketUpdateUserSettleRequest) (*exchange.MsgMarketUpdateUserSettleResponse, error)
MarketUpdateUserSettle is a market endpoint to update whether it allows user-initiated settlement.
func (MsgServer) MarketWithdraw ¶
func (k MsgServer) MarketWithdraw(goCtx context.Context, msg *exchange.MsgMarketWithdrawRequest) (*exchange.MsgMarketWithdrawResponse, error)
MarketWithdraw is a market endpoint to withdraw fees that have been collected.
type QueryServer ¶
type QueryServer struct {
Keeper
}
QueryServer is an alias for a Keeper that implements the exchange.QueryServer interface.
func (QueryServer) CommitmentSettlementFeeCalc ¶ added in v1.18.0
func (k QueryServer) CommitmentSettlementFeeCalc(goCtx context.Context, req *exchange.QueryCommitmentSettlementFeeCalcRequest) (*exchange.QueryCommitmentSettlementFeeCalcResponse, error)
CommitmentSettlementFeeCalc calculates the fees a market will pay for a commitment settlement using current NAVs.
func (QueryServer) GetAccountCommitments ¶ added in v1.18.0
func (k QueryServer) GetAccountCommitments(goCtx context.Context, req *exchange.QueryGetAccountCommitmentsRequest) (*exchange.QueryGetAccountCommitmentsResponse, error)
GetAccountCommitments gets all the funds in an account that are committed to any market.
func (QueryServer) GetAllCommitments ¶ added in v1.18.0
func (k QueryServer) GetAllCommitments(goCtx context.Context, req *exchange.QueryGetAllCommitmentsRequest) (*exchange.QueryGetAllCommitmentsResponse, error)
GetAllCommitments gets all fund committed to any market from any account.
func (QueryServer) GetAllMarkets ¶
func (k QueryServer) GetAllMarkets(goCtx context.Context, req *exchange.QueryGetAllMarketsRequest) (*exchange.QueryGetAllMarketsResponse, error)
GetAllMarkets returns brief information about each market.
func (QueryServer) GetAllOrders ¶
func (k QueryServer) GetAllOrders(goCtx context.Context, req *exchange.QueryGetAllOrdersRequest) (*exchange.QueryGetAllOrdersResponse, error)
GetAllOrders gets all orders in the exchange module.
func (QueryServer) GetAssetOrders ¶
func (k QueryServer) GetAssetOrders(goCtx context.Context, req *exchange.QueryGetAssetOrdersRequest) (*exchange.QueryGetAssetOrdersResponse, error)
GetAssetOrders looks up the orders for a specific asset denom.
func (QueryServer) GetCommitment ¶ added in v1.18.0
func (k QueryServer) GetCommitment(goCtx context.Context, req *exchange.QueryGetCommitmentRequest) (*exchange.QueryGetCommitmentResponse, error)
GetCommitment gets the funds in an account that are committed to the market.
func (QueryServer) GetMarket ¶
func (k QueryServer) GetMarket(goCtx context.Context, req *exchange.QueryGetMarketRequest) (*exchange.QueryGetMarketResponse, error)
GetMarket returns all the information and details about a market.
func (QueryServer) GetMarketCommitments ¶ added in v1.18.0
func (k QueryServer) GetMarketCommitments(goCtx context.Context, req *exchange.QueryGetMarketCommitmentsRequest) (*exchange.QueryGetMarketCommitmentsResponse, error)
GetMarketCommitments gets all the funds committed to a market from any account.
func (QueryServer) GetMarketOrders ¶
func (k QueryServer) GetMarketOrders(goCtx context.Context, req *exchange.QueryGetMarketOrdersRequest) (*exchange.QueryGetMarketOrdersResponse, error)
GetMarketOrders looks up the orders in a market.
func (QueryServer) GetOrder ¶
func (k QueryServer) GetOrder(goCtx context.Context, req *exchange.QueryGetOrderRequest) (*exchange.QueryGetOrderResponse, error)
GetOrder looks up an order by id.
func (QueryServer) GetOrderByExternalID ¶
func (k QueryServer) GetOrderByExternalID(goCtx context.Context, req *exchange.QueryGetOrderByExternalIDRequest) (*exchange.QueryGetOrderByExternalIDResponse, error)
GetOrderByExternalID looks up an order by market id and external id.
func (QueryServer) GetOwnerOrders ¶
func (k QueryServer) GetOwnerOrders(goCtx context.Context, req *exchange.QueryGetOwnerOrdersRequest) (*exchange.QueryGetOwnerOrdersResponse, error)
GetOwnerOrders looks up the orders from the provided owner address.
func (QueryServer) OrderFeeCalc ¶
func (k QueryServer) OrderFeeCalc(goCtx context.Context, req *exchange.QueryOrderFeeCalcRequest) (*exchange.QueryOrderFeeCalcResponse, error)
OrderFeeCalc calculates the fees that will be associated with the provided order.
func (QueryServer) Params ¶
func (k QueryServer) Params(goCtx context.Context, _ *exchange.QueryParamsRequest) (*exchange.QueryParamsResponse, error)
Params returns the exchange module parameters.
func (QueryServer) ValidateCreateMarket ¶
func (k QueryServer) ValidateCreateMarket(goCtx context.Context, req *exchange.QueryValidateCreateMarketRequest) (*exchange.QueryValidateCreateMarketResponse, error)
ValidateCreateMarket checks the provided MsgGovCreateMarketResponse and returns any errors it might have.
func (QueryServer) ValidateManageFees ¶
func (k QueryServer) ValidateManageFees(goCtx context.Context, req *exchange.QueryValidateManageFeesRequest) (*exchange.QueryValidateManageFeesResponse, error)
ValidateManageFees checks the provided MsgGovManageFeesRequest and returns any errors that it might have.
func (QueryServer) ValidateMarket ¶
func (k QueryServer) ValidateMarket(goCtx context.Context, req *exchange.QueryValidateMarketRequest) (*exchange.QueryValidateMarketResponse, error)
ValidateMarket checks for any problems with a market's setup.