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.
- Loading branch information
Showing
5 changed files
with
417 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery.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,39 @@ | ||
--- | ||
title: "3.2 patch for legacy periphery" | ||
author: "BGD Labs @bgdlabs" | ||
discussions: "https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/45" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
Upgrade the Pool contract across all networks, to add an extra fallback on the getReserveData() view function, allowing for integrators unable to update peripheral contracts (Aave Pool Data Provider) to still be compatible with v3.2. | ||
|
||
## Motivation | ||
|
||
Aave v3.2 included the removal of all the logic of stable rate borrow mode, and the release of a new ProtocolDataProvider maintaining retro-compatibility. | ||
|
||
However, post-release we have been contacted by integrators with totally immutable infrastructure depending on so-called “hardcoding” of legacy peripheral contracts, in this case, an old version of the ProtocolDataProvider, designed to be replaced on the core contract of Aave (PoolAddressesProvider) whenever an upgrade happens. | ||
|
||
Even if non-critical, this has created issues for those integrators, and from the Aave side, it is possible to increase even more the retro-compatibility by doing a simple upgrade on the Pool smart contract. | ||
|
||
## Specification | ||
|
||
The governance proposal will configure a MOCK_STABLE_DEBT variable on the PoolAddressesProvider, together with upgrading the Aave Pool contract across all networks. | ||
|
||
On this pool upgrade, the only modification would be to now return the previously configured MOCK_STABLE_DEBT address for stableDebtTokenAddress on Pool.getReserveData(), this way removing any type of unexpected behavior from integrators using legacy ProtocolDataProvider peripheral contracts, consuming getReserveData(). | ||
|
||
## Security considerations | ||
|
||
The proposal was tested via unit tests and Certora [checked the upgrade and proposal](https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/46). | ||
|
||
## References | ||
|
||
- [Proposal Implementation](https://github.com/bgd-labs/protocol-v3.2-pdp-patch/blob/main/src/contracts/UpgradePayload.sol) | ||
- [Protocol Upgrade Implementation](https://github.com/aave-dao/aave-v3-origin/pull/64) | ||
- [Tests](https://github.com/bgd-labs/protocol-v3.2-pdp-patch/tree/main/tests) | ||
- [Discussion](https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/45) | ||
- [Upgrade repository](https://github.com/bgd-labs/protocol-v3.2-pdp-patch) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
295 changes: 295 additions & 0 deletions
295
src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.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,295 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/src/GovV3Helpers.sol'; | ||
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; | ||
import {GovernanceV3ZkSync} from 'aave-address-book/GovernanceV3ZkSync.sol'; | ||
import {ChainIds, EthereumScript, PolygonScript, AvalancheScript, OptimismScript, ArbitrumScript, MetisScript, BaseScript, GnosisScript, ScrollScript, BNBScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; | ||
import {Payloads} from './Payloads.sol'; | ||
|
||
/** | ||
* @dev Deploy Ethereum | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployEthereum chain=mainnet | ||
* verify-command: FOUNDRY_PROFILE=mainnet npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/1/run-latest.json | ||
*/ | ||
contract DeployEthereum is EthereumScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.PROTO; | ||
address payload1 = Payloads.LIDO; | ||
address payload2 = Payloads.ETHERFI; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](3); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
actions[1] = GovV3Helpers.buildAction(payload1); | ||
actions[2] = GovV3Helpers.buildAction(payload2); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Polygon | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployPolygon chain=polygon | ||
* verify-command: FOUNDRY_PROFILE=polygon npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/137/run-latest.json | ||
*/ | ||
contract DeployPolygon is PolygonScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.POLYGON; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Avalanche | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployAvalanche chain=avalanche | ||
* verify-command: FOUNDRY_PROFILE=avalanche npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/43114/run-latest.json | ||
*/ | ||
contract DeployAvalanche is AvalancheScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.AVALANCHE; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Optimism | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployOptimism chain=optimism | ||
* verify-command: FOUNDRY_PROFILE=optimism npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/10/run-latest.json | ||
*/ | ||
contract DeployOptimism is OptimismScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.OPTIMISM; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Arbitrum | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployArbitrum chain=arbitrum | ||
* verify-command: FOUNDRY_PROFILE=arbitrum npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/42161/run-latest.json | ||
*/ | ||
contract DeployArbitrum is ArbitrumScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.ARBITRUM; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Metis | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployMetis chain=metis | ||
* verify-command: FOUNDRY_PROFILE=metis npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/1088/run-latest.json | ||
*/ | ||
contract DeployMetis is MetisScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.METIS; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Base | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployBase chain=base | ||
* verify-command: FOUNDRY_PROFILE=base npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/8453/run-latest.json | ||
*/ | ||
contract DeployBase is BaseScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.BASE; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Gnosis | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployGnosis chain=gnosis | ||
* verify-command: FOUNDRY_PROFILE=gnosis npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/100/run-latest.json | ||
*/ | ||
contract DeployGnosis is GnosisScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.GNOSIS; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy Scroll | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployScroll chain=scroll | ||
* verify-command: FOUNDRY_PROFILE=scroll npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/534352/run-latest.json | ||
*/ | ||
contract DeployScroll is ScrollScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.SCROLL; | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Deploy BNB | ||
* deploy-command: make deploy-ledger contract=src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:DeployBNB chain=bnb | ||
* verify-command: FOUNDRY_PROFILE=bnb npx catapulta-verify -b broadcast/32PatchForLegacyPeriphery_20241010.s.sol/56/run-latest.json | ||
*/ | ||
contract DeployBNB is BNBScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = Payloads.BNB; | ||
|
||
// 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/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery_20241010.s.sol:CreateProposal chain=mainnet | ||
*/ | ||
contract CreateProposal is EthereumScript { | ||
function run() external { | ||
// create payloads | ||
PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](11); | ||
|
||
// compose actions for validation | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](3); | ||
actionsEthereum[0] = GovV3Helpers.buildAction(Payloads.PROTO); | ||
actionsEthereum[1] = GovV3Helpers.buildAction(Payloads.LIDO); | ||
actionsEthereum[2] = GovV3Helpers.buildAction(Payloads.ETHERFI); | ||
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsPolygon = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsPolygon[0] = GovV3Helpers.buildAction(Payloads.POLYGON); | ||
payloads[1] = GovV3Helpers.buildPolygonPayload(vm, actionsPolygon); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsAvalanche = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsAvalanche[0] = GovV3Helpers.buildAction(Payloads.AVALANCHE); | ||
payloads[2] = GovV3Helpers.buildAvalanchePayload(vm, actionsAvalanche); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsOptimism = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsOptimism[0] = GovV3Helpers.buildAction(Payloads.OPTIMISM); | ||
payloads[3] = GovV3Helpers.buildOptimismPayload(vm, actionsOptimism); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsArbitrum = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsArbitrum[0] = GovV3Helpers.buildAction(Payloads.ARBITRUM); | ||
payloads[4] = GovV3Helpers.buildArbitrumPayload(vm, actionsArbitrum); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsMetis = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsMetis[0] = GovV3Helpers.buildAction(Payloads.METIS); | ||
payloads[5] = GovV3Helpers.buildMetisPayload(vm, actionsMetis); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsBase = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsBase[0] = GovV3Helpers.buildAction(Payloads.BASE); | ||
payloads[6] = GovV3Helpers.buildBasePayload(vm, actionsBase); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsGnosis = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsGnosis[0] = GovV3Helpers.buildAction(Payloads.GNOSIS); | ||
payloads[7] = GovV3Helpers.buildGnosisPayload(vm, actionsGnosis); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsScroll = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsScroll[0] = GovV3Helpers.buildAction(Payloads.SCROLL); | ||
payloads[8] = GovV3Helpers.buildScrollPayload(vm, actionsScroll); | ||
|
||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsBNB = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsBNB[0] = GovV3Helpers.buildAction(Payloads.BNB); | ||
payloads[9] = GovV3Helpers.buildBNBPayload(vm, actionsBNB); | ||
|
||
payloads[10] = PayloadsControllerUtils.Payload({ | ||
chain: ChainIds.ZKSYNC, | ||
accessLevel: PayloadsControllerUtils.AccessControl.Level_1, | ||
payloadsController: address(GovernanceV3ZkSync.PAYLOADS_CONTROLLER), | ||
payloadId: 7 | ||
}); | ||
|
||
// create proposal | ||
vm.startBroadcast(); | ||
GovV3Helpers.createProposal( | ||
vm, | ||
payloads, | ||
GovernanceV3Ethereum.VOTING_PORTAL_ETH_POL, | ||
GovV3Helpers.ipfsHashFile( | ||
vm, | ||
'src/20241010_Multi_32PatchForLegacyPeriphery/32PatchForLegacyPeriphery.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,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
library Payloads { | ||
address internal constant POLYGON = address(0x2Efe215aE82339fa059bb9d611E4cC858cfe9Df6); | ||
address internal constant GNOSIS = address(0xD410270dadBA6CAB0b3523136b79ab3a19CCecc8); | ||
address internal constant OPTIMISM = address(0xAdDb96Fb6A795faf042DD25BD4710267C41D1F74); | ||
address internal constant ARBITRUM = address(0xF5eA8A01d4e0456B605dC0f1EC4E401a8cA6397A); | ||
address internal constant AVALANCHE = address(0xA434D495249abE33E031Fe71a969B81f3c07950D); | ||
address internal constant BASE = address(0x29081f7aB5a644716EfcDC10D5c926c5fEe9F72B); | ||
address internal constant SCROLL = address(0x82dcCF206Ae2Ab46E2099e663F70DeE77caE7778); | ||
address internal constant BNB = address(0x3cd1dFB81C50A5300C60a181ED145a7286d81e0a); | ||
address internal constant PROTO = address(0x55c09b4Df32606667dBdF7dc846417bFb4Cec776); | ||
address internal constant ZKSYNC = address(0x449e788367f32a6E19C54557A4D36FA8bc4C2eB4); | ||
address internal constant METIS = address(0x61637B1EF7e9A102e50B661D3d7dbe19ef93347e); | ||
address internal constant LIDO = address(0xF4AbB0d80C1E5D4Be3dCd38a864AD5D8bFDe0ac3); | ||
address internal constant ETHERFI = address(0x56496FA0C8AB691dAe9632320963862108775ab2); | ||
} |
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,42 @@ | ||
import {ConfigFile} from '../../generator/types'; | ||
export const config: ConfigFile = { | ||
rootOptions: { | ||
author: 'BGD Labs @bgdlabs', | ||
pools: [ | ||
'AaveV3Ethereum', | ||
'AaveV3EthereumLido', | ||
'AaveV3EthereumEtherFi', | ||
'AaveV3Polygon', | ||
'AaveV3Avalanche', | ||
'AaveV3Optimism', | ||
'AaveV3Arbitrum', | ||
'AaveV3Metis', | ||
'AaveV3Base', | ||
'AaveV3Gnosis', | ||
'AaveV3Scroll', | ||
'AaveV3BNB', | ||
'AaveV3ZkSync', | ||
], | ||
title: '3.2 patch for legacy periphery', | ||
shortName: '32PatchForLegacyPeriphery', | ||
date: '20241010', | ||
discussion: 'https://governance.aave.com/t/bgd-technical-maintenance-proposals/15274/45', | ||
snapshot: '', | ||
votingNetwork: 'POLYGON', | ||
}, | ||
poolOptions: { | ||
AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 20934650}}, | ||
AaveV3EthereumLido: {configs: {OTHERS: {}}, cache: {blockNumber: 20934651}}, | ||
AaveV3EthereumEtherFi: {configs: {OTHERS: {}}, cache: {blockNumber: 20934651}}, | ||
AaveV3Polygon: {configs: {OTHERS: {}}, cache: {blockNumber: 62862189}}, | ||
AaveV3Avalanche: {configs: {OTHERS: {}}, cache: {blockNumber: 51598199}}, | ||
AaveV3Optimism: {configs: {OTHERS: {}}, cache: {blockNumber: 126478907}}, | ||
AaveV3Arbitrum: {configs: {OTHERS: {}}, cache: {blockNumber: 262322324}}, | ||
AaveV3Metis: {configs: {OTHERS: {}}, cache: {blockNumber: 18682620}}, | ||
AaveV3Base: {configs: {OTHERS: {}}, cache: {blockNumber: 20883624}}, | ||
AaveV3Gnosis: {configs: {OTHERS: {}}, cache: {blockNumber: 36432334}}, | ||
AaveV3Scroll: {configs: {OTHERS: {}}, cache: {blockNumber: 10034555}}, | ||
AaveV3BNB: {configs: {OTHERS: {}}, cache: {blockNumber: 42992248}}, | ||
AaveV3ZkSync: {configs: {OTHERS: {}}, cache: {blockNumber: 46260823}}, | ||
}, | ||
}; |
Oops, something went wrong.