keeper

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
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)
	// KeyTypePayment is the type byte for payments.
	KeyTypePayment = byte(0x70)
	// KeyTypeTargetToPaymentIndex is the type byte for entries in the target to payment index.
	KeyTypeTargetToPaymentIndex = byte(0x10)

	// ParamsKeyTypeSplit is the type string used in the keys for params.DefaultSplit and params.DenomSplits.
	ParamsKeyTypeSplit = "split"
	// ParamsKeyTypeFeeCreatePaymentFlat is the type string used in the keys for params.FeeCreatePaymentFlat.
	ParamsKeyTypeFeeCreatePaymentFlat = "fee_create_payment_flat"
	// ParamsKeyTypeFeeAcceptPaymentFlat is the type string used in the keys for params.FeeAcceptPaymentFlat.
	ParamsKeyTypeFeeAcceptPaymentFlat = "fee_accept_payment_flat"

	// 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

View Source
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

func GetFeeRatioStoreValue(ratio exchange.FeeRatio) []byte

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

func GetIndexKeyPrefixAssetToOrder(assetDenom string) []byte

GetIndexKeyPrefixAssetToOrder creates a key prefix for the asset to order index limited to the given asset.

func GetIndexKeyPrefixMarketToOrder

func GetIndexKeyPrefixMarketToOrder(marketID uint32) []byte

GetIndexKeyPrefixMarketToOrder creates the prefix for the market to order index limited ot the given market id.

func GetIndexKeyPrefixTargetToPayments added in v1.18.0

func GetIndexKeyPrefixTargetToPayments(target sdk.AccAddress) []byte

GetIndexKeyPrefixTargetToPayments creates a key prefix for the target to payments index.

func GetIndexKeyPrefixTargetToPaymentsForSource added in v1.18.0

func GetIndexKeyPrefixTargetToPaymentsForSource(target, source sdk.AccAddress) []byte

GetIndexKeyPrefixTargetToPaymentsForSource creates a key prefix for the target to payments index, specific to a source.

func GetKeyPrefixAllPayments added in v1.18.0

func GetKeyPrefixAllPayments() []byte

GetKeyPrefixAllPayments gets the key prefix for all payments.

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

func GetKeyPrefixCommitmentsToMarket(marketID uint32) []byte

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

func GetKeyPrefixMarket(marketID uint32) []byte

GetKeyPrefixMarket creates the key prefix for all of a market's entries.

func GetKeyPrefixMarketBuyerSettlementFlatFee

func GetKeyPrefixMarketBuyerSettlementFlatFee(marketID uint32) []byte

GetKeyPrefixMarketBuyerSettlementFlatFee creates the key prefix for a market's buyer settlement flat fees.

func GetKeyPrefixMarketBuyerSettlementRatio

func GetKeyPrefixMarketBuyerSettlementRatio(marketID uint32) []byte

GetKeyPrefixMarketBuyerSettlementRatio creates the key prefix for a market's buyer settlement fee ratios.

func GetKeyPrefixMarketBuyerSettlementRatioForPriceDenom

func GetKeyPrefixMarketBuyerSettlementRatioForPriceDenom(marketID uint32, priceDenom string) []byte

GetKeyPrefixMarketBuyerSettlementRatioForPriceDenom creates the key prefix for a market's buyer settlement fee ratios that have the provided price denom.

func GetKeyPrefixMarketCreateAskFlatFee

func GetKeyPrefixMarketCreateAskFlatFee(marketID uint32) []byte

GetKeyPrefixMarketCreateAskFlatFee creates the key prefix for the create-ask flat fees for the provided market.

func GetKeyPrefixMarketCreateBidFlatFee

func GetKeyPrefixMarketCreateBidFlatFee(marketID uint32) []byte

GetKeyPrefixMarketCreateBidFlatFee creates the key prefix for the create-bid flat fees for the provided market.

func GetKeyPrefixMarketCreateCommitmentFlatFee added in v1.18.0

