Approve API3 Data Feeds for use within Compound Finance

Summary

This proposal aims to approve API3 as an oracle solution for existing and upcoming Compound Finance deployments. API3 operates push-oracles akin to the currently utilised oracles. Currently existing and already audited code in the form of adapters can be utilised to consume API3 data feeds presenting no additional overhead for Compound for a potential integration. API3’s decentralized data feeds are maintained directly by first-party oracle nodes and aggregated on-chain in an end-to-end verifiable manner.

What sets API3’s Oracle Stack apart from other oracle solutions is the vertically integrated mechanism to recapture MEV which works on every network that the data feeds are available on. Currently, oracle updates leak value of dApps that utilise them because they treat each update equal in value. However, that is intrinsically not the case. Some oracle updates are infinitely more valuable than others, if they e.g. enable liquidations. For this reason, API3 built a mechanism that supplements regular oracle updates through an auction mechanism that allows for competition to arise for oracle updates. The proceeds of these auctions are then programmatically returned to where the opportunity arose (e.g. the lending protocol itself). Similar auctions on Ethereum and research on the subject matter suggest that up to 99.9% of the available revenue is given up in such auctions.

In the case of Compound, introducing competition for oracle updates that allow for the performance of liquidations. Currently, Compound charges flat percentage based liquidation penalties from its users ranging from 5 - 20%. This is the value that users are being overcharged for to incentivize timely liquidations. Since inception Compound has already paid out close to $100 Million in user funds to liquidators. This doesn’t have to be the case as it has been proven, that given competition and a place for that competition to take place, liquidators are fine walking away with a fraction of what they are being paid currently. Utilising API3s Price Feeds allows for the recapturing of significant sums of money that would enable Compound to gain a competitive advantage in the lending space. These new found funds could be utilised in various different ways ranging from improving returns for lenders, reducing COMP issuance, bolstering the treasury or COMP buybacks.

Rationale

What do oracles have to do with Compound?

Lending Protocols rely on oracles for determining the price of assets for the majority of their functionality. One of the core components that is enabled through oracle transactions is the determination whether a user position is liquidable. It is paramount that positions get liquidated reliably in order to protect the lending protocol from incurring bad debt. In order to ensure this, lending protocols offer up a percentage of the liquidable user’s collateral at a discount to the liquidator as incentivization (“liquidation bonus”). This percentage differs from protocol to protocol and Compound charges users a liquidation penalty ranging from 5 - 20%. This means that if a $100,000 user position is liquidable there is an available reward for liquidators between $5,000 and $20,000. If the position is $1,000,000, the reward equals $50,000 and $200,000, etc.

Liquidators are being overpaid

Liquidations are very lucrative and there is aggressive competition for them. It is API3’s belief that protocols like Compound are leaking enormous amounts of value which could be substantially retained. In a Monoceros report (called ‘The MEV Book’) liquidations on Ethereum were analysed and it was found that liquidators regularly give up 99.9% of the available reward to block builders in order to get their transaction included first. The competition around liquidations and the availability for a market where this competition can take place, forces liquidators/searchers to give up the majority of the reward. This transaction shows one of the biggest liquidations on AAVE v3 this year (January 2024):

The user position was liquidated for $4.2 Million with an available liquidation bonus of $141,477.45. Of the available $141,477.45, $141,416.50 were used a bribe to block builders in order to allow the liquidator to walk away with $60.95. Examples like these prove repeatedly that, given a competitive marketplace, nearly all available revenue will be given away and liquidations will be performed for a fraction of the reward that lending protocols are handing out today.

Oracles and their privileged position for liquidations

As oracles determine when a liquidation is possible by updating the respective price on-chain, they theoretically have first rights to said liquidations. Oracle updates could be bundled with liquidation calls, which would mean that “external” liquidators couldn’t even compete for any liquidations, since the oracle project would ‘catch them all’.

A core issue with this approach is that this inevitably leads to the centralisation of liquidations. If the oracle project is guaranteed to win when they perform these liquidations, why should others even bother to look? This means that if the oracle project would ever fail there wouldn’t be sufficient competition for liquidations, which would lead to Compound inccurring bad debt due to missed liquidations. As such, oracle projects have not taken advantage of their privileged position due to the aforementioned risks.

But what if you could utilise the privileged position of oracles in a way where things remain decentralised, open, and permissionless for everyone? Enter API3 and the OEV Network.

What is API3 & OEV Network?

API3 is a leading blockchain oracle that provides price feeds. API3 operates in push-oracle architecture quite similar to oracle infrastructure which Compound is already utilising. Currently over 170 price feeds are available on 29 EVM-compatible networks.

