From b777395af9318c173b5181146de48c33a5a52b62 Mon Sep 17 00:00:00 2001 From: Mark Hinschberger Date: Fri, 19 Jan 2024 14:54:41 +0000 Subject: [PATCH 1/3] git commit remove submodule --- .gitmodules | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index d90e9d612..9f93dcf35 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,4 @@ [submodule "lib/aave-helpers"] path = lib/aave-helpers url = https://github.com/bgd-labs/aave-helpers -[submodule "lib/stake-token"] - path = lib/stake-token - url = https://github.com/bgd-labs/stake-token.git + From 1062d67a2fe0f067867e49470b7157192f6ab6f7 Mon Sep 17 00:00:00 2001 From: Mark Hinschberger Date: Fri, 19 Jan 2024 15:03:47 +0000 Subject: [PATCH 2/3] update proposal --- package.json | 2 +- .../StkGHO_Activation_20240118.s.sol | 20 ++++---- .../StkGHO_Activation_20240118.sol | 11 ++-- .../StkGHO_Activation_20240118.t.sol | 51 +++++++++++++++++-- yarn.lock | 8 +-- 5 files changed, 68 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index a0c19d5aa..efb10b836 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "vitest": "^1.0.4" }, "dependencies": { - "@bgd-labs/aave-address-book": "^2.14.0", + "@bgd-labs/aave-address-book": "^2.17.0", "@bgd-labs/aave-cli": "0.2.1", "@inquirer/prompts": "^3.3.0", "@inquirer/testing": "^2.1.9", diff --git a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol index 07523f1b8..5efe01248 100644 --- a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol +++ b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol @@ -4,10 +4,11 @@ pragma solidity ^0.8.0; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; import {EthereumScript, PolygonScript} from 'aave-helpers/ScriptUtils.sol'; import {StkGHO_Activation_20240118} from './StkGHO_Activation_20240118.sol'; +import {AaveSafetyModule} from 'aave-address-book/AaveSafetyModule.sol'; /** * @dev Deploy Ethereum - * deploy-command: make deploy-ledger contract=src/20240102_AaveV2Polygon_ReserveFactorUpdates/ReserveFactorUpdates_20240102.s.sol:DeployPolygon chain=polygon + * deploy-command: make deploy-ledger contract=src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol:DeployPolygon chain=polygon * verify-command: npx catapulta-verify -b broadcast/ReserveFactorUpdates_20240102.s.sol/137/run-latest.json */ contract DeployPolygon is PolygonScript { @@ -29,9 +30,13 @@ contract DeployPolygon is PolygonScript { /** * @dev Create Proposal - * command: make deploy-ledger contract=src/20240102_AaveV2Polygon_ReserveFactorUpdates/ReserveFactorUpdates_20240102.s.sol:CreateProposal chain=mainnet + * command: make deploy-ledger contract=src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol:CreateProposal chain=mainnet */ contract CreateProposal is EthereumScript { + uint256 public constant STKGHO_EMISSION_PER_SECOND = 578703703703704; // 50 AAVE/day + uint256 public constant DISTRIBUTION_DURATION = 90 days; // three months + address public constant STKGHO_PROXY = 0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d; // AaveSafetyModule.STK_GHO; + function run() external { // create payloads PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); @@ -39,20 +44,15 @@ contract CreateProposal is EthereumScript { // compose actions for validation IPayloadsControllerCore.ExecutionAction[] memory actionsPolygon = new IPayloadsControllerCore.ExecutionAction[](1); - actionsPolygon[0] = GovV3Helpers.buildAction( - type(StkGHO_Activation_20240118).creationCode - ); - payloads[0] = GovV3Helpers.buildPolygonPayload(vm, actionsPolygon); + actionsPolygon[0] = GovV3Helpers.buildAction(type(StkGHO_Activation_20240118).creationCode); + payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsPolygon); // create proposal vm.startBroadcast(); GovV3Helpers.createProposal( vm, payloads, - GovV3Helpers.ipfsHashFile( - vm, - 'src/StkGHO_Activation_20240118/StkGHOActivation.md' - ) + GovV3Helpers.ipfsHashFile(vm, 'src/StkGHO_Activation_20240118/StkGHOActivation.md') ); } } diff --git a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol index cd555282a..5dcc933a6 100644 --- a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol +++ b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol @@ -9,6 +9,7 @@ import {IAggregatedStakeToken} from 'stake-token/src/contracts/IAggregatedStakeT import {DistributionTypes} from 'stake-token/src/contracts/lib/DistributionTypes.sol'; import {IAaveDistributionManager} from 'stake-token/src/contracts/IAaveDistributionManager.sol'; import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; +import {AaveSafetyModule} from 'aave-address-book/AaveSafetyModule.sol'; /** * @title StkGHO Activation @@ -17,14 +18,12 @@ import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; * - Discussion: https://governance.aave.com/t/arfc-upgrade-safety-module-with-stkgho/15635 */ contract StkGHO_Activation_20240118 is IProposalGenericExecutor { - uint256 public constant STKGHO_EMISSION_PER_SECOND = 5787037037037037; // 50 AAVE/day - uint256 public constant DISTRIBUTION_DURATION = 3*30*86400; // three months - address public constant STKGHO_PROXY = 0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d; + uint256 public constant STKGHO_EMISSION_PER_SECOND = 578703703703704; // 50 AAVE/day + uint256 public constant DISTRIBUTION_DURATION = 90 days; // three months + address public constant STKGHO_PROXY = 0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d; // AaveSafetyModule.STK_GHO; function execute() external { - IAggregatedStakeToken(STKGHO_PROXY).setDistributionEnd( - block.timestamp + DISTRIBUTION_DURATION - ); + IAggregatedStakeToken(STKGHO_PROXY).setDistributionEnd(block.timestamp + DISTRIBUTION_DURATION); DistributionTypes.AssetConfigInput[] memory enableConfigs = new DistributionTypes.AssetConfigInput[](1); enableConfigs[0] = DistributionTypes.AssetConfigInput({ diff --git a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol index e5935f5e7..369aae68a 100644 --- a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol +++ b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol @@ -2,14 +2,27 @@ pragma solidity ^0.8.0; import {ProtocolV2TestBase, ReserveConfig} from 'aave-helpers/ProtocolV2TestBase.sol'; - +import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; +import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; +import 'forge-std/console.sol'; import {StkGHO_Activation_20240118} from './StkGHO_Activation_20240118.sol'; +import {IAggregatedStakeToken} from 'stake-token/src/contracts/IAggregatedStakeToken.sol'; +import {IStakeToken} from 'stake-token/src/contracts/IStakeToken.sol'; +import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; +import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; +import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; +import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; +import {AaveSafetyModule} from 'aave-address-book/AaveSafetyModule.sol'; /** * @dev Test for StkGHO_Activation_20240118 * command: make test-contract filter=StkGHO_Activation_20240118 */ contract StkGHO_Activation_20240118_Test is ProtocolV2TestBase { + uint256 public constant STKGHO_EMISSION_PER_SECOND = 578703703703704; // 50 AAVE/day + uint256 public constant DISTRIBUTION_DURATION = 3 * 30 * 86400; // three months + address public constant STKGHO_PROXY = 0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d; // AaveSafetyModule.STK_GHO; + struct Changes { address asset; uint256 reserveFactor; @@ -18,7 +31,8 @@ contract StkGHO_Activation_20240118_Test is ProtocolV2TestBase { StkGHO_Activation_20240118 internal proposal; function setUp() public { - vm.createSelectFork(vm.rpcUrl('ethereum'), 51940815); + vm.createSelectFork(vm.rpcUrl('mainnet'), 19040576); + proposal = new StkGHO_Activation_20240118(); } @@ -26,7 +40,38 @@ contract StkGHO_Activation_20240118_Test is ProtocolV2TestBase { * @dev executes the generic test suite including e2e and config snapshots */ function test_defaultProposalExecution() public { + (uint128 emissionPerSecondBefore, , ) = IAggregatedStakeToken(STKGHO_PROXY).assets( + AaveV3Ethereum.GHO_TOKEN + ); + + GovV3Helpers.executePayload(vm, address(proposal)); + ( + uint128 emissionPerSecondAfter, + uint128 lastUpdateTimestampAfter, // uint256 indexAfter + + ) = IAggregatedStakeToken(STKGHO_PROXY).assets(AaveV3Ethereum.GHO_TOKEN); + + // NOTE index is still 0 + assertEq((emissionPerSecondBefore + emissionPerSecondAfter), STKGHO_EMISSION_PER_SECOND); + assertEq(lastUpdateTimestampAfter, block.timestamp); + } + + function test_EcosystemCorrectAllowance() public { + uint256 allowanceBefore = IERC20(AaveV3EthereumAssets.AAVE_UNDERLYING).allowance( + MiscEthereum.ECOSYSTEM_RESERVE, + STKGHO_PROXY + ); + + GovV3Helpers.executePayload(vm, address(proposal)); + + uint256 allowanceAfter = IERC20(AaveV3EthereumAssets.AAVE_UNDERLYING).allowance( + MiscEthereum.ECOSYSTEM_RESERVE, + STKGHO_PROXY + ); - + assertEq( + (allowanceAfter + allowanceBefore), + STKGHO_EMISSION_PER_SECOND * DISTRIBUTION_DURATION + ); } } diff --git a/yarn.lock b/yarn.lock index 419baa37d..a090e2c67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -44,10 +44,10 @@ resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.10.0.tgz#19873ec0edf9ee1f1a5539162e6092b0a2b2c4b4" integrity sha512-DVglkDCYUf7etb6mnCziIY2HPgap4X3AnC/1tC0ZqpXFrhO0lQzWBiMeWy20r1x/b81iHMQa02ULaco3LhdeVw== -"@bgd-labs/aave-address-book@^2.14.0": - version "2.14.0" - resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.14.0.tgz#5cf20d1d9bfd2f9dbb57ebadb4e066ff7631009d" - integrity sha512-FFlfxOByUclzb6tY7LuA4rVRY6lRv3U6+FFXOegV6wxwYrsZEP9v3g0gQK0PTnbo3+Ua3kl+TlvySMQU7Klalw== +"@bgd-labs/aave-address-book@^2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.17.0.tgz#06f5e8950135d00039220a0a6f44055e520924e2" + integrity sha512-JhKGyaCm6Qg+0jtX3UiNNi7c8+vYqFp8gbAsgMnxMZhDOEoNo4gPtiEq9M9rFl1PwjSEdMyzoRcP/nquFPC52g== "@bgd-labs/aave-cli@0.2.1": version "0.2.1" From 6d58d1f6c12ffe63b06eb52cf6c7cfd979848547 Mon Sep 17 00:00:00 2001 From: Mark Hinschberger Date: Fri, 19 Jan 2024 15:12:29 +0000 Subject: [PATCH 3/3] sync branch --- .../StkGHO_Activation_20240118.sol | 2 +- .../StkGHO_Activation_20240118.t.sol | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol index 516801ac0..88f03c36e 100644 --- a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol +++ b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol @@ -15,7 +15,7 @@ import {IStakeToken} from './IStakeToken.sol'; * - Discussion: https://governance.aave.com/t/arfc-upgrade-safety-module-with-stkgho/15635 */ contract StkGHO_Activation_20240118 is IProposalGenericExecutor { - uint256 public constant STKGHO_EMISSION_PER_SECOND = 5787037037037037; // 50 AAVE/day + uint256 public constant STKGHO_EMISSION_PER_SECOND = 578703703703704; // 50 AAVE/day uint256 public constant DISTRIBUTION_DURATION = 90 days; // three months address public constant STKGHO_PROXY = 0x1a88Df1cFe15Af22B3c4c783D4e6F7F9e0C1885d; diff --git a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol index 369aae68a..8ce60b9f0 100644 --- a/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol +++ b/src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.t.sol @@ -6,8 +6,8 @@ import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; import 'forge-std/console.sol'; import {StkGHO_Activation_20240118} from './StkGHO_Activation_20240118.sol'; -import {IAggregatedStakeToken} from 'stake-token/src/contracts/IAggregatedStakeToken.sol'; -import {IStakeToken} from 'stake-token/src/contracts/IStakeToken.sol'; +import {IStakeToken} from './IStakeToken.sol'; + import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol'; import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; @@ -40,7 +40,7 @@ contract StkGHO_Activation_20240118_Test is ProtocolV2TestBase { * @dev executes the generic test suite including e2e and config snapshots */ function test_defaultProposalExecution() public { - (uint128 emissionPerSecondBefore, , ) = IAggregatedStakeToken(STKGHO_PROXY).assets( + (uint128 emissionPerSecondBefore, , ) = IStakeToken(STKGHO_PROXY).assets( AaveV3Ethereum.GHO_TOKEN ); @@ -49,7 +49,7 @@ contract StkGHO_Activation_20240118_Test is ProtocolV2TestBase { uint128 emissionPerSecondAfter, uint128 lastUpdateTimestampAfter, // uint256 indexAfter - ) = IAggregatedStakeToken(STKGHO_PROXY).assets(AaveV3Ethereum.GHO_TOKEN); + ) = IStakeToken(STKGHO_PROXY).assets(AaveV3Ethereum.GHO_TOKEN); // NOTE index is still 0 assertEq((emissionPerSecondBefore + emissionPerSecondAfter), STKGHO_EMISSION_PER_SECOND);