func GetKeyPrefixMarketCreateCommitmentFlatFee(marketID uint32) []byte

GetKeyPrefixMarketCreateCommitmentFlatFee creates the key prefix for the create-commitment flat fees for the provided market.

func GetKeyPrefixMarketPermissions

func GetKeyPrefixMarketPermissions(marketID uint32) []byte

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

func GetKeyPrefixMarketSellerSettlementFlatFee(marketID uint32) []byte

GetKeyPrefixMarketSellerSettlementFlatFee creates the key prefix for a market's seller settlement flat fees.

func GetKeyPrefixMarketSellerSettlementRatio

func GetKeyPrefixMarketSellerSettlementRatio(marketID uint32) []byte

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 GetKeyPrefixPaymentsForSource added in v1.18.0

func GetKeyPrefixPaymentsForSource(source sdk.AccAddress) []byte

GetKeyPrefixPaymentsForSource gets the key prefix for payments with a given source.

func GetKeySuffixSettlementRatio

func GetKeySuffixSettlementRatio(ratio exchange.FeeRatio) []byte

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

func MakeIndexKeyAssetToOrder(assetDenom string, orderID uint64) []byte

MakeIndexKeyAssetToOrder creates the key to use for the asset to order index for the provided values.

func MakeIndexKeyMarketExternalIDToOrder

func MakeIndexKeyMarketExternalIDToOrder(marketID uint32, externalID string) []byte

MakeIndexKeyMarketExternalIDToOrder creates the key to use for the market and uuid to order index for the provided values.

func MakeIndexKeyMarketToOrder

func MakeIndexKeyMarketToOrder(marketID uint32, orderID uint64) []byte

MakeIndexKeyMarketToOrder creates the key to use for the market to order index with the given ids.

func MakeIndexKeyTargetToPayment added in v1.18.0

func MakeIndexKeyTargetToPayment(target, source sdk.AccAddress, externalID string) []byte

MakeIndexKeyTargetToPayment creates the key for the target to payment index.

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

func MakeKeyKnownMarketID(marketID uint32) []byte

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

func MakeKeyMarketAcceptingCommitments(marketID uint32) []byte

MakeKeyMarketAcceptingCommitments creates the key to use to indicate that a market allows commitments.

func MakeKeyMarketBuyerSettlementFlatFee

func MakeKeyMarketBuyerSettlementFlatFee(marketID uint32, denom string) []byte

MakeKeyMarketBuyerSettlementFlatFee creates the key for a market's buyer settlement flat fee with the given denom.

func MakeKeyMarketBuyerSettlementRatio

func MakeKeyMarketBuyerSettlementRatio(marketID uint32, ratio exchange.FeeRatio) []byte

MakeKeyMarketBuyerSettlementRatio creates the key to use for the given buyer settlement fee ratio in the given market.

func MakeKeyMarketCommitmentSettlementBips added in v1.18.0

func MakeKeyMarketCommitmentSettlementBips(marketID uint32) []byte

MakeKeyMarketCommitmentSettlementBips creates the key to use to for a market's commitment settlement bips.

func MakeKeyMarketCreateAskFlatFee

func MakeKeyMarketCreateAskFlatFee(marketID uint32, denom string) []byte

MakeKeyMarketCreateAskFlatFee creates the key to use for a create-ask flat fee for the given market and denom.

func MakeKeyMarketCreateBidFlatFee

func MakeKeyMarketCreateBidFlatFee(marketID uint32, denom string) []byte

MakeKeyMarketCreateBidFlatFee creates the key to use for a create-bid flat fee for the given denom.

func MakeKeyMarketCreateCommitmentFlatFee added in v1.18.0

func MakeKeyMarketCreateCommitmentFlatFee(marketID uint32, denom string) []byte

MakeKeyMarketCreateCommitmentFlatFee creates the key to use for a create-commitment flat fee for the given denom.

