You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* In v3.3, reserves had an `unbacked` storage slot which was unused. In v3.4, this feature is removed.
21
-
* The `virtualUnderlyingBalance` slot (previously `__deprecatedVirtualUnderlyingBalance`) is moved into the storage slot previously occupied by `unbacked` for gas optimization.
22
-
***Action:** The `initialize` function within the new `Pool` implementations (`PoolInstanceWithCustomInitialize`, `L2PoolInstanceWithCustomInitialize`), using the `CustomInitialize._initialize` library function, iterates through all reserves upon the first initialization after the upgrade. It copies the value from the old `__deprecatedVirtualUnderlyingBalance` slot to the new `virtualUnderlyingBalance` slot and zeroes out the old slot.
20
+
21
+
- In v3.3, reserves had an `unbacked` storage slot which was unused. In v3.4, this feature is removed.
22
+
- The `virtualUnderlyingBalance` slot (previously `__deprecatedVirtualUnderlyingBalance`) is moved into the storage slot previously occupied by `unbacked` for gas optimization.
23
+
-**Action:** The `initialize` function within the new `Pool` implementations (`PoolInstanceWithCustomInitialize`, `L2PoolInstanceWithCustomInitialize`), using the `CustomInitialize._initialize` library function, iterates through all reserves upon the first initialization after the upgrade. It copies the value from the old `__deprecatedVirtualUnderlyingBalance` slot to the new `virtualUnderlyingBalance` slot and zeroes out the old slot.
23
24
24
25
2.**Flashloan Premium Capture:**
25
-
* The `FLASHLOAN_PREMIUM_TO_PROTOCOL` becomes a constant (100_00) in the v3.4 `Pool` implementation.
26
-
***Action:** The `PoolConfiguratorWithCustomInitialize` implementation, which is set *before* the Pool is upgraded, reads the *old* dynamic value from the v3.3 Pool via `_pool.FLASHLOAN_PREMIUM_TO_PROTOCOL()` during its `initialize` function and emits an event (`FlashloanPremiumToProtocolUpdated`) if it differs from the new constant value. This ensures the old value is recorded before it becomes inaccessible.
26
+
27
+
- The `FLASHLOAN_PREMIUM_TO_PROTOCOL` becomes a constant (100_00) in the v3.4 `Pool` implementation.
28
+
-**Action:** The `PoolConfiguratorWithCustomInitialize` implementation, which is set _before_ the Pool is upgraded, reads the _old_ dynamic value from the v3.3 Pool via `_pool.FLASHLOAN_PREMIUM_TO_PROTOCOL()` during its `initialize` function and emits an event (`FlashloanPremiumToProtocolUpdated`) if it differs from the new constant value. This ensures the old value is recorded before it becomes inaccessible.
27
29
28
30
3.**Deprecated Storage Cleanup (GHO Tokens on Mainnet):**
29
-
* The v3.3 `aGHO` and `vGHO` contracts contained specific storage variables (`ghoVariableDebtToken`, `ghoTreasury` in aToken; `ghoAToken`, `discountToken`, `discountRateStrategy` in vToken) that are not present in standard tokens or the v3.4 GHO tokens.
30
-
***Action:**
31
-
* The custom `ATokenMainnetInstanceGHO` implementation's `resolveFacilitator` function (called during the GHO migration) explicitly deletes the deprecated aToken storage slots.
32
-
* The custom `VariableDebtTokenMainnetInstanceGHO` implementation's `initialize` function explicitly deletes the deprecated vToken storage slots.
33
-
* This cleanup prevents potential storage collisions if future Aave versions add new variables at these storage slots for standard tokens.
31
+
- The v3.3 `aGHO` and `vGHO` contracts contained specific storage variables (`ghoVariableDebtToken`, `ghoTreasury` in aToken; `ghoAToken`, `discountToken`, `discountRateStrategy` in vToken) that are not present in standard tokens or the v3.4 GHO tokens.
32
+
-**Action:**
33
+
- The custom `ATokenMainnetInstanceGHO` implementation's `resolveFacilitator` function (called during the GHO migration) explicitly deletes the deprecated aToken storage slots.
34
+
- The custom `VariableDebtTokenMainnetInstanceGHO` implementation's `initialize` function explicitly deletes the deprecated vToken storage slots.
35
+
- This cleanup prevents potential storage collisions if future Aave versions add new variables at these storage slots for standard tokens.
34
36
35
37
## General Upgrade Sequence (via `UpgradePayload`)
36
38
@@ -40,33 +42,35 @@ This sequence applies to most networks (Polygon, Optimism, Arbitrum, etc.).
40
42
2.**Upgrade Pool Implementation:** The `Pool` contract is updated to the new `PoolInstanceWithCustomInitialize` implementation (or `L2PoolInstanceWithCustomInitialize` in L2 networks). The `initialize` function of this new pool handles the `virtualUnderlyingBalance` storage migration.
41
43
3.**Set New PoolDataProvider:** The `PoolAddressesProvider` is updated to point to the new `AaveProtocolDataProvider` implementation.
42
44
4.**Update AToken/VariableDebtToken Implementations:** The payload iterates through all reserves listed in the Pool:
43
-
* For each reserve, it calls `POOL_CONFIGURATOR.updateAToken` to upgrade the reserve's AToken proxy to the new standard `ATokenInstance` implementation (`A_TOKEN_IMPL`).
44
-
* It then calls `POOL_CONFIGURATOR.updateVariableDebtToken` to upgrade the reserve's VariableDebtToken proxy to the new standard `VariableDebtTokenInstance` implementation (`V_TOKEN_IMPL`).
45
+
- For each reserve, it calls `POOL_CONFIGURATOR.updateAToken` to upgrade the reserve's AToken proxy to the new standard `ATokenInstance` implementation (`A_TOKEN_IMPL`).
46
+
- It then calls `POOL_CONFIGURATOR.updateVariableDebtToken` to upgrade the reserve's VariableDebtToken proxy to the new standard `VariableDebtTokenInstance` implementation (`V_TOKEN_IMPL`).
This sequence includes the general steps plus specific GHO migration steps, executed in a precise order after the `UpgradePayloadMainnet` contract is deployed.
49
51
50
52
**Pre-Execution Step (Payload Constructor):**
51
53
52
-
***Deploy and Initialize New Facilitator:** The new `GhoDirectMinter` proxy contract (`FACILITATOR`) is deployed and initialized using the `TransparentProxyFactory` within the `constructor` of the `UpgradePayloadMainnet` contract. Its implementation, admin, owner (Executor LVL 1), and council are set during this deployment process.
54
+
-**Deploy and Initialize New Facilitator:** The new `GhoDirectMinter` proxy contract (`FACILITATOR`) is deployed and initialized using the `TransparentProxyFactory` within the `constructor` of the `UpgradePayloadMainnet` contract. Its implementation, admin, owner (Executor LVL 1), and council are set during this deployment process.
1.**Grant Facilitator Risk Admin:** The `ACL_MANAGER` grants the `RISK_ADMIN` role to the `GhoDirectMinter` contract (`FACILITATOR`). This allows it to call `setSupplyCap` by the `GhoDirectMinter` contract.
57
59
2.**Add New Facilitator to GhoToken:**
58
-
* The current GHO bucket capacity and level of the old `aGHO` facilitator are fetched from the `GhoToken`.
59
-
* The new `GhoDirectMinter` (`FACILITATOR`) is added as a GHO facilitator in the `GhoToken` contract (`IGhoToken(...).addFacilitator(...)`) using the fetched capacity.
60
+
- The current GHO bucket capacity and level of the old `aGHO` facilitator are fetched from the `GhoToken`.
61
+
- The new `GhoDirectMinter` (`FACILITATOR`) is added as a GHO facilitator in the `GhoToken` contract (`IGhoToken(...).addFacilitator(...)`) using the fetched capacity.
60
62
3.**Distribute Old aGHO Fees:**`IOldATokenMainnetInstanceGHO(AaveV3EthereumAssets.GHO_A_TOKEN).distributeFeesToTreasury()` is called to send any accumulated GHO fees in the old aToken contract to the treasury. It is required step to make the balance of the `GHO_A_TOKEN` equal to zero.
61
63
4.**Upgrade PoolConfigurator Implementation:** The `PoolConfigurator` contract is updated to the new `PoolConfiguratorWithCustomInitialize` implementation.
62
64
5.**Upgrade aGHO to Custom Intermediate Implementation:**`POOL_CONFIGURATOR.updateAToken` is called for the GHO asset, setting its implementation to the custom `ATokenMainnetInstanceGHO` (`A_TOKEN_GHO_IMPL`). This implementation includes the `resolveFacilitator` function and storage cleanup logic.
63
65
6.**Mint and Supply by New Facilitator:** The `mintAndSupply` function of the new `GhoDirectMinter` (`FACILITATOR`) is called, minting GHO equal to the old `aGHO` facilitator's `level` and supplying it to the Aave pool, receiving `aGHO` tokens.
64
-
7.**Resolve Old Facilitator:**`IATokenMainnetInstanceGHO(AaveV3EthereumAssets.GHO_A_TOKEN).resolveFacilitator(level)` is called. This function on the *custom*`aGHO` implementation burns the underlying GHO token amount equal to `level` (balancing the mint in step 6) and clears the deprecated storage slots within the `aGHO` contract proxy's storage.
66
+
7.**Resolve Old Facilitator:**`IATokenMainnetInstanceGHO(AaveV3EthereumAssets.GHO_A_TOKEN).resolveFacilitator(level)` is called. This function on the _custom_`aGHO` implementation burns the underlying GHO token amount equal to `level` (balancing the mint in step 6) and clears the deprecated storage slots within the `aGHO` contract proxy's storage.
65
67
8.**Remove Old Facilitator:**`IGhoToken(AaveV3EthereumAssets.GHO_UNDERLYING).removeFacilitator(AaveV3EthereumAssets.GHO_A_TOKEN)` is called. Since its level is now 0 (due to the burn in step 7), the old `aGHO` contract is successfully removed as a facilitator from the `GhoToken`.
10.**Set GHO Supply Cap:**`POOL_CONFIGURATOR.setSupplyCap` sets GHO's supply cap to 1 wei, effectively preventing user GHO deposits.
68
70
11.**Execute Default Upgrade Steps:** The `_defaultUpgrade()` function is called, performing steps 2, 3, and 4 from the "General Upgrade Sequence" above (Upgrade Pool Impl, Set Data Provider, Update standard A/V Tokens), skipping GHO and AAVE tokens as specified by the overridden `_needToUpdateReserve`.
69
71
12.**Upgrade vGHO to Custom Implementation:**`POOL_CONFIGURATOR.updateVariableDebtToken` is called for GHO, setting its implementation to the custom `VariableDebtTokenMainnetInstanceGHO` (`V_TOKEN_GHO_IMPL`). This version includes storage cleanup and a no-op `updateDiscountDistribution` function for compatibility.
70
72
13.**Upgrade aAAVE Implementation:**`POOL_CONFIGURATOR.updateAToken` updates the AAVE AToken to the `ATokenWithDelegationInstance` (`A_TOKEN_WITH_DELEGATION_IMPL`).
71
73
14.**Upgrade vAAVE Implementation:**`POOL_CONFIGURATOR.updateVariableDebtToken` updates the AAVE VariableDebtToken to the standard `VariableDebtTokenInstance` (`V_TOKEN_IMPL`).
72
-
15.**Enable GHO Flashloaning:**`POOL_CONFIGURATOR.setReserveFlashLoaning` enables flash loans for the GHO reserve.
74
+
15.**Enable GHO Flashloaning:**`POOL_CONFIGURATOR.setReserveFlashLoaning` enables flash loans for the GHO reserve.
75
+
16.**Mint GHO to the pool:** Calling the `mintAndSupply` function once again to mint the remaining(non borrowed) capacity as supply on the pool.
76
+
17.**Add stewards permissions:** Calling `setControlledFacilitator` on the bucket facilitator migrate permissions to the new facilitator.
0 commit comments