-
Notifications
You must be signed in to change notification settings - Fork 118
Gsm4626 deployment script #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule aave-address-book
updated
613 files
Submodule aave-stk-v1-5
updated
13 files
| +4 −0 | Makefile | |
| +1 −1 | lib/aave-address-book | |
| +1 −1 | lib/aave-helpers | |
| +1 −1 | lib/forge-std | |
| +1 −1 | lib/openzeppelin-contracts | |
| +15 −15 | scripts/CreateProposal.s.sol | |
| +15 −0 | scripts/DeployPayload.s.sol | |
| +15 −1 | src/contracts/StakedAaveV3.sol | |
| +2 −2 | src/contracts/StakedTokenV3.sol | |
| +7 −1 | src/interfaces/AggregatedStakedAaveV3.sol | |
| +14 −0 | src/interfaces/IStakedAaveV3.sol | |
| +30 −12 | tests/GovernanceValidation.t.sol | |
| +53 −0 | yarn.lock |
Submodule aave-v3-core
updated
221 files
Submodule aave-v3-periphery
updated
59 files
Submodule solidity-utils
updated
78 files
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,143 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {Script, console2} from 'forge-std/Script.sol'; | ||
| import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
| import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; | ||
| import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; | ||
| import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/TransparentProxyFactory.sol'; | ||
| import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol'; | ||
|
|
||
| import {Gsm4626} from 'src/contracts/facilitators/gsm/Gsm4626.sol'; | ||
| import {FixedPriceStrategy4626} from 'src/contracts/facilitators/gsm/priceStrategy/FixedPriceStrategy4626.sol'; | ||
| import {IGsm} from 'src/contracts/facilitators/gsm/interfaces/IGsm.sol'; | ||
| import {OracleSwapFreezer} from 'src/contracts/facilitators/gsm/swapFreezer/OracleSwapFreezer.sol'; | ||
|
|
||
| // GSM USDC | ||
| uint8 constant USDC_DECIMALS = 6; | ||
| uint128 constant USDC_EXPOSURE_CAP = 8_000_000e6; | ||
|
|
||
| // GSM USDT | ||
| uint8 constant USDT_DECIMALS = 6; | ||
| uint128 constant USDT_EXPOSURE_CAP = 16_000_000e6; | ||
|
|
||
| uint128 constant SWAP_FREEZE_LOWER_BOUND = 0.99e8; | ||
| uint128 constant SWAP_FREEZE_UPPER_BOUND = 1.01e8; | ||
| uint128 constant SWAP_UNFREEZE_LOWER_BOUND = 0.995e8; | ||
| uint128 constant SWAP_UNFREEZE_UPPER_BOUND = 1.005e8; | ||
| bool constant SWAP_UNFREEZE_ALLOWED = true; | ||
|
|
||
| contract DeployGsm4626 is Script { | ||
| function run() external { | ||
| uint256 deployerPrivateKey = vm.envUint('PRIVATE_KEY'); | ||
| address deployerAddress = vm.addr(deployerPrivateKey); | ||
| console2.log('Deployer Address: ', deployerAddress); | ||
| console2.log('Deployer Balance: ', address(deployerAddress).balance); | ||
| console2.log('Block Number: ', block.number); | ||
| vm.startBroadcast(deployerPrivateKey); | ||
| _deploy(); | ||
| vm.stopBroadcast(); | ||
| } | ||
|
|
||
| function _deploy() internal { | ||
| // ------------------------------------------------ | ||
| // 1. FixedPriceStrategy | ||
| // ------------------------------------------------ | ||
| FixedPriceStrategy gsmUsdcPriceStrategy = new FixedPriceStrategy( | ||
| GSM_PRICE_RATIO, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this |
||
| AaveV3EthereumAssets.USDC_UNDERLYING, | ||
| USDC_DECIMALS | ||
| ); | ||
| console2.log('GSM USDC FixedPriceStrategy: ', address(gsmUsdcPriceStrategy)); | ||
|
|
||
| FixedPriceStrategy gsmUsdtPriceStrategy = new FixedPriceStrategy( | ||
| GSM_PRICE_RATIO, | ||
| AaveV3EthereumAssets.USDT_UNDERLYING, | ||
| USDT_DECIMALS | ||
| ); | ||
|
|
||
| // ------------------------------------------------ | ||
| // 2. GSM implementations | ||
| // ------------------------------------------------ | ||
| Gsm4626 gsmUsdcImpl = new Gsm4626( | ||
| AaveV3EthereumAssets.GHO_UNDERLYING, | ||
| AaveV3EthereumAssets.USDC_STATA_TOKEN, | ||
| address(gsmUsdcPriceStrategy) | ||
| ); | ||
| console2.log('GSM stataUSDC Implementation: ', address(gsmUsdcImpl)); | ||
|
|
||
| Gsm4626 gsmUsdtImpl = new Gsm4626( | ||
| AaveV3EthereumAssets.GHO_UNDERLYING, | ||
| AaveV3EthereumAssets.USDT_STATA_TOKEN, | ||
| address(gsmUsdtPriceStrategy) | ||
| ); | ||
| console2.log('GSM stataUSDT Implementation: ', address(gsmUsdtImpl)); | ||
|
|
||
| gsmUsdcImpl.initialize( | ||
| GovernanceV3Ethereum.EXECUTOR_LVL_1, | ||
| address(AaveV3Ethereum.COLLECTOR), | ||
| USDC_EXPOSURE_CAP | ||
| ); | ||
| gsmUsdtImpl.initialize( | ||
| GovernanceV3Ethereum.EXECUTOR_LVL_1, | ||
| address(AaveV3Ethereum.COLLECTOR), | ||
| USDT_EXPOSURE_CAP | ||
| ); | ||
|
|
||
| // ------------------------------------------------ | ||
| // 3. GSM proxy deployment and initialization | ||
| // ------------------------------------------------ | ||
| bytes memory gsmUsdcInitParams = abi.encodeWithSignature( | ||
| 'initialize(address,address,uint128)', | ||
| GovernanceV3Ethereum.EXECUTOR_LVL_1, | ||
| address(AaveV3Ethereum.COLLECTOR), | ||
| USDC_EXPOSURE_CAP | ||
| ); | ||
| address gsmUsdcProxy = TransaprentProxyFactory(MiscEthereum.TRANSPARENT_PROXY_FACTORY).create( | ||
| address(gsmUsdcImpl), | ||
| GovernanceV3Ethereum.EXECUTOR_LVL_1, | ||
| gsmUsdcInitParams | ||
| ); | ||
| console2.log('GSM stataUSDC Proxy: ', gsmUsdcProxy); | ||
|
|
||
| bytes memory gsmUsdtInitParams = abi.encodeWithSignature( | ||
| 'initialize(address,address,uint128)', | ||
| GovernanceV3Ethereum.EXECUTOR_LVL_1, | ||
| address(AaveV3Ethereum.COLLECTOR), | ||
| USDT_EXPOSURE_CAP | ||
| ); | ||
| address gsmUsdtProxy = TransaprentProxyFactory(MiscEthereum.TRANSPARENT_PROXY_FACTORY).create( | ||
| address(gsmUsdtImpl), | ||
| GovernanceV3Ethereum.EXECUTOR_LVL_1, | ||
| gsmUsdtInitParams | ||
| ); | ||
| console2.log('GSM stataUSDT Proxy: ', gsmUsdtProxy); | ||
|
|
||
| // ------------------------------------------------ | ||
| // 4. OracleSwapFreezers | ||
| // ------------------------------------------------ | ||
| OracleSwapFreezer gsmUsdcOracleSwapFreezer = new OracleSwapFreezer( | ||
| IGsm(gsmUsdcProxy), | ||
| AaveV3EthereumAssets.USDC_UNDERLYING, | ||
| IPoolAddressesProvider(address(AaveV3Ethereum.POOL_ADDRESSES_PROVIDER)), | ||
| SWAP_FREEZE_LOWER_BOUND, | ||
| SWAP_FREEZE_UPPER_BOUND, | ||
| SWAP_UNFREEZE_LOWER_BOUND, | ||
| SWAP_UNFREEZE_UPPER_BOUND, | ||
| SWAP_UNFREEZE_ALLOWED | ||
| ); | ||
| console2.log('GSM stataUSDC OracleSwapFreezer: ', address(gsmUsdcOracleSwapFreezer)); | ||
|
|
||
| OracleSwapFreezer gsmUsdtOracleSwapFreezer = new OracleSwapFreezer( | ||
| IGsm(gsmUsdtProxy), | ||
| AaveV3EthereumAssets.USDT_UNDERLYING, | ||
| IPoolAddressesProvider(address(AaveV3Ethereum.POOL_ADDRESSES_PROVIDER)), | ||
| SWAP_FREEZE_LOWER_BOUND, | ||
| SWAP_FREEZE_UPPER_BOUND, | ||
| SWAP_UNFREEZE_LOWER_BOUND, | ||
| SWAP_UNFREEZE_UPPER_BOUND, | ||
| SWAP_UNFREEZE_ALLOWED | ||
| ); | ||
| console2.log('GSM stataUSDT OracleSwapFreezer: ', address(gsmUsdtOracleSwapFreezer)); | ||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Must be
FixedPriceStrategy4626