A core differentiator for API3 is the API3 Market. It is a developer-focused interactive market that lets users permissionlessly deploy data feeds in an instant. Most of API3’s partners only approach us after having activated feeds themselves for e.g. co-marketing activities or the utilisation of potential chain grants for oracle services. Through close relationships with most chains, we can support any feed for free for partners on most networks.

The below video is an example of how quickly e.g. USDT/USD can be spun up on a chain such as Polygon and be ready for use (~1 Minute). Our innovative market and fully automated infrastructure allows our partners to quickly spin up new markets without having to go through business development hurdles & technical pipelines while waiting endlessly for their oracle partner to spin up desired markets. In fact, the majority of people might not even want to have meetings every time and simply get things going immediately. It’s a competitive world out there and having the opportunity to spin up new markets near instantly is a core differentiator that many of API3s partners appreciate.

Another difference compared to other oracle solutions is that API3 exclusively relies on first-party oracles. In a first-party architecture, the data provider and the oracle are one and the same entity. Other solutions that Compound currently relies on are typically referred to as “third-party” oracles. In that architecture the oracle node operators aren’t the entities producing the data that they are providing on-chain. In most cases, third-party solutions don’t provide the ability to verifiably prove where data originates from, which means that you merely have their word if they tell you it’s coming from e.g. Coingecko.

API3’s first-party architecture simplifies the process for traditional API providers to get their data on-chain. The highly reputable data providers that API3 partners with continuously update data on-chain using cryptographically signed data, offering a transparent and verifiable way for developers to use off-chain data.

In a nutshell: With the legacy oracles that Compound relies on you get data served by someone in the middle that “supposedly” gets it from businesses such as Coingecko, Kaiko and others, whereas you get the same data directly and verifiably by multiple data providers like Coingecko through API3s Infrastructure.

Nowadays, there are numerous oracle projects that, in one way or another, all provide you with the same thing: Prices for assets that you want to integrate.

There isn’t a lot of other value that these oracles are adding apart from providing this service, and while security methods and availability of assets and networks of different projects can be debated at length, the result for Compound remains the same. Another oracle that gives you the same service.

For this specific reason, API3 spent the last year conducting research in the area of ‘Oracle Extractable Value’ (OEV) and building a system that allows the recapturing of value that dApps are leaking away due to oracle updates. The solution, a Rollup called OEV Network, was recently announced and is expected to go live imminently. OEV Network allows anyone to compete for oracle updates with value and perform price updates bundled together with the action they want to perform.

In the specific case for Compound, OEV Network allows liquidators to compete for oracle updates that would allow them to perform liquidations. Since we’ve established that oracle prices determine when a user gets liquidated, winning the right to update the oracle to a specific price also gives the exclusive rights to a liquidation. OEV Network takes the competition for liquidations that currently happens on the block level and moves it to the oracle level, meaning that instead of competing to get your transaction included first, liquidators now compete for the oracle update transaction that allows for the liquidation.The proceeds from these auctions are then programmatically returned to dApp utilising the oracle. This makes API3 the only oracle project to do more than simply provide prices. It’s an oracle with a built-in MEV solution that pays you for using it.

API3 is currently securing over 1 Billion in TVL across all integrations, with the bulk of the integrations coming from eager lending protocols awaiting OEV Network to be among the first to utilise it.

OEV Network: The Nitty Gritty

The above graphic shows how Compound would be utilising API3 Oracles together with auctions over OEV Network. At the heart of the service are first-party oracles that maintain price feeds (‘Base Feed’) on the respective chain according to heartbeat & deviation thresholds. These base feeds have an in-built delay, while the same oracles sell ‘real-time’ data over auctions on OEV Network.

Each dApp reads prices on the destination chain over a ‘proxy’ (see Compound wstETH/USD) that is specific to them. This proxy follows the underlying base feed, but can also be updated through cryptographically signed data that was won in auctions on OEV Network. Since the base feed has a slight delay and OEV Network sells real-time data, liquidators can gain an advantage by obtaining the most recent price information over OEV Network.

When winning a bid on OEV Network, liquidators can utilise this price information to update a dApp specific ‘oevproxy’ (e.g. Compound wstETH/USD) and perform consequent actions like liquidations exclusively for a period of time. The price update is only executable when the amount that was bid is transferred to the dApp’s control, which means that liquidators can only make use of this competitive advantage if they pay Compound in the process.

