[ARFC] Repay Excess CRV Debt on Ethereum v2


Title: [ARFC] Repay Excess CRV Debt on Ethereum v2
Author: @llamaxyz - @MatthewGraham @Dydymoon
Dated: 2022-12-08


Simple Summary

This publication proposes sourcing CRV for the purpose of repaying the excess debt in the CRV Reserve on the Ethereum v2 liquidity pool.

Abstract

There are approximately 2,656,335 units of CRV of excessive debt in the Ethereum v2 CRV Reserve. At 66.35 cents per unit, a total of 1,762,478.27 USD, in the form of CRV tokens, is required to recapitalise the protocol.

To recapitalise the protocol, Llama proposes acquiring the full amount of CRV required to repay the excess debt from the existing USDC and aUSDC holdings.

Aave currently holds 6M units of aUSDC and 358.7k units of USDC in the Ethereum Collector Contract.

Motivation

Decide on a path forward to repay the excess debt in the CRV market (currently ~$1.76M USD, dependent on CRV’s token price). Llama proposes using funds held in the Aave v2 Collector Contract to repay the excess debt. As the excess debt must be paid in CRV tokens, Aave is required to acquire 2,152,041 units of CRV.

There is currently an active proposal whereby Gauntlet’s insolvency fund (valued at around $280k) is to be transferred to the Economic Reserve. The insolvency fund only offsets a portion of the total cost incurred by Aave. There has been no indication of support from the community for using AAVE held within the Safety Module or from the Ecosystem Reserve to recapitalise the protocol. If Aave was to sell AAVE or stkAAVE to fund the CRV acquisition, there are two non exclusive ways of doing this:

  1. Auction via the shortfall event
  2. Swap contract where anyone can swap AAVE or stkAAVE for CRV

Option 2 eliminates the need for negotiating any terms with a counterparty, or any counterparty needing to review contracts prior to interacting with a whitelisted contract. It is worth noting the Collector Contract holds insufficient AAVE or stkAAVE to support using AAVE <> CRV swaps. Any swap contract of this nature requires using the Economic Reserve. General discussion to date has indicated little appetite to sell AAVE to fund excessive debt.

There has been some interest from the community to use the aCRV holding, currently 504,294 units, in the Ethereum Collector Contract to partially recapitalise the protocol. This is a partial solution that is equivalent to just 18.98% ($334.6k) of the required CRV size needed. If the community was to use the aCRV position, a further 1,647,747 units of CRV are to be acquired.

With the launch of a new aToken, expected soon, Curve liquidity tokens can be deposited into Aave and still receive CRV rewards from the Curve gauges. Aave has the option to deploy the aCRV holding to veCRV and direct rewards towards Curve gauges that benefit the Aave ecosystem. This has the potential to become a meaningful income stream for Aave.

If Aave was to incur a delay in creating veCRV, historically this is one of the highest yielding reserves which is why CRV is the largest earning asset outside of the major stable coins. In more normal environments, over a 150 to 200 day period, the CRV reserve would generate sufficient yield to repay the excessive debt. This revenue source , CRV yield, would be lost if aCRV was used to fund repaying the excessive debt. Due to the potential upside, this publication supports retaining the aCRV holding.

As part of a broader consolidation of the Ethereum Collector Contract, approximately $434.6k of assets are to be swapped for USDC. This represents 24.7% of the funds required to recapitalise the protocol.

Holdings Summary

Holding $ Value % of Excessive Debt
aUSDC 6,002,226.07 340.56
USDC 358,701.07 20.35
v2 Consolidation 434,570.98 24.70
aCRV 330,834.02 18.98
Excessive Debt 1,762,478.27 100

The table shows there is in total 385.61% more USDC relative to the excessive debt value. Do note this is only the USDC portion of the Collector Contract. There is also large DAI ($4,684,700.46) and USDT ($3,915,311.69) holdings.

Due to the relative size of the USDC and the upside potential to the new aToken developed by Aave Companies, Llama suggests the community utilise the USDC and aUSDC holdings to acquire the full amount of CRV needed to recapitalise the protocol.

Specification

Deploy a swap contract exchanging USDC and aUSDC for CRV.

The exchange rate is the Chainlink CRV/USD Oracle + 10 bps.

