Hello another week from the Bored Ghosts side, Aave !
As the community already knows, at the moment the Safety Module has as one of its components a Balancer liquidity pool token, a representation of providing liquidity on a Balancer AAVE (80%) / WETH (20%) pool. Currently, this pool with ~$144m TVL is one of the top 3 pools on the whole Balancer system.
This pool was created in January 2021, so it runs on the Balancer v1 system. Given the existence of Balancer v2 as an improved version of v1, together with the new BAL tokenomics, it is a clear requirement for the AAVE/WETH pool to migrate to Balancer v2.
As presented in the list of tasks of BGD, one of our objectives is to implement the technical aspects for the community to proceed with this migration. In this post, we will present the details of how we see this happening.
Context
As commented, the AAVE/WETH pool is relatively big and it has some particularities:
- It is a smart pool, upgradeable, and controlled in a decentralized manner by the Aave governance.
- The pool is highly linked to the AAVE Safety Module: the ABPT tokens (representing a liquidity position on the Balancer pool) can be deposited into a component of the Safety Module, participating this way in its dynamics.
- 99.96% of the supply of ABPT tokens is deposited into the Aave Safety Module. This means that almost everybody providing liquidity is also depositing on the Aave SM, to receive the AAVE rewards for doing it.
It is important to highlight that same as with the AAVE/WETH pool, the Aave Safety Module is controlled by the Aave governance.
Because of all the previous aspects, the scenario can be summarised as a Balancer upgradeable pool with only 1 big liquidity provider which is upgradeable itself too (the Aave Safety Module itself, as almost every ABPT is deposited there).
Migration’s specification
Given the chain of ownership of upgradeability defined in the previous section, we consider the best way to do the migration is via an atomic upgrade of 2 contracts: the AAVE/WETH Balancer smart pool and the stkABPT Safety Module.
By doing this, the migration will be fully transparent to users, as they will not need to do any action. In addition, this way is possible to control any potential arbitrage due to liquidity disruptions that could happen if people would be obliged to withdraw from the AAVE/WETH Balancer v1 to deposit into a hypothetical AAVE/WETH Balancer v2.
Going into the technical details (and subject to any potential change if we feel adequate), the migration will consist of the following steps:
- Create a proposal on the Aave governance including an update of the AAVE/WETH Balancer v1 proxy and the stkABPT Safety Module proxy, which will sequentially execute the following actions:
- On the AAVE/WETH Balancer v1 update:
- Stop liquidity providing and trading.
- Create a new Balancer v2 WeightedPool, using the WeightedPool2TokensFactory contract.
- By interacting with the Balancer V2 Vault contract, migrate the whole AAVE and ETH liquidity on AAVE/WETH Balancer v1 to its equivalent on Balancer v2. Temporarily, the proxy of AAVE/WETH Balancer v1 will hold all the supply of the AAVE/WETH Balancer v2 tokens.
- Deploy a migrator contract from AAVE/WETH Balancer v1 tokens their Balancer v2 equivalents. This contract will define an exchange rate as between both.
- Transfer the AAVE/WETH Balancer v2 supply from the AAVE/WETH Balancer v1 proxy to the migrator contract.
- On the stkABPT Safety module update:
- Using the previously deployed migrator contract, migrate all the ABPT tokens of AAVE/WETH Balancer v1 currently deposited on the Safety Module, to their Balancer v2 equivalents.
- Store the exchange rate defined on the migrator on the Safety Module side. From this point onwards, stkABPT will operate its internal accounting with the reference of AAVE/WETH Balancer v1, by using the aforementioned exchange rate.
- On the AAVE/WETH Balancer v1 update:
From the perspective of the users currently depositing their Balancer liquidity pool tokens into the Aave Safety Module, the only effect will be that when they will withdraw from the Safety Module, they will receive Balancer liquidity pool tokens of AAVE/WETH Balancer v2, instead of the ones they deposited of AAVE/WETH Balancer v1.
Next steps
BGD has already started working on this project, but we will proceed with the implementation, with the goal to have a PoC in the following 2 weeks.
Once the code is ready and security procedures are defined and applied to it, an on-chain proposal will be created. If approved by the community, the migration will be immediate.
In parallel to the previous, we will research implications to integrators of the Safety Module, supporting them if anything is needed for a simple transition.
Links
- aBPT Balancer v1 token: https://etherscan.io/address/0x41a08648c3766f9f9d85598ff102a08f4ef84f84
- aBPT Balancer v1 pool: https://etherscan.io/address/0xc697051d1c6296c24ae3bcef39aca743861d9a81
- stkABPT Safety Module: https://etherscan.io/address/0xa1116930326d21fb917d5a27f1e9943a9595fb47