The exchange module is used to facilitate the trading of on-chain assets. Funds being traded remain (on hold) in the buyers' and sellers' accounts. Settlement is done directly between the two parties without the funds touching a 3rd party's account.
Figure Markets is a great example of pro usage of this module!
ConceptsOverviewCore ComponentsMarketsMarket FeaturesMarket ResponsibilitiesMarket PermissionsRequired AttributesOrdersOrder LifecycleAsk OrdersBid OrdersPartial OrdersExternal IDsSettlementSettlement RulesSettlement ProcessUser SettlementTransfer AgentCommitmentsCommitment BehaviorCommitment SettlementPaymentsPayment StructurePayment LifecyclePayment FeesFeesFee TypesFee ConfigurationOrder Creation FeesSettlement Flat FeesSettlement Ratio FeesSeller Settlement Ratio FeeBuyer Settlement Ratio FeeCommitment FeesCommitment Creation FeesCommitment Settlement Fee CollectionCommitment Settlement Fee ChargeExchange FeesExchange Fees for OrdersExchange Fees for CommitmentsExchange Fees for PaymentsSummaryStateOverviewState OrganizationParamsDefault SplitSpecific Denom SplitMarketsMarket Fee ConfigurationsMarket Create-Ask Flat FeeMarket Create-Bid Flat FeeMarket Create-Commitment Flat FeeMarket Seller Settlement Flat FeeMarket Seller Settlement Ratio FeeMarket Buyer Settlement Flat FeeMarket Buyer Settlement Ratio FeeMarket Status IndicatorsMarket Not-Accepting-Orders IndicatorMarket User-Settle IndicatorMarket Accepting Commitments IndicatorMarket PermissionsMarket Required AttributesMarket Create-Ask Required AttributesMarket Create-Bid Required AttributesMarket Create-Commitment Required AttributesMarket ConfigurationMarket Commitment Settlement BipsMarket Intermediary DenomMarket AccountMarket DetailsMarket ID ManagementKnown Market IDLast Market IDOrdersOrder Storage FormatAsk OrdersBid OrdersLast Order IDCommitmentsPaymentsIndexesMarket to OrderOwner Address to OrderAsset Denom to OrderMarket External ID to OrderTarget Address to PaymentState Architecture SummaryEfficient LookupsScalable DesignData IntegrityPerformance OptimizationMessagesSummaryUser EndpointsCreateAskCreateBidCommitFundsCancelOrderFillBidsFillAsksMarket EndpointsMarketSettleMarketCommitmentSettleMarketReleaseCommitmentsMarketSetOrderExternalIDMarketWithdrawMarketUpdateDetailsMarketUpdateAcceptingOrdersMarketUpdateUserSettleMarketUpdateAcceptingCommitmentsMarketUpdateIntermediaryDenomMarketManagePermissionsMarketManageReqAttrsPayment EndpointsCreatePaymentAcceptPaymentRejectPaymentRejectPaymentsCancelPaymentsChangePaymentTargetGovernance ProposalsGovCreateMarketGovManageFeesGovCloseMarketGovUpdateParamsEventsOverviewEvent CategoriesOrder EventsEventOrderCreatedEventOrderCancelledEventOrderFilledEventOrderPartiallyFilledEventOrderExternalIDUpdatedCommitment EventsEventFundsCommittedEventCommitmentReleasedMarket Management EventsEventMarketWithdrawEventMarketDetailsUpdatedMarket Status EventsEventMarketOrdersEnabledEventMarketOrdersDisabledEventMarketUserSettleEnabledEventMarketUserSettleDisabledEventMarketCommitmentsEnabledEventMarketCommitmentsDisabledMarket Configuration EventsEventMarketIntermediaryDenomUpdatedEventMarketPermissionsUpdatedEventMarketReqAttrUpdatedGovernance EventsEventMarketCreatedEventMarketFeesUpdatedEventParamsUpdatedPayment EventsEventPaymentCreatedEventPaymentUpdatedEventPaymentAcceptedEventPaymentRejectedEventPaymentCancelledEvent Usage PatternsOrder Lifecycle TrackingMarket Administration MonitoringCommitment Flow TrackingPayment Flow TrackingEvent Monitoring StrategiesTrading Activity MonitoringMarket AdministrationCompliance and AuditingSystem MonitoringSummaryComplete Activity TrackingRich Event DataMonitoring CapabilitiesIntegration SupportQueriesOverviewQuery CategoriesFee Calculation QueriesOrderFeeCalcQueryOrderFeeCalcRequestQueryOrderFeeCalcResponseCommitmentSettlementFeeCalcQueryCommitmentSettlementFeeCalcRequestQueryCommitmentSettlementFeeCalcResponsePaymentFeeCalcQueryPaymentFeeCalcRequestQueryPaymentFeeCalcResponseOrder QueriesGetOrderQueryGetOrderRequestQueryGetOrderResponseOrderGetOrderByExternalIDQueryGetOrderByExternalIDRequestQueryGetOrderByExternalIDResponseGetMarketOrdersQueryGetMarketOrdersRequestQueryGetMarketOrdersResponseGetOwnerOrdersQueryGetOwnerOrdersRequestQueryGetOwnerOrdersResponseGetAssetOrdersQueryGetAssetOrdersRequestQueryGetAssetOrdersResponseGetAllOrdersQueryGetAllOrdersRequestQueryGetAllOrdersResponseCommitment QueriesGetCommitmentQueryGetCommitmentRequestQueryGetCommitmentResponseGetAccountCommitmentsQueryGetAccountCommitmentsRequestQueryGetAccountCommitmentsResponseGetMarketCommitmentsQueryGetMarketCommitmentsRequestQueryGetMarketCommitmentsResponseGetAllCommitmentsQueryGetAllCommitmentsRequestQueryGetAllCommitmentsResponseMarket QueriesGetMarketQueryGetMarketRequestQueryGetMarketResponseGetAllMarketsQueryGetAllMarketsRequestQueryGetAllMarketsResponseMarketBriefSystem QueriesParamsQueryParamsRequestQueryParamsResponseValidation QueriesValidateCreateMarketQueryValidateCreateMarketRequestQueryValidateCreateMarketResponseValidateMarketQueryValidateMarketRequestQueryValidateMarketResponseValidateManageFeesQueryValidateManageFeesRequestQueryValidateManageFeesResponsePayment QueriesGetPaymentQueryGetPaymentRequestQueryGetPaymentResponseGetPaymentsWithSourceQueryGetPaymentsWithSourceRequestQueryGetPaymentsWithSourceResponseGetPaymentsWithTargetQueryGetPaymentsWithTargetRequestQueryGetPaymentsWithTargetResponseGetAllPaymentsQueryGetAllPaymentsRequestQueryGetAllPaymentsResponseQuery Usage PatternsOrder Management WorkflowMarket Analysis WorkflowFee Calculation WorkflowCommitment Management WorkflowSummaryComplete Data AccessFee TransparencyValidation SupportDeveloper ExperienceIntegration FeaturesParamsOverviewParameter CategoriesFee Distribution ParametersDefault SplitDenomination-Specific SplitsPayment Fee ParametersPayment Creation FeePayment Acceptance FeeDefault ConfigurationDefault Parameter ValuesDefault Split RationaleParameter ManagementGovernance ControlUpdate ProcessGovernance Proposal StructureParameter ValidationCurrent Parameter QueryData StructuresParamsDenomSplitPractical ExamplesFee Distribution ScenariosScenario 1: Default Split OnlyScenario 2: Mixed Split ConfigurationScenario 3: High Exchange RevenuePayment Fee ExamplesStandard PaymentLarge PaymentEconomic ConsiderationsFee Distribution ImpactPayment Fee EconomicsParameter OptimizationMonitoring and AnalyticsFee Distribution TrackingPayment Fee AnalysisSummaryFee Distribution ManagementPayment Fee StructureSystem BenefitsEconomic DesignExchange MessagesSummaryUser EndpointsCreateAskCreateBidCommitFundsCancelOrderFillBidsFillAsksMarket EndpointsMarketSettleMarketCommitmentSettleMarketReleaseCommitmentsMarketSetOrderExternalIDMarketWithdrawMarketUpdateDetailsMarketUpdateAcceptingOrdersMarketUpdateUserSettleMarketUpdateAcceptingCommitmentsMarketUpdateIntermediaryDenomMarketManagePermissionsMarketManageReqAttrsPayment EndpointsCreatePaymentAcceptPaymentRejectPaymentRejectPaymentsCancelPaymentsChangePaymentTargetGovernance ProposalsGovCreateMarketGovManageFeesGovCloseMarketGovUpdateParams
Concepts
Overview
The x/exchange module facilitates the trading of on-chain assets. Markets provide fee structures and are responsible for identifying and triggering settlements. Orders are created by users to indicate a desire to trade on-chain funds in a market. The exchange module defines a portion of market fees to be paid to the chain (distributed like gas fees).
Core Components
Markets
A market is a combination of on-chain setup and off-chain processes. They are created by a governance proposal using the MsgGovCreateMarketRequest message. Most aspects of the market are then manageable using permissioned endpoints. Fees can only be managed with a governance proposal using the MsgGovManageFeesRequest message.
Market Features
Each market has a set of optional details designed for human-use, including:
- Name
- Description
- Website URL
Market Responsibilities
Order Management:
- If a market accepts orders, it is responsible (off-chain) for identifying order matches and triggering (on-chain) settlement
- Markets can restrict who can create orders by defining required account attributes
- Markets can control whether user-settlement is allowed
- Markets can control whether orders can be created for it
Commitment Management:
- If a market accepts commitments, it is able to manage committed funds and is responsible for releasing commitments as needed
- Markets can separately control whether funds can be committed to it
Fee Collection:
- A market receives fees for order creation and order settlement
- It also defines what fees are required and what is acceptable as payments
- The fees collected by a market are kept in the market's account, and can be accessed using the MarketWithdraw endpoint
Market Permissions
A market can delegate various permissions to other accounts, allowing those accounts to use specific endpoints on behalf of the market.
Permission | Description | Endpoints |
PERMISSION_SETTLE | Settlement operations | MarketSettle |
PERMISSION_SET_IDS | External ID management | MarketSetOrderExternalID |
PERMISSION_CANCEL | Cancellation operations | CancelOrder, MarketReleaseCommitments |
PERMISSION_WITHDRAW | Fund withdrawal | MarketWithdraw |
PERMISSION_UPDATE | Market updates | MarketUpdateDetails, MarketUpdateAcceptingOrders, MarketUpdateUserSettle, MarketUpdateAcceptingCommitments, MarketUpdateIntermediaryDenom |
PERMISSION_PERMISSIONS | Permission management | MarketManagePermissions |
PERMISSION_ATTRIBUTES | Attribute management | MarketManageReqAttrs |
Required Attributes
Markets can control access by requiring specific attributes for different operations:
Attribute Matching:
- There is a separate list of attributes required to create each order type and commitments
- If one or more attributes are required for an action, the associated account must have all of them
- Required attributes can have a wildcard at the start to indicate pattern matching
Wildcard Support:
- The only place a wildcard (*) is allowed is at the start of the string and must be immediately followed by a period
- Example: A required attribute of
.kyc.pb
would matchbuyer.kyc.pb
orspecial.seller.kyc.pb
, but notbuyer.xkyc.pb
orkyc.pb
Attributes are defined using the x/name module, and are managed on accounts using the x/attributes module.
Orders
Orders are created by users that want to trade assets in a market. When an order is created, a hold is placed on the applicable funds. Those funds will remain in the user's account until the order is settled or cancelled.
Order Lifecycle
Creation:
- Hold is placed on the applicable funds
- Funds remain in user's account until settlement or cancellation
- Orders cannot be modified except in specific ways
Modification Limitations:
- When an order is partially filled, the amounts in it will be reduced accordingly
- An order's external ID can be changed by the market
- Cancelling an order will release the held funds and delete the order
- Settling an order in full will delete the order
Cancellation:
- Orders can be cancelled by either the user or the market
- Cancellation releases held funds and deletes the order
Ask Orders
Ask orders represent a desire to sell some specific assets at a minimum price.
Hold Behavior:
- When an ask order is created, a hold is placed on the assets being sold
- If the seller_settlement_flat_fee denom differs from the price denom, a hold is placed on that flat fee too
Settlement:
- Ask orders can be filled at a larger price than initially defined
- The seller_settlement_flat_fee is verified at creation but only paid during settlement
- Assets are transferred directly to the buyer(s) and the price is transferred directly from the buyer(s)
- Seller settlement fees are transferred from the seller to the market
Fee Calculation:
During settlement, the seller settlement fee ratio with the appropriate price denom is applied to the price the seller is receiving. That result is then added to the ask order's seller_settlement_flat_fee to get the total settlement fee.
Example Settlement:
A user creates an ask order to sell 2cow for at least 15chicken. The market settles at 16chicken, but the seller's settlement fee is 2chicken. During settlement:
- 2cow transferred from seller to buyer
- 16chicken transferred from buyer to seller
- 2chicken transferred from seller to market
- Seller ends up with 14chicken for their 2cow
Bid Orders
Bid orders represent a desire to buy some specific assets at a specific price.
Hold Behavior:
- When a bid order is created, a hold is placed on the order's price and buyer_settlement_fees
Settlement:
- Price is transferred directly to the seller(s) and the assets are transferred directly from the seller(s)
- Buyer settlement fees are transferred from the buyer to the market
- The buyer_settlement_fees are verified at creation but only paid during settlement
- Fees are paid in addition to the price the buyer is paying
Partial Orders
Both Ask orders and Bid orders can optionally allow partial fulfillment by setting the allow_partial field to true when creating the order.
Requirements for Partial Settlement:
- Order must allow partial settlement (defined at order creation)
- Order must be evenly divisible
- The following calculations must result in whole numbers:
<order price> * <assets filled> / <order assets>
<settlement fees> * <assets filled> / <order assets>
Partial Settlement Behavior:
- When an order is partially filled, the order's same assets:price and assets:settlement-fees ratios are maintained
- Order amounts are updated to reflect what hasn't yet been filled
- An order can be partially filled multiple times (as long as the numbers allow for it)
External IDs
Orders can be identified using an off-chain identifier for easier tracking and management.
External ID Features:
- Can be provided during order creation in the external_id field
- Can be set by the market after order creation using MarketSetOrderExternalID
- Each external ID is unique inside a market
- Multiple orders in different markets can have the same external ID
- External IDs are optional (multiple orders can have empty external IDs)
- Limited to 100 characters
- Orders with external IDs can be looked up using GetOrderByExternalID query
Settlement
Each market is responsible for the settlement of its orders. To do this, it must first identify a matching set of asks and bids. The MarketSettle endpoint is then used to settle and clear orders.
Settlement Rules
Partial Settlement:
- At most one order can be partially filled, and it must be the last order in its list
- That order must allow partial settlement and be evenly divisible
- The market must set the expect_partial field to true in the request
- If all orders are being filled in full, the expect_partial field must be false
Asset and Price Requirements:
- All orders in a settlement must have the same assets denoms
- All orders must have the same price denoms
- Fees can be anything
- The total bid price must be at least the total ask price
Settlement Process
During settlement, the following transfers occur:
- The assets are transferred directly from the seller(s) to the buyer(s)
- The price funds are transferred directly from the buyer(s) to the seller(s)
- All settlement fees are transferred directly from the seller(s) and buyer(s) to the market
- The exchange's portion of the fees is transferred from the market to the chain's fee collector
Transfer Restrictions:
- Transfers of the assets and price bypass the quarantine module since order creation can be viewed as acceptance of those funds
- No other send-restrictions are bypassed (e.g. x/marker or x/sanction module restrictions)
- If an order's funds are in a sanctioned account, settlement will fail
User Settlement
If the market allows, users can also settlement orders with their own funds using the FillBids or FillAsks endpoints.
Transfer Agent
During a settlement, commitment settlement, or market withdrawal, the admin is also used as the transfer agent. A transfer agent is used by the x/marker module's Send Restrictions to help facilitate movement of restricted coins.
Commitments
A Commitment allows an account to give control of some of its funds to a market. When funds are committed to a market, they remain in the source account and a hold is placed on them.
Commitment Behavior
Fund Control:
- Committed funds are not usable by the account they are in; only the market can move them
- The funds stay in the account until the market either moves them using MarketCommitmentSettle or cancels the commitment
- Commitments can only be cancelled by the market (or a governance proposal)
Market Requirements:
For a market to start accepting commitments, it must have either:
- A settlement bips, or
- A commitment creation flat fee defined
If a settlement bips is defined, an intermediary denom must also be defined and a NAV must exist from the intermediary denom to the chain's fee denom.
Commitment Settlement
A market can move funds committed to it by using the MarketCommitmentSettle endpoint.
Settlement Process:
- Holds are released on the funds to be transferred
- The funds are transferred
- The funds are re-committed in the destination accounts
Settlement Features:
- The market can collect fees as part of this settlement, but is also charged extra fees for the tx
- The funds are re-committed regardless of the market's accepting_commitments value
- The accounts these funds are being re-committed to also are not required to have the create-commitment required attributes
Payments
A payment is used to trade fund between two accounts. The account that creates the payment is the source. The account that can accept (or reject) the payment is the target.
Payment Structure
Account Roles:
- Source: The account that creates the payment
- Target: The account that can accept or reject the payment (does not need to be declared when payment is created)
Payment Amounts:
- source_amount: The amount that the source is providing
- target_amount: The amount that the target is providing
- Both amounts are optional, but at least one must be provided
Payment Lifecycle
Creation:
- A hold is placed the source_amount funds in the source account
- A payment is uniquely identified by its source and external_id
- It is up to the source to choose an external_id that they are not already using
Acceptance:
- When a payment is accepted, the hold is released
- The source_amount is sent from the source to the target
- The target_amount is sent from the target to the source
- All the details of the payment must be provided in the acceptance request
Completion:
- Once a payment has been accepted, rejected, or cancelled, its external ID can be reused by the source
- Two different sources can use the same external ID
Payment Fees
Creating or accepting a payment may require an extra amount to be included in the tx fees. This amount is defined in the exchange module Params. The amount required for a specific payment can be calculated using the PaymentFeeCalc query.
Fees
Markets dictate the minimum required fees. It's possible to pay more than the required fees, but not less. A portion of the fees that a market collects are sent to the blockchain and distributed similar to gas fees.
Fee Types
There are several types of fees:
Fee Type | Description | When Paid |
Order Creation | Flat fees paid at the time that an order is created | Order creation |
Settlement Flat Fees | A fee paid during settlement that is the same for each order | Settlement |
Settlement Ratio Fees | A fee paid during settlement that is based off of the order's price | Settlement |
Commitment Fees | Fees paid in relation to commitments | Commitment creation/settlement |
Fee Configuration
Order Type Specificity:
For each fee type, there is a configuration for each order type. For example, the ask-order creation fee is configured separately from the bid-order creation fee.
Multiple Options:
Each fee type is only paid in a single denom, but a market can define multiple options for each. For example, if flat fee options for a specific fee are 5chicken,1cow, users can provide either 5chicken or 1cow to fulfill that required fee.
Optional Fees:
If a market does not have any options defined for a given fee type, that fee is not required.
Order Creation Fees
This is a fee provided in the order_creation_fee field of the order creation messages and is collected immediately. These are paid on top of any gas or message fees required.
Configuration:
- fee_create_ask_flat: The available Coin fee options for creating an ask order
- fee_create_bid_flat: The available Coin fee options for creating a bid order
Settlement Flat Fees
This is a fee provided as part of an order, but is not collected until settlement.
Configuration:
- fee_seller_settlement_flat: The available Coin fee options that are paid by the seller during settlement
- fee_buyer_settlement_flat: The available Coin fee options that are paid by the buyer during settlement
Requirements:
- The ask order's seller_settlement_flat_fee must be at least one of the available fee_seller_settlement_flat options
- The bid order's buyer_settlement_fees must be enough to cover one of the fee_buyer_settlement_flat options plus one of the buyer settlement ratio fee options
Settlement Ratio Fees
A FeeRatio is a pair of Coins defining a price to fee ratio.
Configuration:
- fee_seller_settlement_ratios: The available FeeRatio options that are applied to the price received
- fee_buyer_settlement_ratios: The available FeeRatio options that are applied to the bid order's price
Seller Settlement Ratio Fee
A market's fee_seller_settlement_ratios are limited to FeeRatios that have the same price and fee denom. This ensures that the seller settlement fee can always be paid by the funds the seller is receiving.
Calculation Formula:
<settlement price> * <ratio fee> / <ratio price>
If that is not a whole number, it is rounded up to the next whole number.
Example:
A market has 1000chicken:3chicken in fee_seller_settlement_ratios:
- An order settling for 400chicken: 400 * 3 / 1000 = 1.2, which is rounded up to 2chicken
- An order settling for 3000chicken: 3000 * 3 / 1000 = 9, which doesn't need rounding
Buyer Settlement Ratio Fee
A market's fee_buyer_settlement_ratios can have FeeRatios with any denom pair. It can also have multiple entries with the same price denom or fee denom, but it can only have one entry for each price to fee denom pair.
Calculation Formula:
<bid price> * <ratio fee> / <ratio price>
If that is not a whole number, it is rounded up to the next whole number.
The buyer settlement ratio fee should be added to the buyer settlement flat fee and provided in the buyer_settlement_fees in the bid order.
Commitment Fees
A market can collect commitment fees at commitment creation and/or during settlement. A market is also charged an extra Tx fee when doing a settlement.
Commitment Creation Fees
Similar to order creation fees, these are paid by the committer at the time of committal. A portion of these fees are given to the exchange.
Configuration:
- fee_create_commitment_flat: The available Coin fee options that are paid by the committer when committing funds
Commitment Settlement Fee Collection
During a commitment settlement, a market can collect fees by populating the fees field in the MsgMarketCommitmentSettleRequest. The exchange does NOT keep any portion of these fees. Only fees that have been committed to the market can be collected in this way.
Commitment Settlement Fee Charge
An additional fee is charged (similar to a msg-based fee) for commitment settlements that is based on the total funds being moved. The CommitmentSettlementFeeCalc query can be used to find out how much the fee will be for a commitment settlement.
Fee Calculation Process:
- Sum the settlement inputs
- Use Marker Net-Asset-Value (NAV) entries to convert the total into the market's intermediary denom
- A NAV is used to convert the intermediary total to the fee denom
- The market's commitment_settlement_bips is applied to the fee denom total
- That total is divided by two to get the final fee amount
Exchange Fees
A portion of the fees collected by a market are given to the exchange. The amount is defined using basis points in the exchange module's Params and can be configured differently for specific denoms.
Exchange Fees for Orders
Calculation Formula:
<fee amount> * <basis points> / 10,000
If that is not a whole number, it is rounded up to the next whole number.
Example:
Say the exchange has a default split of 500 (basis points), and a specific split of 100 for rooster. When a market collects a fee of 1500hen,710rooster:
- For hen: 1500 * 500 / 10,000 = 75hen
- For rooster: 710 * 100 / 10,000 = 7.1 which gets rounded up to 8rooster
So the market receives 1500hen,710rooster from the buyers/sellers, then 75hen,8rooster is transferred to the fee collector, leaving the market with 1425hen,702rooster.
Exchange Fees for Commitments
When a commitment is created, a portion of the fee collected by the market is given to the exchange in the same manner that order creation fees are handled. During a commitment settlement, the exchange collects a fee proportional to the funds being settled.
Exchange Fees for Payments
When a payment is created with a non-zero source_amount, an extra amount is required to be included in the tx fees. When a payment is accepted with a non-zero target_amount, an extra amount is required to be included in the tx fees. The amounts are flat and defined in the exchange module Params.
Summary
The x/exchange module provides a comprehensive trading infrastructure that includes:
Core Trading Components:
- Markets for organizing and facilitating trades
- Orders for expressing trading intent
- Settlement mechanisms for executing trades
- Commitments for managed fund control
- Payments for direct fund transfers
Advanced Features:
- Flexible permission systems for market delegation
- Attribute-based access controls
- Partial order fulfillment capabilities
- External ID tracking for off-chain integration
- Comprehensive fee structures
Fee Management:
- Multiple fee types for different operations
- Configurable fee options per market
- Exchange fee sharing mechanisms
- Basis point calculations with proper rounding
This design enables sophisticated trading scenarios while maintaining security, flexibility, and proper fee distribution throughout the ecosystem.
State
Overview
The Exchange module manages several components in state. Big-endian ordering is used for all conversions between numbers and byte arrays. This document details the key-value store structure and organization used by the exchange module to persist data on the blockchain.
State Organization
The exchange module organizes state data using prefix-based keys to enable efficient lookups and iterations. The following type bytes are used as prefixes:
Type Byte | Component | Description |
0x00 | Params | Module parameters and configuration |
0x01 | Markets | Market-specific data and settings |
0x02 | Orders | Individual order records |
0x03 | Market-Order Index | Maps markets to their orders |
0x04 | Address-Order Index | Maps addresses to their orders |
0x05 | Asset-Order Index | Maps asset denoms to orders |
0x06 | Last Market ID | Auto-increment counter for markets |
0x07 | Known Market ID | Market existence indicators |
0x08 | Last Order ID | Auto-increment counter for orders |
0x09 | External ID Index | Maps external IDs to orders |
0x10 | Payment Index | Payment target address mappings |
0x63 | Commitments | Committed funds by market and account |
0x70 | Payments | Payment records |
Params
All params entries start with the type byte
0x00
followed by a string identifying the entry type. Each <split>
is stored as a uint16
(2 bytes) in big-endian order. The byte 0x1E
is used in a few places as a record separator.Default Split
The default split defines the split amount (in basis points) the exchange receives of fees when there is not an applicable specific denom split.
Key Format:
plain text0x00 | "split" (5 bytes)
Value Format:
plain text<split (2 bytes)>
Specific Denom Split
A specific denom split is a split amount (in basis points) the exchange receives of fees for fees paid in a specific denom.
Key Format:
plain text0x00 | "split" (5 bytes) | <denom (string)>
Value Format:
plain text<split (2 bytes)>
Markets
Each aspect of a market is stored separately for specific lookup. Each
<market id>
is a uint32
(4 bytes) in big-endian order. Most aspects of a market have keys that start with the type byte 0x01
, followed by the <market id>
then another type byte.Market Fee Configurations
Market Create-Ask Flat Fee
One entry per configured denom.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x00 | <denom (string)>
Value Format:
plain text<amount (string)>
Market Create-Bid Flat Fee
One entry per configured denom.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x01 | <denom (string)>
Value Format:
plain text<amount (string)>
Market Create-Commitment Flat Fee
One entry per configured denom.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x11 | <denom (string)>
Value Format:
plain text<amount (string)>
Market Seller Settlement Flat Fee
One entry per configured denom.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x02 | <denom (string)>
Value Format:
plain text<amount (string)>
Market Seller Settlement Ratio Fee
One entry per configured price:fee denom pair.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x03 | <price denom (string)> | 0x1E | <fee denom (string)>
Value Format:
plain text<price amount (string)> | 0x1E | <fee amount (string)>
Market Buyer Settlement Flat Fee
One entry per configured denom.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x04 | <denom (string)>
Value Format:
plain text<amount (string)>
Market Buyer Settlement Ratio Fee
One entry per configured price:fee denom pair.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x05 | <price denom (string)> | 0x1E | <fee denom (string)>
Value Format:
plain text<price amount (string)> | 0x1E | <fee amount (string)>
Market Status Indicators
The exchange module uses boolean indicators stored as nil values. When the condition is true, the entry exists with a nil value. When false, the entry does not exist.
Market Not-Accepting-Orders Indicator
When a market has
accepting_orders = false
, this state entry will exist. When it has accepting_orders = true
, this entry will not exist.Key Format:
plain text0x01 | <market id (4 bytes)> | 0x06
Value Format:
plain text<nil (0 bytes)>
Market User-Settle Indicator
When a market has
allow_user_settlement = true
, this state entry will exist. When it has allow_user_settlement = false
, this entry will not exist.Key Format:
plain text0x01 | <market id (4 bytes)> | 0x07
Value Format:
plain text<nil (0 bytes)>
Market Accepting Commitments Indicator
When a market has
accepting_commitments = true
, this state entry will exist. When it has accepting_commitments = false
, this entry will not exist.Key Format:
plain text0x01 | <market id (4 bytes)> | 0x10
Value Format:
plain text<nil (0 bytes)>
Market Permissions
When an address has a given permission in a market, the following entry will exist.
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x08 | <addr len (1 byte)> | <addr> | <permission type byte (1 byte)>
Value Format:
plain text<nil (0 bytes)>
The
<permission type byte>
is a single byte as uint8
with the same values as the enum entries:Permission | Type Byte | Description |
PERMISSION_UNSPECIFIED | 0x00 | Invalid permission |
PERMISSION_SETTLE | 0x01 | Settlement operations |
PERMISSION_SET_IDS | 0x02 | External ID management |
PERMISSION_CANCEL | 0x03 | Cancellation operations |
PERMISSION_WITHDRAW | 0x04 | Fund withdrawal |
PERMISSION_UPDATE | 0x05 | Market updates |
PERMISSION_PERMISSIONS | 0x06 | Permission management |
PERMISSION_ATTRIBUTES | 0x07 | Attribute management |
Market Required Attributes
Market Create-Ask Required Attributes
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x09 | 0x00
Value Format:
plain text<list of strings separated by 0x1E>
Market Create-Bid Required Attributes
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x09 | 0x01
Value Format:
plain text<list of strings separated by 0x1E>
Market Create-Commitment Required Attributes
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x09 | 0x63
Value Format:
plain text<list of strings separated by 0x1E>
Market Configuration
Market Commitment Settlement Bips
Commitment Settlement Bips is stored as a
uint16
.Key Format:
plain text0x01 | <market id (4 bytes)> | 0x12
Value Format:
plain text<bips (2 bytes)>
Market Intermediary Denom
Key Format:
plain text0x01 | <market id (4 bytes)> | 0x13
Value Format:
plain text<denom>
Market Account
Each market has an associated
MarketAccount
with an address derived from the market_id
. Each MarketAccount
is stored using the Accounts module.protobufmessage MarketAccount { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; cosmos.auth.v1beta1.BaseAccount base_account = 1 [(gogoproto.embed) = true]; uint32 market_id = 2; MarketDetails market_details = 3; }
Market Details
The MarketDetails are stored as part of the MarketAccount (in the x/auth module).
Market ID Management
Known Market ID
These entries are used to indicate that a given market exists.
Key Format:
plain text0x07 | <market id (4 bytes)>
Value Format:
plain text<nil (0 bytes)>
Last Market ID
This indicates the last market-id that was auto-selected for use. When a
MsgGovCreateMarketRequest
is processed that has a market_id
of 0 (zero), the next available market id is auto selected.Key Format:
plain text0x06
Value Format:
plain text<market id (4 bytes)>
Auto-Selection Process:
- Starting with the number after what's in this state entry, each market id is sequentially checked until an available one is found
- The new market gets that id
- This entry is then updated to indicate what that was
When a
MsgGovCreateMarketRequest
is processed that has a non-zero market_id
, this entry is not considered or altered.Orders
Each
<order id>
is a uint64
(8 bytes) in big-endian order. Orders are stored using a type-prefixed format that allows for different order types.Order Storage Format
Key Format:
plain text0x02 | <order id (8 bytes)>
Value Format:
plain text<order type byte> | protobuf(order type)
The
<order type byte>
has these possible values:Order Type | Type Byte | Description |
Ask Order | 0x00 | Sell orders |
Bid Order | 0x01 | Buy orders |
Ask Orders
Key Format:
plain text0x02 | <order id (8 bytes)>
Value Format:
plain text0x00 | protobuf(AskOrder)
Bid Orders
Key Format:
plain text0x02 | <order id (8 bytes)>
Value Format:
plain text0x01 | protobuf(BidOrder)
Last Order ID
Whenever an order is created, this value is looked up and incremented to get the new order's id. Then this entry is updated to reflect the new order.
Key Format:
plain text0x08
Value Format:
plain text<order id (8 bytes)>
Commitments
Commitments represent funds that accounts have committed to markets.
Key Format:
plain text0x63 | <market_id> (4 bytes) | <addr len (1 byte)> | <addr>
Value Format:
plain text<coins string>
Payments
Payments facilitate direct fund transfers between accounts.
Key Format:
plain text0x70 | <source len (1 byte)> | <source> | <external id>
Value Format:
plain textprotobuf(Payment)
Indexes
Several index entries are maintained to help facilitate lookups. The
<order type byte>
values are the same as those described in the Orders section.Market to Order
This index can be used to find orders in a given market.
Key Format:
plain text0x03 | <market id (4 bytes)> | <order id (8 bytes)>
Value Format:
plain text<order type byte (1 byte)>
Owner Address to Order
This index can be used to find orders with a given buyer or seller.
Key Format:
plain text0x04 | <addr len (1 byte)> | <addr> | <order id (8 bytes)>
Value Format:
plain text<order type byte (1 byte)>
Asset Denom to Order
This index can be used to find orders involving a given assets denom.
Key Format:
plain text0x05 | <asset denom> | <order id (8 bytes)>
Value Format:
plain text<order type byte (1 byte)>
Market External ID to Order
This index is used to look up orders by their market and external id.
Key Format:
plain text0x09 | <market id (4 bytes)> | <external id (string)>
Value Format:
plain text<order id (8 bytes)>
Target Address to Payment
This index is used to look up payments that have a specific target address.
Key Format:
plain text0x10 | <target len (1 byte)> | <target> | <source len (1 byte)> | <source> | <external id>
Value Format:
plain text<nil (0 bytes)>
State Architecture Summary
The exchange module employs a sophisticated state organization strategy that provides:
Efficient Lookups
Prefix-Based Organization:
- Type bytes enable quick filtering of data categories
- Market IDs allow direct access to market-specific data
- Order IDs provide unique identification for all orders
Multiple Index Structures:
- Market-to-order mapping for market-specific queries
- Address-to-order mapping for user portfolio views
- Asset-to-order mapping for asset-specific searches
- External ID mapping for off-chain integration
Scalable Design
Separate Storage:
- Each market aspect stored independently
- Fee configurations stored per denom
- Permissions stored per address-permission pair
Boolean Indicators:
- Efficient storage using nil values for true conditions
- Absence of entry indicates false condition
- Minimal storage overhead for status flags
Data Integrity
Auto-Increment Counters:
- Last Market ID ensures unique market identification
- Last Order ID prevents order ID collisions
- Sequential allocation with gap detection
Type Safety:
- Order type bytes distinguish ask from bid orders
- Permission type bytes enforce access control
- Structured protobuf serialization for complex data
Performance Optimization
Big-Endian Encoding:
- Consistent byte ordering for numeric values
- Predictable key sorting for range queries
- Efficient prefix-based iterations
Record Separators:
- 0x1E byte for multi-part value separation
- Clean parsing of compound data structures
- Support for list-based attribute storage
This state organization enables the exchange module to handle complex trading scenarios while maintaining high performance and data consistency across all operations.
Messages
Summary
The Provenance Exchange module provides comprehensive message endpoints for trading operations, market management, payment processing, and governance actions. These endpoints are categorized into user-accessible functions (order creation, fund commitment, settlement), market administrator functions (order matching, permission management, configuration updates), payment system operations (bilateral fund transfers), and governance-controlled actions (market creation, fee management, parameter updates). Each endpoint includes specific validation rules, permission requirements, and failure conditions to ensure secure and compliant trading operations on the Provenance blockchain.
User Endpoints
User endpoints are available to all users, though some markets may impose restrictions based on account attributes or market settings.
CreateAsk
Create an ask order to sell assets at a minimum price. Markets may require specific attributes for order creation and can disable order creation entirely.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L116-L124
protobuf// MsgCreateAskRequest structure message MsgCreateAskRequest { AskOrder ask_order = 1; uint64 order_creation_fee = 2; }
Related structures:
- AskOrder: orders.proto#L28-L53
- MsgCreateAskResponse: tx.proto#L126-L130
Expected failures:
- Market does not exist or disallows order creation
- Seller lacks required attributes or assets
- Insufficient fees or invalid denomination
- External ID already in use
CreateBid
Create a bid order to buy assets at a specific price. Similar restrictions and validation as ask orders apply.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L132-L140
protobuf// MsgCreateBidRequest structure message MsgCreateBidRequest { BidOrder bid_order = 1; uint64 order_creation_fee = 2; }
Related structures:
- BidOrder: orders.proto#L55-L78
- MsgCreateBidResponse: tx.proto#L142-L146
CommitFunds
Commit funds to a market. If funds are already committed, the new amount is added to existing commitments.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L148-L163
protobuf// MsgCommitFundsRequest structure message MsgCommitFundsRequest { string account = 1; uint32 market_id = 2; repeated cosmos.base.v1beta1.Coin amount = 3; cosmos.base.v1beta1.Coin creation_fee = 4; }
Response: tx.proto#L165-L166
CancelOrder
Cancel existing orders. Order creators can cancel their own orders, and market actors with PERMISSION_CANCEL can cancel any orders in their market.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L168-L178
protobuf// MsgCancelOrderRequest structure message MsgCancelOrderRequest { string signer = 1; uint64 order_id = 2; }
Response: tx.proto#L180-L181
FillBids
Execute user-settlement by filling one or more bid orders with user's own assets. Similar to an "Immediate or Cancel" ask order.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L183-L203
protobuf// MsgFillBidsRequest structure message MsgFillBidsRequest { string seller = 1; uint32 market_id = 2; repeated uint64 bid_order_ids = 3; repeated cosmos.base.v1beta1.Coin total_assets = 4; // Additional fee fields... }
Response: tx.proto#L205-L206
FillAsks
Execute user-settlement by filling one or more ask orders with user's own price funds. Similar to an "Immediate or Cancel" bid order.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L208-L229
protobuf// MsgFillAsksRequest structure message MsgFillAsksRequest { string buyer = 1; uint32 market_id = 2; repeated uint64 ask_order_ids = 3; cosmos.base.v1beta1.Coin total_price = 4; // Additional fee fields... }
Response: tx.proto#L231-L232
Market Endpoints
Market endpoints are available to designated market administrators with specific permissions or governance authority.
MarketSettle
Settle matched orders identified by the market. Requires PERMISSION_SETTLE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L234-L251
protobuf// MsgMarketSettleRequest structure message MsgMarketSettleRequest { string admin = 1; uint32 market_id = 2; repeated uint64 ask_order_ids = 3; repeated uint64 bid_order_ids = 4; bool expect_partial = 5; }
Response: tx.proto#L253-L254
MarketCommitmentSettle
Move committed funds within a market. Requires PERMISSION_SETTLE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L256-L276
protobuf// MsgMarketCommitmentSettleRequest structure message MsgMarketCommitmentSettleRequest { string admin = 1; uint32 market_id = 2; repeated AccountAmount inputs = 3; repeated AccountAmount outputs = 4; repeated NetAssetValue navs = 5; }
Response: tx.proto#L278-L279
MarketReleaseCommitments
Release committed funds from a market. Requires PERMISSION_CANCEL permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L281-L294
MarketSetOrderExternalID
Attach market-specific identifiers to orders. Requires PERMISSION_SET_IDS permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L299-L313
MarketWithdraw
Withdraw collected fees from market account. Requires PERMISSION_WITHDRAW permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L318-L332
MarketUpdateDetails
Update market details and metadata. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L337-L348
MarketUpdateAcceptingOrders
Enable or disable order creation in the market. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L377-L388
MarketUpdateUserSettle
Control whether user-settlement is allowed in the market. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L393-L406
MarketUpdateAcceptingCommitments
Control whether the market accepts fund commitments. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L411-L424
MarketUpdateIntermediaryDenom
Change the market's intermediary denomination for fee calculations. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L429-L440
MarketManagePermissions
Manage permissions for market operations. Requires PERMISSION_PERMISSIONS permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L445-L460
MarketManageReqAttrs
Manage required attributes for order creation. Requires PERMISSION_ATTRIBUTES permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L465-L486
Payment Endpoints
Payment endpoints facilitate bilateral transfers between accounts without market association.
CreatePayment
Create a payment between source and target accounts with external ID identification.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L491-L497
protobuf// MsgCreatePaymentRequest structure message MsgCreatePaymentRequest { Payment payment = 1; }
Related structures:
- Payment: payments.proto#L13-L43
- Response: tx.proto#L499-L500
AcceptPayment
Accept a previously created payment, executing the bilateral transfer.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L502-L508
RejectPayment
Reject a specific payment, releasing held funds.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L513-L523
RejectPayments
Reject all payments from specified source accounts.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L528-L536
CancelPayments
Cancel payments by external ID from the source account.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L541-L549
ChangePaymentTarget
Modify the target account for an existing payment.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L554-L564
Governance Proposals
Governance endpoints require authority from the governance module account for system-level operations.
GovCreateMarket
Create new markets through governance proposals with configurable market parameters.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L569-L580
protobuf// MsgGovCreateMarketRequest structure message MsgGovCreateMarketRequest { string authority = 1; Market market = 2; }
Related structures:
- Market: market.proto#L52-L148
- MarketDetails: market.proto#L28-L40
- FeeRatio: market.proto#L150-L158
- AccessGrant: market.proto#L160-L166
- Permission: market.proto#L168-L186
GovManageFees
Modify market fee structures through governance proposals.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L585-L635
GovCloseMarket
Close markets, cancelling all orders and releasing commitments.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L640-L648
GovUpdateParams
Update exchange module parameters through governance.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L653-L662
Events
Overview
The exchange module emits several events for various actions. These events provide comprehensive tracking and monitoring capabilities for all exchange operations, enabling applications to respond to trading activities, market changes, and administrative actions in real-time.
Event Categories
The exchange module organizes events into logical categories based on their purpose:
Category | Event Count | Description |
Order Events | 5 | Order lifecycle and management |
Commitment Events | 2 | Fund commitment operations |
Market Management Events | 10 | Market configuration and administration |
Governance Events | 3 | System-level changes |
Payment Events | 5 | Direct payment operations |
Order Events
Events related to order creation, modification, settlement, and cancellation.
EventOrderCreated
Any time an order is created, an EventOrderCreated is emitted.
Event Type:
provenance.exchange.v1.EventOrderCreated
Attribute Key | Attribute Value | Description |
order_id | The id of the order just created | Unique identifier for the new order |
order_type | The type of the order just created | "ask" or "bid" |
market_id | The id of the market that the order was created in | Market where order was placed |
external_id | The external id of the order just created | Optional external identifier |
EventOrderCancelled
When an order is cancelled (either by the owner or the market), an EventOrderCancelled is emitted.
Event Type:
provenance.exchange.v1.EventOrderCancelled
Attribute Key | Attribute Value | Description |
order_id | The id of the cancelled order | Unique identifier of cancelled order |
cancelled_by | The bech32 address of the account that cancelled the order | Who initiated the cancellation |
market_id | The id of the market that the cancelled order was in | Market where order existed |
external_id | The external id of the order that was just cancelled | Optional external identifier |
EventOrderFilled
When an order is filled in full, an EventOrderFilled is emitted. This event indicates that an order has been settled, cleared, and deleted.
Event Type:
provenance.exchange.v1.EventOrderFilled
Attribute Key | Attribute Value | Description |
order_id | The id of the settled order | Unique identifier of completed order |
assets | The assets that were bought or sold (Coin string) | Actual assets transferred |
price | The price received (Coin string) | Actual price received |
fees | The fees paid to settle the order (Coins string) | Total fees paid for settlement |
market_id | The id of the market that the order was in | Market where settlement occurred |
external_id | The external id of the order | Optional external identifier |
Important Notes:
- The assets, price, and fees reflect the funds that were actually transferred
- When an ask order is settled for a higher price than set in the order, the price reflects what the seller actually received
- The fees reflect the actual settlement fees paid (both flat and ratio) by the order's owner
- If an order was previously partially filled, but now the rest is being filled, this event is emitted
EventOrderPartiallyFilled
When an order is partially filled, an EventOrderPartiallyFilled is emitted. This event indicates that some of an order was filled, but that the order has been reduced and still exists.
Event Type:
provenance.exchange.v1.EventOrderPartiallyFilled
Attribute Key | Attribute Value | Description |
order_id | The id of the partially settled order | Unique identifier of partially filled order |
assets | The assets that were bought or sold (Coin string) | Assets transferred in this partial fill |
price | The price received (Coin string) | Price received for this partial fill |
fees | The fees paid for the partial settlement of this order (Coins string) | Fees paid for this partial settlement |
market_id | The id of the market that the order is in | Market where partial settlement occurred |
external_id | The external id of the order | Optional external identifier |
Important Notes:
- The assets, price, and fees reflect the funds that were actually transferred
- If an order was previously partially filled, but now the rest is being filled, an EventOrderFilled is emitted
EventOrderExternalIDUpdated
When an order's external id is updated, an EventOrderExternalIDUpdated is emitted.
Event Type:
provenance.exchange.v1.EventOrderExternalIDUpdated
Attribute Key | Attribute Value | Description |
order_id | The id of the updated order | Unique identifier of the order |
market_id | The id of the market that the order is in | Market containing the order |
external_id | The new external id of the order | New external identifier assigned |
Commitment Events
Events related to fund commitment operations and lifecycle management.
EventFundsCommitted
When funds are committed to a market by an account, an EventFundsCommitted is emitted.
Event Type:
provenance.exchange.v1.EventFundsCommitted
Attribute Key | Attribute Value | Description |
account | The bech32 address of the account that committed the funds | Account committing funds |
market_id | The id of the market that funds were committed to | Target market for commitment |
amount | The funds committed (Coins string) | Amount of funds committed |
tag | The event_tag provided in the msg | Optional tag for categorization |
EventCommitmentReleased
When funds are released by a market, an EventCommitmentReleased is emitted.
Event Type:
provenance.exchange.v1.EventCommitmentReleased
Attribute Key | Attribute Value | Description |
account | The bech32 address of the account that committed the funds | Account whose funds are released |
market_id | The id of the market that funds were committed to | Market releasing the funds |
amount | The funds committed (Coins string) | Amount of funds released |
tag | The event_tag provided in the msg | Optional tag for categorization |
Market Management Events
Events related to market administration, configuration changes, and operational updates.
EventMarketWithdraw
Any time a market's funds are withdrawn, an EventMarketWithdraw is emitted.
Event Type:
provenance.exchange.v1.EventMarketWithdraw
Attribute Key | Attribute Value | Description |
market_id | The id of the market the funds were withdrawn from | Source market |
amount | The funds withdrawn (Coins string) | Amount withdrawn |
destination | The bech32 address string of the account that received the funds | Recipient account |
withdrawn_by | The bech32 address string of the admin account that made the withdrawal | Administrator who executed withdrawal |
EventMarketDetailsUpdated
When a market's details are updated, an EventMarketDetailsUpdated is emitted.
Event Type:
provenance.exchange.v1.EventMarketDetailsUpdated
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market that was updated |
updated_by | The bech32 address string of the admin account that made the change | Administrator who made the change |
Market Status Events
The exchange module emits specific events when market operational settings change:
EventMarketOrdersEnabled
When a market's accepting_orders changes from false to true, an EventMarketOrdersEnabled is emitted.
Event Type:
provenance.exchange.v1.EventMarketOrdersEnabled
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market that now accepts orders |
updated_by | The bech32 address string of the admin account that made the change | Administrator who enabled orders |
EventMarketOrdersDisabled
When a market's accepting_orders changes from true to false, an EventMarketOrdersDisabled is emitted.
Event Type:
provenance.exchange.v1.EventMarketOrdersDisabled
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market that no longer accepts orders |
updated_by | The bech32 address string of the admin account that made the change | Administrator who disabled orders |
EventMarketUserSettleEnabled
When a market's allow_user_settlement changes from false to true, an EventMarketUserSettleEnabled is emitted.
Event Type:
provenance.exchange.v1.EventMarketUserSettleEnabled
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market that now allows user settlement |
updated_by | The bech32 address string of the admin account that made the change | Administrator who enabled user settlement |
EventMarketUserSettleDisabled
When a market's allow_user_settlement changes from true to false, an EventMarketUserSettleDisabled is emitted.
Event Type:
provenance.exchange.v1.EventMarketUserSettleDisabled
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market that no longer allows user settlement |
updated_by | The bech32 address string of the admin account that made the change | Administrator who disabled user settlement |
EventMarketCommitmentsEnabled
When a market's accepting_commitments changes from false to true, an EventMarketCommitmentsEnabled is emitted.
Event Type:
provenance.exchange.v1.EventMarketCommitmentsEnabled
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market that now accepts commitments |
updated_by | The bech32 address string of the admin account that made the change | Administrator who enabled commitments |
EventMarketCommitmentsDisabled
When a market's accepting_commitments changes from true to false, an EventMarketCommitmentsDisabled is emitted.
Event Type:
provenance.exchange.v1.EventMarketCommitmentsDisabled
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market that no longer accepts commitments |
updated_by | The bech32 address string of the admin account that made the change | Administrator who disabled commitments |
Market Configuration Events
EventMarketIntermediaryDenomUpdated
When a market's intermediary_denom is updated, an EventMarketIntermediaryDenomUpdated is emitted.
Event Type:
provenance.exchange.v1.EventMarketIntermediaryDenomUpdated
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market with updated intermediary denomination |
updated_by | The bech32 address string of the admin account that made the change | Administrator who updated the denomination |
EventMarketPermissionsUpdated
Any time a market's permissions are managed, an EventMarketPermissionsUpdated is emitted.
Event Type:
provenance.exchange.v1.EventMarketPermissionsUpdated
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market with updated permissions |
updated_by | The bech32 address string of the admin account that made the change | Administrator who updated permissions |
EventMarketReqAttrUpdated
When a market's required attributes are altered, an EventMarketReqAttrUpdated is emitted.
Event Type:
provenance.exchange.v1.EventMarketReqAttrUpdated
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market with updated required attributes |
updated_by | The bech32 address string of the admin account that made the change | Administrator who updated attributes |
Governance Events
Events related to system-level changes that require governance approval.
EventMarketCreated
When a market is created, an EventMarketCreated is emitted.
Event Type:
provenance.exchange.v1.EventMarketCreated
Attribute Key | Attribute Value | Description |
market_id | The id of the new market | Unique identifier of the newly created market |
EventMarketFeesUpdated
When a market's fees are updated, an EventMarketFeesUpdated is emitted.
Event Type:
provenance.exchange.v1.EventMarketFeesUpdated
Attribute Key | Attribute Value | Description |
market_id | The id of the updated market | Market with updated fee structure |
EventParamsUpdated
An EventParamsUpdated is emitted when the exchange module's params are changed.
Event Type:
provenance.exchange.v1.EventParamsUpdated
Attribute Key | Attribute Value | Description |
(none) | No specific attributes | Indicates module parameters were updated |
Payment Events
Events related to direct payment operations between accounts.
EventPaymentCreated
When a payment is created, an EventPaymentCreated is emitted.
Event Type:
provenance.exchange.v1.EventPaymentCreated
Attribute Key | Attribute Value | Description |
source | The bech32 address string of the source account (that created the payment) | Account creating the payment |
source_amount | The amount in the source account involved in the payment (Coins string) | Funds provided by source |
target | The bech32 address string of the target account | Account that can accept the payment |
target_amount | The amount that the target account will provide (Coins string) | Funds expected from target |
external_id | The external id of the payment just created | External identifier for the payment |
EventPaymentUpdated
When a payment's target is changed, an EventPaymentUpdated is emitted.
Event Type:
provenance.exchange.v1.EventPaymentUpdated
Attribute Key | Attribute Value | Description |
source | The bech32 address string of the source account (that updated the payment) | Account that updated the payment |
source_amount | The amount in the source account involved in the payment (Coins string) | Funds provided by source |
old_target | The old bech32 address string of the target account | Previous target account |
new_target | The new bech32 address string of the target account | New target account |
target_amount | The amount that the target account will provide (Coins string) | Funds expected from target |
external_id | The external id of the payment just updated | External identifier for the payment |
EventPaymentAccepted
When a payment is accepted, an EventPaymentAccepted is emitted.
Event Type:
provenance.exchange.v1.EventPaymentAccepted
Attribute Key | Attribute Value | Description |
source | The bech32 address string of the source account (that created the payment) | Account that created the payment |
source_amount | The amount in the source account involved in the payment (Coins string) | Funds provided by source |
target | The bech32 address string of the target account (that accepted the payment) | Account that accepted the payment |
target_amount | The amount that the target account will provide (Coins string) | Funds provided by target |
external_id | The external id of the payment just accepted | External identifier for the payment |
EventPaymentRejected
When a payment is rejected (by a target), an EventPaymentRejected is emitted.
Event Type:
provenance.exchange.v1.EventPaymentRejected
Attribute Key | Attribute Value | Description |
source | The bech32 address string of the source account (that created the payment) | Account that created the payment |
target | The bech32 address string of the target account (that rejected the payment) | Account that rejected the payment |
external_id | The external id of the payment just rejected | External identifier for the payment |
EventPaymentCancelled
When a payment is cancelled (by a source), an EventPaymentCancelled is emitted.
Event Type:
provenance.exchange.v1.EventPaymentCancelled
Attribute Key | Attribute Value | Description |
source | The bech32 address string of the source account (that cancelled the payment) | Account that cancelled the payment |
target | The bech32 address string of the target account | Target account of the cancelled payment |
external_id | The external id of the payment just cancelled | External identifier for the payment |
Event Usage Patterns
Order Lifecycle Tracking
plain textOrder Lifecycle Events: 1. EventOrderCreated โ 2. (Optional) EventOrderExternalIDUpdated โ 3. Settlement Options: - EventOrderFilled (complete settlement) - EventOrderPartiallyFilled โ EventOrderFilled (partial then complete) - EventOrderCancelled (cancelled before settlement)
Market Administration Monitoring
plain textMarket Management Events: Creation: - EventMarketCreated Configuration Changes: - EventMarketDetailsUpdated - EventMarketPermissionsUpdated - EventMarketReqAttrUpdated - EventMarketIntermediaryDenomUpdated Operational Status: - EventMarketOrdersEnabled/Disabled - EventMarketUserSettleEnabled/Disabled - EventMarketCommitmentsEnabled/Disabled Financial Operations: - EventMarketWithdraw - EventMarketFeesUpdated (governance only)
Commitment Flow Tracking
plain textCommitment Lifecycle: 1. EventFundsCommitted โ 2. (Market manages committed funds) โ 3. EventCommitmentReleased
Payment Flow Tracking
plain textPayment Lifecycle: 1. EventPaymentCreated โ 2. (Optional) EventPaymentUpdated (target changes) โ 3. Resolution: - EventPaymentAccepted (successful completion) - EventPaymentRejected (rejected by target) - EventPaymentCancelled (cancelled by source)
Event Monitoring Strategies
Trading Activity Monitoring
Use Case | Relevant Events | Purpose |
Order Flow Analysis | EventOrderCreated, EventOrderFilled, EventOrderPartiallyFilled | Track trading volume and patterns |
Market Activity | All order events filtered by market_id | Monitor specific market performance |
User Trading | Order events filtered by addresses | Track individual trading behavior |
Settlement Monitoring | EventOrderFilled, EventOrderPartiallyFilled | Monitor successful trade execution |
Market Administration
Use Case | Relevant Events | Purpose |
Market Status | EventMarketOrders*, EventMarketUserSettle*, EventMarketCommitments* | Monitor operational status changes |
Configuration Changes | EventMarketDetailsUpdated, EventMarketPermissionsUpdated | Track administrative modifications |
Financial Operations | EventMarketWithdraw, EventMarketFeesUpdated | Monitor fee collection and withdrawals |
Access Control | EventMarketPermissionsUpdated, EventMarketReqAttrUpdated | Track permission and attribute changes |
Compliance and Auditing
Use Case | Relevant Events | Purpose |
Complete Audit Trail | All events | Comprehensive activity tracking |
Governance Changes | EventMarketCreated, EventMarketFeesUpdated, EventParamsUpdated | Track governance-level changes |
Fund Movement | Order settlement events, commitment events, payment events | Monitor all fund transfers |
Administrative Actions | Market management events with updated_by fields | Track who made what changes |
System Monitoring
Use Case | Relevant Events | Purpose |
Performance Metrics | EventOrderFilled, EventOrderPartiallyFilled | Calculate settlement success rates |
Error Detection | EventOrderCancelled | Identify potential issues |
Capacity Planning | EventOrderCreated frequency | Monitor system load |
Feature Usage | Payment events, commitment events | Track feature adoption |
Summary
The x/exchange module provides comprehensive event coverage that enables:
Complete Activity Tracking
- Order Lifecycle: Creation, modification, settlement, and cancellation
- Market Operations: Administrative changes and operational status updates
- Financial Operations: Fund movements, fee collection, and withdrawals
- Payment Processing: Direct payment lifecycle management
Rich Event Data
- Identity Information: Account addresses and identifiers for all participants
- Financial Details: Exact amounts transferred, fees paid, and prices received
- Administrative Context: Who made changes and when they occurred
- External Integration: External IDs and tags for off-chain system integration
Monitoring Capabilities
- Real-time Tracking: Immediate notification of all exchange activities
- Audit Trails: Complete history of all operations and changes
- Performance Monitoring: Data for analyzing system performance and usage
- Compliance Support: Detailed records for regulatory requirements
Integration Support
- External System Integration: Rich event data for connecting to external systems
- Business Intelligence: Comprehensive data for analytics and reporting
- Automated Responses: Events enable automated reaction to system changes
- User Interfaces: Real-time updates for user-facing applications
This event system ensures that all exchange module activities are transparent, traceable, and available for integration with external monitoring, analytics, and business systems.
Queries
Overview
There are several queries for getting information about items in the exchange module. These queries provide comprehensive access to order data, market information, commitments, payments, fee calculations, and validation services.
Query Categories
The exchange module organizes queries into logical categories based on their purpose:
Category | Query Count | Description |
Fee Calculation | 3 | Calculate required fees for various operations |
Order Queries | 6 | Access order data by various criteria |
Commitment Queries | 4 | Query fund commitment information |
Market Queries | 2 | Access market configuration and status |
System Queries | 1 | Module parameters and configuration |
Validation Queries | 3 | Validate operations before execution |
Payment Queries | 5 | Access payment data and calculations |
Fee Calculation Queries
Queries for calculating fees required for various exchange operations.
OrderFeeCalc
The OrderFeeCalc query is used to find out the various required fee options for a given order. The idea is that you can provide your AskOrder or BidOrder in this query in order to identify what fees you'll need to pay.
Usage Guidelines:
- Either an ask_order or a bid_order must be provided, but not both
- Each response field is a list of options available for the requested order
- If a response field is empty, then no fee of that type is required
For Ask Orders:
- Choose one entry from creation_fee_options to provide as the order_creation_fee
- Choose one entry from settlement_flat_fee_options and provide that as the seller_settlement_flat_fee
- The settlement_ratio_fee_options is purely informational and is the minimum seller's settlement ratio fee for the order
For Bid Orders:
- Choose one entry from creation_fee_options to provide as the order_creation_fee
- Choose one entry from each of settlement_flat_fee_options and settlement_ratio_fee_options, add them together, and provide that as the buyer_settlement_fees
QueryOrderFeeCalcRequest
protobufmessage QueryOrderFeeCalcRequest { // ask_order is the ask order to calculate fees for. AskOrder ask_order = 1; // bid_order is the bid order to calculate fees for. BidOrder bid_order = 2; }
QueryOrderFeeCalcResponse
protobufmessage QueryOrderFeeCalcResponse { // creation_fee_options are the choices of fees that must be paid when creating this order. repeated cosmos.base.v1beta1.Coin creation_fee_options = 1; // settlement_flat_fee_options are the choices of flat fees that will be added to the settlement. repeated cosmos.base.v1beta1.Coin settlement_flat_fee_options = 2; // settlement_ratio_fee_options are the choices of ratio fees that will be applied during settlement. repeated cosmos.base.v1beta1.Coin settlement_ratio_fee_options = 3; }
CommitmentSettlementFeeCalc
To find out the additional tx fee required for a commitment settlement, use the CommitmentSettlementFeeCalc query.
QueryCommitmentSettlementFeeCalcRequest
protobufmessage QueryCommitmentSettlementFeeCalcRequest { // settlement is the settlement to calculate the fees for. MsgMarketCommitmentSettleRequest settlement = 1; // include_breakdown_fields is a flag for whether to include the // breakdown_* fields in the response. bool include_breakdown_fields = 2; }
QueryCommitmentSettlementFeeCalcResponse
protobufmessage QueryCommitmentSettlementFeeCalcResponse { // exchange_fees are the fees that the exchange will pay for this settlement. repeated cosmos.base.v1beta1.Coin exchange_fees = 1; // breakdown_intermediary_amount is the sum of the inputs converted to the intermediary denom. repeated cosmos.base.v1beta1.Coin breakdown_intermediary_amount = 2; // breakdown_conversion_navs are the NAVs used to convert the intermediary amounts to the fee denom. repeated NetAssetPrice breakdown_conversion_navs = 3; // breakdown_converted_total is the intermediary amounts converted to the fee denom. repeated cosmos.base.v1beta1.Coin breakdown_converted_total = 4; // breakdown_conversion_fee_total is the fee denom amounts that the bips will be applied to. repeated cosmos.base.v1beta1.Coin breakdown_conversion_fee_total = 5; }
PaymentFeeCalc
The PaymentFeeCalc query can be used to calculate the fees for creating or accepting a payment.
QueryPaymentFeeCalcRequest
protobufmessage QueryPaymentFeeCalcRequest { // payment is the payment to calculate fees for. Payment payment = 1; }
QueryPaymentFeeCalcResponse
protobufmessage QueryPaymentFeeCalcResponse { // creation_fee_total is the total amount required for the create payment tx fee. repeated cosmos.base.v1beta1.Coin creation_fee_total = 1; // acceptance_fee_total is the total amount required for the accept payment tx fee. repeated cosmos.base.v1beta1.Coin acceptance_fee_total = 2; }
Order Queries
Queries for accessing order data by various criteria and identifiers.
GetOrder
Use the GetOrder query to look up an order by its id.
QueryGetOrderRequest
protobufmessage QueryGetOrderRequest { // order_id is the id of the order to look up. uint64 order_id = 1; }
QueryGetOrderResponse
protobufmessage QueryGetOrderResponse { // order is the order with the given id. Order order = 1; }
Order
protobufmessage Order { // order_id is the numerical identifier for this order. uint64 order_id = 1; // ask_order is defined if this order is an ask order. AskOrder ask_order = 2; // bid_order is defined if this order is a bid order. BidOrder bid_order = 3; }
GetOrderByExternalID
Orders with external ids can be looked up using the GetOrderByExternalID query.
QueryGetOrderByExternalIDRequest
protobufmessage QueryGetOrderByExternalIDRequest { // market_id is the id of the market the order is in. uint32 market_id = 1; // external_id is the external id of the order to look up. string external_id = 2; }
QueryGetOrderByExternalIDResponse
protobufmessage QueryGetOrderByExternalIDResponse { // order is the order with the given external id. Order order = 1; }
GetMarketOrders
To get all of the orders in a given market, use the GetMarketOrders query. Results can be optionally limited by order type (e.g. "ask" or "bid") and/or a minimum (exclusive) order id. This query is paginated.
QueryGetMarketOrdersRequest
protobufmessage QueryGetMarketOrdersRequest { // market_id is the id of the market to get orders for. uint32 market_id = 1; // order_type is optional and can be used to only get orders of the given type. string order_type = 2; // after_order_id is optional. If provided, only orders with an id >= this value will be included. uint64 after_order_id = 3; // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetMarketOrdersResponse
protobufmessage QueryGetMarketOrdersResponse { // orders are the orders in the given market. repeated Order orders = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
GetOwnerOrders
To get all of the orders with a specific owner (e.g. buyer or seller), use the GetOwnerOrders query. Results can be optionally limited by order type (e.g. "ask" or "bid") and/or a minimum (exclusive) order id. This query is paginated.
QueryGetOwnerOrdersRequest
protobufmessage QueryGetOwnerOrdersRequest { // owner is the bech32 address of the owner to get orders for. string owner = 1; // order_type is optional and can be used to only get orders of the given type. string order_type = 2; // after_order_id is optional. If provided, only orders with an id >= this value will be included. uint64 after_order_id = 3; // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetOwnerOrdersResponse
protobufmessage QueryGetOwnerOrdersResponse { // orders are the orders for the given owner. repeated Order orders = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
GetAssetOrders
To get all of the orders with a specific asset denom, use the GetAssetOrders query. Results can be optionally limited by order type (e.g. "ask" or "bid") and/or a minimum (exclusive) order id. This query is paginated.
QueryGetAssetOrdersRequest
protobufmessage QueryGetAssetOrdersRequest { // asset is the denom of the asset to get orders for. string asset = 1; // order_type is optional and can be used to only get orders of the given type. string order_type = 2; // after_order_id is optional. If provided, only orders with an id >= this value will be included. uint64 after_order_id = 3; // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetAssetOrdersResponse
protobufmessage QueryGetAssetOrdersResponse { // orders are the orders for the given asset. repeated Order orders = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
GetAllOrders
To get all existing orders, use the GetAllOrders query. This query is paginated.
QueryGetAllOrdersRequest
protobufmessage QueryGetAllOrdersRequest { // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetAllOrdersResponse
protobufmessage QueryGetAllOrdersResponse { // orders are all the orders. repeated Order orders = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
Commitment Queries
Queries for accessing fund commitment information by various criteria.
GetCommitment
To find out how much an account has committed to a market, use the GetCommitment query.
QueryGetCommitmentRequest
protobufmessage QueryGetCommitmentRequest { // account is the bech32 address of the account to get the commitment for. string account = 1; // market_id is the numerical identifier of the market to get the commitment for. uint32 market_id = 2; }
QueryGetCommitmentResponse
protobufmessage QueryGetCommitmentResponse { // amount is the total amount committed to the market by the account. repeated cosmos.base.v1beta1.Coin amount = 1; }
GetAccountCommitments
To look up the amounts an account has committed to any market, use the GetAccountCommitments query.
QueryGetAccountCommitmentsRequest
protobufmessage QueryGetAccountCommitmentsRequest { // account is the bech32 address of the account to get commitments for. string account = 1; }
QueryGetAccountCommitmentsResponse
protobufmessage QueryGetAccountCommitmentsResponse { // commitments are the commitments of the account. repeated MarketAmount commitments = 1; }
GetMarketCommitments
To get the amounts committed to a market by any account, use the GetMarketCommitments query.
QueryGetMarketCommitmentsRequest
protobufmessage QueryGetMarketCommitmentsRequest { // market_id is the numerical identifier of the market to get commitments for. uint32 market_id = 1; // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetMarketCommitmentsResponse
protobufmessage QueryGetMarketCommitmentsResponse { // commitments are the commitments for the market. repeated AccountAmount commitments = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
GetAllCommitments
To get all funds committed by any account to any market, use the GetAllCommitments query.
QueryGetAllCommitmentsRequest
protobufmessage QueryGetAllCommitmentsRequest { // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetAllCommitmentsResponse
protobufmessage QueryGetAllCommitmentsResponse { // commitments are all the commitments. repeated MarketAccountAmount commitments = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
Market Queries
Queries for accessing market configuration, status, and information.
GetMarket
All the information and setup for a market can be looked up using the GetMarket query.
QueryGetMarketRequest
protobufmessage QueryGetMarketRequest { // market_id is the id of the market to look up. uint32 market_id = 1; }
QueryGetMarketResponse
protobufmessage QueryGetMarketResponse { // address is the bech32 address string of the market's account. string address = 1; // market is the market with the given id. Market market = 2; }
GetAllMarkets
Use the GetAllMarkets query to get brief information about all markets.
QueryGetAllMarketsRequest
protobufmessage QueryGetAllMarketsRequest { // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetAllMarketsResponse
protobufmessage QueryGetAllMarketsResponse { // markets are brief information about all markets. repeated MarketBrief markets = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
MarketBrief
protobufmessage MarketBrief { // market_id is the numerical identifier for this market. uint32 market_id = 1; // market_details contains information about this market. MarketDetails market_details = 2; // market_account is the bech32 address string of this market's account. string market_account = 3; }
System Queries
Queries for accessing module-level configuration and parameters.
Params
The exchange module params can be looked up using the Params query.
QueryParamsRequest
protobufmessage QueryParamsRequest {}
QueryParamsResponse
protobufmessage QueryParamsResponse { // params are the parameters of the exchange module. Params params = 1; }
Validation Queries
Queries for validating operations before execution to prevent errors.
ValidateCreateMarket
It's possible for a MsgGovCreateMarketRequest to result in a market setup that is problematic. To verify that one is not problematic, this ValidateCreateMarket can be used.
Result Interpretation:
gov_prop_will_pass | error field | Meaning |
false | Has details | Submitting the proposal will fail, or the Msg will result in an error after the proposal is passed |
true | Non-empty | The Msg would successfully run, but would result in the problems identified in the error field |
true | Empty | There are no problems with the provided Msg |
QueryValidateCreateMarketRequest
protobufmessage QueryValidateCreateMarketRequest { // create_market_request is the msg to validate. MsgGovCreateMarketRequest create_market_request = 1; }
QueryValidateCreateMarketResponse
protobufmessage QueryValidateCreateMarketResponse { // error is any problems or errors found in the create market request. string error = 1; // gov_prop_will_pass is whether the proposal will pass if submitted as-is. bool gov_prop_will_pass = 2; }
ValidateMarket
An existing market's setup can be checked for problems using the ValidateMarket query. Any problems detected will be returned in the error field.
QueryValidateMarketRequest
protobufmessage QueryValidateMarketRequest { // market_id is the id of the market to validate. uint32 market_id = 1; }
QueryValidateMarketResponse
protobufmessage QueryValidateMarketResponse { // error is any problems or errors found in the market. string error = 1; }
ValidateManageFees
It's possible for a MsgGovManageFeesRequest to result in a problematic setup for a market. To verify that one does not result in such a state, use this ValidateManageFees query.
Result Interpretation:
gov_prop_will_pass | error field | Meaning |
false | Has details | Submitting the proposal will fail, or the Msg will result in an error after the proposal is passed |
true | Non-empty | The Msg would successfully run, but would result in the problems identified in the error field |
true | Empty | There are no problems with the provided Msg |
QueryValidateManageFeesRequest
protobufmessage QueryValidateManageFeesRequest { // manage_fees_request is the msg to validate. MsgGovManageFeesRequest manage_fees_request = 1; }
QueryValidateManageFeesResponse
protobufmessage QueryValidateManageFeesResponse { // error is any problems or errors found in the manage fees request. string error = 1; // gov_prop_will_pass is whether the proposal will pass if submitted as-is. bool gov_prop_will_pass = 2; }
Payment Queries
Queries for accessing payment data by various criteria and calculating payment fees.
GetPayment
Use the GetPayment query to look up a payment by source and external_id.
QueryGetPaymentRequest
protobufmessage QueryGetPaymentRequest { // source is the bech32 address of the source account. string source = 1; // external_id is the external id of the payment. string external_id = 2; }
QueryGetPaymentResponse
protobufmessage QueryGetPaymentResponse { // payment is the payment with the given source and external id. Payment payment = 1; }
GetPaymentsWithSource
To get all payments with a specific source, use the GetPaymentsWithSource query. This query is paginated.
QueryGetPaymentsWithSourceRequest
protobufmessage QueryGetPaymentsWithSourceRequest { // source is the bech32 address to get payments for. string source = 1; // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetPaymentsWithSourceResponse
protobufmessage QueryGetPaymentsWithSourceResponse { // payments are the payments with the given source. repeated Payment payments = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
GetPaymentsWithTarget
To get all payments with a specific target, use the GetPaymentsWithTarget query. This query is paginated.
QueryGetPaymentsWithTargetRequest
protobufmessage QueryGetPaymentsWithTargetRequest { // target is the bech32 address to get payments for. string target = 1; // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetPaymentsWithTargetResponse
protobufmessage QueryGetPaymentsWithTargetResponse { // payments are the payments with the given target. repeated Payment payments = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
GetAllPayments
A listing of all existing payments can be found using the GetAllPayments query. This query is paginated.
QueryGetAllPaymentsRequest
protobufmessage QueryGetAllPaymentsRequest { // pagination defines optional pagination parameters for the request. cosmos.base.query.v1beta1.PageRequest pagination = 99; }
QueryGetAllPaymentsResponse
protobufmessage QueryGetAllPaymentsResponse { // payments are all the payments. repeated Payment payments = 1; // pagination provides the pagination information of this query. cosmos.base.query.v1beta1.PageResponse pagination = 99; }
Query Usage Patterns
Order Management Workflow
plain textOrder Query Flow: 1. OrderFeeCalc โ Calculate required fees 2. CreateAsk/CreateBid โ Submit order with fees 3. GetOrder โ Monitor order status 4. GetMarketOrders โ View market activity 5. GetOwnerOrders โ Track personal orders
Market Analysis Workflow
plain textMarket Analysis Flow: 1. GetAllMarkets โ Discover available markets 2. GetMarket โ Get detailed market information 3. ValidateMarket โ Check market health 4. GetMarketOrders โ Analyze trading activity 5. GetMarketCommitments โ Review fund commitments
Fee Calculation Workflow
plain textFee Planning Flow: 1. OrderFeeCalc โ Calculate order fees 2. CommitmentSettlementFeeCalc โ Calculate settlement fees 3. PaymentFeeCalc โ Calculate payment fees 4. Execute operations with proper fee amounts
Commitment Management Workflow
plain textCommitment Tracking Flow: 1. GetCommitment โ Check specific commitment 2. GetAccountCommitments โ View all account commitments 3. GetMarketCommitments โ Monitor market commitments 4. CommitmentSettlementFeeCalc โ Plan settlements
Summary
The x/exchange module provides a comprehensive query interface that enables:
Complete Data Access
- Order Information: Access orders by ID, market, owner, asset, and external ID
- Market Data: Retrieve market configuration, status, and brief information
- Commitment Tracking: Query fund commitments by account, market, or globally
- Payment Management: Access payment data with flexible filtering options
Fee Transparency
- Order Fees: Calculate creation and settlement fees before order submission
- Commitment Fees: Determine settlement fees for commitment operations
- Payment Fees: Calculate creation and acceptance fees for payments
Validation Support
- Market Validation: Check market configuration for problems
- Operation Validation: Validate governance proposals before submission
- Error Prevention: Identify issues before executing operations
Developer Experience
- Consistent Patterns: Similar request/response structures across queries
- Pagination Support: Handle large datasets efficiently
- Flexible Filtering: Multiple ways to query the same data
- Rich Responses: Complete data structures with all relevant information
Integration Features
- External ID Support: Query orders by external identifiers
- Batch Operations: Retrieve multiple items efficiently
- Real-time Data: Current state information for all entities
- Comprehensive Coverage: Every aspect of the exchange module is queryable
This query system ensures that developers have complete visibility into exchange operations, enabling sophisticated trading applications, market analysis tools, and administrative interfaces.
Params
Overview
The exchange module params dictate how much of the fees (collected by markets) go to the exchange/chain. The split values are in basis points and are limited to between 0 and 10,000 (both inclusive). The exchange module params also dictate the fees associated with payments.
Parameter Categories
The exchange module parameters control two main aspects of system operation:
Category | Parameters | Purpose |
Fee Distribution | default_split, denom_splits | Control how market fees are split between markets and the exchange |
Payment Fees | fee_create_payment_flat, fee_accept_payment_flat | Set flat fees for payment operations |
Fee Distribution Parameters
Parameters that control how market-collected fees are distributed between markets and the exchange system.
Default Split
The default_split is used when a specific DenomSplit does not exist for a given denom.
Split Value Examples:
Split Value | Percentage | Exchange Share | Market Share | Description |
0 | 0% | None | All | Exchange receives none of the fees, market keeps all |
500 | 5% | 5% | 95% | Exchange receives 5% of fees, market keeps 95% |
2500 | 25% | 25% | 75% | Exchange receives 25% of fees, market keeps 75% |
5000 | 50% | 50% | 50% | Equal split between exchange and market |
7500 | 75% | 75% | 25% | Exchange receives 75% of fees, market keeps 25% |
10000 | 100% | All | None | Exchange receives all fees, market gets nothing |
Denomination-Specific Splits
Markets can have different split ratios for different denominations through DenomSplit configurations. This allows for flexible fee structures based on the type of asset being traded.
Split Priority:
- Specific DenomSplit - If defined for the denom, this value is used
- Default Split - If no specific DenomSplit exists, the default_split is used
Benefits of Denomination-Specific Splits:
- Asset-Based Pricing - Different fee structures for different asset types
- Market Incentives - Lower splits for preferred denominations
- Revenue Optimization - Higher splits for premium assets
- Flexibility - Customizable per market needs
Payment Fee Parameters
Parameters that control the flat fees charged for payment operations.
Payment Creation Fee
The fee_create_payment_flat is assessed as a msg fee when creating a payment (paid by the caller/source).
Fee Application:
- When Charged - During payment creation transaction
- Who Pays - The source account creating the payment
- Fee Type - Flat fee added to transaction costs
- Purpose - Covers network costs for payment processing
Payment Acceptance Fee
The fee_accept_payment_flat is assessed as a msg fee when accepting a payment (paid by the caller/target).
Fee Application:
- When Charged - During payment acceptance transaction
- Who Pays - The target account accepting the payment
- Fee Type - Flat fee added to transaction costs
- Purpose - Covers network costs for payment settlement
Default Configuration
The exchange module comes with sensible default parameters that can be modified through governance.
Default Parameter Values
Parameter | Default Value | Description |
default_split | 500 basis points (5%) | Exchange receives 5% of market fees by default |
denom_splits | Empty list | No denomination-specific splits configured |
fee_create_payment_flat | 100,000,000 nhash (0.1 HASH) | Flat fee for creating payments |
fee_accept_payment_flat | 100,000,000 nhash (0.1 HASH) | Flat fee for accepting payments |
Default Split Rationale
5% Exchange Share:
- Sustainable Revenue - Provides exchange with operational funding
- Market Incentive - Markets retain 95% of fees as incentive
- Competitive Balance - Reasonable split for market participation
- Network Support - Funds exchange infrastructure and development
Equal Payment Fees:
- Simple Structure - Same fee for creation and acceptance
- Fair Distribution - Both parties pay equivalent costs
- Network Efficiency - Covers transaction processing costs
- Predictable Costs - Fixed fees for budgeting purposes
Parameter Management
Governance Control
Parameters can only be modified through governance proposals to ensure community oversight.
Update Process
- Proposal Creation - Submit GovUpdateParams governance proposal
- Community Review - Public discussion and analysis period
- Voting Period - HASH token holders vote on the proposal
- Implementation - If passed, parameters are automatically updated
Governance Proposal Structure
protobufmessage MsgGovUpdateParamsRequest { string authority = 1; // Governance module account Params params = 2; // New parameter values }
Parameter Validation
The system enforces constraints on parameter values to ensure system stability:
Split Value Constraints:
- Minimum Value - 0 basis points (0%)
- Maximum Value - 10,000 basis points (100%)
- Valid Range - Any integer between 0 and 10,000 inclusive
Payment Fee Constraints:
- Non-negative - Fees cannot be negative
- Reasonable Limits - Fees should not be excessive
- Denom Validation - Must be valid denomination strings
Current Parameter Query
The current params can be looked up using the Params query:
plain textprovenanced query exchange params
This returns the current parameter configuration for verification and analysis.
Data Structures
Params
protobufmessage Params { // default_split is the split value to use for fees when a specific split is not defined for the given denom. uint32 default_split = 1; // denom_splits are the denom specific splits. repeated DenomSplit denom_splits = 2; // fee_create_payment_flat is the flat fee charged for creating a payment. repeated cosmos.base.v1beta1.Coin fee_create_payment_flat = 3; // fee_accept_payment_flat is the flat fee charged for accepting a payment. repeated cosmos.base.v1beta1.Coin fee_accept_payment_flat = 4; }
DenomSplit
protobufmessage DenomSplit { // denom is the denomination this split applies to. string denom = 1; // split is the basis points this denom split uses. uint32 split = 2; }
DenomSplit Fields:
- denom - The cryptocurrency denomination (e.g., "nhash", "uusdc")
- split - The basis points value for this specific denomination
Practical Examples
Fee Distribution Scenarios
Scenario 1: Default Split Only
Configuration:
- default_split: 500 (5%)
- denom_splits: empty
Results:
- All denominations use 5% split
- Exchange receives 5% of all market fees
- Markets retain 95% of all fees collected
Scenario 2: Mixed Split Configuration
Configuration:
- default_split: 500 (5%)
- denom_splits: [{"nhash": 300}, {"uusdc": 750}]
Results:
- HASH fees: 3% to exchange, 97% to market
- USDC fees: 7.5% to exchange, 92.5% to market
- Other denoms: 5% to exchange, 95% to market
Scenario 3: High Exchange Revenue
Configuration:
- default_split: 2000 (20%)
- denom_splits: [{"premium_token": 5000}]
Results:
- Premium tokens: 50% to exchange, 50% to market
- Other denoms: 20% to exchange, 80% to market
- Higher exchange revenue for sustainability
Payment Fee Examples
Standard Payment
Fee Structure:
- Creation fee: 0.1 HASH
- Acceptance fee: 0.1 HASH
User Experience:
- Source pays 0.1 HASH to create payment
- Target pays 0.1 HASH to accept payment
- Total system cost: 0.2 HASH per payment
Large Payment
Scenario: 1000 HASH payment
Fee Structure:
- Creation fee: 0.1 HASH (0.01% of payment)
- Acceptance fee: 0.1 HASH (0.01% of payment)
Analysis: Fixed fees make large payments very cost-effective
Economic Considerations
Fee Distribution Impact
Market Incentives:
- Lower Splits - Encourage market participation and growth
- Higher Splits - Generate more revenue for exchange operations
- Denom-Specific - Customize incentives by asset type
Network Sustainability:
- Exchange Revenue - Funds continued development and operations
- Market Revenue - Incentivizes market creation and management
- Balance Point - Optimal split maintains both aspects
Payment Fee Economics
Fixed Fee Benefits:
- Predictable Costs - Users can budget payment expenses
- Large Payment Efficiency - Percentage cost decreases with size
- Network Protection - Prevents spam through minimum cost
Fixed Fee Considerations:
- Small Payment Impact - High percentage cost for small payments
- Fee Adjustment - May need updates with HASH price changes
- User Experience - Should remain reasonable for typical use
Parameter Optimization
Split Optimization Factors:
- Market Adoption - Lower splits may increase market creation
- Exchange Needs - Higher splits provide more operational funding
- Competition - Competitive splits attract market operators
- Asset Types - Different splits for different asset categories
Payment Fee Optimization:
- Network Usage - Fees should cover actual network costs
- User Adoption - Reasonable fees encourage payment usage
- Spam Prevention - Sufficient fees deter abuse
- Value Proposition - Fees should be justified by utility
Monitoring and Analytics
Fee Distribution Tracking
Key Metrics:
- Total Fees Collected - Overall market fee generation
- Exchange Share - Amount retained by exchange system
- Market Share - Amount retained by individual markets
- Denom Breakdown - Fee distribution by denomination
Analysis Points:
- Split Effectiveness - Whether current splits achieve goals
- Market Behavior - How splits affect market creation and operation
- Revenue Trends - Growth patterns in fee collection
- Denom Performance - Which assets generate most fees
Payment Fee Analysis
Usage Metrics:
- Payment Volume - Number of payments created and accepted
- Fee Revenue - Total fees collected from payment operations
- User Behavior - How fees affect payment adoption
- Cost Effectiveness - Fee-to-value ratios for different payment sizes
Optimization Indicators:
- Fee Sensitivity - How fee changes affect usage
- Market Feedback - User and market operator responses
- Network Efficiency - Whether fees cover actual costs
- Competitive Position - Fee comparison with alternatives
Summary
The x/exchange module parameters provide essential controls for:
Fee Distribution Management
- Flexible Split System - Default and denomination-specific fee splits
- Basis Point Precision - Fine-grained control over fee distribution
- Market Incentives - Balanced revenue sharing between exchange and markets
- Governance Control - Community oversight of fee structure changes
Payment Fee Structure
- Fixed Fee Model - Predictable costs for payment operations
- Dual Fee System - Separate fees for creation and acceptance
- Network Sustainability - Fees cover operational costs
- User Experience - Reasonable fees for typical usage
System Benefits
- Revenue Generation - Sustainable funding for exchange operations
- Market Participation - Attractive fee structures for market operators
- Flexibility - Customizable parameters for different scenarios
- Transparency - Clear, queryable parameter configuration
Economic Design
- Balanced Incentives - Fair distribution between stakeholders
- Market Dynamics - Parameters that encourage healthy market activity
- Network Effects - Fee structures that support ecosystem growth
- Adaptability - Governance-controlled parameters for changing needs
This parameter system ensures the exchange module operates sustainably while providing appropriate incentives for all participants in the trading ecosystem.
Exchange Messages
Summary
The Provenance Exchange module provides comprehensive message endpoints for trading operations, market management, payment processing, and governance actions. These endpoints are categorized into user-accessible functions (order creation, fund commitment, settlement), market administrator functions (order matching, permission management, configuration updates), payment system operations (bilateral fund transfers), and governance-controlled actions (market creation, fee management, parameter updates). Each endpoint includes specific validation rules, permission requirements, and failure conditions to ensure secure and compliant trading operations on the Provenance blockchain.
User Endpoints
User endpoints are available to all users, though some markets may impose restrictions based on account attributes or market settings.
CreateAsk
Create an ask order to sell assets at a minimum price. Markets may require specific attributes for order creation and can disable order creation entirely.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L116-L124
protobuf// MsgCreateAskRequest structure message MsgCreateAskRequest { AskOrder ask_order = 1; uint64 order_creation_fee = 2; }
Related structures:
- AskOrder: orders.proto#L28-L53
- MsgCreateAskResponse: tx.proto#L126-L130
Expected failures:
- Market does not exist or disallows order creation
- Seller lacks required attributes or assets
- Insufficient fees or invalid denomination
- External ID already in use
CreateBid
Create a bid order to buy assets at a specific price. Similar restrictions and validation as ask orders apply.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L132-L140
protobuf// MsgCreateBidRequest structure message MsgCreateBidRequest { BidOrder bid_order = 1; uint64 order_creation_fee = 2; }
Related structures:
- BidOrder: orders.proto#L55-L78
- MsgCreateBidResponse: tx.proto#L142-L146
CommitFunds
Commit funds to a market. If funds are already committed, the new amount is added to existing commitments.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L148-L163
protobuf// MsgCommitFundsRequest structure message MsgCommitFundsRequest { string account = 1; uint32 market_id = 2; repeated cosmos.base.v1beta1.Coin amount = 3; cosmos.base.v1beta1.Coin creation_fee = 4; }
Response: tx.proto#L165-L166
CancelOrder
Cancel existing orders. Order creators can cancel their own orders, and market actors with PERMISSION_CANCEL can cancel any orders in their market.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L168-L178
protobuf// MsgCancelOrderRequest structure message MsgCancelOrderRequest { string signer = 1; uint64 order_id = 2; }
Response: tx.proto#L180-L181
FillBids
Execute user-settlement by filling one or more bid orders with user's own assets. Similar to an "Immediate or Cancel" ask order.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L183-L203
protobuf// MsgFillBidsRequest structure message MsgFillBidsRequest { string seller = 1; uint32 market_id = 2; repeated uint64 bid_order_ids = 3; repeated cosmos.base.v1beta1.Coin total_assets = 4; // Additional fee fields... }
Response: tx.proto#L205-L206
FillAsks
Execute user-settlement by filling one or more ask orders with user's own price funds. Similar to an "Immediate or Cancel" bid order.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L208-L229
protobuf// MsgFillAsksRequest structure message MsgFillAsksRequest { string buyer = 1; uint32 market_id = 2; repeated uint64 ask_order_ids = 3; cosmos.base.v1beta1.Coin total_price = 4; // Additional fee fields... }
Response: tx.proto#L231-L232
Market Endpoints
Market endpoints are available to designated market administrators with specific permissions or governance authority.
MarketSettle
Settle matched orders identified by the market. Requires PERMISSION_SETTLE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L234-L251
protobuf// MsgMarketSettleRequest structure message MsgMarketSettleRequest { string admin = 1; uint32 market_id = 2; repeated uint64 ask_order_ids = 3; repeated uint64 bid_order_ids = 4; bool expect_partial = 5; }
Response: tx.proto#L253-L254
MarketCommitmentSettle
Move committed funds within a market. Requires PERMISSION_SETTLE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L256-L276
protobuf// MsgMarketCommitmentSettleRequest structure message MsgMarketCommitmentSettleRequest { string admin = 1; uint32 market_id = 2; repeated AccountAmount inputs = 3; repeated AccountAmount outputs = 4; repeated NetAssetValue navs = 5; }
Response: tx.proto#L278-L279
MarketReleaseCommitments
Release committed funds from a market. Requires PERMISSION_CANCEL permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L281-L294
MarketSetOrderExternalID
Attach market-specific identifiers to orders. Requires PERMISSION_SET_IDS permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L299-L313
MarketWithdraw
Withdraw collected fees from market account. Requires PERMISSION_WITHDRAW permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L318-L332
MarketUpdateDetails
Update market details and metadata. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L337-L348
MarketUpdateAcceptingOrders
Enable or disable order creation in the market. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L377-L388
MarketUpdateUserSettle
Control whether user-settlement is allowed in the market. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L393-L406
MarketUpdateAcceptingCommitments
Control whether the market accepts fund commitments. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L411-L424
MarketUpdateIntermediaryDenom
Change the market's intermediary denomination for fee calculations. Requires PERMISSION_UPDATE permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L429-L440
MarketManagePermissions
Manage permissions for market operations. Requires PERMISSION_PERMISSIONS permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L445-L460
MarketManageReqAttrs
Manage required attributes for order creation. Requires PERMISSION_ATTRIBUTES permission.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L465-L486
Payment Endpoints
Payment endpoints facilitate bilateral transfers between accounts without market association.
CreatePayment
Create a payment between source and target accounts with external ID identification.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L491-L497
protobuf// MsgCreatePaymentRequest structure message MsgCreatePaymentRequest { Payment payment = 1; }
Related structures:
- Payment: payments.proto#L13-L43
- Response: tx.proto#L499-L500
AcceptPayment
Accept a previously created payment, executing the bilateral transfer.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L502-L508
RejectPayment
Reject a specific payment, releasing held funds.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L513-L523
RejectPayments
Reject all payments from specified source accounts.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L528-L536
CancelPayments
Cancel payments by external ID from the source account.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L541-L549
ChangePaymentTarget
Modify the target account for an existing payment.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L554-L564
Governance Proposals
Governance endpoints require authority from the governance module account for system-level operations.
GovCreateMarket
Create new markets through governance proposals with configurable market parameters.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L569-L580
protobuf// MsgGovCreateMarketRequest structure message MsgGovCreateMarketRequest { string authority = 1; Market market = 2; }
Related structures:
- Market: market.proto#L52-L148
- MarketDetails: market.proto#L28-L40
- FeeRatio: market.proto#L150-L158
- AccessGrant: market.proto#L160-L166
- Permission: market.proto#L168-L186
GovManageFees
Modify market fee structures through governance proposals.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L585-L635
GovCloseMarket
Close markets, cancelling all orders and releasing commitments.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L640-L648
GovUpdateParams
Update exchange module parameters through governance.
GitHub Repository: provenance/proto/provenance/exchange/v1/tx.proto#L653-L662