Skip to content

Commit

Permalink
Adding webhooks section
Browse files Browse the repository at this point in the history
  • Loading branch information
akarys92 committed Jun 13, 2024
1 parent 0074d12 commit ebaeb8b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 34 deletions.
8 changes: 6 additions & 2 deletions docs/contracts/uniswapx/guides/arbitrumfiller.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
id: arbitrumfiller
title: Arbitrum Pilot
sidebar_position: 1
sidebar_position: 4
---

# Arbitrum Pilot Overview
Starting June 19 2024, the Uniswap team will be piloting running a portion of trades on Arbitrum through UniswapX. Unlike UniswapX on mainnet, these orders will have **no RFQ portion and thus no exclusivity** during the pilot.

Filling on Arbitrum, however, follows the same two steps as filling on Mainnet: 1) Retrieving signed orders and 2) Filling orders.
Filling on Arbitrum, however, follows the same two steps as filling on Mainnet:
1. Retrieving signed orders
2. Filling orders

## Retrieving Signed Orders
All signed Dutch Orders on Arbitrum, created through the Uniswap UI will be available via the UniswapX Orders Endpoint. We have [swagger documentation](https://api.uniswap.org/v2/uniswapx/docs) but see below for a quick example curl.
Expand All @@ -18,6 +20,8 @@ GET https://api.uniswap.org/v2/orders?orderStatus=open&chainId=42161&limit=1000

Use the [UniswapX SDK](https://github.com/Uniswap/sdks/tree/main/sdks/uniswapx-sdk) to parse the `encodedOrder` field returned from endpoint. Each one of these `Orders` represents a fillable user trader.

As a lower latency alternative to polling the API, fillers can also apply to register a webhook and receive a feed of all open orders. See details for registering [here](./webhooks)

## Filling Orders
To execute a discovered order, a filler needs to call the [execute](https://github.com/Uniswap/UniswapX/blob/main/src/reactors/BaseReactor.sol#L31) method of the Reactor specified in the retrieved `encodedOrder` body. Currently the Reactor used by the Uniswap interface is located at:

Expand Down
32 changes: 0 additions & 32 deletions docs/contracts/uniswapx/guides/becomeQuoter.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,3 @@ To begin testing in beta quoters will need to:

The Uniswap Labs team will review the 5 transactions to confirm they were successful exclusive fills. Once they are confirmed, the quoters setup will be promoted to production and will start receiving traffic.

# (Optional) Signed Order Webhook Notifications

Signed open orders can always be fetched via the UniswapX API, but to provide improved latency there is the option to register for webhook notifications. Quoters can register an endpoint with their filler address, and receive notifications for every newly posted order that matches the filter.

**Filter**

Orders can be filtered by various fields, but most relevant here is `filler`. When registering your webhook notification endpoint, we recommend you provide the `filler` address that you plan to use to execute orders and to receive the last-look exclusivity period. Alternatively the webhook can be configured to send all open orders to your endpoint.

**Filter**

To register your webhook endpoint, please reach out in [UniswapX Fillers - Discussion](https://t.me/uniswapx_fillers_discussion).

**Notification**

Order notifications will be sent to the registered endpoint as http requests as follows:

```jsx
method: POST
content-type: application/json
data: {
orderHash: "the hash identifier for the order",
createdAt: "timestamp at which the order was posted",
signature: "the swapper signature to include with order execution",
orderStatus: "current order status (always should be `open` upon receiving notification)",
encodedOrder: "The abi-encoded order to include with order execution. This can be decoded using the Uniswapx-SDK (https://github.com/uniswap/uniswapx-sdk) to verify order fields and signature",
chainId: "The chain ID that the order originates from and must be settled on",
filler?: "If this order was quoted by an RFQ participant then this will be their filler address",
quoteId?: "If this order was quoted by an RFQ participant then this will be the requestId from the quote request",
swapper?: "The swapper address",
type?: "The order type (e.g. 'Dutch_V2', 'Limit', etc)"
}
```
2 changes: 2 additions & 0 deletions docs/contracts/uniswapx/guides/createFiller.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ All signed Dutch Orders created through the Uniswap UI will be available via the
GET https://api.uniswap.org/v2/orders?orderStatus=open&chainId=1&limit=1
```

As a lower latency alternative to polling the API, fillers can also apply to register a webhook and receive a feed of all open orders. See details for registering [here](./webhooks).

It’s up to the individual filler to architect their own systems for finding and executing profitable orders, but the basic flow is as follows:

1. Call `GET` on the `/orders` of the UniswapX Orders Endpoint as written above, to retrieve open signed orders. Dutch Orders are available on Mainnet (`chainId=1`) and Arbitrum (`chainId=42161`).
Expand Down
38 changes: 38 additions & 0 deletions docs/contracts/uniswapx/guides/webhooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: webhooks
title: Webhook Support
sidebar_position: 3
---

# Signed Order Webhook Notifications

Signed open orders can always be fetched via the UniswapX API, but to provide improved latency there is the option to register for webhook notifications. Fillers can register an endpoint and receive notifications for every newly posted order that matches their desired filter.

## Notifications

Order notifications will be sent to the registered endpoint as http requests as follows:

```jsx
method: POST
content-type: application/json
data: {
orderHash: "the hash identifier for the order",
createdAt: "timestamp at which the order was posted",
signature: "the swapper signature to include with order execution",
orderStatus: "current order status (always should be `open` upon receiving notification)",
encodedOrder: "The abi-encoded order to include with order execution. This can be decoded using the Uniswapx-SDK (https://github.com/uniswap/uniswapx-sdk) to verify order fields and signature",
chainId: "The chain ID that the order originates from and must be settled on",
filler?: "If this order was quoted by an RFQ participant then this will be their filler address",
quoteId?: "If this order was quoted by an RFQ participant then this will be the requestId from the quote request",
swapper?: "The swapper address",
type?: "The order type (e.g. 'Dutch_V2', 'Limit', etc)"
}
```

## Filtering
Orders can be filtered by various fields. For quoters, the most common use case is to filter to their address so they are notified immediately of won bids. Alternatively the webhook can be configured to send all open orders to your endpoint.


## Request a Webhook
To register your webhook endpoint, please reach out in [UniswapX Fillers - Discussion](https://t.me/uniswapx_fillers_discussion).

0 comments on commit ebaeb8b

Please sign in to comment.