Uniswap X Trades

UniswapX: Dutch Order Reactor orders and settlement. This

ethereum.dex.uniswap_x_trades table includes all trades including failed execute calls from Uniswap X's ExclusiveDutchOrderReactor .

⚠️ This model includes failed orders that failed to execute.

To filter them out, set status = 1 (see example below) .These trades amount to ~1.6% of total volume, and ~3% of all trades.

UniswapX is a new permissionless, open source (GPL), auction-based routing protocol for trading across AMMs and other liquidity sources.

Sample Query

-- Daily Swap Volume 
select 
    date(block_timestamp) as date, 
    sum(usd_amount) as usd_volume,
    count(distinct transaction_hash) as txn_count
from ethereum.dex.uniswap_x_trades
where status = 1 
group by all 

Methodology

  • Identify the following trace call from UniswapX ExclusiveDutchOrderReactor contract

    • executeBatchWithCallback executeWithCallback executeBatch execute

  • From the trace calls, we fetch the serialised order and ABI decode.

  • From event logs, we join the corresponding Fill event emitted by the ExclusiveDutchOrderReactor contract

Using this transaction as an example: https://etherscan.io/tx/0xc3cb3b518f455144d153e6d086b8688d6678b7318ab928b82983ab03e315e333

{
  "msg.sender": "0x6f1cdbbb4d53d226cf4b917bf768b94acbab6168",
  "func": "execute",
  "args": {
    "order": [
      {
        "order": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000065c529c20000000000000000000000000000000000000000000000000000000065c529fe000000000000000000000000d198fbe60c49d4789525fc54567447518c7d2a110000000000000000000000000000000000000000000000000000000000000064000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000000000000000000000000083f4b3a5432fac844d000000000000000000000000000000000000000000000083f4b3a5432fac844d00000000000000000000000000000000000000000000000000000000000002000000000000000000000000006000da47483062a0d734ba3dc7576ce6a0b645c400000000000000000000000045fabb434124afaa123eeee19cea29b5e0e3dd0b04683207312f3edb79be915765c1d5b7529ef4a9500dbe0e667c9878fe7bce010000000000000000000000000000000000000000000000000000000065c52a0a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057a57e7d2199140000000000000000000000000000000000000000000000000052ff507e7c84afc00000000000000000000000045fabb434124afaa123eeee19cea29b5e0e3dd0b",
        "sig": "0x4f210fdb1808d4ca777960ff781ceecc37f4362605fa241216ec85f201f3d244179158351a0a2d2e5ba9a2d42c4bf647ac6bcf46216d10863644cb31ea42eef31c"
      }
    ]
  },
  "return": []
}

Table Columns

Note that the decoded orders can be found in the extra_fields column.

Column Name
Description
Example

project

Project name.

uniswap_x

protocol

Protocol name.

uniswap_x

trace_call

Trace call method.

execute

order_type

Order type. Can be either `single` or `batch` orders. `execute` and `executeWithCallback` maps to single orders.

single

order_index

Order index within the call. For batch orders, they are flatten with each order executed represented as a line.

0

status

Trace status of the call. This will 1 for successful traces and 0 for failed traces.

1

error

Error message emitted by the trace call.

filler

Address of the filler. These agents pickup signed orders from swappers and compete to execute them using any source of liquidity they have access to.

0x7321ac264b89254ea749a0657d41a9a2ebf8e3da

reactor

Address or the reactor. Order Reactors settle UniswapX orders. They are responsible for validating orders of a specific type, resolving them into inputs and outputs, and executing them against the filler's strategy, and verifying that the order was successfully fulfilled.

0x6000da47483062a0d734ba3dc7576ce6a0b645c4

swapper

Address of the swapper.

0x27b6318dd9861cf26ba8c32dde26bbf8b5e0c956

exclusive_filler

Address of the exclusive filler.

0x7321ac264b89254ea749a0657d41a9a2ebf8e3da

exclusivity_override_bps

The amount in bps that a non-exclusive filler needs to improve the outputs by to be able to fill the order.

100

token_sold_address

Input token address. Input tokens will map to token sold. Native ETH will be represented as zero address `0x0000000000000000000000000000000000000000`.

0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

token_sold_name

Input token name.

Wrapped Ether

token_sold_symbol

Input token symbol.

WETH

token_sold_decimals

Input token decimals.

18

token_sold_amount_raw

Input token amount, unnormalized, in string.

40000000000000000

token_sold_amount

Input token amount, normalized.

0.04

usd_sold_amount

USD value of the input token.

132.4968

outputs

Array of outputs. Note that there can be > 1 outputs for a single trade. Most of the case the bulk of the output values goes to the first output.