func MakeKeyMarketIntermediaryDenom added in v1.18.0

func MakeKeyMarketIntermediaryDenom(marketID uint32) []byte

MakeKeyMarketIntermediaryDenom creates the key to use to for a market's commitment intermediary denom.

func MakeKeyMarketNotAcceptingOrders added in v1.18.0

func MakeKeyMarketNotAcceptingOrders(marketID uint32) []byte

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

func MakeKeyMarketReqAttrAsk(marketID uint32) []byte

MakeKeyMarketReqAttrAsk creates the key to use for a market's attributes required to create an ask order.

func MakeKeyMarketReqAttrBid

func MakeKeyMarketReqAttrBid(marketID uint32) []byte

MakeKeyMarketReqAttrBid creates the key to use for a market's attributes required to create a bid order.

func MakeKeyMarketReqAttrCommitment added in v1.18.0

func MakeKeyMarketReqAttrCommitment(marketID uint32) []byte

MakeKeyMarketReqAttrCommitment creates the key to use for a market's attributes required to create a commitment.

func MakeKeyMarketSellerSettlementFlatFee

func MakeKeyMarketSellerSettlementFlatFee(marketID uint32, denom string) []byte

MakeKeyMarketSellerSettlementFlatFee creates the key for a market's seller settlement flat fee with the given denom.

func MakeKeyMarketSellerSettlementRatio

func MakeKeyMarketSellerSettlementRatio(marketID uint32, ratio exchange.FeeRatio) []byte

MakeKeyMarketSellerSettlementRatio creates the key to use for the given seller settlement fee ratio in the given market.

func MakeKeyMarketUserSettle

func MakeKeyMarketUserSettle(marketID uint32) []byte

MakeKeyMarketUserSettle creates the key to use to indicate that a market allows settlement by users.

func MakeKeyOrder

func MakeKeyOrder(orderID uint64) []byte

MakeKeyOrder creates the key to use for an order ID.

func MakeKeyParamsFeeAcceptPaymentFlat added in v1.18.0

func MakeKeyParamsFeeAcceptPaymentFlat() []byte

MakeKeyParamsFeeAcceptPaymentFlat creates the key to use for the params FeeAcceptPaymentFlat entry.

func MakeKeyParamsFeeCreatePaymentFlat added in v1.18.0

func MakeKeyParamsFeeCreatePaymentFlat() []byte

MakeKeyParamsFeeCreatePaymentFlat creates the key to use for the params FeeCreatePaymentFlat entry.

func MakeKeyParamsSplit

func MakeKeyParamsSplit(denom string) []byte

MakeKeyParamsSplit creates the key to use for the params defining the splits. A denom of "" is used for the default split value.

func MakeKeyPayment added in v1.18.0

func MakeKeyPayment(source sdk.AccAddress, externalID string) []byte

MakeKeyPayment creates the key for a payment.

func NewMsgServer

func NewMsgServer(k Keeper) exchange.MsgServer

func NewQueryServer

func NewQueryServer(k Keeper) exchange.QueryServer

func ParseFeeRatioStoreValue

func ParseFeeRatioStoreValue(value []byte) (priceAmount, feeAmount sdkmath.Int, err error)

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

func ParseIndexKeyAssetToOrder(key []byte) (string, uint64, error)

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

func ParseIndexKeyMarketToOrder(key []byte) (uint32, uint64, error)

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

func ParseIndexKeySuffixOrderID(key []byte) (uint64, bool)

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 ParseIndexKeySuffixTargetToPayment added in v1.18.0

func ParseIndexKeySuffixTargetToPayment(suffix []byte) (sdk.AccAddress, string, error)

ParseIndexKeySuffixTargetToPayment parses the source and external id out of the suffix of a target to payment index key. The input must have the format: <source length byte> | <source> | <external id>.

func ParseIndexKeyTargetToPayment added in v1.18.0