CRV/USD Oracle: 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f

Estimated Premium: 1,762,478.27 * 0.0010 = $1,762.48
A $15,000 swap via ParaSwap at 14 gwei + depositing into the swap contract is estimated to cost $12 - $15, 10 bps is $15.

A cap of $2M will be placed on swap contract. This is a defined ceiling which limits the amount of funds allocated for acquiring CRV on market. This essentially creates an upper price bound on the CRV price of 75.29 cents, which is a 13% above the current spot price, 66.35 cents.

The actor interacting with the swap contract will have the ability to select USDC and aUSDC by choosing true or false respectively.

To repay the excess debt, the repay function will be used. This function requires CRV as an input and the address the bad debt has accumulated within.

pool.repay(crv, total bad debt, variableInterest, Address)

CRV: ethereum:0xD533a949740bb3306d119CC777fa900bA034cd52
Total Excessive Debt: 2,656,335 units of CRV
Address: 0x57e04786e231af3343562c062e0d058f25dace9e

Next Steps

Discuss in the comment section the above proposal. A Snapshot will be presented for the two most popular options. At the time of writing, these appear to be:

Option 1) Use USDC to acquire CRV
Option 2) Use aCRV + USDC to acquire CRV
Option 3) Do Not Recapitalise Protocol

Option 3 gives the community the ability to not recapitalise the protocol.

If the Community was to prefer to sell AAVE, the preferred mechanism is a swap contract at the AAVE/CRV composite oracle rate. ie: AAVE/USD x USD/CRV >> AAVE/CRV There would be no premium offered such a swap. Let us know what you think in the comments.

Copyright

Copyright and related rights waived via CC0.

11 Likes

Hi Everyone :wave:,

A Snapshot has been created for the community to express there preference in if and how Aave repays the excessive debt in the CRV Reserve.

Thank you for your participation.

https://snapshot.org/#/aave.eth/proposal/0xa9634f562ba88a5cd23fabe515f36094ccb1d13294a5319bc41ead5dc77a23f9

2 Likes

Hi Everyone :wave:

Some not so great news, although the CRV proposal is ready to go, the market has moved against Aave with the CRV price now exceeding our earlier approved budget.

The new ask, enabling Aave to chase the market, is for the budget to be extended from $2M to $3,105,000. In addition to the $3,105,000 budget, we will have a clear price cap of $1.15 per unit of CRV.

During the review stage, there was a concern raised that if this order was to go unfilled in the market, then the CRV debt could grow to exceed Aave’s approved budget without CRV necessarily exceeding the upper price limit. We don’t have a mitigation for this.

Another suggested improvement is to not fix the amount of CRV to be purchased to an arbitrary number. Instead the contract should query a feed which advises the remaining excessive debt in the CRV Reserve. We can integrate this feature if the community wishes, or we can make an allowance to purchase more CRV than the current excessive debt is with the expectation the swap contract will be filled quickly. The current excessive debt figure is 2,676,356, we propose acquiring 2,700,000 units.

In summary, the revised proposal updates include:

Deploy a swap contract that acquires 2,700,000 units of CRV, with a USDC spend limit of $3,105,000 and max unit value of $1.15 per CRV token.

The execution philosophy of using a Chainlink oracle + 10 bps and all other aspects remain the same.

The excessive debt will be repaid within this AIP and any left over CRV will be deposited into v2 or v3 at a later date.

It is unclear if this proposal should go to Snapshot again, we are looking to the community for guidance on how to proceed. This is time sensitive and Llama’s prefer is to move quickly whilst respecting the communities wishes at all times.

Out of curiosity, why wasn’t this executed earlier?

Snapshot reached consensus a month ago and has yet to progress to the next stage. This delay has resulted in an extra $1mm in expenses incurred by the DAO.

Would have loved to have seen aCRV used to lessen the effect of market movement.

Helping us understand where blockers exist are useful in designing a more efficient process.

5 Likes

Hi @fig,

The Snapshot vote for this proposal and the Ethereum v2 Asset Consolidation scope finished on 16th December 2022. Shortly afterwards, many team members went on leave over the Christmas period, returning early January.

