generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Harsh Pandey <[email protected]>
- Loading branch information
1 parent
a62a21d
commit 42b67ff
Showing
7 changed files
with
491 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...32_20240924_before_AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924_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 | ||
{} | ||
``` |
22 changes: 22 additions & 0 deletions
22
...Multi_UpgradeAllAaveInstancesTo32/AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924.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,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol'; | ||
|
||
/** | ||
* @title Audit cost reimbursement | ||
* @author BGD labs | ||
* - Discussion: https://governance.aave.com/t/bgd-aave-v3-2-liquid-emodes/19037/4#p-48735-activation-stage-3 | ||
*/ | ||
contract AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924 is IProposalGenericExecutor { | ||
address public constant BGD_RECEIVER = 0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF; | ||
|
||
function execute() external { | ||
AaveV3Ethereum.COLLECTOR.transfer( | ||
AaveV3EthereumAssets.GHO_UNDERLYING, | ||
BGD_RECEIVER, | ||
76_000 ether | ||
); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...lti_UpgradeAllAaveInstancesTo32/AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924.t.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,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; | ||
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3TestBase.sol'; | ||
import {AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924} from './AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Ethereum_GHOBorrowRateUpdate_20240814 | ||
* command: FOUNDRY_PROFILE=mainnet forge test --match-path=src/20240924_Multi_UpgradeAllAaveInstancesTo32/AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924.t.sol -vv | ||
*/ | ||
contract AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924_Test is ProtocolV3TestBase { | ||
address public constant BGD_RECEIVER = 0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF; | ||
uint256 public constant AUDIT_COST = 76_000 ether; | ||
AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924 internal proposal; | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('mainnet'), 20872348); | ||
proposal = new AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924(); | ||
} | ||
|
||
/** | ||
* @dev executes the generic test suite including e2e and config snapshots | ||
*/ | ||
function test_defaultProposalExecution() public { | ||
uint256 collectorBalanceBefore = IERC20(AaveV3EthereumAssets.GHO_UNDERLYING).balanceOf( | ||
address(AaveV3Ethereum.COLLECTOR) | ||
); | ||
uint256 bgdBalanceBefore = IERC20(AaveV3EthereumAssets.GHO_UNDERLYING).balanceOf(BGD_RECEIVER); | ||
defaultTest( | ||
'AaveV3Ethereum_UpgradeAllAaveInstancesTo32_20240924', | ||
AaveV3Ethereum.POOL, | ||
address(proposal) | ||
); | ||
uint256 collectorBalanceAfter = IERC20(AaveV3EthereumAssets.GHO_UNDERLYING).balanceOf( | ||
address(AaveV3Ethereum.COLLECTOR) | ||
); | ||
uint256 bgdBalanceAfter = IERC20(AaveV3EthereumAssets.GHO_UNDERLYING).balanceOf(BGD_RECEIVER); | ||
assertEq(collectorBalanceBefore - AUDIT_COST, collectorBalanceAfter); | ||
assertEq(bgdBalanceBefore + AUDIT_COST, bgdBalanceAfter); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/20240924_Multi_UpgradeAllAaveInstancesTo32/UpgradeAllAaveInstancesTo32.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,70 @@ | ||
--- | ||
title: "Upgrade all Aave instances to 3.2" | ||
author: "BGD Labs @bgdlabs" | ||
discussions: "https://governance.aave.com/t/bgd-aave-v3-2-liquid-emodes/19037/3" | ||
snapshot: "https://snapshot.org/#/aave.eth/proposal/0x68ce69b5e71df1d77c2ad814a5d41162a40be54473576ff590d0b1bb5afde4a7" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
Upgrades all active Aave instances to Aave 3.2 which debuts "Liquid eModes" and fully deprecated stable borrowing. | ||
|
||
## Motivation | ||
|
||
EModes have been a powerful feature since the inception of Aave v3. | ||
Liquid eModes builds on this success by increase the flexibility in configuring eModes. With Liquid eModes it is now possible, to have a single asset be listed in multiple eModes. | ||
At the same time, it's possible to granularly control which assets are collateral and borrowable inside an eMode. | ||
|
||
Stable debt has been off-boarded from Aave v3 for quite some time. What was remaining on the protocol code were merely artifacts that increased gas consumption and code size. | ||
Therefore the 3.2 release removes these artifacts in a backwards compatible way. | ||
|
||
_In addition to the upgrade itself, the proposal payload includes reimbursement of $76’000 denominated in GHO, to cover the cost of extra external security procedures incurred._ | ||
|
||
## Specification | ||
|
||
Aave 3.2 focuses on two main areas of the aave protocol: | ||
|
||
- The final deprecation of stable borrowing | ||
- Improvements on the eModes, introducing "Liquid eModes" | ||
|
||
The proposal will execute to following operations on each active Aave v3 pool: | ||
|
||
- Upgrade the Pool/L2Pool implementation to 3.2, which will internally set the stableDebtToken address to `address(0)` on all assets | ||
- Upgrade the PoolConfigurator implementation to 3.2 | ||
- Deploy new ProtocolDataProvider compatible with v3.2, and set it on the addresses provider contract | ||
- Migrate all assets currently in eMode to be both borrowable & collateral in eMode | ||
- Migrate the InterestRateStrategy to a new version without stable rate calculations | ||
|
||
An additional payload will transfer `76,000.00` GHO to the BGD-controlled address `0xb812d0944f8F581DfAA3a93Dda0d22EcEf51A9CF`. | ||
|
||
## Security procedures | ||
|
||
In addition to unit tests & integration test suites, the changes have been audited in 5 audits by 4 independent auditors: | ||
|
||
### Stable Rate and Liquid eModes | ||
|
||
- [Certora](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/audits/2024-09-10_Certora_Aave-v3.2_Stable_Rate_Removal.pdf) | ||
- [Enigma Dark](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/audits/2024-09-30_Enigma_Aave-v3.2.pdf) | ||
|
||
### Liquid eModes | ||
|
||
- [Certora](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/audits/2024-09-19_Certora_Aave-v3.2_Liquid_eModes.pdf) | ||
- [Oxorio](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/audits/2024-09-12_Oxorio_Aav3-v3.2.pdf) | ||
- [Pashov](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/audits/2024-09-15_Pashov_Aave-v3.2.pdf) | ||
|
||
## References | ||
|
||
- [Payload Implementation](https://github.com/bgd-labs/protocol-v3.2-upgrade/blob/main/src/contracts/UpgradePayload.sol) | ||
- [New initialization logic of Pool](https://github.com/bgd-labs/protocol-v3.2-upgrade/blob/main/src/contracts/CustomInitialize.sol) | ||
- [New L1 pool implementation](https://github.com/bgd-labs/protocol-v3.2-upgrade/blob/main/src/contracts/PoolInstance.sol) | ||
- [New L2 pool implementation](https://github.com/bgd-labs/protocol-v3.2-upgrade/blob/main/src/contracts/L2PoolInstance.sol) | ||
- [Payload Tests](https://github.com/bgd-labs/protocol-v3.2-upgrade/tree/main/tests) | ||
- [Live-code and post execution state diffs](https://github.com/bgd-labs/protocol-v3.2-upgrade/tree/main/diffs) | ||
- [PoolDiff](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/docs/3.2/3.1_3.2_L2PoolDiff.md), [PoolConfiguratorDiff](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/docs/3.2/3.1-3.2_PoolConfiguratorDiff.md) | ||
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0x68ce69b5e71df1d77c2ad814a5d41162a40be54473576ff590d0b1bb5afde4a7) | ||
- [Discussion](https://governance.aave.com/t/bgd-aave-v3-2-liquid-emodes/19037/3) | ||
- [Migration guide](https://github.com/aave-dao/aave-v3-origin/blob/v3.2.0/docs/3.2/Aave-3.2-features.md) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
Oops, something went wrong.
42b67ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Foundry report
Build log
Test success 🌈