Skip to content

Commit 73aca99

Browse files
committed
(WIP) Express relay docs
1 parent d524fd3 commit 73aca99

File tree

3 files changed

+39
-23
lines changed

3 files changed

+39
-23
lines changed

pages/express-relay/_meta.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@
2323
"type": "separator"
2424
},
2525

26-
"api-reference": "API Reference",
26+
"api-reference": {
27+
"title": "API Reference ↗",
28+
"href": "https://per-staging.dourolabs.app/docs/"
29+
},
2730
"contract-addresses": "Contract Addresses",
2831
"error-codes": "Error Codes",
2932

3033
"examples": {
31-
"title": "Example Application ↗"
34+
"title": "Example Application ↗",
35+
"href": "https://github.com/pyth-network/pyth-crosschain/tree/main/express_relay/examples/easy_lend"
3236
},
3337
"-- Understand Express Relay": {
3438
"title": "Understanding Express Relay",
3539
"type": "separator"
3640
},
3741

3842
"how-express-relay-works": "How Express Relay Works"
39-
}
43+
}
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
# Contract Address
1+
# Contract Address
2+
3+
Express Relay is currently deployed on the following networks:
4+
5+
## Mainnets
6+
7+
| Network | Contract address |
8+
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
9+
10+
## Testnets
11+
12+
| Network | Contract address |
13+
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14+
| Optimism Sepolia | []() |

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

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ Developers need to update the Protocol's contract to:
5454

5555
The `isPermissioned` function takes two arguments:
5656
1. `protocolFeeReceiver`: The address of the Protocol's contract.
57-
1. `permissionId`: A unique identifier for the liquidation opportunity.
58-
59-
<Callout type="info" emoji="ℹ️">
60-
The `permissionId` allows you to permission an depermission a set of transaction. ........ To know more about permission ID, refer to the [Permission ID](#) page.
61-
</Callout>
57+
1. `permissionId`: A unique identifier of a vault or position eligible for liquidation.
6258

6359
```solidity copy
6460
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelay.sol";
@@ -75,11 +71,16 @@ require(
7571
"invalid liquidation"
7672
);
7773
```
78-
74+
<Callout type="info" emoji="ℹ️">
75+
The `permissionId` represents unique identifying information for the vault or position within a protocol.
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.
78+
</Callout>
7979

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

82-
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.
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
8384

8485
```solidity copy
8586
interface IExpressRelayFeeReceiver {
@@ -90,13 +91,9 @@ interface IExpressRelayFeeReceiver {
9091
```
9192

9293

94+
The following code snippet shows a sample liquidation method via Express Relay:
9395

94-
95-
96-
97-
The following code snippet shows a sample liquidation method and updates to the Protocol's contract to permit Express Relay transactions:
98-
99-
```solidity showLineNumbers {1,2,12,14,39-43, 59-63} copy
96+
```solidity showLineNumbers {1,2,12,14,21,38-42, 57-61} copy
10097
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelay.sol";
10198
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelayFeeReceiver.sol";
10299
@@ -114,12 +111,10 @@ contract EasyLend is IExpressRelayFeeReceiver {
114111
115112
constructor(
116113
address expressRelayAddress,
117-
address oracleAddress,
118114
bool allowUndercollateralized
119115
){
120116
_nVaults = 0;
121117
expressRelay = expressRelayAddress;
122-
_oracle = oracleAddress;
123118
_allowUndercollateralized = allowUndercollateralized;
124119
}
125120
@@ -138,7 +133,7 @@ contract EasyLend is IExpressRelayFeeReceiver {
138133
// Check if the liquidation is permissioned
139134
bool permissioned = IExpressRelay(payable(expressRelay)).isPermissioned(
140135
address(this),
141-
abi.encode(vaultID) // vault id uniquely represents the opportunity and can be used as permission id
136+
abi.encode(vaultID) // permissionId generated from the unique vault ID
142137
);
143138
require(permissioned, "invalid liquidation");
144139
@@ -168,7 +163,7 @@ contract EasyLend is IExpressRelayFeeReceiver {
168163

169164
## Expose Liquidation Opportunities to Searchers
170165

171-
Protocols must fetch liquidation opportunities like vaults and positions eligible for liquidation and expose them to Express Relay for auction.
166+
Protocols must fetch vaults and positions eligible for liquidation and expose them to Express Relay for auction.
172167

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

@@ -197,11 +192,11 @@ The JSON payload should contain liquidation opportunities in the following forma
197192
}
198193
```
199194

200-
TODO: Include a callout to give more info about permission ID
201195

202196
Protocols must evaluate each position's health using the latest Oracle prices before exposing them to Express Relay.
203197
You can do this by indexing the chain, listening to protocol events, or querying open positions through an RPC provider.
204198

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

206201

207202
## Additional Resources
@@ -214,6 +209,10 @@ You may find these additional resources helpful for integrating Express Relay as
214209

215210
### Contract Address
216211

212+
The [Contract Address](./contract-addresses.mdx) page lists the addresses of Express Relay deployed on various networks.
213+
217214
### Error Codes
218215

219-
### API Reference
216+
### API Reference
217+
218+
The [API Reference](https://per-staging.dourolabs.app/docs/) provides detailed information on the Express Relay API.

0 commit comments

Comments
 (0)