Skip to content

Commit

Permalink
feat: update README with better description and easier migration on p…
Browse files Browse the repository at this point in the history
…ayload
  • Loading branch information
efecarranza committed Nov 23, 2023
1 parent ecdf165 commit 52d282a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 50 deletions.
18 changes: 9 additions & 9 deletions src/20231102_Multi_AaveFundingUpdates/AaveFundingUpdates.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ However, with the emergence of new service provider proposal expected, the DAO n

## Specification

- Deposit 1M units of DAI from Treasury into Aave v3
- Migrate all aDAI from Aave v2 to v3
- Deposit 1M units of DAI from treasury (Aave V3 Ethereum Collector) into Aave v3 Ethereum
- Migrate all aDAI from Aave v2 Ethereum to Aave v3 Ethereum

- Redeem and transfer 1.7M USDC to Ethereum Treasury
- Redeem and transfer 0.5M DAI to Ethereum Treasury
- Redeem and transfer 0.75M USDT to Ethereum Treasury
- Redeem from Aave v2 Polygon 1.7M USDC and bridge to Ethereum treasury
- Redeem from Aave v2 Polygon 0.5M DAI and bridge to Ethereum treasury
- Redeem from Aave v2 Polygon 0.75M USDT and bridge to Ethereum treasury

Swap the following asset holdings to GHO:
Swap the following asset holdings to GHO on Ethereum mainnet:

- All available aTUSD that can be redeemed (57,373.85 units at time of writing)
- 500k units of DAI held in Treasury (received from Polygon bridge)
- All available aBUSD (~42500 units at time of writing)
- 500k units of DAI held in treasury (received from previous Polygon bridge)
- All available aBUSD (~42,500 units at time of writing)

Swap the following asset holdings to USDC (there is no GHO / ETH oracle thus these tokens cannot be swapped to GHO directly):
Swap the following asset holdings on Ethereum treasury to USDC (there is no GHO / ETH oracle thus these tokens cannot be swapped to GHO directly, they are Aave v2 Assets with no Aave v3 equivalent oracle):

