Skip to content

Commit 0a56469

Browse files
committed
tiny changes
1 parent f45490f commit 0a56469

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
import { Steps } from 'nextra/components'
2+
import { Tabs } from 'nextra/components'
3+
24

35
# How to Integrate Express Relay as a Protocol
46

5-
This guide explains how to integrate Express Relay as a protocol.
6-
To integrate Express Relay as a protocol, you need to:
7+
Protocol developers can **permissionlessly** integrate with Express Relay to recapture MEV and access a network of searchers.
8+
9+
Integrating with Express Relay involves two main steps:
710

8-
- Update the protocol's contract to **permission** Express Relay transactions.
11+
- Update the Protocol's contract to **permission** Express Relay transactions.
912
- Write a script to **expose** liquidation opportunities to Searchers for auction.
1013

1114
## Update the Protocol's Contract
1215

13-
Express Relay requires the protocol's contract to permit Express Relay to access liquidation.
16+
The Protocol's contract must permit Express Relay to access liquidation opportunities.
1417

1518
<Steps>
1619
### Install the Express Relay SDK
1720

18-
Pyth provides a [Solidity SDK](https://www.npmjs.com/package/@pythnetwork/express-relay-sdk-solidity) to help you integrate Express Relay into your protocol.
19-
The SDK exposes `IExpressRelay` and `IExpressRelayFeeReceiver` interfaces to interact with Express Relay.
21+
Pyth provides a [Solidity SDK](https://www.npmjs.com/package/@pythnetwork/express-relay-sdk-solidity) to help developers integrate Express Relay into your Protocol.
22+
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.
2023

21-
#### Truffle/Hardhat
22-
23-
If you are using Truffle or Hardhat, you can install the SDK using npm:
24+
<Tabs items={['Hardhat', 'Foundry']}>
25+
<Tabs.Tab>
26+
If you are using Hardhat, you can install the SDK using npm:
2427

2528
```bash copy
2629
npm install @pythnetwork/express-relay-sdk-solidity
2730
```
28-
#### Foundry
29-
30-
If you are using Foundry, you must create an NPM project if you don't already have one. From the root directory of your project, run:
31+
</Tabs.Tab>
32+
<Tabs.Tab>
33+
If you are using Foundry, you must create an NPM project if you don't already have one. From the root directory of your project, run:
3134

3235
```bash copy
3336
npm init -y
@@ -39,19 +42,21 @@ Then add the following line to `remappings.txt` file:
3942
```text copy
4043
@pythnetwork/express-relay-sdk-solidity/=node_modules/@pythnetwork/express-relay-sdk-solidity
4144
```
45+
</Tabs.Tab>
46+
</Tabs>
4247

4348
### Modifying the Protocol's Contract
4449

45-
The protocol's contract should be updated to:
50+
The Protocol's contract should be updated to:
4651

4752
1. Utilize `isPermissioned` method from `IExpressRelay` interface to **permit** Express Relay transactions.
4853
1. Implement the `IExpressRelayFeeReceiver` interface to receive funds from Express Relay.
4954

5055
#### 1. Permit Express Relay Transactions
5156

5257
The `isPermissioned` function takes two arguments:
53-
1. `protocolFeeReceiver`: The address of the protocol's contract.
54-
1. `permissionId`: A unique identifier for the liquidation opportunity.
58+
1. `protocolFeeReceiver`: The address of the Protocol's contract.
59+
1. `permissionId`: A unique identifier for the liquidation opportunity. TODO: Add Permission ID Reference
5560

5661
```solidity copy
5762
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelay.sol";
@@ -72,7 +77,7 @@ require(
7277

7378
#### 2. Set up Fee Receiver
7479

75-
The `IExpressRelayFeeReceiver` interface requires the protocol's contract to implement the `receiveAuctionProceedings` function. The Express Relay server calls this function to send funds to the protocol's contract.
80+
The `IExpressRelayFeeReceiver` interface requires the Protocol's contract to implement the `receiveAuctionProceedings` function. The Express Relay server calls this function to send funds to the protocol's contract.
7681

7782
```solidity copy
7883
interface IExpressRelayFeeReceiver {
@@ -87,9 +92,9 @@ interface IExpressRelayFeeReceiver {
8792

8893

8994

90-
The following code snippet shows a sample liquidation method and updates to the protocol's contract to permit Express Relay transactions:
95+
The following code snippet shows a sample liquidation method and updates to the Protocol's contract to permit Express Relay transactions:
9196

92-
```solidity showLineNumbers {1,2,12,14,39-43} copy
97+
```solidity showLineNumbers {1,2,12,14,39-43, 59-63} copy
9398
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelay.sol";
9499
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelayFeeReceiver.sol";
95100
@@ -173,7 +178,7 @@ The JSON payload should contain liquidation opportunities in the following forma
173178
"chain_id": "op_sepolia",
174179
"target_contract": "0xcA11bde05977b3631167028862bE2a173976CA11", // Protocol contract address to call for liquidation
175180
"permission_key": "0xcafebabe", // Unique identifier for the liquidation opportunity
176-
"target_call_value": "1", // Value(in Wei) to send with to the protocol contract.
181+
"target_call_value": "1", // Value(in Wei) to send with to the Protocol contract.
177182
"buy_tokens": [ // Tokens to buy (Collateral)
178183
{
179184
"amount": "1000",
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
# How to Integrate Express Relay as a Searcher
1+
# How to Integrate Express Relay as a Searcher
2+
3+
This guide explains how to integrate Express Relay as a searcher for liquidation opportunities.
4+
To integrate Express Relay as a searcher, you need to:

0 commit comments

Comments
 (0)