forked from bgd-labs/aave-proposals-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
16 changed files
with
829 additions
and
0 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
...art2/AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.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,93 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; | ||
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol'; | ||
import {AaveSwapper} from 'aave-helpers/swaps/AaveSwapper.sol'; | ||
import {DepositV3SwapPayload} from 'aave-helpers/swaps/DepositV3SwapPayload.sol'; | ||
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; | ||
|
||
/** | ||
* @title Treasury Management - GSM Funding & RWA Strategy Preparations (Part 2) | ||
* @author karpatkey_TokenLogic | ||
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xb39537e468eef8c212c67a539cdc6d802cd857f186a4f66aefd44faaadd6ba19 | ||
* - Discussion: https://governance.aave.com/t/arfc-treasury-management-gsm-funding-rwa-strategy-preparations/16128 | ||
*/ | ||
contract AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209 is | ||
DepositV3SwapPayload | ||
{ | ||
using SafeERC20 for IERC20; | ||
|
||
uint256 public constant USDC_TO_SWAP = 700_000e6; | ||
AaveSwapper public constant SWAPPER = AaveSwapper(MiscEthereum.AAVE_SWAPPER); | ||
address public constant MILKMAN = 0x11C76AD590ABDFFCD980afEC9ad951B160F02797; | ||
address public constant PRICE_CHECKER = 0xe80a1C615F75AFF7Ed8F08c9F21f9d00982D666c; | ||
|
||
function execute() external { | ||
// Transfer 700k USDC from Collector to Swapper | ||
AaveV3Ethereum.COLLECTOR.transfer( | ||
AaveV3EthereumAssets.USDC_UNDERLYING, | ||
address(SWAPPER), | ||
USDC_TO_SWAP | ||
); | ||
|
||
// Deposit all remaining USDC from collector into Aave v3. | ||
uint256 usdcBalance = IERC20(AaveV3EthereumAssets.USDC_UNDERLYING).balanceOf( | ||
address(AaveV3Ethereum.COLLECTOR) | ||
); | ||
|
||
AaveV3Ethereum.COLLECTOR.transfer( | ||
AaveV3EthereumAssets.USDC_UNDERLYING, | ||
address(this), | ||
usdcBalance | ||
); | ||
|
||
_deposit(AaveV3EthereumAssets.USDC_UNDERLYING, usdcBalance); | ||
|
||
// Transfer the whole DAI balance of the collector into the Swapper | ||
uint256 daiBalance = IERC20(AaveV3EthereumAssets.DAI_UNDERLYING).balanceOf( | ||
address(AaveV3Ethereum.COLLECTOR) | ||
); | ||
|
||
AaveV3Ethereum.COLLECTOR.transfer( | ||
AaveV3EthereumAssets.DAI_UNDERLYING, | ||
address(SWAPPER), | ||
daiBalance | ||
); | ||
|
||
// Swap DAI into USDT with receiver being this contract | ||
SWAPPER.swap( | ||
MILKMAN, | ||
PRICE_CHECKER, | ||
AaveV3EthereumAssets.DAI_UNDERLYING, | ||
AaveV3EthereumAssets.USDT_UNDERLYING, | ||
AaveV3EthereumAssets.DAI_ORACLE, | ||
AaveV3EthereumAssets.USDT_ORACLE, | ||
SELF, | ||
daiBalance, | ||
50 | ||
); | ||
|
||
// Swap USDC into USDT with receiver being this contract | ||
SWAPPER.swap( | ||
MILKMAN, | ||
PRICE_CHECKER, | ||
AaveV3EthereumAssets.USDC_UNDERLYING, | ||
AaveV3EthereumAssets.USDT_UNDERLYING, | ||
AaveV3EthereumAssets.USDC_ORACLE, | ||
AaveV3EthereumAssets.USDT_ORACLE, | ||
SELF, | ||
USDC_TO_SWAP, | ||
50 | ||
); | ||
} | ||
|
||
/** | ||
* @dev To be used after the async swap takes place to deposit USDT in AAVE v3 | ||
*/ | ||
function deposit(address token, uint256 amount) external { | ||
_deposit(token, amount); | ||
} | ||
} |
125 changes: 125 additions & 0 deletions
125
...t2/AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.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,125 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; | ||
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; | ||
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol'; | ||
|
||
import {AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209} from './AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209 | ||
* command: make test-contract filter=AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209 | ||
*/ | ||
contract AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209_Test is | ||
ProtocolV3TestBase | ||
{ | ||
event SwapRequested( | ||
address milkman, | ||
address indexed fromToken, | ||
address indexed toToken, | ||
address fromOracle, | ||
address toOracle, | ||
uint256 amount, | ||
address indexed recipient, | ||
uint256 slippage | ||
); | ||
|
||
AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209 | ||
internal proposal; | ||
|
||
address public constant swapProxyDai = 0xa59c5fE2c0A09069bD1fD31a71031d9b8D3FaE93; | ||
address public constant swapProxyUsdc = 0x16b97c7a2870edCA71e4Ed837b3a0Ec93Af328E9; | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('mainnet'), 19215132); | ||
proposal = new AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209(); | ||
} | ||
|
||
/** | ||
* @dev executes the generic test suite including e2e and config snapshots | ||
*/ | ||
function test_defaultProposalExecution() public { | ||
uint256 collectorDaiBalanceBefore = IERC20(AaveV3EthereumAssets.DAI_UNDERLYING).balanceOf( | ||
address(AaveV3Ethereum.COLLECTOR) | ||
); | ||
|
||
uint256 aUsdcBalanceBefore = IERC20(AaveV3EthereumAssets.USDC_A_TOKEN).balanceOf( | ||
address(AaveV3Ethereum.COLLECTOR) | ||
); | ||
|
||
vm.expectEmit(true, true, true, true, MiscEthereum.AAVE_SWAPPER); | ||
emit SwapRequested( | ||
proposal.MILKMAN(), | ||
AaveV3EthereumAssets.DAI_UNDERLYING, | ||
AaveV3EthereumAssets.USDT_UNDERLYING, | ||
AaveV3EthereumAssets.DAI_ORACLE, | ||
AaveV3EthereumAssets.USDT_ORACLE, | ||
IERC20(AaveV3EthereumAssets.DAI_UNDERLYING).balanceOf(address(AaveV3Ethereum.COLLECTOR)), | ||
address(proposal), | ||
50 | ||
); | ||
|
||
vm.expectEmit(true, true, true, true, MiscEthereum.AAVE_SWAPPER); | ||
emit SwapRequested( | ||
proposal.MILKMAN(), | ||
AaveV3EthereumAssets.USDC_UNDERLYING, | ||
AaveV3EthereumAssets.USDT_UNDERLYING, | ||
AaveV3EthereumAssets.USDC_ORACLE, | ||
AaveV3EthereumAssets.USDT_ORACLE, | ||
proposal.USDC_TO_SWAP(), | ||
address(proposal), | ||
50 | ||
); | ||
|
||
executePayload(vm, address(proposal)); | ||
|
||
assertEq( | ||
IERC20(AaveV3EthereumAssets.DAI_UNDERLYING).balanceOf(address(AaveV3Ethereum.COLLECTOR)), | ||
0, | ||
'DAI balance of Collector is not zero' | ||
); | ||
assertEq( | ||
IERC20(AaveV3EthereumAssets.DAI_UNDERLYING).balanceOf(swapProxyDai), | ||
collectorDaiBalanceBefore, | ||
'DAI balance of proxy is not equal to Collector balance before' | ||
); | ||
|
||
assertEq( | ||
IERC20(AaveV3EthereumAssets.USDC_UNDERLYING).balanceOf(address(AaveV3Ethereum.COLLECTOR)), | ||
0, | ||
'USDC balance of Collector is not zero' | ||
); | ||
assertEq( | ||
IERC20(AaveV3EthereumAssets.USDC_UNDERLYING).balanceOf(swapProxyUsdc), | ||
proposal.USDC_TO_SWAP(), | ||
'USDC balance of proxy is not equal to USDC_TO_SWAP amount' | ||
); | ||
|
||
assertGt( | ||
IERC20(AaveV3EthereumAssets.USDC_A_TOKEN).balanceOf(address(AaveV3Ethereum.COLLECTOR)), | ||
aUsdcBalanceBefore, | ||
'aUSDC balance of Collector is not greater than before' | ||
); | ||
} | ||
|
||
function test_depositsToV3() public { | ||
uint256 collectorAUsdtBalanceBefore = IERC20(AaveV3EthereumAssets.USDT_A_TOKEN).balanceOf( | ||
address(AaveV3Ethereum.COLLECTOR) | ||
); | ||
|
||
uint256 toWithdraw = 1_000e6; | ||
|
||
deal(AaveV3EthereumAssets.USDT_UNDERLYING, address(proposal), toWithdraw); | ||
|
||
proposal.deposit(AaveV3EthereumAssets.USDT_UNDERLYING, toWithdraw); | ||
|
||
assertApproxEqAbs( | ||
IERC20(AaveV3EthereumAssets.USDT_A_TOKEN).balanceOf(address(AaveV3Ethereum.COLLECTOR)), | ||
collectorAUsdtBalanceBefore + toWithdraw, | ||
1 | ||
); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...gyPreparationsPart2/TreasuryManagementGSMFundingRWAStrategyPreparationsPart2.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,32 @@ | ||
--- | ||
title: "Treasury Management - GSM Funding & RWA Strategy Preparations (Part 2)" | ||
author: "karpatkey_TokenLogic" | ||
discussions: "https://governance.aave.com/t/arfc-treasury-management-gsm-funding-rwa-strategy-preparations/16128" | ||
snapshot: "https://snapshot.org/#/aave.eth/proposal/0xb39537e468eef8c212c67a539cdc6d802cd857f186a4f66aefd44faaadd6ba19" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
In preparation for potentially funding the GHO Stability Module (GSM) and the $1M RWA strategy with Centrifuge, this publication seeks to make available the necessary amount of USDC, USDT and DAI on Ethereum. | ||
|
||
## Motivation | ||
|
||
The GSM was deployed in a previous proposal and the current stable coin holdings on Ethereum are insufficient to support both the GSM, RWA strategy and Service Provider (SP) commitments. Additional funds are needed on Ethereum to support the GSM. | ||
|
||
## Specification | ||
|
||
- Swap all DAI to USDT | ||
- Swap 0.70M USDC to USDT | ||
- Deposit USDT into Aave v3 | ||
- Deposit USDC minus 0.70M into Aave v3 | ||
|
||
## References | ||
|
||
- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/312f7338478da05b55b2104434002762238df0d3/src/20240209_AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2/AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.sol) | ||
- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/312f7338478da05b55b2104434002762238df0d3/src/20240209_AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2/AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.t.sol) | ||
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xb39537e468eef8c212c67a539cdc6d802cd857f186a4f66aefd44faaadd6ba19) | ||
- [Discussion](https://governance.aave.com/t/arfc-treasury-management-gsm-funding-rwa-strategy-preparations/16128) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
60 changes: 60 additions & 0 deletions
60
...PreparationsPart2/TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.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,60 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; | ||
import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; | ||
import {AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209} from './AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.sol'; | ||
|
||
/** | ||
* @dev Deploy Ethereum | ||
* deploy-command: make deploy-ledger contract=src/20240209_AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2/TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.s.sol:DeployEthereum chain=mainnet | ||
* verify-command: npx catapulta-verify -b broadcast/TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.s.sol/1/run-latest.json | ||
*/ | ||
contract DeployEthereum is EthereumScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = GovV3Helpers.deployDeterministic( | ||
type(AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209) | ||
.creationCode | ||
); | ||
|
||
// 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/20240209_AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2/TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209.s.sol:CreateProposal chain=mainnet | ||
*/ | ||
contract CreateProposal is EthereumScript { | ||
function run() external { | ||
// create payloads | ||
PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); | ||
|
||
// compose actions for validation | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsEthereum[0] = GovV3Helpers.buildAction( | ||
type(AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2_20240209) | ||
.creationCode | ||
); | ||
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); | ||
|
||
// create proposal | ||
vm.startBroadcast(); | ||
GovV3Helpers.createProposal( | ||
vm, | ||
payloads, | ||
GovV3Helpers.ipfsHashFile( | ||
vm, | ||
'src/20240209_AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2/TreasuryManagementGSMFundingRWAStrategyPreparationsPart2.md' | ||
) | ||
); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...0240209_AaveV3Ethereum_TreasuryManagementGSMFundingRWAStrategyPreparationsPart2/config.ts
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,15 @@ | ||
import {ConfigFile} from '../../generator/types'; | ||
export const config: ConfigFile = { | ||
rootOptions: { | ||
pools: ['AaveV3Ethereum'], | ||
title: 'Treasury Management - GSM Funding & RWA Strategy Preparations (Part 2)', | ||
shortName: 'TreasuryManagementGSMFundingRWAStrategyPreparationsPart2', | ||
date: '20240209', | ||
author: 'karpatkey_TokenLogic', | ||
discussion: | ||
'https://governance.aave.com/t/arfc-treasury-management-gsm-funding-rwa-strategy-preparations/16128', | ||
snapshot: | ||
'https://snapshot.org/#/aave.eth/proposal/0xb39537e468eef8c212c67a539cdc6d802cd857f186a4f66aefd44faaadd6ba19', | ||
}, | ||
poolOptions: {AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 19191027}}}, | ||
}; |
33 changes: 33 additions & 0 deletions
33
src/20240220_AaveV3Arbitrum_AaveProtocolEmbassy/AaveProtocolEmbassy.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,33 @@ | ||
--- | ||
title: "Aave Protocol Embassy" | ||
author: "karpatkey_TokenLogic_ACI" | ||
discussions: "https://governance.aave.com/t/arfc-establishing-the-aave-protocol-embassy-ape/16445" | ||
snapshot: "https://snapshot.org/#/aave.eth/proposal/0xe9da0e50526a98a55aae743f44afc21a86076a12184a6c6c9022aa63dcb0be73" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
Transfer all available ARB on Aave V3 Arbitrum to the Aave Protocol Embassy multi-sig. | ||
|
||
## Motivation | ||
|
||
The Aave DAO possesses significant voting power in various governance tokens. However, the current structure of the collector contract hinders direct participation in other DAOs' governance. To effectively leverage this power and actively participate in pivotal governance decisions, such as LTIPs on Arbitrum, the creation of APE is essential. | ||
|
||
This will allow the Aave DAO to have a meta-governance embassy represented by Aave DAO service providers and significant delegates. | ||
|
||
## Specification | ||
|
||
The multi-sig address was commented [here](https://governance.aave.com/t/arfc-establishing-the-aave-protocol-embassy-ape/16445/9). | ||
|
||
- Transfer all available ARB on the Collector on Arbitrum to SAFE Multi-sig 0xa9e777D56C0Ad861f6a03967E080e767ad8D39b6 | ||
|
||
## References | ||
|
||
- Implementation: [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/1b85d9fb8fd2175b49da486fc6db3f8b752349cc/src/20240220_AaveV3Arbitrum_AaveProtocolEmbassy/AaveV3Arbitrum_AaveProtocolEmbassy_20240220.sol) | ||
- Tests: [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/1b85d9fb8fd2175b49da486fc6db3f8b752349cc/src/20240220_AaveV3Arbitrum_AaveProtocolEmbassy/AaveV3Arbitrum_AaveProtocolEmbassy_20240220.t.sol) | ||
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xe9da0e50526a98a55aae743f44afc21a86076a12184a6c6c9022aa63dcb0be73) | ||
- [Discussion](https://governance.aave.com/t/arfc-establishing-the-aave-protocol-embassy-ape/16445) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
Oops, something went wrong.