Skip to content

Commit a1ebb8d

Browse files
committed
Merge branch '(feat)-add-express-relay' of github.com:pyth-network/documentation into (feat)-add-express-relay
2 parents e1c5734 + 9cf9fec commit a1ebb8d

File tree

3 files changed

+41
-24
lines changed

3 files changed

+41
-24
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: 20 additions & 20 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,10 @@ interface IExpressRelayFeeReceiver {
9091
```
9192

9293

94+
The following code snippet shows a sample liquidation method via Express Relay.
95+
Note: The highlighted lines show the contract's relevant additions for Express Relay integration.
9396

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
97+
```solidity showLineNumbers {1,2,12,14,21,38-42, 57-61} copy
10098
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelay.sol";
10199
import "@pythnetwork/express-relay-sdk-solidity/IExpressRelayFeeReceiver.sol";
102100
@@ -114,12 +112,10 @@ contract EasyLend is IExpressRelayFeeReceiver {
114112
115113
constructor(
116114
address expressRelayAddress,
117-
address oracleAddress,
118115
bool allowUndercollateralized
119116
){
120117
_nVaults = 0;
121118
expressRelay = expressRelayAddress;
122-
_oracle = oracleAddress;
123119
_allowUndercollateralized = allowUndercollateralized;
124120
}
125121
@@ -138,7 +134,7 @@ contract EasyLend is IExpressRelayFeeReceiver {
138134
// Check if the liquidation is permissioned
139135
bool permissioned = IExpressRelay(payable(expressRelay)).isPermissioned(
140136
address(this),
141-
abi.encode(vaultID) // vault id uniquely represents the opportunity and can be used as permission id
137+
abi.encode(vaultID) // permissionId generated from the unique vault ID
142138
);
143139
require(permissioned, "invalid liquidation");
144140
@@ -168,7 +164,7 @@ contract EasyLend is IExpressRelayFeeReceiver {
168164

169165
## Expose Liquidation Opportunities to Searchers
170166

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

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

@@ -197,11 +193,11 @@ The JSON payload should contain liquidation opportunities in the following forma
197193
}
198194
```
199195

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

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

200+
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.
205201

206202

207203
## Additional Resources
@@ -210,10 +206,14 @@ You may find these additional resources helpful for integrating Express Relay as
210206

211207
### Example Application
212208

213-
[Easy Lend](https://github.com/pyth-network/pyth-crosschain/tree/main/express_relay/examples/easy_lend) is a simple lending protocol that allows users to borrow and lend assets. This lending protocol contract is updated to permit Express Relay transactions.
209+
[Easy Lend](https://github.com/pyth-network/pyth-crosschain/tree/main/express_relay/examples/easy_lend) is a dummy lending protocol contract that allows users to borrow and lend assets. This lending protocol contract is updated to permit Express Relay transactions.
214210

215211
### Contract Address
216212

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

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

0 commit comments

Comments
 (0)