- All GUSD (18,464.03 units at time of writing)
- All UST (893,257.63 units at time of writing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102 is IProposalGenericExecutor
address public constant TUSD_USD_FEED = 0xec746eCF986E2927Abd291a2A1716c940100f8Ba;
address public constant BUSD_USD_FEED = 0x833D8Eb16D306ed1FbB5D7A2E019e106B960965A;

// https://etherscan.io/address/0x3f12643D3f6f874d39C2a4c9f2Cd6f2DbAC877FC
address public constant GHO_ORACLE = 0x3f12643D3f6f874d39C2a4c9f2Cd6f2DbAC877FC;

function execute() external {
_migration();
_swaps();
Expand All @@ -53,30 +56,29 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102 is IProposalGenericExecutor
0
);

// Migration
address[] memory toMigrate = new address[](1);
toMigrate[0] = AaveV2EthereumAssets.DAI_UNDERLYING;

IMigrationHelper.RepaySimpleInput[] memory toRepay = new IMigrationHelper.RepaySimpleInput[](0);
IMigrationHelper.PermitInput[] memory permits = new IMigrationHelper.PermitInput[](0);
IMigrationHelper.CreditDelegationInput[]
memory creditDelegationPermits = new IMigrationHelper.CreditDelegationInput[](0);

// Migrate all aDAI from Aave v2 to v3
uint256 amountDAI = IERC20(AaveV2EthereumAssets.DAI_A_TOKEN).balanceOf(
address(AaveV3Ethereum.COLLECTOR)
AaveV3Ethereum.COLLECTOR.transfer(
AaveV2EthereumAssets.DAI_A_TOKEN,
address(this),
IERC20(AaveV2EthereumAssets.DAI_A_TOKEN).balanceOf(address(AaveV3Ethereum.COLLECTOR))
);
AaveV3Ethereum.COLLECTOR.transfer(AaveV2EthereumAssets.DAI_A_TOKEN, address(this), amountDAI);
IERC20(AaveV2EthereumAssets.DAI_A_TOKEN).forceApprove(
AaveV2Ethereum.MIGRATION_HELPER,
amountDAI
AaveV2Ethereum.POOL.withdraw(
AaveV2EthereumAssets.DAI_UNDERLYING,
type(uint256).max,
address(this)
);

MIGRATION.migrate(toMigrate, toRepay, permits, creditDelegationPermits);
uint256 amountDai = IERC20(AaveV2EthereumAssets.DAI_UNDERLYING).balanceOf(address(this));
IERC20(AaveV2EthereumAssets.DAI_UNDERLYING).forceApprove(
address(AaveV3Ethereum.POOL),
amountDai
);

IERC20(AaveV3EthereumAssets.DAI_A_TOKEN).safeTransfer(
AaveV3Ethereum.POOL.deposit(
AaveV3EthereumAssets.DAI_UNDERLYING,
amountDai,
address(AaveV3Ethereum.COLLECTOR),
IERC20(AaveV3EthereumAssets.DAI_A_TOKEN).balanceOf(address(this))
0
);
}

Expand All @@ -93,7 +95,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102 is IProposalGenericExecutor
AaveV3EthereumAssets.DAI_UNDERLYING,
AaveV3EthereumAssets.GHO_UNDERLYING,
AaveV3EthereumAssets.DAI_ORACLE,
AaveV3EthereumAssets.GHO_ORACLE,
GHO_ORACLE,
address(AaveV3Ethereum.COLLECTOR),
DAI_TO_SWAP,
100
Expand Down Expand Up @@ -138,7 +140,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102 is IProposalGenericExecutor
AaveV2EthereumAssets.TUSD_UNDERLYING,
AaveV3EthereumAssets.GHO_UNDERLYING,
TUSD_USD_FEED,
AaveV3EthereumAssets.GHO_ORACLE,
GHO_ORACLE,
address(AaveV3Ethereum.COLLECTOR),
IERC20(AaveV2EthereumAssets.TUSD_UNDERLYING).balanceOf(address(SWAPPER)),
300
Expand All @@ -161,7 +163,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102 is IProposalGenericExecutor
AaveV2EthereumAssets.BUSD_UNDERLYING,
AaveV3EthereumAssets.GHO_UNDERLYING,
BUSD_USD_FEED,
AaveV3EthereumAssets.GHO_ORACLE,
GHO_ORACLE,
address(AaveV3Ethereum.COLLECTOR),
IERC20(AaveV2EthereumAssets.BUSD_UNDERLYING).balanceOf(address(SWAPPER)),
300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102_Test is ProtocolV3TestBase {
0
);

uint256 balanceATusdBefore = IERC20(AaveV2EthereumAssets.TUSD_A_TOKEN).balanceOf(address(AaveV3Ethereum.COLLECTOR));
assertGt(
balanceATusdBefore,
0
uint256 balanceATusdBefore = IERC20(AaveV2EthereumAssets.TUSD_A_TOKEN).balanceOf(
address(AaveV3Ethereum.COLLECTOR)
);
assertGt(balanceATusdBefore, 0);

uint256 balanceABusdBefore = IERC20(AaveV2EthereumAssets.BUSD_A_TOKEN).balanceOf(address(AaveV3Ethereum.COLLECTOR));
assertGt(
balanceABusdBefore,
0
uint256 balanceABusdBefore = IERC20(AaveV2EthereumAssets.BUSD_A_TOKEN).balanceOf(
address(AaveV3Ethereum.COLLECTOR)
);
assertGt(balanceABusdBefore, 0);

assertGt(
IERC20(AaveV2EthereumAssets.GUSD_UNDERLYING).balanceOf(address(AaveV3Ethereum.COLLECTOR)),
Expand All @@ -73,7 +71,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102_Test is ProtocolV3TestBase {
AaveV3EthereumAssets.DAI_UNDERLYING,
AaveV3EthereumAssets.GHO_UNDERLYING,
AaveV3EthereumAssets.DAI_ORACLE,
AaveV3EthereumAssets.GHO_ORACLE,
proposal.GHO_ORACLE(),
proposal.DAI_TO_SWAP(),
address(AaveV3Ethereum.COLLECTOR),
100
Expand All @@ -97,7 +95,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102_Test is ProtocolV3TestBase {
AaveV2EthereumAssets.TUSD_UNDERLYING,
AaveV3EthereumAssets.GHO_UNDERLYING,
proposal.TUSD_USD_FEED(),
AaveV3EthereumAssets.GHO_ORACLE,
proposal.GHO_ORACLE(),
IERC20(AaveV2EthereumAssets.TUSD_UNDERLYING).balanceOf(address(AaveV2Ethereum.COLLECTOR)),
address(AaveV3Ethereum.COLLECTOR),
300
Expand All @@ -109,7 +107,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102_Test is ProtocolV3TestBase {
AaveV2EthereumAssets.BUSD_UNDERLYING,
AaveV3EthereumAssets.GHO_UNDERLYING,
proposal.BUSD_USD_FEED(),
AaveV3EthereumAssets.GHO_ORACLE,
proposal.GHO_ORACLE(),
IERC20(AaveV2EthereumAssets.BUSD_UNDERLYING).balanceOf(address(AaveV2Ethereum.COLLECTOR)),
address(AaveV3Ethereum.COLLECTOR),
300
Expand Down Expand Up @@ -165,10 +163,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102_Test is ProtocolV3TestBase {
0
);

assertEq(
IERC20(AaveV3EthereumAssets.DAI_UNDERLYING).balanceOf(address(proposal.SWAPPER())),
0
);
assertEq(IERC20(AaveV3EthereumAssets.DAI_UNDERLYING).balanceOf(address(proposal.SWAPPER())), 0);

assertEq(
IERC20(AaveV2EthereumAssets.TUSD_UNDERLYING).balanceOf(address(proposal.SWAPPER())),
Expand All @@ -180,10 +175,7 @@ contract AaveV3Ethereum_AaveFundingUpdates_20231102_Test is ProtocolV3TestBase {
0
);

assertEq(
IERC20(AaveV2EthereumAssets.UST_UNDERLYING).balanceOf(address(proposal.SWAPPER())),
0
);
assertEq(IERC20(AaveV2EthereumAssets.UST_UNDERLYING).balanceOf(address(proposal.SWAPPER())), 0);

assertEq(
IERC20(AaveV2EthereumAssets.GUSD_UNDERLYING).balanceOf(address(proposal.SWAPPER())),
Expand Down

0 comments on commit 52d282a

Please sign in to comment.