The PR for the CRV acquisition was submitted for peer review on the 10th January and concluded on Friday 13th January by @bgdlabs with several finding as mentioned in our earlier comment. History shows, it is better to submit a proposal early in the working week as this leads to higher voter attendance. Before Monday, 16th January, the CRV spot price exceeded the originally proposed budget allocation. Thus, creating a need to rework the proposal.

Currently, we have the following proposals at the peer review stage:

  • Repay Excess CRV Debt on Ethereum v2
  • Updated Proposal: Aave Grants DAO Renewal
  • Ethereum v2 Collector Contract Consolidation

v3 is also about to be deployed and this is likely a higher priority.

All three of proposals have been advanced since the original 16th December date during a period of reduced capacity due to the Christmas and new year period. The revised CRV acquisition proposal is with BGD for review.

There is still risk that during the period of time it takes to progress a proposal through the AIP process, (pending, voting, queuing, execution >> ~5 days) that the CRV price continues its current trend and exceeds the mentioned budget. Then, actors can deposit CRV into the contract and swap it for USDC.

The key decision now, is do we have a 5 day discussion and new Snapshot on the back of the recent changes in the spot price of CRV ?

Currently, we are waiting on guidance from the community on how to proceed, noting the material nature of the change affecting this proposal.

1 Like

the ACI is in favor of cleaning the tab asap.

the community intention of repaying the excess debt has been clear and we’re in favor of proceeding without further delay to AIP stage to avoid debt to widen if market conditions keep improving.

it’s a shame the DAO “lost a million+” due to delays but no one control the market.

As a general remark, with the current approved steams of stablecoins, we need to focus more on revenue and cost-cutting to avoid “running out” of stables and be compelled to sell strategic & potentially productive assets to pay service providers.

2 Likes

From the technical side, as @Llamaxyz previously commented, we think the current model of swap is problematic when combined with timing, as the limits/caps go really easily out of control in a volatile (USDC/CRV) market.

At the same time, it is a bit concerning to see the stablecoins (USDC) cap to be spent raised to important levels, factually de-capitalizing the protocol. We think the community should probably re-evaluate using the aCRV holdings on the Collector, or even defining a streaming mechanism to, over time, use the aCRV income to close the bad debt.
If going this route, it could be an option to also “discount” from the variable borrow debt the equivalent to pending bad debt, to not generate any interest overhead, even if this involves some additional governance proposal.

Additionally, could be important to evaluate the swap based on other assets (non-USDC/stablecoins), with a more historic correlation with CRV. That way, the potential price exposure could be reduced.

Hi @bgdlabs,

Without knowing when v2 is to be deprecated, ideally sooner rather than later due to potential oracle charges, would it make more sense for quicker solution rather than earn aCRV to then pay back the excess debt?

This approach appears to have extended unknown duration given the main sources of earning aCRV are all restricted, not yet deployed or frozen, see below:

a) SupplyCaps on v3 restricting the market on Polygon
b) No clear path to listing CRV on v3 Ethereum
c) v2 Ethereum CRV Reserve is frozen
d) v2 Polygon CRV Reserve is frozen

If such contract was built, would it need to go to Certora for audit given the complexity leap relative to a swap contract ? If so, this would then include lengthy waits and additional opportunity costs due to finite resources being allocated to this initiative as opposed to more lucrative growth initiatives.

It is disappointing that there is such a lack of accountability here. The DAO is paying Llama upwards of $2m for an annual engagement and should expect a higher level of service. Their proposed scope covers “treasury management” and this indiscretion should be viewed in that light. Their management, or lack thereof, of the treasury cost the DAO $1m and counting due to a lack of priority.

The community was active and responsive in the the day of the CRV attack and prioritized derisking thereafter, even Llama got involved in review and risk mitigation. The protocol was proactive in changing risk parameters and Llama was proactive in pushing the community towards a resolution on debt repayment, until they weren’t.

With ~$1.8m in Bad Debt owed by the protocol, the community was up in arms against Gauntlet. Why is poor planning and execution by Llama to the same scale viewed differently? The fact that there was a one month gap between the snapshot and PR review shows that either the initial strategy was rushed without a full plan of efficient implementation or that Aave, during an extremely vulnerable period, was not their top priority. No one controls the market, but a seeing as we’re likely going to have to restart the approval process (two votes and peer review), a 2-month delay from hack to repayment should not be viewed as acceptable and nor should the lack of communication from Llama during that period.