func ParseIndexKeyTargetToPayment(key []byte) (target, source sdk.AccAddress, externalID string, err error)

ParseIndexKeyTargetToPayment parses a target to payment key. The input must have the format: <type byte> | <target length byte> | <target> | <source length byte> | <source> | <external id>.

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

func ParseKeyOrder(key []byte) (uint64, bool)

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 ParseKeyPayment added in v1.18.0

func ParseKeyPayment(key []byte) (sdk.AccAddress, string, error)

ParseKeyPayment parses the full key that identifies a payment. The input must have the format: <type byte> | <source length byte> | <source> | <external id>.

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

func ParseKeySuffixKnownMarketID(suffix []byte) (uint32, bool)

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 ParseKeySuffixPayment added in v1.18.0

func ParseKeySuffixPayment(suffix []byte) (sdk.AccAddress, string, error)

ParseKeySuffixPayment parses a payment key that does not have its type byte. The input must have the format: <source length byte> | <source> | <external id>.

func ParseKeySuffixSettlementRatio

func ParseKeySuffixSettlementRatio(suffix []byte) (priceDenom, feeDenom string, err error)

ParseKeySuffixSettlementRatio parses the <price denom><RS><fee denom> portion of a settlement ratio key back into the denom strings.

func ParseReqAttrStoreValue

func ParseReqAttrStoreValue(value []byte) []string

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) AcceptPayment added in v1.18.0

func (k Keeper) AcceptPayment(ctx sdk.Context, payment *exchange.Payment) error

AcceptPayment verifies that all the payment data matches what's in state, then deletes the payment and sends the source funds to the target and target funds to the source.

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

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

func (k Keeper) CalculateExchangeSplit(ctx sdk.Context, feeAmt sdk.Coins) sdk.Coins

CalculateExchangeSplit calculates the amount that the exchange will keep of the provided fee.

func (Keeper) CalculatePaymentFees added in v1.18.0

func (k Keeper) CalculatePaymentFees(ctx sdk.Context, payment *exchange.Payment) *exchange.QueryPaymentFeeCalcResponse

CalculatePaymentFees calculates the fees required for the provided payment.

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

