Help us share this thread on 𝕏
We hope you bookmarked this…
In our humble opinion, this post aged very well over the past year. The broader crypto community are still gaining appreciation for the phenomenal innovations baked into Curve-NG pools.
The game-changing nature of $crvUSD may have captured the most attention, but we’re pleased to see the hard work put into NG pools is finally receiving its much-deserved acclaim.
In the past few days, in-depth reports have highlighted the power of two new features built into NG pools: improved oracles and approval-less trades.
Oracles
Before the weekend, Curve joked that it may be accidentally tiptoeing into the oracle business.
The cheeky boast came as a result of an in-depth and must-read Prisma Risk team study on the behavior of oracles.
The Prisma Risks team was conducting the study because of the critical nature of oracles within the Prisma ecosystem. In particular, the nature of “redemptions” as a stabilization mechanism has been a key issue within Liquity v1 type CDPs. As the report explains:
Besides the inconvenience of having one's trove forcibly redeemed against, the user may experience some value extraction due to the Oracle's deviation from spot price. Mispricing can cause users to lose more assets than required, notably when the Oracle reports a price lower than the fair market value. On the other hand, an Oracle that reports a price above the fair market price may prevent redemptions from taking place, negating the redemption mechanism's purpose to enforce a floor price on the mkUSD peg.
Therefore the report compared two possible oracle options:
Chainlink price feeds
Curve pool EMAs
The intent was to find a “maximally secure and reflective of the current spot price for the target asset,” where spot price is pulled from Uniswap data.
You can observe a direct comparison of the performance of the two price feeds in historical data from the stETH pool:
Running through several pools, the results for several pools found that the Curve oracle proved better across the board:
Based on historical data, the Curve pool Oracle price follows the reference (UniswapV3 Price data) much more closely than Chainlink's price. The Data suggests that implementing the Curve Oracle would have resulted in decreased MEV by bots and provided a better exchange rate for users experiencing redemptions against their troves.
The effect is visualized here from the point of view of a bot trader:
So is Curve ready to swallow Chainlink?
Not so fast! Satisfactory oracle design in applications is incredibly difficult, and the cause of so many exploits within DeFi. The Prisma Risks team recommends not ditching Chainlink, but instead a hybrid oracle solution:
It might be tempting to use Curve Oracle as a stand-alone Oracle, but the effectiveness of the price feed from Curve is subject to the depth of liquidity for a particular asset and interactions with the pool. A blend of Curve Oracle and Chainlink Oracle can be used to match the prices on-chain while maintaining the reliability and broad market coverage inherited from using Chainlink Oracles.
Indeed, just minutes after Curve teased it might be entering the oracle business, it pointed out that in fact Chainlink oracles proved highly necessary in implementing Llama Lend on L2s, as a workaround for occasional sequencer downtimes.
In a theme we expect to hammer home several times this week, the emergence of additional “competition” within DeFi is only a good thing for the broader ecosystem. Likely nobody will ever replace Chainlink, but the emergence of NG-pools as a useful oracle solution only serves to make the broader DeFi landscape more resilient.
Incidentally, another risk team, “Llama Risk,” published a deeper dive on the same “Llama Lend” this week… another great read:
Approval-less Trades
Another outstanding blog post made the rounds this morning, showing off a different feature in Curve NG pools:
When gas spiked over the past few weeks, the recurring bugbear of “approvals” in crypto once again became apparent to the wider community.
It’s not simply that needing to send a separate transaction to approve spending is a nuisance in crypto, it’s a major security threat. To avoid the cost of sending repeat approval transactions, the majority of users simply grant infinite approvals. When contracts get exploited, this provides a ready exploit vector through which hackers can drain funds, already costing users over $10MM this year.
Everybody’s been seeking a better way, and Curve stepped up to the challenge. All NG pools have a built-in exchange-received
function, which allows for approval-less transactions that ultimately save on gas. The method is innovative, although it comes with some tradeoffs.
For the first step, a token to be traded is sent directly to a pool:
For the example here, we presume ETH is roughly equal to $1K. This transfer causes a slight imbalance within the pool.
For the next step, the user calls the exchange-received
function.
The exchange-received
function calculates the imbalance and sends it back the equivalent amount of WETH to the user.
In any such trade there must necessarily be a pair of transfers, but without an approval the overall gas costs are lessened. The gas profile of a normal trade:
Compare against the gas profile of an approval-less transaction:
One fewer transaction and almost 10% less gas. Did you catch the drawback though?
The pool doesn’t care who sent it the surplus tokens in the first step. It simply cares that the pool happens to register an imbalance at the moment anybody calls exchange-received
. It could easily be called by somebody else if you’re not fast.
If you are attempting to use this method of trading as a normie, somebody else will likely drink your milkshake. To use this method, you must squeeze the transactions as close together as possible, preferably bundled directly together via a smart contract.
The blog post doesn’t specifically reference MEV, but crypto users know quite well that every bot is like an armed hunter stalking through the dark forest like a ghost, gently pushing aside branches that block the path and trying to tread without sound…
If you are interested in learning more, we recommend you check out the accompanying Jupyter Notebooks, right in your browser thanks to the power of titanoboa!
Takeaways
In the case of both improved oracles and approval-free swaps, they are likely features that will not be utilized directly by the median degen. Oracle options are of most use for builders. Approval-free swaps are most useful for DEX aggregators or arbitrageurs.
Regular users mostly benefit downstream from the resultant stronger applications that get launched in DeFi along the bleeding frontier of progress.
For one such example of innovation begetting innovation, the soft liquidation mechanism in LLAMMA based products allowed DeFi Saver to built out hard liquidation protections:
As a simple Curve enjoy000r, the most immediate benefit you may get from these two new articles is the satisfaction of better appreciating everything that’s going on underneath the hood. While $crvUSD got significant attention, the broader community is only starting to appreciate the innovations built into NG pools over a year later. However, we believe the advantages of these innovations will enrich the application layer for many blocks to come.
For more on the subject, check out some prior posts on NG pools:
Disclaimers! In addition to the usual exposure to $CRV, author has exposure to $LINK.