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

Add proposal for Gho Incident Report 20231113 #1

Merged
merged 10 commits into from
Dec 5, 2023
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/aave-helpers"]
path = lib/aave-helpers
url = https://github.com/bgd-labs/aave-helpers
[submodule "lib/gho-core"]
path = lib/gho-core
url = https://github.com/aave/gho-core
1 change: 1 addition & 0 deletions lib/gho-core
Submodule gho-core added at b2db75
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ aave-v3-periphery/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-periphery/
ds-test/=lib/aave-helpers/lib/forge-std/lib/ds-test/src/
forge-std/=lib/aave-helpers/lib/forge-std/src/
solidity-utils/=lib/aave-helpers/lib/solidity-utils/src/
gho-core/=lib/gho-core/src/
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126} from './AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126.sol';
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol';
import {EthereumScript} from 'aave-helpers/ScriptUtils.sol';

/**
* @dev Deploy AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126
* command: make deploy-ledger contract=src/20231126_AaveV3Ethereum_GHOVariableDebtTokenUpgrade/AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126.s.sol:DeployEthereum chain=mainnet
*/
contract DeployEthereum is EthereumScript {
address constant NEW_VGHO_IMPL = 0x0000000000000000000000000000000000000000;

function run() external broadcast {
// deploy payloads
AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126 payload0 = new AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126(
NEW_VGHO_IMPL
);

// compose action
IPayloadsControllerCore.ExecutionAction[]
memory actions = new IPayloadsControllerCore.ExecutionAction[](1);
actions[0] = GovV3Helpers.buildAction(address(payload0));

// register action at payloadsController
GovV3Helpers.createPayload(actions);
}
}

/**
* @dev Create Proposal
* command: make deploy-ledger contract=src/20231126_AaveV3Ethereum_GHOVariableDebtTokenUpgrade/AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126.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);
//TODO: Replace this address with payload address
actionsEthereum[0] = GovV3Helpers.buildAction(0xfb1163CD80850CD107bB134C15E5dfDF284F63FE);
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum);

// create proposal
vm.startBroadcast();
GovV3Helpers.createProposal2_5(
payloads,
GovV3Helpers.ipfsHashFile(
vm,
'src/20231126_AaveV3Ethereum_GHOVariableDebtTokenUpgrade/<INSERT MD FILE HERE>' //TODO: Replace this with Summary file
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {ConfiguratorInputTypes} from 'aave-address-book/AaveV3.sol';
import {IERC20} from 'forge-std/interfaces/IERC20.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';

/**
* @title vGHO improvement: upgrade vGHO implementation
* @author AAVE
* - Discussion:
*/
contract AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126 {
address public immutable NEW_VGHO_IMPL;

constructor(address newVGhoImpl) {
NEW_VGHO_IMPL = newVGhoImpl;
}

function execute() external {
AaveV3Ethereum.POOL_CONFIGURATOR.updateVariableDebtToken(
ConfiguratorInputTypes.UpdateDebtTokenInput({
asset: AaveV3EthereumAssets.GHO_UNDERLYING,
incentivesController: AaveV3Ethereum.DEFAULT_INCENTIVES_CONTROLLER,
name: IERC20(AaveV3EthereumAssets.GHO_V_TOKEN).name(),
symbol: IERC20(AaveV3EthereumAssets.GHO_V_TOKEN).symbol(),
implementation: NEW_VGHO_IMPL,
params: bytes('')
})
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';
import {AaveV3EthereumAssets, AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol';
import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol';
import {AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126} from './AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126.sol';
import {IGhoVariableDebtToken} from 'gho-core/contracts/facilitators/aave/tokens/interfaces/IGhoVariableDebtToken.sol';

interface IGhoVariableDebtTokenHelper is IGhoVariableDebtToken {
miguelmtzinf marked this conversation as resolved.
Show resolved Hide resolved
function DEBT_TOKEN_REVISION() external returns (uint256);
}

/**
* @dev Test for AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126
* command: make test-contract filter=AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126
*/
contract AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126_Test is ProtocolV3TestBase {
AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126 internal proposal;
address constant NEW_VGHO_IMPL = address(0);

function setUp() public {
vm.createSelectFork(vm.rpcUrl('mainnet'), 18584275);
proposal = new AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126(NEW_VGHO_IMPL);
}

function test_defaultProposalExecution() public {
defaultTest(
'AaveV3Ethereum_GHOVariableDebtTokenUpgrade_20231126',
AaveV3Ethereum.POOL,
address(proposal)
);
}

function test_debtTokenRevisionUpdate() public {
assertTrue(
IGhoVariableDebtTokenHelper(AaveV3EthereumAssets.GHO_V_TOKEN).DEBT_TOKEN_REVISION() == 0x3
);
}
}