Skip to content

Commit

Permalink
feat: Add script and tests with final addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Jan 19, 2024
1 parent 30656b9 commit 6200cf4
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 36 deletions.
22 changes: 22 additions & 0 deletions src/20240119_Gho_GHOStabilityModule/GHOStabilityModule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "GHO Stability Module"
author: "Aave Labs @aave"
discussions: "https://governance.aave.com/t/gho-stability-module-update/14442"
---

## Simple Summary

## Motivation

## Specification

## References

- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240119_Gho_GHOStabilityModule/AaveV3Ethereum_GHOStabilityModule_20240119.sol)
- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240119_Gho_GHOStabilityModule/AaveV3Ethereum_GHOStabilityModule_20240119.t.sol)
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xe9b62e197a98832da7d1231442b5960588747f184415fba4699b6325d7618842)
- [Discussion](https://governance.aave.com/t/gho-stability-module-update/14442)

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 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 {Gho_GHOStabilityModule_20240119} from './Gho_GHOStabilityModule_20240119.sol';

/**
* @dev Deploy Ethereum
* deploy-command: make deploy-ledger contract=src/20240119_Gho_GHOStabilityModule/GHOStabilityModule_20240119.s.sol:DeployEthereum chain=mainnet
* verify-command: npx catapulta-verify -b broadcast/GHOStabilityModule_20240119.s.sol/1/run-latest.json
*/
contract DeployEthereum is EthereumScript {
function run() external broadcast {
// deploy payloads
address payload0 = GovV3Helpers.deployDeterministic(
type(Gho_GHOStabilityModule_20240119).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/20240119_Gho_GHOStabilityModule/GHOStabilityModule_20240119.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(Gho_GHOStabilityModule_20240119).creationCode
);
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum);

// create proposal
vm.startBroadcast();
GovV3Helpers.createProposal(
vm,
payloads,
GovV3Helpers.ipfsHashFile(vm, 'src/20240119_Gho_GHOStabilityModule/GHOStabilityModule.md')
);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
Expand All @@ -26,14 +27,6 @@ interface IGsmRegistry {
}

interface IAaveCLRobotOperator {
/**
* @notice method called by owner to register the automation robot keeper.
* @param name - name of keeper.
* @param upkeepContract - upkeepContract of the keeper.
* @param gasLimit - max gasLimit which the chainlink automation node can execute for the automation.
* @param amountToFund - amount of link to fund the keeper with.
* @return chainlink id for the registered keeper.
**/
function register(
string memory name,
address upkeepContract,
Expand All @@ -60,29 +53,25 @@ interface IAaveCLRobotOperator {
* 3. GHO Stability Module Launch
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xe9b62e197a98832da7d1231442b5960588747f184415fba4699b6325d7618842
*/
contract Gho_GhoStabilityModule {
contract Gho_GHOStabilityModule_20240119 is IProposalGenericExecutor {
using SafeERC20 for IERC20;

address public constant GSM_USDC = 0x55027d3dBBcEA0327eF73eFd74ba0Af42A13A966; // TODO
address public constant GSM_USDC_ORACLE_SWAP_FREEZER = 0x1Dbbf529D78d6507B0dd71F6c02f41138d828990; // TODO
address public constant GSM_USDT = 0x9eb52339B52e71B1EFD5537947e75D23b3a7719B; // TODO
address public constant GSM_USDT_ORACLE_SWAP_FREEZER = 0xf18774574148852771c2631d7d06E2A6c8b44fCA; // TODO
address public constant GSM_REGISTRY = 0x9f62EE65a8395824Ee0821eF2Dc4C947a23F0f25; // TODO

address public constant GSM_FIXED_FEE_STRATEGY = 0xF6d2cE02a0647dd10F3f4263e29f2167DC6542cC; // TODO
address public constant GSM_USDC = 0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578;
address public constant GSM_USDC_ORACLE_SWAP_FREEZER = 0xD9096444807Da3D05EcA6d1E19380133A59394A6;
address public constant GSM_USDT = 0x686F8D21520f4ecEc7ba577be08354F4d1EB8262;
address public constant GSM_USDT_ORACLE_SWAP_FREEZER = 0x0F1773be3CaA314273A69dfE1A107814893C359F;
address public constant GSM_REGISTRY = 0x167527DB01325408696326e3580cd8e55D99Dc1A;
address public constant GSM_FIXED_FEE_STRATEGY = 0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5;

string public constant GSM_USDC_FACILITATOR_LABEL = 'GSM USDC';
uint128 public constant GSM_USDC_BUCKET_CAPACITY = 500_000e18;
string public constant GSM_USDT_FACILITATOR_LABEL = 'GSM USDT';
uint128 public constant GSM_USDT_BUCKET_CAPACITY = 500_000e18;

//
address public constant ROBOT_OPERATOR = 0x020E452b463568f55BAc6Dc5aFC8F0B62Ea5f0f3;
uint96 public constant LINK_AMOUNT_ORACLE_FREEZER_KEEPER = 10 ether;
uint96 public constant TOTAL_LINK_AMOUNT_KEEPERS = LINK_AMOUNT_ORACLE_FREEZER_KEEPER * 2; // 2 GSMs

//

function execute() external {
// 1. Enroll GSMs as GHO Facilitators
IGhoToken(AaveV3Ethereum.GHO_TOKEN).addFacilitator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'forge-std/Test.sol';
import {AaveV3EthereumAssets, AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol';
import {IPoolConfigurator} from 'aave-address-book/AaveV3.sol';
import {Gho_GhoStabilityModule} from './20240119_Gho_GhoStabilityModule.sol';
import {Gho_GHOStabilityModule_20240119} from './Gho_GHOStabilityModule_20240119.sol';

interface IGhoToken {
struct Facilitator {
Expand Down Expand Up @@ -46,24 +46,19 @@ interface IOracleSwapFreezer {
}

/**
* @dev Test for Gho_GhoStabilityModule
* command: make test-contract filter=Gho_GhoStabilityModule
* @dev Test for Gho_GHOStabilityModule_20240119
* command: make test-contract filter=Gho_GHOStabilityModule_20240119
*/
contract Gho_GhoStabilityModule_Test is ProtocolV3TestBase {
address constant NEW_VGHO_IMPL = 0x20Cb2f303EDe313e2Cc44549Ad8653a5E8c0050e;

Gho_GhoStabilityModule internal proposal;
contract Gho_GHOStabilityModule_20240119_Test is ProtocolV3TestBase {
Gho_GHOStabilityModule_20240119 internal proposal;

function setUp() public {
vm.createSelectFork(vm.rpcUrl('mainnet'), 19026100);
proposal = new Gho_GhoStabilityModule();
vm.createSelectFork(vm.rpcUrl('mainnet'), 19037431);
proposal = new Gho_GHOStabilityModule_20240119();
}

function test_defaultProposalExecution() public {
// // increase GHO borrow cap so test borrows can succeed
// vm.prank(AaveV3Ethereum.CAPS_PLUS_RISK_STEWARD);
// AaveV3Ethereum.POOL_CONFIGURATOR.setBorrowCap(AaveV3Ethereum.GHO_TOKEN, 36_000_000);
defaultTest('Gho_GhoStabilityModule', AaveV3Ethereum.POOL, address(proposal));
defaultTest('Gho_GHOStabilityModule_20240119', AaveV3Ethereum.POOL, address(proposal));
}

function test_checkConfig() public {
Expand Down Expand Up @@ -93,8 +88,8 @@ contract Gho_GhoStabilityModule_Test is ProtocolV3TestBase {

// GSM USDC
GsmConfig memory gsmUsdcConfig = GsmConfig({
sellFee: 200,
buyFee: 200,
sellFee: 0.0020e4, // 0.2%
buyFee: 0.0020e4, // 0.2%
exposureCap: 500_000e6,
isFrozen: false,
isSeized: false,
Expand All @@ -113,8 +108,8 @@ contract Gho_GhoStabilityModule_Test is ProtocolV3TestBase {

// GSM USDT
GsmConfig memory gsmUsdtConfig = GsmConfig({
sellFee: 200,
buyFee: 200,
sellFee: 0.0020e4, // 0.2%
buyFee: 0.0020e4, // 0.2%
exposureCap: 500_000e6,
isFrozen: false,
isSeized: false,
Expand Down
14 changes: 14 additions & 0 deletions src/20240119_Gho_GHOStabilityModule/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {ConfigFile} from '../../generator/types';
export const config: ConfigFile = {
rootOptions: {
pools: ['AaveV3Ethereum'],
title: 'GHO Stability Module',
shortName: 'GHOStabilityModule',
date: '20240119',
author: 'Aave Labs @aave',
discussion: 'https://governance.aave.com/t/gho-stability-module-update/14442',
snapshot:
'https://snapshot.org/#/aave.eth/proposal/0xe9b62e197a98832da7d1231442b5960588747f184415fba4699b6325d7618842',
},
poolOptions: {AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 19037596}}},
};

0 comments on commit 6200cf4

Please sign in to comment.