forked from bgd-labs/aave-proposals-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from bgd-labs/fix/resolve-conflicts
fix: resolve conflicts
- Loading branch information
Showing
14 changed files
with
749 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...tion_20240503_before_AaveV3Ethereum_AaveV31CantinaCompetition_20240503_after.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Raw diff | ||
|
||
```json | ||
{} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Deprecation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: "Aave V1 Deprecation Phase 3" | ||
author: "BGD Labs @bgdlabs" | ||
discussions: "https://governance.aave.com/t/temp-check-bgd-further-aave-v1-deprecation-strategy/15893/7" | ||
snapshot: "https://snapshot.org/#/aave.eth/proposal/0x7451f00809986c7cb8cce7ef4587efdfedad06089ebf2851d64122d00b035d9c" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
Approve further steps of Aave v1 off-boarding, to reduce operational overhead on deprecated Aave instances. | ||
|
||
## Motivation | ||
|
||
The Aave protocol v1 was released in January 2020 and eventually superseded by Aave protocol v2 in December on the same year. | ||
|
||
While Aave v1 has been deprecated for a long time, some liquidity is still stuck on the protocol 1. Even if this instance is not covered by the Aave Safety Module, being part of Aave, it still is monitored and evaluated whenever development and/or security decisions are made. | ||
|
||
This creates meaningful overhead for all involved development & security teams, which directly adds cost to the Aave DAO. Additionally, the architecture of Aave v1 is quite different to Aave v2 & v3, making it the most ad-hoc instance of Aave. | ||
|
||
On [6th of february](https://vote.onaave.com/proposal/?proposalId=15) a first set of measures was implemented by the DAO to accelerate the offboarding process, followed by a second proposal on [3th of march](https://vote.onaave.com/proposal/?proposalId=37&ipfsHash=0xa451c9a2426267673fd125702c99581683426ca5ff1a003b07a3cd129ed30470). | ||
|
||
This `Phase 3` is the final phase of the off-boarding as suggested on the [forum](https://governance.aave.com/t/temp-check-bgd-further-aave-v1-deprecation-strategy/15893/7) with some slight modifications: | ||
|
||
- the proposal does not inject capital to core. The rational being that: | ||
- there is enough liquidity for even the biggest account of each asset to withdraw. | ||
- it's not possible to calculate the **exact** amount of bad debt as some of the debt is collateralized with a basket of relatively small collateral positions. | ||
- if a situation in which a user cannot withdraw due to liquidity constrains ever occurs the treasury managers can easily inject capital at any point. | ||
- the proposal also replaces the stable asset oracles with the capo oracles introduced on [aave v2](https://vote.onaave.com/proposal/?proposalId=82&ipfsHash=0x4886864ed1dc6cb220f17cd372697218cbb5c2ada41e63d6a1f7664168d59052) for consistency across the pools. | ||
|
||
## Specification | ||
|
||
Upon execution the proposal upgrades the following contracts: | ||
|
||
- POOL: in order to disable all actions, but liquidation, repay & withdraw | ||
- POOL_CORE: in order to update the index upon IR updates | ||
- POOL_LIQUIDATION_MANAGER: in order to increase the static liquidation penalty from 3% to 5%, while reducing the gas overhead | ||
|
||
Also, the proposal will change the pool configuration: | ||
|
||
- all reserves interest rate strategies will be replaced with a zero interest rate strategy | ||
- the stablecoin oracles are replaced with the capped oracles also used on ethereum v2 | ||
|
||
## References | ||
|
||
- Implementation: [AaveV1Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/016fe7db25ffa0de51b283fc2574762af7aea9e3/src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Ethereum_AaveV1Deprecation_20240502.sol) | ||
- Tests: [AaveV1Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/016fe7db25ffa0de51b283fc2574762af7aea9e3/src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Ethereum_AaveV1Deprecation_20240502.t.sol) | ||
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0x7451f00809986c7cb8cce7ef4587efdfedad06089ebf2851d64122d00b035d9c) | ||
- [Discussion](https://governance.aave.com/t/temp-check-bgd-further-aave-v1-deprecation-strategy/15893/7) | ||
- [Upgraded V1 Contracts](https://github.com/bgd-labs/v1-offboarding) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
58 changes: 58 additions & 0 deletions
58
src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Deprecation_20240502.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; | ||
import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; | ||
import {AaveV1Ethereum_AaveV1Deprecation_20240502} from './AaveV1Ethereum_AaveV1Deprecation_20240502.sol'; | ||
|
||
/** | ||
* @dev Deploy Ethereum | ||
* deploy-command: make deploy-ledger contract=src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Deprecation_20240502.s.sol:DeployEthereum chain=mainnet | ||
* verify-command: npx catapulta-verify -b broadcast/AaveV1Deprecation_20240502.s.sol/1/run-latest.json | ||
*/ | ||
contract DeployEthereum is EthereumScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = GovV3Helpers.deployDeterministic( | ||
type(AaveV1Ethereum_AaveV1Deprecation_20240502).creationCode | ||
); | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Create Proposal | ||
* command: make deploy-ledger contract=src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Deprecation_20240502.s.sol:CreateProposal chain=mainnet | ||
*/ | ||
contract CreateProposal is EthereumScript { | ||
function run() external { | ||
// create payloads | ||
PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); | ||
|
||
// compose actions for validation | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsEthereum[0] = GovV3Helpers.buildAction( | ||
type(AaveV1Ethereum_AaveV1Deprecation_20240502).creationCode | ||
); | ||
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); | ||
|
||
// create proposal | ||
vm.startBroadcast(); | ||
GovV3Helpers.createProposal( | ||
vm, | ||
payloads, | ||
GovV3Helpers.ipfsHashFile( | ||
vm, | ||
'src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Deprecation.md' | ||
) | ||
); | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
src/20240502_AaveV1Ethereum_AaveV1Deprecation/AaveV1Ethereum_AaveV1Deprecation_20240502.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; | ||
import {AaveV2Ethereum, AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol'; | ||
import {AaveV1} from 'aave-address-book/AaveV1.sol'; | ||
import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; | ||
|
||
interface ILendingPoolCore { | ||
function getReserves() external view returns (address[] memory); | ||
|
||
function getReserveInterestRateStrategyAddress(address) external view returns (address); | ||
|
||
function getReserveATokenAddress(address) external view returns (address); | ||
|
||
function getReserveLiquidityCumulativeIndex(address) external view returns (uint256); | ||
|
||
function getReserveVariableBorrowsCumulativeIndex(address) external view returns (uint256); | ||
|
||
function getReserveCurrentLiquidityRate(address) external view returns (uint256); | ||
|
||
function getReserveCurrentVariableBorrowRate(address) external view returns (uint256); | ||
|
||
function getReserveCurrentStableBorrowRate(address) external view returns (uint256); | ||
} | ||
|
||
interface ILendingPoolAddressesProvider { | ||
function getLendingPoolCore() external view returns (address); | ||
|
||
function setLendingPoolCoreImpl(address _core) external; | ||
|
||
function getLendingPool() external view returns (address); | ||
|
||
function setLendingPoolImpl(address _pool) external; | ||
|
||
function getLendingPoolLiquidationManager() external view returns (address); | ||
|
||
function setLendingPoolLiquidationManager(address _manager) external; | ||
} | ||
|
||
interface IPoolConfigurator { | ||
function setReserveInterestRateStrategyAddress( | ||
address _reserve, | ||
address _rateStrategyAddress | ||
) external; | ||
} | ||
|
||
interface IAaveOracle { | ||
function setAssetSources(address[] calldata _assets, address[] calldata _sources) external; | ||
|
||
function getAssetPrice(address asset) external returns (uint256); | ||
} | ||
|
||
interface IWETH { | ||
function withdraw(uint256) external; | ||
} | ||
|
||
/** | ||
* @title Aave V1 Deprecation | ||
* @author BGD Labs @bgdlabs | ||
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0x7451f00809986c7cb8cce7ef4587efdfedad06089ebf2851d64122d00b035d9c | ||
* - Discussion: https://governance.aave.com/t/temp-check-bgd-further-aave-v1-deprecation-strategy/15893/7 | ||
*/ | ||
contract AaveV1Ethereum_AaveV1Deprecation_20240502 is IProposalGenericExecutor { | ||
ILendingPoolAddressesProvider public constant ADDRESSES_PROVIDER = | ||
ILendingPoolAddressesProvider(AaveV1.ADDRESSES_PROVIDER); | ||
IPoolConfigurator public constant CONFIGURATOR = | ||
IPoolConfigurator(0x4965f6FA20fE9728deCf5165016fc338a5a85aBF); | ||
ILendingPoolCore public constant CORE = | ||
ILendingPoolCore(0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3); | ||
IAaveOracle public constant ORACLE = IAaveOracle(0x76B47460d7F7c5222cFb6b6A75615ab10895DDe4); | ||
|
||
address public constant CORE_IMPL = address(0x0E26E0bf83b4ec2cb0dcbC037bb01dA5BB352eAE); | ||
address public constant ZERO_IR = address(0xB20E27A199404bf9BCD56e37B6dE07DC906581Db); | ||
address public constant LIQUIDATION_MANAGER_IMPL = | ||
address(0xB67347196F551d1f85B7a07e64e0E47E6c9c254a); | ||
address public constant POOL_IMPL = address(0x588790f64ac1424862081A56b8329Decae206249); | ||
|
||
function execute() external { | ||
// 1. upgrade core to update irs one last time | ||
ADDRESSES_PROVIDER.setLendingPoolCoreImpl(CORE_IMPL); | ||
// 2. upgrade irs to be zero & deactivate reserve | ||
address[] memory reserves = CORE.getReserves(); | ||
for (uint256 i = 0; i < reserves.length; i++) { | ||
CONFIGURATOR.setReserveInterestRateStrategyAddress(reserves[i], ZERO_IR); | ||
} | ||
// 3. upgrade liquidationManager | ||
ADDRESSES_PROVIDER.setLendingPoolLiquidationManager(LIQUIDATION_MANAGER_IMPL); | ||
// 4. upgrade lending pool | ||
ADDRESSES_PROVIDER.setLendingPoolImpl(POOL_IMPL); | ||
// 5. upgrade stablecoin oracles | ||
address[] memory assets = new address[](6); | ||
address[] memory sources = new address[](6); | ||
assets[0] = AaveV2EthereumAssets.BUSD_UNDERLYING; | ||
sources[0] = AaveV2EthereumAssets.BUSD_ORACLE; | ||
assets[1] = AaveV2EthereumAssets.DAI_UNDERLYING; | ||
sources[1] = AaveV2EthereumAssets.DAI_ORACLE; | ||
assets[2] = AaveV2EthereumAssets.USDC_UNDERLYING; | ||
sources[2] = AaveV2EthereumAssets.USDC_ORACLE; | ||
assets[3] = AaveV2EthereumAssets.TUSD_UNDERLYING; | ||
sources[3] = AaveV2EthereumAssets.TUSD_ORACLE; | ||
assets[4] = AaveV2EthereumAssets.sUSD_UNDERLYING; | ||
sources[4] = AaveV2EthereumAssets.sUSD_ORACLE; | ||
assets[5] = AaveV2EthereumAssets.USDT_UNDERLYING; | ||
sources[5] = AaveV2EthereumAssets.USDT_ORACLE; | ||
ORACLE.setAssetSources(assets, sources); | ||
} | ||
} |
Oops, something went wrong.