Skip to content

Commit 1780065

Browse files
committed
(WIP) Express relay docs- Yaser comments
1 parent 59b1992 commit 1780065

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

pages/express-relay/integrate-as-protocol.mdx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ import { Callout, Tabs, Steps } from 'nextra/components'
22

33
# How to Integrate Express Relay as a Protocol
44

5-
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.
66

77
Integrating with Express Relay involves two main steps:
88

9-
- Update the Protocol's contract to **permission** Express Relay transactions.
9+
- Update your defi Protocol's contract to **permission** Express Relay transactions.
1010
- Write a script to **expose** liquidation opportunities to Searchers for auction.
1111

12-
## Update the Protocol's Contract
12+
## Update your defi Protocol's Contract
1313

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.
1515

1616
<Steps>
1717
### Install the Express Relay SDK
1818

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.
2020
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.
2121

2222
<Tabs items={['Hardhat', 'Foundry']}>
@@ -45,15 +45,15 @@ Then add the following line to `remappings.txt` file:
4545

4646
### Modifying the Protocol's Contract
4747

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.
4949

5050
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.
5151
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.
5252

53-
#### 1. Permit Express Relay Transactions
53+
#### 1. Permission Express Relay Transactions
5454

5555
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.
5757
1. `permissionId`: A unique identifier of a vault or position eligible for liquidation.
5858

5959
```solidity copy
@@ -74,13 +74,12 @@ require(
7474
<Callout type="info" emoji="ℹ️">
7575
The `permissionId` represents unique identifying information for the vault or position within a protocol.
7676
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.
7878
</Callout>
7979

8080
#### 2. Set up Fee Receiver
8181

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
8483

8584
```solidity copy
8685
interface IExpressRelayFeeReceiver {
@@ -164,7 +163,7 @@ contract EasyLend is IExpressRelayFeeReceiver {
164163

165164
## Expose Liquidation Opportunities to Searchers
166165

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.
168167

169168
The Express Relay auction server provides a **POST** method, `/v1/opportunities`, which accepts a JSON payload containing the details of the liquidation opportunity.
170169

@@ -194,7 +193,7 @@ The JSON payload should contain liquidation opportunities in the following forma
194193
```
195194

196195

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.
198197
You can do this by indexing the chain, listening to protocol events, or querying open positions through an RPC provider.
199198

200199
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

Comments
 (0)