In summary, instead of waiting for oracles to update and then racing to become the first person to perform the liquidation, liquidators will now compete for oracle transactions and bundle them together with the liquidation while paying Compound for the right to do so. By adopting API3 & OEV Network, Compound has the opportunity to utilise ‘an oracle that pays them’ by recapturing value that has been needlessly leaking away.

The Numbers

Congratulations, you made it this far. This is a very technical and some might say ‘boring’ topic, so why should you even care? I mean, how big of an opportunity could this possibly be? Well, believe me when I say, if this wasn’t a significant number, we wouldn’t be boring you with such a lengthy write-up.

Since 2021, close to $80 Million has been paid out to liquidators on Compound V2 Ethereum alone, amounting to a monthly average of $2 Million.

Including the remaining Compound deployments this number is closer to $100 Million, bringing the monthly average value lost to $2.5 Million. (Historical Data available on API3’s OEV Watchtower)

By integrating with API3 Price Feeds, Compound enables the emergence of a competitive market for liquidations on their platform that returns value to them. Referring to similar order-flow auction designs on mainnet Ethereum and liquidator behaviour on them, Compound can expect to recuperate most of what they are paying out for liquidation incentives today.

API3 charges liquidators a 10% fee on the OEV Network, which means that the maximal potential recapture value for Compound is 90% of what is currently being lost, assuming optimal bidding and competition levels on OEV Network. If a solution like the OEV Network was available to Compound at inception, it would have had the potential to recapture over $90 Million in lost value, which amounts to $2.3 Million a month.

This new income stream would allow Compound to experiment in numerous ways to attract capital and improve protocol performance. One potential usage for these funds could be as a replacement for COMP issuance, allowing Compound to remove inflationary aspects of their tokenomics while maintaining incentives for users. Alternatively, these funds could be utilised to buy back COMP from the open market to keep the liquidity mining incentives going for longer in a sustainable way. If in fact, an OEV recapturing solution would have been available to Compound since inception, and if the proceeds would have been used to buy back COMP every month, an additional 700,000 COMP would be available today for further incentivization.

A recent analysis of ‘Oracle Extractable Value’ by Decentralised.co goes into the value loss that lending protocols such as AAVE are experiencing and presents how solutions such as OEV Network could recapture significant amounts of this value.

Conclusion

Current oracle solutions that Compound relies on are blind to the value that their updates create and are a leading cause for having lost close to $100 Million in value to liquidators. This is value that was extracted from Compound users and ultimately TVL that had the potential to be retained within the protocol. By approving API3 data feeds for usage, Compound not only gets another oracle solution that provides price feeds, but one with an innovative design and unmatched speeds that also has a built-in MEV solution that has the potential to recapture millions that are currently leaking away needlessly. These funds could be utilised in creative ways to allow Compound to gain significant advantages against competitors within the industry.


Useful Links:

API3 Market

API3 Data Feeds (dAPIs) Documentation

OEV Network Presentation at ETHZurich

Commonly Asked Questions:

What happens if OEV Network is down?

In the unlikely event that OEV Network is down the first-party oracles still maintain the base feeds on the respective destination chain. Liquidations can simply occur in the same fashion they do now on Compound with the liquidation bonus being paid out to the liquidator without recapturing anything. API3 is highly incentivized to keep OEV Network up and running as the fee that liquidators are being charged is the only means of monetization. API3 does not earn any revenue by running the base oracles and is thoroughly incentivized to enable a reliable experience with OEV Network.

Can prices be updated with malicious data?

OEV Network is only able to auction off updates from the oracles that are also maintaining the base feed. The ‘oevproxy’ on the respective chain can only be updated with cryptographically signed data from the first-party oracles run by data providers themselves, which means that the majority of them would need to be compromised.

Is it realistic that 90% of the lost value is being recaptured?

How much is being recaptured is solely dependent on liquidator activity and competition on OEV Network. OEV Network gives liquidators that utilise it a competitive edge over those that don’t. Since competition is already occurring between liquidators naturally, they will be highly incentivized to utilise any tool that can potentially give them an advantage. While recapturing 90% of the total value lost cannot be guaranteed, trends from similar order-flow auction models and behaviour on them indicate that auctions have the biggest potential to maximise retained value through the competition that arises on them.

Is it hard for current liquidators to integrate?

Not at all. It’s additional RPC calls to OEV Network and the inclusion of the oracle update within their bundle. We have guides and example scripts available for liquidators to build upon.

Is the integration for Compound complicated?

It’s as simple as reading a new price feed. The already written and available adapters for oracles can be used and pointed towards Compound’s ‘oevproxy’ for each utilised price feed.

3 Likes