Skip to content

Commit f044075

Browse files
committed
content dump
1 parent ecb7ca6 commit f044075

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

pages/express-relay/how-express-relay-works/auction.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
The auction in Express Relay is held off-chain at the auction server.
44
Liquidation bids arrive at the auction server and compete against other bids, vying for the same [permission key](./permissioning.mdx).
5-
A [relayer](./relayer.mdx) selected by governance serves as the auctioneer and determines the auction in line with the criterion of maximizing the revenue shared back to the protocol that generated this opportunity.
6-
That means the auctioneer is expected to forward the subset of bids that maximizes the revenue back to the protocol.
5+
A [relayer](./relayer.mdx) selected by governance serves as the auctioneer and determines the auction in line with the criterion of maximizing the revenue shared back to the protocol that generated this opportunity. That means the auctioneer is expected to forward the subset of bids that maximizes the revenue back to the protocol.
76

8-
Thus, the Express Relay auction is analogous to a sealed-bid auction, i.e., participants in the auction will not have the contents of their bid disclosed publicly unless they are forwarded on-chain.
7+
Thus, the Express Relay auction is analogous to a sealed-bid auction, i.e., participants in the auction will not have the contents of their bid disclosed publicly unless they are forwarded on-chain.
8+
9+
The forwarded subset of transactions is submitted on-chain and first processed by the [`ExpressRelay`](https://github.com/pyth-network/per/blob/main/contracts/src/express-relay/ExpressRelay.sol) contract before individual searchers' submissions are routed to their corresponding `targetContract`s.
910

1011
Generally, the auction server expects bids to execute successfully on-chain. Falback bids are also forwarded in case of execution failures for the predicted winners.
1112

pages/express-relay/how-express-relay-works/opportunities.mdx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,26 @@ In the pre-Express Relay world, opportunities therefore correspond to MEV: a pro
66

77
In the context of Express Relay, the value deriving from an opportunity no longer flows to the validator but instead is recaptured by the system and shared back with the protocol. In Express Relay, protocols expose opportunities to the network of integrated searchers, and the searchers then bid on priority to execute those opportunities. Critically, the auction has moved from being determined by validators to a lower level at the protocol level.
88

9+
## Oracle-agnostic
10+
11+
Critically, opportunities do not refer to only transactions that use an oracle. In truth, any transaction that is lucrative but limited (available to only the first user(s) who executes it) generates MEV. As a result, Express Relay and the opportunity schema have been designed to be oracle-agnostic.
12+
13+
Examples of opportunities include:
14+
- liquidations
15+
- open trade offers
16+
- NFT mints
17+
- top-of-block DEX arbitrage
18+
919
## Opportunity Adapter
1020

11-
The
21+
The Opportunity Adapter contract enables searchers to engage with opportunities from different protocols without needing to do any bespoke integration work per protocol. Instead of exposing lower-level fields determined by protocols (e.g. `amountCollateral`, `addressBorrower`), the Opportunity Adapter abstracts away the semantics of the opportunity and instead [exposes the fundamental traits](https://github.com/pyth-network/per/blob/30c3fc695034f518225f8255ebe8423604e8aca3/contracts/src/opportunity-adapter/Structs.sol#L20-L23) of any opportunity:
22+
- the tokens sold
23+
- the tokens bought
24+
- the identity of the user executing this opportunity
25+
- the contract to call and the calldata and value to call with
26+
- the user's bid
27+
28+
Thus, the Opportunity Adapter unifies the disparate interfaces of different protocols with respect to their different opportunities. This unification in a single interface is what makes Express Relay an opportunity hub connecting protocols and searchers.
1229

1330
### Permit2
1431

@@ -18,10 +35,14 @@ The `OpportunityAdapter` contract uses the [Permit2](https://github.com/Uniswap/
1835

1936
Once on-chain opportunities arise, searchers can be notified of their existence via the opportunity server. Like the auction server, this is an off-chain piece of the Express Relay stack that is run by an infrastructure partner designated by the DAO. The opportunity server presents opportunities to searchers in a way that abstracts away bespoke integration work for the searcher: instead of worrying about crafting calldata specific to every new liquidation interface, searchers now view liquidation opportunities in terms of tokens they need to sell (debt they repay) in exchange for tokens they buy (collateral they liquidate). This simplified interface unifies different liquidation schemas and allows searchers to easily plug into more protocols, improving the access between protocols and searchers.
2037

21-
In addition to learning about present opportunities, searchers can also query the opportunity server for data around historical opportunities
38+
In addition to learning about present opportunities, searchers can also query the opportunity server for data around historical opportunities.
2239

2340
-(TODO) Diagram of searchers before and after ExpressRelay
2441
-before: searcher connects to every new protocol bespokely. similarly, protocols have to court and incentivize individual searchers. maybe a messy looking bipartite graph with O(NM) edges
2542
-after: searcher connects once to ExpressRelay, then gets access to opportunities of all integrated protocols. similarly, protocol connects once to ExpressRelay, then gets access to DeFi services of all integrated searchers. a cleaner looking graph with ER in the middle as a hub for both protocols and searchers.
2643

27-
Explanation of how to write the monitor at a high level
44+
## Opportunity monitor
45+
46+
Many integrated protocols with Express Relay build out an opportunity monitor script to query executable opportunities on their protocol and expose them to searchers. This allows them to tap into all Express Relay-integrated searchers, who do not need to do any additional integration work beyond having access to the relevant tokens to execute opportunities on the protocol.
47+
48+
In terms of existing infrastructure, the opportunity monitor script is most analogous to a protocol's liquidation scripts/bots. Typically, many lending protocols build liquidation bot libraries that they share publicly in hopes of encouraging liquidators. With minor modifications, these scripts can serve as the opportunity monitor that enables all Express Relay-integrated searchers to participate in this protocol's liquidations.

pages/express-relay/how-express-relay-works/relayer.mdx

Whitespace-only changes.

0 commit comments

Comments
 (0)