Limit Orders
Last updated
Last updated
The LimitOrders.sol
contract is a settlement contract for executing orders from our off-chain limit order service. Users approve the contract to spend their tokens and provide signatures of their Order
to an off-chain API. An order execution bot monitors markets and executes them against this contract when allowed. Orders are executed on the contract by providing the Order parameters and an EIP712 Typed Data Signature of the Order, using the contracts domain information, to the executeOrder
function. The functions to execute orders on the contract are permissioned in the initial version as a security precaution.
Field | Type | Description |
---|---|---|
The current domain separator hashed used to verify EIP712 signatures.
The Bond Aggregator contract (i.e. top-level contract of the bond system) that this settlement contract supports.
The Authority contract that determine access to permissioned functions on the contract.
Currently cached value for the chain ID.
Returns the hash digest of the provided order. Used to calculate a unique order identifier and verify EIP712 signatures of Orders.
Returns the Status
of an order (identified by its hash digest).
Cancels an order on the settlement contract. A cancelled order cannot be executed, even by a permissioned executor.
Parameters
Execute a single order. Permissioned.
Parameters
Execute multiple orders in one transaction. Permissioned.
Parameters
Reinstates a previously cancelled order.
Parameters
Updates the cached domain separator in the event that the chainId changes. Saves gas on future digest computations.
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Parameters
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
marketId
uint256
ID of the market that the order is for
recipient
address
Address that will receive the payout of the order
referrer
address
Referrer address for the order. May receive a fee if set on the Teller contract for the market.
amount
uint256
Amount of quote tokens to spend on the order, in quote token decimals
minAmountOut
uint256
Minimum amount of payout tokens to receive from the order, in payout token decimals
maxFee
uint256
Maximum fee in the quote token that the user is willing to process the order, in quote token decimals
submitted
uint256
Timestamp that the order was submitted at. Used by the off-chain service to give priority to equivalent orders. API will not accept an order where the submitted date is a certain amount older than the current time.
deadline
uint256
Timestamp that the order is valid until. The order will not be executable after this time.
user
address
Address that the order proceeds will come from and that is required to sign the order.
order_
LimitOrders.Order
Order parameters. Specified in the Data Structures section above.
order_
LimitOrders.Order
Order parameters. Specified in the Data Structures section above.
signature_
bytes
ECDSA signature of the EIP712 hash digest of the order_
by order_.user
fee_
uint256
Amount of quote tokens to charge as a fee. Must be less than or equal to order_.maxFee
. Determined by the executor based on network gas fees and token prices at the time of execution.
orders_
LimitOrders.Order[]
Array of Order parameters. Specified in the Data Structures section above.
signatures_
bytes[]
Array of ECDSA signatures of the EIP712 hash digest of the corresponding order_
by order_.user
fees_
uint256[]
Array of quote token amounts to charge as a fee on the corresponding order_
. Must be less than or equal to order_.maxFee
. Determined by the executor based on network gas fees and token prices at the time of execution.
order_
LimitOrders.Order
undefined
user indexed
address
undefined
newAuthority indexed
contract Authority
undefined
digest
bytes32
undefined
digest
bytes32
undefined
digest
bytes32
undefined
user indexed
address
undefined
newOwner indexed
address
undefined
digest
bytes32
undefined
fee
uint256
undefined
maxFee
uint256
undefined
signature
bytes
undefined
marketId
uint256
undefined
digest
bytes32
undefined
deadline
uint256
undefined