Skip to content

Market Orders

Market orders are defined within a transaction and can be uniquely identified by block and event index.

nametypedescription
market idbytes32The market ID on which the offer is consumed.
takeraddressThe consumer address.
gotuint256The amount of outbound token that the taker received from the market order.
gaveuint256The amount of inbound token used for the market order.
feeuint256The amount of inbound token used to pay the governance fee.
bountyuint256The amount of native provisions sent by the expired offers to the taker.
fillVolumeuint256The original amount asked if fillWants is true, or sent if fillWants is false.
fillWantsboolWhether the fillVolume is the amount asked or the amount sent.

While indexing, the primary key for a market order should be a composite of the block number and the event index. The following additional metadata should be saved for convenience while querying:

nametypedescription
blockuint256The block number of the transaction.
indexuint256The index of the event in the transaction.
timestampuint256The timestamp of the transaction.
transaction hashbytes32The hash of the transaction.

The following event is emitted by the market order:

/// @notice Emitted when a market order is executed.
event MarketOrder(
  bytes32 indexed market,
  address indexed taker,
  uint256 got,
  uint256 gave,
  uint256 fee,
  uint256 bounty,
  uint256 fillVolume,
  bool fillWants
);