You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Protocol developers can **permissionlessly** integrate with Express Relay to recapture MEV and access a network of searchers.
5
+
Defi Protocols can **permissionlessly** integrate with Express Relay to recapture MEV and access a network of searchers.
6
6
7
7
Integrating with Express Relay involves two main steps:
8
8
9
-
- Update the Protocol's contract to **permission** Express Relay transactions.
9
+
- Update your defi Protocol's contract to **permission** Express Relay transactions.
10
10
- Write a script to **expose** liquidation opportunities to Searchers for auction.
11
11
12
-
## Update the Protocol's Contract
12
+
## Update your defi Protocol's Contract
13
13
14
-
The Protocol's contract must permit Express Relay to access liquidation opportunities.
14
+
To integrate with Express Relay, your protocol's contract must permit Express Relay to access liquidation opportunities.
15
15
16
16
<Steps>
17
17
### Install the Express Relay SDK
18
18
19
-
Pyth provides a [Solidity SDK](https://www.npmjs.com/package/@pythnetwork/express-relay-sdk-solidity) to help developers integrate Express Relay into your Protocol.
19
+
Pyth provides a [Solidity SDK](https://www.npmjs.com/package/@pythnetwork/express-relay-sdk-solidity) to help developers integrate Express Relay into their defi protocol.
20
20
The SDK exposes [`IExpressRelay`](https://github.com/pyth-network/pyth-crosschain/blob/main/express_relay/sdk/solidity/IExpressRelay.sol) and [`IExpressRelayFeeReceiver`](https://github.com/pyth-network/pyth-crosschain/blob/main/express_relay/sdk/solidity/IExpressRelayFeeReceiver.sol) interfaces to interact with Express Relay.
21
21
22
22
<Tabsitems={['Hardhat', 'Foundry']}>
@@ -45,15 +45,15 @@ Then add the following line to `remappings.txt` file:
45
45
46
46
### Modifying the Protocol's Contract
47
47
48
-
Developers need to update the Protocol's contract to:
48
+
The following steps show how to modify your protocol's contract to permit Express Relay transactions and receive funds from Express Relay.
49
49
50
50
1. Utilize [`isPermissioned`](https://github.com/pyth-network/pyth-crosschain/blob/main/express_relay/sdk/solidity/IExpressRelay.sol#L10C14-L10C28) method from `IExpressRelay` interface to **permit** Express Relay transactions.
51
51
1. Implement the [`IExpressRelayFeeReceiver`](https://github.com/pyth-network/pyth-crosschain/blob/main/express_relay/sdk/solidity/IExpressRelayFeeReceiver.sol#L4) interface to **receive** funds from Express Relay.
52
52
53
-
#### 1. Permit Express Relay Transactions
53
+
#### 1. Permission Express Relay Transactions
54
54
55
55
The `isPermissioned` function takes two arguments:
56
-
1.`protocolFeeReceiver`: The address of the Protocol's contract.
56
+
1.`protocolFeeReceiver`: The contract address that will receive the protocol fee from the winning searcher after a successful auction.
57
57
1.`permissionId`: A unique identifier of a vault or position eligible for liquidation.
58
58
59
59
```solidity copy
@@ -74,13 +74,12 @@ require(
74
74
<Callouttype="info"emoji="ℹ️">
75
75
The `permissionId` represents unique identifying information for the vault or position within a protocol.
76
76
It can be the vault address or the vault ID, concatenated into `bytes` format.
77
-
Consult [`Permission Id`](#) for more information on generating permission IDs.
77
+
Consult [`Permissioning`](./how-express-relay-works/permissioning.mdx) for more information on generating permission IDs.
78
78
</Callout>
79
79
80
80
#### 2. Set up Fee Receiver
81
81
82
-
After a successful auction, the Express Relay server sends funds to the Protocol's contract.
83
-
Express Relay server calls the `receiveAuctionProceedings` function present in `IExpressRelayFeeReceiver` to send funds to the Protocol's contract
82
+
After a successful auction, the Express Relay calls the `receiveAuctionProceedings` function present in `IExpressRelayFeeReceiver` to send the portion of the fee paid by the winning searcher to the Protocol's contract
84
83
85
84
```solidity copy
86
85
interface IExpressRelayFeeReceiver {
@@ -164,7 +163,7 @@ contract EasyLend is IExpressRelayFeeReceiver {
164
163
165
164
## Expose Liquidation Opportunities to Searchers
166
165
167
-
Protocols should fetch vaults and positions eligible for liquidation and expose them to Express Relay for auction.
166
+
Your defi Protocol should fetch vaults and positions eligible for liquidation and expose them to Express Relay for auction.
168
167
169
168
The Express Relay auction server provides a **POST** method, `/v1/opportunities`, which accepts a JSON payload containing the details of the liquidation opportunity.
170
169
@@ -194,7 +193,7 @@ The JSON payload should contain liquidation opportunities in the following forma
194
193
```
195
194
196
195
197
-
Protocols must evaluate each position's health using the latest Oracle prices before exposing them to Express Relay.
196
+
Each protocol integrated with Express Relay must evaluate every position's health using the latest Oracle prices before exposing them to Express Relay.
198
197
You can do this by indexing the chain, listening to protocol events, or querying open positions through an RPC provider.
199
198
200
199
Check the [`monitor.ts`]() script, which fetches liquidation opportunities for the below-mentioned [Easy Lend](https://github.com/pyth-network/pyth-crosschain/tree/main/express_relay/examples/easy_lend) example and exposes them to Express Relay for auction.
0 commit comments