[ { "endAmount": 92415831, "recipient": "0x27b6318dd9861cf26ba8c32dde26bbf8b5e0c956", "startAmount": 119475368, "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" }, { "endAmount": 138831, "recipient": "0x27213e28d7fda5c57fe9e5dd923818dbccf71c47", "startAmount": 179482, "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" } ]

token_bought_address

First output token address. Output tokens will map to tokens bought. Native ETH will be represented as zero address `0x0000000000000000000000000000000000000000`.

0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

token_bought_name

First output token name.

USD Coin

token_bought_symbol

First output token address.

USDC

token_bought_decimals

First output token decimals.

6

token_bought_amount_raw

Amount of token bought, unnormalized and in string.

119475368

token_bought_amount

Amount of token bought, normalized.

119.475368

usd_bought_amount

USD amount of token bought, normalized.

119.43952539

usd_amount

USD value of the swap. We preferentially select the input (token sold) usd value. If this is not available, we will select the output.

132.4968

additional_validation_contract

Custom validation contract.

0x0000000000000000000000000000000000000000

additional_validation_data

Encoded validation params for additionalValidationContract.

deadline

Deadline timestamp.

1712191068

decay_start_time

The time at which the DutchOutputs start decaying.

2024-04-04 00:36:36.000

decay_end_time

The time at which price becomes static.

2024-04-04 00:37:36.000

order_hash

Unique hash of the order.

0xe2bdd76383aab99fb591ca99fac72b6b99dc0e5822df200f7e97e481a99426b7

nonce

Nonce of the order.

1993352865421623303439960934785910165619400008222801057126382995622032590081

sig

Signature of the order.

extra_fields

The decoded serialized order.

{ "decayEndTime": 1712191056, "decayStartTime": 1712190996, "exclusiveFiller": "0x7321ac264b89254ea749a0657d41a9a2ebf8e3da", "exclusivityOverrideBps": 100, "input": { "endAmount": 40000000000000000, "startAmount": 40000000000000000, "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" }, "orders": { "additionalValidationContract": "0x0000000000000000000000000000000000000000", "additionalValidationData": "", "deadline": 1712191068, "nonce": 1.993352865421623e+75, "reactor": "0x6000da47483062a0d734ba3dc7576ce6a0b645c4", "swapper": "0x27b6318dd9861cf26ba8c32dde26bbf8b5e0c956" }, "outputs": [ { "endAmount": 92415831, "recipient": "0x27b6318dd9861cf26ba8c32dde26bbf8b5e0c956", "startAmount": 119475368, "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" }, { "endAmount": 138831, "recipient": "0x27213e28d7fda5c57fe9e5dd923818dbccf71c47", "startAmount": 179482, "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" } ] }

transaction_from_address

The address of the sending party of this transaction.

0xd9f4faa80fa2ace09ccf56b15b9d2eec423dd4bd

transaction_to_address

The address of the receiving party of this transaction (could be a contract address).

0x7321ac264b89254ea749a0657d41a9a2ebf8e3da

transaction_hash

Transaction hash of this trade.

0xb072c5aa5c36dc3a31140d8adf02af47c5290238fd4294076701dbbf99256e6a

transaction_index

Transaction index of this trade in the block.

57

calldata_selector

The call data selector of the transaction.

0x01349c00

transaction_fees

Fees paid at the transaction level.

0.00365229813185184

transaction_fees_usd

Fees paid in USD.

12.097945378

fee_details

Additional fee details of the transaction, including max priority fee, gas price and gas used for the transaction.

{ "gas": 247915, "gas_price": 0, "max_fee_per_gas": null, "max_priority_fee_per_gas": null, "receipt_effective_gas_price": 21038098960, "receipt_gas_used": 173604 }

log_index

Log index of this trade.

133

trace_id

Block timestamp of this trade.

call_0xb072c5aa5c36dc3a31140d8adf02af47c5290238fd4294076701dbbf99256e6a_0

trace_type

Block number of this trade.

call

call_type

Block hash of this trade.

call

block_timestamp

Block timestamp of this trade.

2024-04-04 00:36:23.000

block_number

Block number of this trade.

19578864

block_hash

Block hash of this trade.

0xef0c1104a96c2a515121058f045b945f54f679f27665a5a64d55fba070f0aa8e

unique_id

Unique ID of each trade.

trace_id-call_0xb072c5aa5c36dc3a31140d8adf02af47c5290238fd4294076701dbbf99256e6a_0_order_index-0

_created_at

Timestamp of the entry creation.

2024-04-04 04:29:21.057

_updated_at

Timestamp of the entry update.

2024-04-04 04:29:21.057

Last updated