I would be eager to hear @Llamaxyz’s proposal on how the DAO can recoup losses from this oversight and the plan to prevent it in the future. Personally, I would view this as a mark against their ability to “manage Aave’s treasury” and would hope they include the final value of loss on CRV debt in any measurement of “success” when reviewing their relationship with the DAO, per their own KPIs below.

3 Likes

Update:

Following the execution of AIP-144 CRVBadDebtRepayment contract allowed the acquisition of 2.7M CRV clearing the remaining excess debt on the Aave V2 protocol in about 15h and a dozen txs.

We would like to thank all parties involved in this process that allowed to clear the excess debt in the Aave protocol and protect the aave users.

4 Likes

Hi @float, thanks for the question. This proposal had a number of steps and each was significantly complex. It is important that we allowed enough time for contracts to be developed, peer-reviewed internally, and peer-reviewed by BGD. It is not in Aave’s best interest to compromise on security for the sake of speed. As Marc said, AIP-146 was executed successfully yesterday: the contract allowed the acquisition of 2.7m units of CRV within 15 hours, clearing the remaining excess debt on Aave V2. Having said that, we agree we could have communicated more during this period and hope to clarify things here.

November 23, 2022: Along with Gauntlet, we co-authored an initial discussion for how Aave could repay excess debt in the CRV market [1]. At this point, we noted there were 2 options forward:

  1. Repay the debt using the Safety Module
  2. Repay the debt using the Aave V2 Collector Contract

Given the size of the debt and technical complexity involved with option 1, we recommended the DAO repay the debt using the Collector Contract. At this point, we allowed the community to weigh in and simultaneously began preparing a plan for repaying the debt from the Collector Contract, as well as coordinating with Gauntlet on the logistics of the insolvency refund.

November 30, 2022: We shared more details about CRV repayment using Aave’s V2 Collector Contract [2]. We recommended that the community retain existing CRV holdings due to their strategic value and acquire enough CRV in the market with USDC from the treasury to offset excess debt. As this would result in an outflow of USDC, we also outlined plans to consolidate long-tail holdings in order to offset this USDC outflow. We shared more information about this plan here [3].

While we present recommendations to the DAO, ultimately we will follow the community’s decision regarding the treasury and protocol. While most of the community agreed with our approach to acquire more CRV rather than using Aave’s existing aCRV (which would only have offset a portion of the excess debt), a significant portion of the community also favored using existing aCRV holdings. We decided to allow some time for debate on the forum, after which we posted an ARFC with more details on our proposed solution.

December 8, 2022: We published an ARFC [4] with more technical and financial details on how Aave could repay the bad debt. As there was still no overwhelming community sentiment, we then presented a Snapshot to allow the community to decide on the best course of action.

December 12-16, 2022: A Snapshot [5] was run to determine the best path forward. The DAO ultimately voted to use USDC to acquire CRV rather than using existing aCRV + USDC to acquire CRV (66% to 34%). At this point, we began working on developing the proposal payload. In parallel, we also began work on consolidating the Collector Contract in order to offset any outflows in USDC.

December 16, 2023 - January 5, 2023: Internal Development. This was a complex proposal that involved multiple steps and sophisticated contracts, rather than a simple transfer/approval. We did have several Aave related proposal payloads in the timeline, but prioritized development on this one. In order to ensure everything was working as intended, we also had to write a comprehensive test suite along with integration testing with Aave governance against a forked instance of mainnet to ensure code coverage for all scenarios.

Contracts involved:

CRV Bad Debt Repayment Contract: This was the most sophisticated contract as part of this proposal with multiple moving parts, external system dependencies and validations:

  1. function purchase(uint256 _amountIn, bool _toUnderlying) external returns (uint256) that allows a user to purchase USDC/aUSDC using CRV. The user receives a 10 bps premium for doing so. The first parameter is the amount of CRV they are sending in uint256 _amountIn and the second parameter bool _toUnderlying is for the user to choose whether to receive USDC (true) or aUSDC (false).
  2. function availableCRVToBeFilled() public view returns (uint256) informs the user on how much CRV is left to be sold to this contract. Users should call this view function before calling purchase to know how much CRV there’s available to sell through this contract.
  3. function availableAUSDCToBeSold() public view returns (uint256) informs the user how much USDC/aUSDC is left to be purchased through this contract. User should call this function prior to calling purchase to see how much USDC is left to be purchased.
  4. function getAmountOut(uint256 amountIn) public view returns (uint256) informs the user how much USDC/aUSDC they are going to get from their purchase, with the 10bps premium included.
  5. function getOraclePrice() public view returns (uint256) informs the user the current CRV price, per the specified Chainlink Oracle. It also includes logic to throw an error if price crosses the MAX_ORACLE_PRICE that this contract is willing to purchase CRV at.
  6. function repay() external returns (uint256) that sends the CRV balance of the Aave v2 Collector contract to the AAVE V2 pool to repay the bad debt generated by address 0x57E04786E231Af3343562C062E0d058F25daCE9E.
  7. function rescueTokens(address[] calldata tokens) external This is a rescue function that can be called by anyone to transfer any tokens accidentally sent to this contract to the Aave v2 Collector contract.
  8. uint256 public totalCRVReceived The amount of CRV received by the contract.
  9. uint256 public totalAUSDCSold The amount of USDC/aUSDC sold by the contract.

Proposal Payload: This payload did 3 distinct actions:

  1. Converted the existing USDC balance within the Aave v2 Collector contract to aUSDC so that it was not sitting idle in the treasury.
  2. Approved the CRV Bad Debt Repayment Contract to spend up to the aUSDC Cap defined in the CRV Bad Debt Repayment Contract from the Aave v2 Collector contract. This was required to enable the CRV purchase
  3. Approved the CRV Bad Debt Repayment Contract to spend up to the CRV Cap defined in the CRV Bad Debt Repayment Contract from the Aave v2 Collector contract. This was required to pay back the CRV bad debt on behalf of Aave.

January 5, 2023 - January 9, 2023: Internal Review. There were a couple of things that were caught in internal review and fixed during this time:

  1. Ensuring that the CRV Bad Debt Repayment Contract held no custody of CRV and aUSDC/USDC as part of the swap and instead have it custodied in the Aave v2 Collector contract
  2. Some fixes related to precision math
  3. Ensuring to deposit the idle USDC within the Aave v2 Collector contract to aUSDC as part of the Proposal Payload.
  4. More extensive tests to ensure all scenarios are covered.

January 10, 2023: Proposal payload sent to BGD for external review.

January 10, 2023 - January 13, 2023: BGD external review. We received the following feedback during this external review which we went ahead and implemented:

  1. Extend interfaces for all our contracts so that it makes programmatic interaction with the contracts more convenient.
  2. Allow calling repay() whenever there is some CRV for repayment (instead of waiting for the entire CRV Cap to be filled) so that the debt can be repaid over time.
  3. Define a MAX_ORACLE_PRICE so that the purchase is within budget and not depleted if CRV price goes up beyond that threshold.
  4. More extensive tests to ensure all scenarios are covered.

January 13, 2023 (Friday): Due to generally lower voter turnout on weekends (multiple proposals have failed after being put up for a vote on weekends), we opted to wait until Monday. At this point, CRV was also nearing the price cap set in the contract.

January 16, 2023 (Monday): By this point, the price of CRV had exceeded the earlier approved budget. As Aave’s governance process did not make it clear whether another Snapshot vote needed to be run or not, we decided to publish a comment on the forum [6] outlining the potential options.

January 17, 2023: We updated the threshold of USDC/aUSDC that could be spent by the DAO from $2,000,000 to $3,105,000 (CRV price from $0.75 to $1.15).

January 20, 2023: Proposal published on-chain [7].

January 25, 2023: Proposal executed on-chain. 2.7m CRV acquired and cleared remaining excess debt on Aave V2 in roughly 15 hours and ~12 transactions ahead of the V3 launch.

We can’t control market prices; what’s in our control is coordinating with different stakeholders, working on a secure payload, and shipping it in a timely fashion.

We are working to increase transparency on the timeline of our active proposals so the community can more easily see where proposals are in development.

4 Likes