From 12ab55eae31892105c50f6c18ae42bee20a02518 Mon Sep 17 00:00:00 2001 From: "defijesus.eth" Date: Thu, 19 Oct 2023 00:52:41 +0100 Subject: [PATCH 1/7] almost ready for review, tests can be improved --- ...FromPolygonToEthereumTreasury_20231018.sol | 51 ++++++++++++++++++ ...omPolygonToEthereumTreasury_20231018.t.sol | 52 +++++++++++++++++++ ...omPolygonToEthereumTreasury_20231018.s.sol | 34 ++++++++++++ ...sferAssetsFromPolygonToEthereumTreasury.md | 46 ++++++++++++++++ 4 files changed, 183 insertions(+) create mode 100644 src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol create mode 100644 src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol create mode 100644 src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol create mode 100644 src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol new file mode 100644 index 00000000..e6a68f81 --- /dev/null +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; +import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; +import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; +import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol'; +import {AaveMisc} from 'aave-address-book/AaveMisc.sol'; + + +interface IAavePolEthERC20Bridge { + function bridge(address token, uint256 amount) external; +} + +/** + * @title Transfer Assets From Polygon To Ethereum Treasury + * @author TokenLogic + * - Snapshot: https://snapshot.org/#/aave.eth/proposal/0x33def6fd7bc3424fc47256ec0abdc3b75235d6f123dc1d15be7349066bc86319 + * - Discussion: https://governance.aave.com/t/arfc-transfer-assets-from-polygon-to-ethereum-treasury/15044 + */ +contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 is + IProposalGenericExecutor +{ + + IAavePolEthERC20Bridge public constant BRIDGE = IAavePolEthERC20Bridge(AaveMisc.AAVE_POL_ETH_BRIDGE); + address public constant COLLECTOR = address(AaveV2Polygon.COLLECTOR); + + function execute() external { + uint256 daiAmount = 1_500_000 * 1e18; + uint256 crvAmount = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(COLLECTOR); + uint256 balAmount = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(COLLECTOR); + + AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.DAI_A_TOKEN, address(this), daiAmount); + AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.CRV_A_TOKEN, address(this), crvAmount); + AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.BAL_A_TOKEN, address(this), balAmount); + + + daiAmount = + AaveV2Polygon.POOL.withdraw(AaveV2PolygonAssets.DAI_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); + + crvAmount = + AaveV2Polygon.POOL.withdraw(AaveV2PolygonAssets.CRV_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); + + balAmount = + AaveV2Polygon.POOL.withdraw(AaveV2PolygonAssets.BAL_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); + + BRIDGE.bridge(AaveV2PolygonAssets.DAI_UNDERLYING, daiAmount); + BRIDGE.bridge(AaveV2PolygonAssets.CRV_UNDERLYING, crvAmount); + BRIDGE.bridge(AaveV2PolygonAssets.BAL_UNDERLYING, balAmount); + } +} \ No newline at end of file diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol new file mode 100644 index 00000000..e77fa69a --- /dev/null +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import 'forge-std/Test.sol'; +import {GovHelpers} from 'aave-helpers/GovHelpers.sol'; +import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol'; +import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; +import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018} from './AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol'; +import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; +import {AaveMisc} from 'aave-address-book/AaveMisc.sol'; + +/** + * @dev Test for AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 + * command: make test-contract filter=AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 + */ +contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018_Test is + ProtocolV3TestBase +{ + AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 internal proposal; + + function setUp() public { + vm.createSelectFork(vm.rpcUrl('polygon'), 48879417); + proposal = new AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018(); + } + + function testProposalExecution() public { + address collector = address(AaveV2Polygon.COLLECTOR); + address bridge = AaveMisc.AAVE_POL_ETH_BRIDGE; + + uint256 daiAmount = 1_500_000 ether; + uint256 daiCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); + + uint256 crvCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(collector); + + uint256 balCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(collector); + + GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.POLYGON_BRIDGE_EXECUTOR); + + uint256 daiCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); + + uint256 crvCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(collector); + + uint256 balCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(collector); + + assertApproxEqRel(daiCollectorBalanceAfter, daiCollectorBalanceBefore - daiAmount, 0.001e18); + /// >should be zero >isn't + // assertEq(crvCollectorBalanceAfter, 0); + // assertEq(balCollectorBalanceAfter, 0); + + } +} diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol new file mode 100644 index 00000000..0d40638a --- /dev/null +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {GovHelpers} from 'aave-helpers/GovHelpers.sol'; +import {EthereumScript, PolygonScript} from 'aave-helpers/ScriptUtils.sol'; +import {AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018} from './AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol'; + +/** + * @dev Deploy AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 + * command: make deploy-ledger contract=src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol:DeployPolygon chain=polygon + */ +contract DeployPolygon is PolygonScript { + function run() external broadcast { + new AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018(); + } +} + +/** + * @dev Create Proposal + * command: make deploy-ledger contract=src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol:CreateProposal chain=mainnet + */ +contract CreateProposal is EthereumScript { + function run() external broadcast { + GovHelpers.Payload[] memory payloads = new GovHelpers.Payload[](1); + payloads[0] = GovHelpers.buildPolygon(address(0)); // TODO + GovHelpers.createProposal( + payloads, + GovHelpers.ipfsHashFile( + vm, + 'src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md' + ) + ); + } +} diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md new file mode 100644 index 00000000..d278670b --- /dev/null +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md @@ -0,0 +1,46 @@ +--- +title: "Transfer Assets From Polygon To Ethereum Treasury" +author: "TokenLogic" +discussions: "https://governance.aave.com/t/arfc-transfer-assets-from-polygon-to-ethereum-treasury/15044" +--- + +## Simple Summary + +This publication proposes transferring BAL, CRV, and USDC from the Polygon Treasury to the Ethereum Treasury. + +## Motivation + +Recently, the Aave DAO has created the [GHO Liquidity Committee](https://governance.aave.com/t/arfc-treasury-manage-gho-liquidity-committee/14914), completed an [AURA tokenswap with Olyympus](https://governance.aave.com/t/arfc-treasury-management-acquire-aura/14683), and is also considering a [tokenswap with Aura Finance](https://snapshot.org/#/aave.eth/proposal/0x94735082d4ba33b53497efb025aa6dbf75a5e4ade71684fd675c03f0e416a294). Each of these proposals has already utilized or is likely to utilize stable coins held in the Ethereum Treasury: + +406,000 DAI - GHO Liquidity Committee +420,159.28 DAI - Olympus DAO token swap +600,000 USDC - Acquire AURA OTC with Aura Finance & AEF +Total of 1,426,159.28 stable coins +This publication proposes transferring 1.5M DAI from Polygon to Ethereum to replenish the stable coin reserves. + +Additionally, the Aave DAO’s BAL and CRV holdings will also be transferred from Polygon to Ethereum. These assets can then be integrated into the DAO’s broader strategy for managing these assets on Ethereum. + +To implement this proposal, the newly released [Aave Polygon-Mainnet ERC20Bridge](https://governance.aave.com/t/update-on-aave-swapper-and-strategic-asset-manager-contracts/14522/3) by Llama will be utilized. + +## Specification + +Using the transfer the following assets from the Polygon to Ethereum Treasury. + +- All BAL +- All CRV +- 1,500,000 DAI + +## References + +- Implementation: [Polygon](https://github.com/bgd-labs/aave-proposals/blob/main/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol) +- Tests: [Polygon](https://github.com/bgd-labs/aave-proposals/blob/main/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol) +- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0x33def6fd7bc3424fc47256ec0abdc3b75235d6f123dc1d15be7349066bc86319) +- [Discussion](https://governance.aave.com/t/arfc-transfer-assets-from-polygon-to-ethereum-treasury/15044) + +## Disclaimer + +TokenLogic receives no payment from beyond Aave protocol for the creation of this proposal. TokenLogic is a delegate within the Aave ecosystem. + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From 8bcf0e209f94b3619dda25c03d3eef563cb23250 Mon Sep 17 00:00:00 2001 From: "defijesus.eth" Date: Thu, 19 Oct 2023 14:43:02 +0100 Subject: [PATCH 2/7] remove unused imports --- ...gon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol | 1 - ...n_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol index e6a68f81..92b6ee08 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.0; import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; -import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol'; import {AaveMisc} from 'aave-address-book/AaveMisc.sol'; diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol index e77fa69a..952f7976 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol @@ -5,7 +5,7 @@ import 'forge-std/Test.sol'; import {GovHelpers} from 'aave-helpers/GovHelpers.sol'; import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol'; import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; -import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol'; +import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; import {AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018} from './AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol'; import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; import {AaveMisc} from 'aave-address-book/AaveMisc.sol'; From 68753cfe7f0484f7a93925af53605026f116d299 Mon Sep 17 00:00:00 2001 From: "defijesus.eth" Date: Mon, 23 Oct 2023 14:54:21 +0100 Subject: [PATCH 3/7] change from daiv2 to daiv3 --- ...FromPolygonToEthereumTreasury_20231018.sol | 6 +++--- ...omPolygonToEthereumTreasury_20231018.t.sol | 21 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol index 92b6ee08..1c866569 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.0; import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; +import {AaveV3Polygon, AaveV3PolygonAssets} from 'aave-address-book/AaveV3Polygon.sol'; import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; import {AaveMisc} from 'aave-address-book/AaveMisc.sol'; @@ -29,13 +30,12 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 is uint256 crvAmount = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(COLLECTOR); uint256 balAmount = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(COLLECTOR); - AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.DAI_A_TOKEN, address(this), daiAmount); + AaveV2Polygon.COLLECTOR.transfer(AaveV3PolygonAssets.DAI_A_TOKEN, address(this), daiAmount); AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.CRV_A_TOKEN, address(this), crvAmount); AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.BAL_A_TOKEN, address(this), balAmount); - daiAmount = - AaveV2Polygon.POOL.withdraw(AaveV2PolygonAssets.DAI_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); + AaveV3Polygon.POOL.withdraw(AaveV3PolygonAssets.DAI_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); crvAmount = AaveV2Polygon.POOL.withdraw(AaveV2PolygonAssets.CRV_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol index 952f7976..ea7c2615 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol @@ -5,6 +5,7 @@ import 'forge-std/Test.sol'; import {GovHelpers} from 'aave-helpers/GovHelpers.sol'; import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol'; import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; +import {AaveV3PolygonAssets} from 'aave-address-book/AaveV3Polygon.sol'; import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; import {AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018} from './AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol'; import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; @@ -20,33 +21,31 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018_Tes AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 internal proposal; function setUp() public { - vm.createSelectFork(vm.rpcUrl('polygon'), 48879417); + vm.createSelectFork(vm.rpcUrl('polygon'), 49058267); proposal = new AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018(); } function testProposalExecution() public { address collector = address(AaveV2Polygon.COLLECTOR); - address bridge = AaveMisc.AAVE_POL_ETH_BRIDGE; uint256 daiAmount = 1_500_000 ether; - uint256 daiCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); - - uint256 crvCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(collector); - - uint256 balCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(collector); + + vm.prank(0xD3C39cba6d3Afb3d304703F085Fc7A8249576C18); + IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).transfer(collector, daiAmount); + + uint256 daiCollectorBalanceBefore = IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).balanceOf(collector); GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.POLYGON_BRIDGE_EXECUTOR); - uint256 daiCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); + uint256 daiCollectorBalanceAfter = IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).balanceOf(collector); uint256 crvCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(collector); uint256 balCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(collector); assertApproxEqRel(daiCollectorBalanceAfter, daiCollectorBalanceBefore - daiAmount, 0.001e18); - /// >should be zero >isn't - // assertEq(crvCollectorBalanceAfter, 0); - // assertEq(balCollectorBalanceAfter, 0); + assertLe(crvCollectorBalanceAfter, 10e18); + assertLe(balCollectorBalanceAfter, 10e18); } } From 417a8589770bca27b64aa148029f6d7e4efdd552 Mon Sep 17 00:00:00 2001 From: "defijesus.eth" Date: Mon, 23 Oct 2023 15:08:12 +0100 Subject: [PATCH 4/7] fix typo, check for event emission --- ..._TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol | 3 ++- .../TransferAssetsFromPolygonToEthereumTreasury.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol index ea7c2615..1e591cb7 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol @@ -34,7 +34,8 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018_Tes IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).transfer(collector, daiAmount); uint256 daiCollectorBalanceBefore = IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).balanceOf(collector); - + + vm.expectEmit(AaveMisc.AAVE_POL_ETH_BRIDGE); GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.POLYGON_BRIDGE_EXECUTOR); uint256 daiCollectorBalanceAfter = IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).balanceOf(collector); diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md index d278670b..ffec2b45 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md @@ -10,7 +10,7 @@ This publication proposes transferring BAL, CRV, and USDC from the Polygon Treas ## Motivation -Recently, the Aave DAO has created the [GHO Liquidity Committee](https://governance.aave.com/t/arfc-treasury-manage-gho-liquidity-committee/14914), completed an [AURA tokenswap with Olyympus](https://governance.aave.com/t/arfc-treasury-management-acquire-aura/14683), and is also considering a [tokenswap with Aura Finance](https://snapshot.org/#/aave.eth/proposal/0x94735082d4ba33b53497efb025aa6dbf75a5e4ade71684fd675c03f0e416a294). Each of these proposals has already utilized or is likely to utilize stable coins held in the Ethereum Treasury: +Recently, the Aave DAO has created the [GHO Liquidity Committee](https://governance.aave.com/t/arfc-treasury-manage-gho-liquidity-committee/14914), completed an [AURA tokenswap with Olympus](https://governance.aave.com/t/arfc-treasury-management-acquire-aura/14683), and is also considering a [tokenswap with Aura Finance](https://snapshot.org/#/aave.eth/proposal/0x94735082d4ba33b53497efb025aa6dbf75a5e4ade71684fd675c03f0e416a294). Each of these proposals has already utilized or is likely to utilize stable coins held in the Ethereum Treasury: 406,000 DAI - GHO Liquidity Committee 420,159.28 DAI - Olympus DAO token swap From 412f1150aa7088c57082a68c2bf1c78c9c1fe537 Mon Sep 17 00:00:00 2001 From: "defijesus.eth" Date: Mon, 23 Oct 2023 16:02:39 +0100 Subject: [PATCH 5/7] change to daiv3 --- ...ferAssetsFromPolygonToEthereumTreasury_20231018.sol | 5 ++--- ...rAssetsFromPolygonToEthereumTreasury_20231018.t.sol | 10 +++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol index 1c866569..382c6394 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.0; import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; -import {AaveV3Polygon, AaveV3PolygonAssets} from 'aave-address-book/AaveV3Polygon.sol'; import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; import {AaveMisc} from 'aave-address-book/AaveMisc.sol'; @@ -30,12 +29,12 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 is uint256 crvAmount = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(COLLECTOR); uint256 balAmount = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(COLLECTOR); - AaveV2Polygon.COLLECTOR.transfer(AaveV3PolygonAssets.DAI_A_TOKEN, address(this), daiAmount); + AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.DAI_A_TOKEN, address(this), daiAmount); AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.CRV_A_TOKEN, address(this), crvAmount); AaveV2Polygon.COLLECTOR.transfer(AaveV2PolygonAssets.BAL_A_TOKEN, address(this), balAmount); daiAmount = - AaveV3Polygon.POOL.withdraw(AaveV3PolygonAssets.DAI_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); + AaveV2Polygon.POOL.withdraw(AaveV2PolygonAssets.DAI_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); crvAmount = AaveV2Polygon.POOL.withdraw(AaveV2PolygonAssets.CRV_UNDERLYING, type(uint256).max, AaveMisc.AAVE_POL_ETH_BRIDGE); diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol index 1e591cb7..15274665 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol @@ -5,7 +5,6 @@ import 'forge-std/Test.sol'; import {GovHelpers} from 'aave-helpers/GovHelpers.sol'; import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol'; import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; -import {AaveV3PolygonAssets} from 'aave-address-book/AaveV3Polygon.sol'; import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; import {AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018} from './AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.sol'; import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; @@ -30,15 +29,12 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018_Tes uint256 daiAmount = 1_500_000 ether; - vm.prank(0xD3C39cba6d3Afb3d304703F085Fc7A8249576C18); - IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).transfer(collector, daiAmount); + uint256 daiCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); - uint256 daiCollectorBalanceBefore = IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).balanceOf(collector); - - vm.expectEmit(AaveMisc.AAVE_POL_ETH_BRIDGE); + // vm.expectEmit(AaveMisc.AAVE_POL_ETH_BRIDGE); GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.POLYGON_BRIDGE_EXECUTOR); - uint256 daiCollectorBalanceAfter = IERC20(AaveV3PolygonAssets.DAI_A_TOKEN).balanceOf(collector); + uint256 daiCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); uint256 crvCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(collector); From fc5814fd0325e9f511d6444bbb98f6841fc16705 Mon Sep 17 00:00:00 2001 From: "defijesus.eth" Date: Mon, 23 Oct 2023 16:18:34 +0100 Subject: [PATCH 6/7] check for bridge events --- ...ferAssetsFromPolygonToEthereumTreasury_20231018.t.sol | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol index 15274665..d2631509 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol @@ -19,6 +19,8 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018_Tes { AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018 internal proposal; + event Bridge(address token, uint256 amount); + function setUp() public { vm.createSelectFork(vm.rpcUrl('polygon'), 49058267); proposal = new AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018(); @@ -31,7 +33,12 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018_Tes uint256 daiCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); - // vm.expectEmit(AaveMisc.AAVE_POL_ETH_BRIDGE); + vm.expectEmit(true, true, false, false, AaveMisc.AAVE_POL_ETH_BRIDGE); + emit Bridge(AaveV2PolygonAssets.DAI_UNDERLYING, daiAmount); + vm.expectEmit(true, true, false, false, AaveMisc.AAVE_POL_ETH_BRIDGE); + emit Bridge(AaveV2PolygonAssets.CRV_UNDERLYING, 9514859900351685761386); + vm.expectEmit(true, true, false, false, AaveMisc.AAVE_POL_ETH_BRIDGE); + emit Bridge(AaveV2PolygonAssets.BAL_UNDERLYING, 1867915444013591329250); GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.POLYGON_BRIDGE_EXECUTOR); uint256 daiCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); From 772d9ee054d15c9fc370817213569c5e697cd109 Mon Sep 17 00:00:00 2001 From: "defijesus.eth" Date: Mon, 23 Oct 2023 17:28:43 +0100 Subject: [PATCH 7/7] deploy payload & update test and script --- ...TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol | 4 ++-- ...TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol index d2631509..231c7ff2 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.t.sol @@ -22,8 +22,8 @@ contract AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018_Tes event Bridge(address token, uint256 amount); function setUp() public { - vm.createSelectFork(vm.rpcUrl('polygon'), 49058267); - proposal = new AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018(); + vm.createSelectFork(vm.rpcUrl('polygon'), 49062641); + proposal = AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018(0xCCAfBbbD68bb9B1A5F1C6ac948ED1944429F360a); } function testProposalExecution() public { diff --git a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol index 0d40638a..854ad3a8 100644 --- a/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol +++ b/src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.s.sol @@ -22,7 +22,7 @@ contract DeployPolygon is PolygonScript { contract CreateProposal is EthereumScript { function run() external broadcast { GovHelpers.Payload[] memory payloads = new GovHelpers.Payload[](1); - payloads[0] = GovHelpers.buildPolygon(address(0)); // TODO + payloads[0] = GovHelpers.buildPolygon(0xCCAfBbbD68bb9B1A5F1C6ac948ED1944429F360a); GovHelpers.createProposal( payloads, GovHelpers.ipfsHashFile(