This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transfer Assets From Polygon To Ethereum Treasury (#339)
* almost ready for review, tests can be improved * remove unused imports * change from daiv2 to daiv3 * fix typo, check for event emission * change to daiv3 * check for bridge events * deploy payload & update test and script --------- Co-authored-by: defijesus.eth <[email protected]>
- Loading branch information
Showing
4 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...oEthereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.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,49 @@ | ||
// 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 {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); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...thereumTreasury/AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018.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,55 @@ | ||
// 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} 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; | ||
|
||
event Bridge(address token, uint256 amount); | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('polygon'), 49062641); | ||
proposal = AaveV3_Polygon_TransferAssetsFromPolygonToEthereumTreasury_20231018(0xCCAfBbbD68bb9B1A5F1C6ac948ED1944429F360a); | ||
} | ||
|
||
function testProposalExecution() public { | ||
address collector = address(AaveV2Polygon.COLLECTOR); | ||
|
||
uint256 daiAmount = 1_500_000 ether; | ||
|
||
uint256 daiCollectorBalanceBefore = IERC20(AaveV2PolygonAssets.DAI_A_TOKEN).balanceOf(collector); | ||
|
||
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); | ||
|
||
uint256 crvCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.CRV_A_TOKEN).balanceOf(collector); | ||
|
||
uint256 balCollectorBalanceAfter = IERC20(AaveV2PolygonAssets.BAL_A_TOKEN).balanceOf(collector); | ||
|
||
assertApproxEqRel(daiCollectorBalanceAfter, daiCollectorBalanceBefore - daiAmount, 0.001e18); | ||
assertLe(crvCollectorBalanceAfter, 10e18); | ||
assertLe(balCollectorBalanceAfter, 10e18); | ||
|
||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...lygonToEthereumTreasury/AaveV3_TransferAssetsFromPolygonToEthereumTreasury_20231018.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,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(0xCCAfBbbD68bb9B1A5F1C6ac948ED1944429F360a); | ||
GovHelpers.createProposal( | ||
payloads, | ||
GovHelpers.ipfsHashFile( | ||
vm, | ||
'src/20231018_AaveV3_Pol_TransferAssetsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.md' | ||
) | ||
); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...etsFromPolygonToEthereumTreasury/TransferAssetsFromPolygonToEthereumTreasury.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,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 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 | ||
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/). |
e069a04
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 🌈