Skip to content
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

StkGHO Initialization proposal #170

Merged
merged 32 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
24a3f7d
Add proposal for Gho Incident Report 20231113 (#1)
parth-15 Dec 5, 2023
4aa6143
fix: Make new impl constant (#3)
miguelmtzinf Dec 6, 2023
27dd485
fix: Amend AIP text (#4)
miguelmtzinf Dec 6, 2023
2f242a6
test: Tweak default tests with borrow cap update (#5)
miguelmtzinf Dec 7, 2023
4812d01
fix: lint issue (#6)
parth-15 Dec 7, 2023
43a7687
test: Add diffs from test running (#7)
miguelmtzinf Dec 7, 2023
4c79bb9
fix: Add payload address (#8)
miguelmtzinf Dec 7, 2023
76cd4b6
fix: Fix payload address in script (#9)
miguelmtzinf Dec 7, 2023
120f564
fix: Remove unneeded diff file (#10)
miguelmtzinf Dec 7, 2023
4d6a3d9
Merge branch 'bgd-labs:main' into main
miguelmtzinf Dec 13, 2023
4cb8573
Merge branch 'bgd-labs:main' into main
miguelmtzinf Jan 16, 2024
6c5ee89
feat: added stkgho initialization proposal
The-3D Jan 18, 2024
1b99bd8
feat: fixed proposal description
The-3D Jan 18, 2024
c3d48cd
feat: removed submodule
The-3D Jan 19, 2024
7938a2d
feat: fixed deployment script
The-3D Jan 19, 2024
575b445
feat: replaced duration calculation
The-3D Jan 19, 2024
b777395
git commit remove submodule
foodaka Jan 19, 2024
79f2011
feat: fixed payload build function
The-3D Jan 19, 2024
1062d67
update proposal
foodaka Jan 19, 2024
fd43d71
chore: sync
foodaka Jan 19, 2024
6d58d1f
sync branch
foodaka Jan 19, 2024
0ac9c62
Merge pull request #12 from aave/feat/proposal-revision-stk
The-3D Jan 19, 2024
35a12a3
fix: variable name
The-3D Jan 19, 2024
5df6a3e
fix: Fix AIP payload
miguelmtzinf Jan 19, 2024
121b4f4
fix: Fix tests
miguelmtzinf Jan 19, 2024
d1e97c6
test: added further test on emission per day
The-3D Jan 19, 2024
8e940eb
refactor: removed unused constants
The-3D Jan 19, 2024
33fac26
fix: catapulta commands
The-3D Jan 19, 2024
c50ff04
fix: Add fixes to payload
miguelmtzinf Jan 19, 2024
1f79a77
fix: Rebuild proposal with autogenerate tool
miguelmtzinf Jan 19, 2024
f8490ca
Merge branch 'main' of https://github.com/aave/aave-proposals-v3 into…
miguelmtzinf Jan 19, 2024
45d813c
Merge branch 'bgd/main' into stkgho-proposal
miguelmtzinf Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/aave-helpers
Submodule aave-helpers updated 43 files
+1 −0 .assets/005b16eaa54199269ae451836387895a28c5d76e.svg
+1 −0 .assets/08d9252b4f8f8c9e59638a9a35a34e736f126166.svg
+0 −1 .assets/3bff92d2cfac98105fbeed24302d9d3577cb1325.svg
+1 −0 .assets/463b4c710a9b305cac1e136801dfbb5d2264a078.svg
+1 −0 .assets/5f02ea67e5ba53eee2797379ac1cd619db8b194e.svg
+0 −1 .assets/66aa72f6fe3716b9b6a43abb25a455671672849e.svg
+0 −1 .assets/6f34858c4ab5446d26b260c353dc36aa73d94358.svg
+1 −0 .assets/8062d95ddc9e1bec6e4a6b53fca46e335385d902.svg
+0 −1 .assets/9ed0ac5bda0d6aea5b627325dd757aab5a706122.svg
+1 −0 .assets/a9946a5d9adc46c59f833ceafb1d7a117d8d5e26.svg
+1 −0 .assets/cf503516adca0ef2b3e859f702e54d27d132edf2.svg
+0 −1 .assets/d89ecf5f1ccbeb07b104da02d99f5a5862da4efa.svg
+1 −0 .assets/ee0b6581b78f686087dd5f50440a7a76f4dd607d.svg
+1 −0 .assets/f75716c7eaa3c871931fca294b19538f6ade058c.svg
+5 −0 .env.example
+10 −2 Makefile
+4 −4 diffs/preTestEngineOptV3_postTestEngineOptV3.md
+4 −4 diffs/preTestEngineRates_postTestEngineRates.md
+4 −0 foundry.toml
+1 −1 lib/aave-address-book
+1 −1 lib/forge-std
+176 −96 reports/default_after.json
+1,308 −1 reports/default_before.json
+79 −79 reports/postTestEngineOptV3.json
+76 −76 reports/postTestEngineRates.json
+76 −76 reports/preTestEngineOptV3.json
+76 −76 reports/preTestEngineRates.json
+1,508 −1 reports/preTestV2RatesUpdates.json
+82 −1 scripts/AaveV3ConfigEngine.s.sol
+14 −0 scripts/FreezingStewards.s.sol
+23 −0 scripts/RiskStewards.s.sol
+38 −0 scripts/V3RateStrategyFactory.s.sol
+3 −0 src/ChainIds.sol
+61 −5 src/GovV3Helpers.sol
+8 −0 src/ScriptUtils.sol
+15 −0 src/v3-config-engine/AaveV3PayloadPolygonZkEvm.sol
+15 −0 src/v3-config-engine/AaveV3PayloadScroll.sol
+0 −82 tests/GovTest.t.sol
+0 −71 tests/GovV2_5.t.sol
+14 −8 tests/GovV3Test.t.sol
+6 −5 tests/swaps/DepositV3SwapPayloadTest.t.sol
+1 −1 tests/v3-config-engine/AaveV3ConfigEngineTest.t.sol
+2 −2 tests/v3-config-engine/V3RateStrategyFactory.t.sol
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';
import {AaveV3EthereumAssets, AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol';
import {IPoolConfigurator} from 'aave-address-book/AaveV3.sol';
import {AaveV3Ethereum_GhoIncidentReport_20231113} from './AaveV3Ethereum_GhoIncidentReport_20231113.sol';
Expand All @@ -28,7 +28,7 @@ contract AaveV3Ethereum_GhoIncidentReport_20231113_Test is ProtocolV3TestBase {
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);
AaveV3Ethereum.POOL_CONFIGURATOR.setBorrowCap(AaveV3EthereumAssets.GHO_UNDERLYING, 36_000_000);
defaultTest(
'AaveV3Ethereum_GhoIncidentReport_20231113',
AaveV3Ethereum.POOL,
Expand Down
194 changes: 194 additions & 0 deletions src/20240118_StkGHO_Activation/IStakeToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
pragma solidity ^0.8.10;

interface IStakeToken {
event Approval(address indexed owner, address indexed spender, uint256 value);
event AssetConfigUpdated(address indexed asset, uint256 emission);
event AssetIndexUpdated(address indexed asset, uint256 index);
event Cooldown(address indexed user, uint256 amount);
event CooldownSecondsChanged(uint256 cooldownSeconds);
event DistributionEndChanged(uint256 endTimestamp);
event EIP712DomainChanged();
event ExchangeRateChanged(uint216 exchangeRate);
event FundsReturned(uint256 amount);
event Initialized(uint64 version);
event MaxSlashablePercentageChanged(uint256 newPercentage);
event PendingAdminChanged(address indexed newPendingAdmin, uint256 role);
event Redeem(address indexed from, address indexed to, uint256 assets, uint256 shares);
event RewardsAccrued(address user, uint256 amount);
event RewardsClaimed(address indexed from, address indexed to, uint256 amount);
event RoleClaimed(address indexed newAdmin, uint256 role);
event Slashed(address indexed destination, uint256 amount);
event SlashingExitWindowDurationChanged(uint256 windowSeconds);
event SlashingSettled();
event Staked(address indexed from, address indexed to, uint256 assets, uint256 shares);
event Transfer(address indexed from, address indexed to, uint256 value);
event UserIndexUpdated(address indexed user, address indexed asset, uint256 index);

struct AssetConfigInput {
uint128 emissionPerSecond;
uint256 totalStaked;
address underlyingAsset;
}

function CLAIM_HELPER_ROLE() external view returns (uint256);

function COOLDOWN_ADMIN_ROLE() external view returns (uint256);

function DOMAIN_SEPARATOR() external view returns (bytes32);

function EMISSION_MANAGER() external view returns (address);

function EXCHANGE_RATE_UNIT() external view returns (uint256);

function INITIAL_EXCHANGE_RATE() external view returns (uint216);

function LOWER_BOUND() external view returns (uint256);

function PRECISION() external view returns (uint8);

function REWARDS_VAULT() external view returns (address);

function REWARD_TOKEN() external view returns (address);

function SLASH_ADMIN_ROLE() external view returns (uint256);

function STAKED_TOKEN() external view returns (address);

function UNSTAKE_WINDOW() external view returns (uint256);

function allowance(address owner, address spender) external view returns (uint256);

function approve(address spender, uint256 value) external returns (bool);

function assets(
address
) external view returns (uint128 emissionPerSecond, uint128 lastUpdateTimestamp, uint256 index);

function balanceOf(address account) external view returns (uint256);

function claimRewards(address to, uint256 amount) external;

function claimRewardsAndRedeem(address to, uint256 claimAmount, uint256 redeemAmount) external;

function claimRewardsAndRedeemOnBehalf(
address from,
address to,
uint256 claimAmount,
uint256 redeemAmount
) external;

function claimRewardsOnBehalf(
address from,
address to,
uint256 amount
) external returns (uint256);

function claimRoleAdmin(uint256 role) external;

function configureAssets(AssetConfigInput[] memory assetsConfigInput) external;

function cooldown() external;

function cooldownOnBehalfOf(address from) external;

function decimals() external view returns (uint8);

function distributionEnd() external view returns (uint256);

function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);

function getAdmin(uint256 role) external view returns (address);

function getCooldownSeconds() external view returns (uint256);

function getExchangeRate() external view returns (uint216);

function getMaxSlashablePercentage() external view returns (uint256);

function getPendingAdmin(uint256 role) external view returns (address);

function getTotalRewardsBalance(address staker) external view returns (uint256);

function getUserAssetData(address user, address asset) external view returns (uint256);

function inPostSlashingPeriod() external view returns (bool);

function initialize(
string memory name,
string memory symbol,
address slashingAdmin,
address cooldownPauseAdmin,
address claimHelper,
uint256 maxSlashablePercentage,
uint256 cooldownSeconds
) external;

function name() external view returns (string memory);

function nonces(address owner) external view returns (uint256);

function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;

function previewRedeem(uint256 shares) external view returns (uint256);

function previewStake(uint256 assets) external view returns (uint256);

function redeem(address to, uint256 amount) external;

function redeemOnBehalf(address from, address to, uint256 amount) external;

function returnFunds(uint256 amount) external;

function setCooldownSeconds(uint256 cooldownSeconds) external;

function setDistributionEnd(uint256 newDistributionEnd) external;

function setMaxSlashablePercentage(uint256 percentage) external;

function setPendingAdmin(uint256 role, address newPendingAdmin) external;

function settleSlashing() external;

function slash(address destination, uint256 amount) external returns (uint256);

function stake(address to, uint256 amount) external;

function stakeWithPermit(
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;

function stakerRewardsToClaim(address) external view returns (uint256);

function stakersCooldowns(address) external view returns (uint40 timestamp, uint216 amount);

function symbol() external view returns (string memory);

function totalSupply() external view returns (uint256);

function transfer(address to, uint256 value) external returns (bool);

function transferFrom(address from, address to, uint256 value) external returns (bool);
}
33 changes: 33 additions & 0 deletions src/20240118_StkGHO_Activation/StkGHOActivation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "GHO Safety Module Initialization"
author: "Aave_BGDLabs_ACI"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to other proposals we review, we are not to be included here. Usually who implements the proposal and who creates it are included (Aave Lab & ACI).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
author: "Aave_BGDLabs_ACI"
author: "Aave Labs & ACI"

discussions: "https://governance.aave.com/t/arfc-upgrade-safety-module-with-stkgho/15635"
---

## Simple Summary

This AIP activates the new GHO based Safety module by initiating the emission schedule approved by the community during the vote
https://snapshot.org/#/aave.eth/proposal/0x4bc99a842adab6cdd8c7d5c7a787ee4c0056be554fde0d008d53b45b3e795065

## Motivation

The GHO Safety Module will fortify the Aave Protocol’s resilience by adding a stablecoin asset, which is inherently less volatile than AAVE. This strategic move diversifies the Safety Module’s capacity to absorb shocks from various risk vectors in case of shortfall events.

## Specification

The GHO Safety module will be activated with the following parameters:

Base emission: 50 AAVE/day
Duration: Three months

## References
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here links should be included. Some default ones should have been auto-generated though.
And probably good to add stkGHO proxy additionally and link to https://github.com/bgd-labs/stake-token (the implementation)


[TBD]
Copy link
Contributor

@foodaka foodaka Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[TBD]
- https://github.com/bgd-labs/stake-token
- https://snapshot.org/#/aave.eth/proposal/0x4bc99a842adab6cdd8c7d5c7a787ee4c0056be554fde0d008d53b45b3e795065
- https://governance.aave.com/t/arfc-upgrade-safety-module-with-stkgho/15635

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@The-3D wanna add the simulated payload address?


## Disclaimer

Aave Labs, BGD Labs and ACI receive no compensation beyond Aave protocol for the creation of this proposal. BGD Labs and ACI are both delegates within the Aave ecosystem.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point on mentioning BGD Labs here, and we are not really delegates

Copy link
Contributor

@foodaka foodaka Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Aave Labs, BGD Labs and ACI receive no compensation beyond Aave protocol for the creation of this proposal. BGD Labs and ACI are both delegates within the Aave ecosystem.
Aave Labs and ACI receive no compensation beyond Aave protocol for the creation of this proposal. ACI is a delegate within the Aave ecosystem.


## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
54 changes: 54 additions & 0 deletions src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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 {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/20240118_StkGHO_Activation/StkGHO_Activation_20240118.s.sol:DeployEthereum chain=mainnet
* verify-command: npx catapulta-verify -b broadcast/20240118_StkGHO_Activation.s.sol/137/run-latest.json
*/
contract DeployEthereum is EthereumScript {
function run() external broadcast {
// deploy payloads
address payload0 = GovV3Helpers.deployDeterministic(
type(StkGHO_Activation_20240118).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/20240118_StkGHO_Activation/StkGHO_Activation_20240118.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(StkGHO_Activation_20240118).creationCode);
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum);

// create proposal
vm.startBroadcast();
GovV3Helpers.createProposal(
vm,
payloads,
GovV3Helpers.ipfsHashFile(vm, 'src/StkGHO_Activation_20240118/StkGHOActivation.md')
);
}
}
41 changes: 41 additions & 0 deletions src/20240118_StkGHO_Activation/StkGHO_Activation_20240118.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {AaveSafetyModule} from 'aave-address-book/AaveSafetyModule.sol';
import {IStakeToken} from './IStakeToken.sol';

/**
* @title StkGHO Activation
* @author the3d.eth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @author the3d.eth
* @author Aave Labs & ACI

* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0x4bc99a842adab6cdd8c7d5c7a787ee4c0056be554fde0d008d53b45b3e795065
* - Discussion: https://governance.aave.com/t/arfc-upgrade-safety-module-with-stkgho/15635
*/
contract StkGHO_Activation_20240118 is IProposalGenericExecutor {
uint128 public constant AAVE_EMISSION_PER_SECOND = uint128(50e18) / 1 days; // 50 AAVE per day
uint256 public constant DISTRIBUTION_DURATION = 90 days; // 3 months

function execute() external {
// Configure distribution
IStakeToken(AaveSafetyModule.STK_GHO).setDistributionEnd(
block.timestamp + DISTRIBUTION_DURATION
);
IStakeToken.AssetConfigInput[] memory enableConfigs = new IStakeToken.AssetConfigInput[](1);
enableConfigs[0] = IStakeToken.AssetConfigInput({
emissionPerSecond: AAVE_EMISSION_PER_SECOND,
totalStaked: 0, // it's overwritten internally
underlyingAsset: AaveSafetyModule.STK_GHO
});
IStakeToken(AaveSafetyModule.STK_GHO).configureAssets(enableConfigs);

// Allowance to pull funds from Ecosystem Reserve
MiscEthereum.AAVE_ECOSYSTEM_RESERVE_CONTROLLER.approve(
MiscEthereum.ECOSYSTEM_RESERVE,
AaveV3EthereumAssets.AAVE_UNDERLYING,
AaveSafetyModule.STK_GHO,
AAVE_EMISSION_PER_SECOND * DISTRIBUTION_DURATION
);
}
}
Loading