func (k Keeper) CanCancelOrdersForMarket(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanCreateAsk(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) bool

CanCreateAsk returns true if the provided address is allowed to create an ask order in the given market.

func (Keeper) CanCreateBid

func (k Keeper) CanCreateBid(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) bool

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

func (k Keeper) CanCreateCommitment(ctx sdk.Context, marketID uint32, addr sdk.AccAddress) bool

CanCreateCommitment returns true if the provided address is allowed to create a commitment in the given market.

func (Keeper) CanManagePermissions

func (k Keeper) CanManagePermissions(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanManageReqAttrs(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanReleaseCommitmentsForMarket(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanSetIDs(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanSettleCommitments(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanSettleOrders(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanUpdateMarket(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CanWithdrawMarketFunds(ctx sdk.Context, marketID uint32, admin string) bool

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

func (k Keeper) CancelAllOrdersForMarket(ctx sdk.Context, marketID uint32, signer string)

CancelAllOrdersForMarket cancels all orders for a market, deleting them and releasing their holds.

func (Keeper) CancelOrder

func (k Keeper) CancelOrder(ctx sdk.Context, orderID uint64, signer string) error

CancelOrder releases an order's held funds and deletes it.

func (Keeper) CancelPayments added in v1.18.0

func (k Keeper) CancelPayments(ctx sdk.Context, source sdk.AccAddress, externalIDs []string) error

CancelPayments deletes the payments (and releases their holds) for a source and set of external ids. There must be at least one external id and there must be a payment for each external id (and source).

func (Keeper) CloseMarket added in v1.18.0

func (k Keeper) CloseMarket(ctx sdk.Context, marketID uint32, signer string)

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

func (k Keeper) CollectFees(ctx sdk.Context, marketID uint32, inputs []banktypes.Input) error

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

func (k Keeper) CreateMarket(ctx sdk.Context, market exchange.Market) (uint32, error)

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) CreatePayment added in v1.18.0

func (k Keeper) CreatePayment(ctx sdk.Context, payment *exchange.Payment) error

CreatePayment stores the provided payment in the state store and places a hold on the source funds.

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) FillAsks

func (k Keeper) FillAsks(ctx sdk.Context, msg *exchange.MsgFillAsksRequest) error

FillAsks settles one or more ask orders for a buyer.

func (Keeper) FillBids

func (k Keeper) FillBids(ctx sdk.Context, msg *exchange.MsgFillBidsRequest) error

FillBids settles one or more bid orders for a seller.

func (Keeper) GetAccessGrants

func (k Keeper) GetAccessGrants(ctx sdk.Context, marketID uint32) []exchange.AccessGrant

GetAccessGrants gets all the access grants for a market.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority gets the address (as bech32) that has governance authority.

func (Keeper) GetBuyerSettlementFlatFees

func (k Keeper) GetBuyerSettlementFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin

GetBuyerSettlementFlatFees gets the buyer settlement flat fee options for a market.

func (Keeper) GetBuyerSettlementRatios

func (k Keeper) GetBuyerSettlementRatios(ctx sdk.Context, marketID uint32) []exchange.FeeRatio

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

func (k Keeper) GetCommitmentSettlementBips(ctx sdk.Context, marketID uint32) uint32

GetCommitmentSettlementBips gets the commitment settlement bips for the given market.

func (Keeper) GetCreateAskFlatFees

func (k Keeper) GetCreateAskFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin

GetCreateAskFlatFees gets the create-ask flat fee options for a market.

func (Keeper) GetCreateBidFlatFees

func (k Keeper) GetCreateBidFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin

GetCreateBidFlatFees gets the create-bid flat fee options for a market.

func (Keeper) GetCreateCommitmentFlatFees added in v1.18.0

func (k Keeper) GetCreateCommitmentFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin

GetCreateCommitmentFlatFees gets the create-commitment flat fee options for a market.

func (Keeper) GetExchangeSplit

func (k Keeper) GetExchangeSplit(ctx sdk.Context, denom string) uint16

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

func (k Keeper) GetFeeCollectorName() string

GetFeeCollectorName gets the name of the fee collector.

func (Keeper) GetIntermediaryDenom added in v1.18.0

func (k Keeper) GetIntermediaryDenom(ctx sdk.Context, marketID uint32) string

GetIntermediaryDenom gets a market's intermediary denom.

func (Keeper) GetMarket

func (k Keeper) GetMarket(ctx sdk.Context, marketID uint32) *exchange.Market

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

func (k Keeper) GetMarketAccount(ctx sdk.Context, marketID uint32) *exchange.MarketAccount

GetMarketAccount gets a market's account from the account module.

func (Keeper) GetMarketBrief

func (k Keeper) GetMarketBrief(ctx sdk.Context, marketID uint32) *exchange.MarketBrief

GetMarketBrief gets the MarketBrief for the given market id.

func (Keeper) GetMarketDetails

func (k Keeper) GetMarketDetails(ctx sdk.Context, marketID uint32) *exchange.MarketDetails

GetMarketDetails gets a market's details.

func (Keeper) GetNav added in v1.18.0

func (k Keeper) GetNav(ctx sdk.Context, assetsDenom, priceDenom string) *exchange.NetAssetPrice

GetNav looks up a NAV from the marker module and returns it as a NetAssetPrice.

func (Keeper) GetOrder

func (k Keeper) GetOrder(ctx sdk.Context, orderID uint64) (*exchange.Order, error)

GetOrder gets an order. Returns nil, nil if the order does not exist.

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

func (k Keeper) GetParams(ctx sdk.Context) *exchange.Params

GetParams gets the exchange module params. If there aren't any params in state, nil is returned.

func (Keeper) GetParamsOrDefaults

func (k Keeper) GetParamsOrDefaults(ctx sdk.Context) *exchange.Params

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) GetPayment added in v1.18.0

func (k Keeper) GetPayment(ctx sdk.Context, source sdk.AccAddress, externalID string) (*exchange.Payment, error)

GetPayment gets a payment from the state store. If it doesn't exist, nil, nil is returned.

func (Keeper) GetPaymentsForTargetAndSource added in v1.18.0

func (k Keeper) GetPaymentsForTargetAndSource(ctx sdk.Context, target, source sdk.AccAddress) []*exchange.Payment

GetPaymentsForTargetAndSource gets all the payments with the given target and source. Returns nil if either the target or source is empty. I.e. this can't be used to find payments from a source that don't have a target.

func (Keeper) GetReqAttrsAsk

func (k Keeper) GetReqAttrsAsk(ctx sdk.Context, marketID uint32) []string

GetReqAttrsAsk gets the attributes required to create an ask order.

func (Keeper) GetReqAttrsBid

func (k Keeper) GetReqAttrsBid(ctx sdk.Context, marketID uint32) []string

GetReqAttrsBid gets the attributes required to create a bid order.

func (Keeper) GetReqAttrsCommitment added in v1.18.0

func (k Keeper) GetReqAttrsCommitment(ctx sdk.Context, marketID uint32) []string

GetReqAttrsCommitment gets the attributes required to create a commitment.

func (Keeper) GetSellerSettlementFlatFees

func (k Keeper) GetSellerSettlementFlatFees(ctx sdk.Context, marketID uint32) []sdk.Coin

GetSellerSettlementFlatFees gets the seller settlement flat fee options for a market.

func (Keeper) GetSellerSettlementRatios

func (k Keeper) GetSellerSettlementRatios(ctx sdk.Context, marketID uint32) []exchange.FeeRatio

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

func (k Keeper) IsAuthority(addr string) bool

IsAuthority returns true if the provided address bech32 string is the authority address.

func (Keeper) IsMarketAcceptingCommitments added in v1.18.0

func (k Keeper) IsMarketAcceptingCommitments(ctx sdk.Context, marketID uint32) bool

IsMarketAcceptingCommitments gets whether commitments are allowed for a market.

func (Keeper) IsMarketAcceptingOrders added in v1.18.0

func (k Keeper) IsMarketAcceptingOrders(ctx sdk.Context, marketID uint32) bool

IsMarketAcceptingOrders returns true if the provided market is accepting orders.

func (Keeper) IsMarketKnown

func (k Keeper) IsMarketKnown(ctx sdk.Context, marketID uint32) bool

IsMarketKnown returns true if the provided market id is a known market's id.

func (Keeper) IsUserSettlementAllowed

func (k Keeper) IsUserSettlementAllowed(ctx sdk.Context, marketID uint32) bool

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

func (k Keeper) IterateCommitments(ctx sdk.Context, cb func(commitment exchange.Commitment) bool)

IterateCommitments iterates over all commitment entries in the store.

func (Keeper) IterateKnownMarketIDs

func (k Keeper) IterateKnownMarketIDs(ctx sdk.Context, cb func(marketID uint32) bool)

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

func (k Keeper) IterateMarkets(ctx sdk.Context, cb func(market *exchange.Market) bool)

IterateMarkets iterates over all markets. The callback should return whether to stop, i.e. true = stop iterating, false = keep going.

func (Keeper) IterateOrders

func (k Keeper) IterateOrders(ctx sdk.Context, cb func(order *exchange.Order) bool) error

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) IteratePayments added in v1.18.0

func (k Keeper) IteratePayments(ctx sdk.Context, cb func(payment *exchange.Payment) bool)

IteratePayments iterates over all payments. The callback takes in the payment and should return whether to stop iterating.

func (Keeper) RejectPayment added in v1.18.0

func (k Keeper) RejectPayment(ctx sdk.Context, target, source sdk.AccAddress, externalID string) error

RejectPayment deletes a payment and releases the hold on it. An error is returned if a payment can't be found for the source + external id, or if that payment has a different target than the one provided.

func (Keeper) RejectPayments added in v1.18.0

func (k Keeper) RejectPayments(ctx sdk.Context, target sdk.AccAddress, sources []sdk.AccAddress) error

RejectPayments deletes some payments and releases their holds. Each source must have at least one payment for the target.

func (Keeper) ReleaseAllCommitmentsForMarket added in v1.18.0

func (k Keeper) ReleaseAllCommitmentsForMarket(ctx sdk.Context, marketID uint32)

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

func (k Keeper) SetParams(ctx sdk.Context, params *exchange.Params)

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

func (k Keeper) SettleOrders(ctx sdk.Context, req *exchange.MsgMarketSettleRequest) error

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) UpdatePaymentTarget added in v1.18.0

func (k Keeper) UpdatePaymentTarget(ctx sdk.Context, source sdk.AccAddress, externalID string, newTarget sdk.AccAddress) error

UpdatePaymentTarget changes the target of a payment.

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

func (k Keeper) UpdateReqAttrs(ctx sdk.Context, msg *exchange.MsgMarketManageReqAttrsRequest) error

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

func (k Keeper) ValidateAuthority(addr string) error

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

func (k Keeper) ValidateCreateAskFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error

ValidateCreateAskFlatFee returns an error if the provided fee is not a sufficient create-ask flat fee.

func (Keeper) ValidateCreateBidFlatFee

func (k Keeper) ValidateCreateBidFlatFee(ctx sdk.Context, marketID uint32, fee *sdk.Coin) error

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

func (k Keeper) ValidateMarket(ctx sdk.Context, marketID uint32) error

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) AcceptPayment added in v1.18.0

AcceptPayment is used by a target to accept a payment.

func (MsgServer) CancelOrder

CancelOrder cancels an order.

func (MsgServer) CancelPayments added in v1.18.0

CancelPayments can be used by a source to cancel one or more payments.

func (MsgServer) ChangePaymentTarget added in v1.18.0

ChangePaymentTarget can be used by a source to change the target in one of their payments.

func (MsgServer) CommitFunds added in v1.18.0

CommitFunds marks funds in an account as manageable by a market.

func (MsgServer) CreateAsk

CreateAsk creates an ask order (to sell something you own).

func (MsgServer) CreateBid

CreateBid creates a bid order (to buy something you want).

func (MsgServer) CreatePayment added in v1.18.0

CreatePayment creates a payment to facilitate a trade between two accounts.

func (MsgServer) FillAsks

FillAsks uses the funds in your account to fulfill one or more asks (similar to a fill-or-cancel bid).

func (MsgServer) FillBids

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

GovCloseMarket is a governance proposal endpoint that will disable order and commitment creation, cancel all orders, and release all commitments.

func (MsgServer) GovCreateMarket

GovCreateMarket is a governance proposal endpoint for creating a market.

func (MsgServer) GovManageFees

GovManageFees is a governance proposal endpoint for updating a market's fees.

func (MsgServer) GovUpdateParams

GovUpdateParams is a governance proposal endpoint for updating the exchange module's params.

func (MsgServer) MarketCommitmentSettle added in v1.18.0

MarketCommitmentSettle is a market endpoint to transfer committed funds.

func (MsgServer) MarketManagePermissions

MarketManagePermissions is a market endpoint to manage a market's user permissions.

func (MsgServer) MarketManageReqAttrs

MarketManageReqAttrs is a market endpoint to manage the attributes required to interact with it.

func (MsgServer) MarketReleaseCommitments added in v1.18.0

MarketReleaseCommitments is a market endpoint return control of funds back to the account owner(s).

func (MsgServer) MarketSetOrderExternalID

MarketSetOrderExternalID updates an order's external id field.

func (MsgServer) MarketSettle

MarketSettle is a market endpoint to trigger the settlement of orders.

func (MsgServer) MarketUpdateAcceptingCommitments added in v1.18.0

MarketUpdateAcceptingCommitments is a market endpoint to update whether it accepts commitments.

func (MsgServer) MarketUpdateAcceptingOrders added in v1.18.0

MarketUpdateAcceptingOrders is a market endpoint to update whether its accepting orders.

func (MsgServer) MarketUpdateDetails

MarketUpdateDetails is a market endpoint to update its details.

func (MsgServer) MarketUpdateEnabled

MarketUpdateEnabled is a market endpoint to update whether its accepting orders.

func (MsgServer) MarketUpdateIntermediaryDenom added in v1.18.0

MarketUpdateIntermediaryDenom sets a market's intermediary denom.

func (MsgServer) MarketUpdateUserSettle

MarketUpdateUserSettle is a market endpoint to update whether it allows user-initiated settlement.

func (MsgServer) MarketWithdraw

MarketWithdraw is a market endpoint to withdraw fees that have been collected.

func (MsgServer) RejectPayment added in v1.18.0

RejectPayment can be used by a target to reject a payment.

func (MsgServer) RejectPayments added in v1.18.0

RejectPayments can be used by a target to reject all payments from one or more sources.

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

CommitmentSettlementFeeCalc calculates the fees a market will pay for a commitment settlement using current NAVs.

func (QueryServer) GetAccountCommitments added in v1.18.0

GetAccountCommitments gets all the funds in an account that are committed to any market.

func (QueryServer) GetAllCommitments added in v1.18.0

GetAllCommitments gets all fund committed to any market from any account.

func (QueryServer) GetAllMarkets

GetAllMarkets returns brief information about each market.

func (QueryServer) GetAllOrders

GetAllOrders gets all orders in the exchange module.

func (QueryServer) GetAllPayments added in v1.18.0

GetAllPayments gets all payments.

func (QueryServer) GetAssetOrders

GetAssetOrders looks up the orders for a specific asset denom.

func (QueryServer) GetCommitment added in v1.18.0

GetCommitment gets the funds in an account that are committed to the market.

func (QueryServer) GetMarket

GetMarket returns all the information and details about a market.

func (QueryServer) GetMarketCommitments added in v1.18.0

GetMarketCommitments gets all the funds committed to a market from any account.

func (QueryServer) GetMarketOrders

GetMarketOrders looks up the orders in a market.

func (QueryServer) GetOrder

GetOrder looks up an order by id.

func (QueryServer) GetOrderByExternalID

GetOrderByExternalID looks up an order by market id and external id.

func (QueryServer) GetOwnerOrders

GetOwnerOrders looks up the orders from the provided owner address.

func (QueryServer) GetPayment added in v1.18.0

GetPayment gets a single specific payment.

func (QueryServer) GetPaymentsWithSource added in v1.18.0

GetPaymentsWithSource gets all payments with a specific source account.

func (QueryServer) GetPaymentsWithTarget added in v1.18.0

GetPaymentsWithTarget gets all payments with a specific target account.

func (QueryServer) OrderFeeCalc

OrderFeeCalc calculates the fees that will be associated with the provided order.

func (QueryServer) Params

Params returns the exchange module parameters.

func (QueryServer) PaymentFeeCalc added in v1.18.0

PaymentFeeCalc calculates the fees that must be paid for creating or accepting a specific payment.

func (QueryServer) ValidateCreateMarket

ValidateCreateMarket checks the provided MsgGovCreateMarketResponse and returns any errors it might have.

func (QueryServer) ValidateManageFees

ValidateManageFees checks the provided MsgGovManageFeesRequest and returns any errors that it might have.

func (QueryServer) ValidateMarket

ValidateMarket checks for any problems with a market's setup.

Jump to

Keyboard shortcuts

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