Skip to content

Commit

Permalink
Add AIP for GHO Cross-Chain Launch (bgd-labs#350)
Browse files Browse the repository at this point in the history
* Add proposal for Gho Incident Report 20231113 (#1)

* chore: add payload and deploy script for update of GHO variable debt token

* forge install: gho-core

* chore: add gho-core to dependency

* test: Add tests for update of gho variable token

* test: Add tests for update of gho variable token

* fix: add modifier in method of interface

* fix: remove gho dependency from repo and fix test

* fix: Remove unnecesary dependency

* fix: Add latest details

---------

Co-authored-by: miguelmtzinf <[email protected]>

* fix: Make new impl constant (#3)

* fix: Amend AIP text (#4)

* fix: Make new impl constant

* fix: Fix AIP text

* test: Tweak default tests with borrow cap update (#5)

* fix: lint issue (#6)

* test: Add diffs from test running (#7)

* fix: Add payload address (#8)

* fix: Fix payload address in script (#9)

* fix: Remove unneeded diff file (#10)

* feat: Add AIP code

* fix: Fix AIP docs and imports

* fix: Remove unnecesary test

* fix: Updates risk params

* test: Add ccip e2e tests

* fix: Fix Arbitrum payload max bytecode size exceeded

* feat: Add sophisticated defensive aave seed (#13)

* feat: Add sophhisticated defensive aave seed

* fix: Allows AaveDefensive contract remove itself as facilitator

* fix: Add docs and reduce bytecode size

* fix: Reduce Utils lib bytecode size

* fix: Fix error in Utils

* fix: Add Capped gho usd price oracle

* fix: Add AIP draft text

* fix: Update block number for tests

* fix: Remove unneeded files

* fix: Install latest version of gho and ccip repos

* fix: Remove unused helper function

* fix: Fix AIP text

* fix: Remove defensive and use create2

* fix: Add fixed price oracle

* fix: Remove unnecessary memory variables

* fix: Use create1 and move listing out

* fix: Remove listing aip

---------

Co-authored-by: Parth Patel <[email protected]>
  • Loading branch information
miguelmtzinf and parth-15 authored Jun 14, 2024
1 parent 58067dd commit 7725647
Show file tree
Hide file tree
Showing 14 changed files with 1,574 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "lib/aave-helpers"]
path = lib/aave-helpers
url = https://github.com/bgd-labs/aave-helpers
[submodule "lib/ccip"]
path = lib/ccip
url = https://github.com/aave/ccip
[submodule "lib/gho-core"]
path = lib/gho-core
url = https://github.com/aave/gho-core
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
1 change: 1 addition & 0 deletions lib/ccip
Submodule ccip added at d6cb9d
1 change: 1 addition & 0 deletions lib/gho-core
Submodule gho-core added at a9647e
4 changes: 3 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ aave-v3-core/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-core/
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/
solidity-utils/=lib/aave-helpers/lib/solidity-utils/src/
ccip/=lib/ccip/contracts/src/
gho-core/=lib/gho-core/src/contracts/
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol';
import {MiscArbitrum} from 'aave-address-book/MiscArbitrum.sol';
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
import {UpgradeableBurnMintTokenPool} from 'ccip/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol';
import {UpgradeableTokenPool} from 'ccip/v0.8/ccip/pools/GHO/UpgradeableTokenPool.sol';
import {RateLimiter} from 'ccip/v0.8/ccip/libraries/RateLimiter.sol';
import {UpgradeableGhoToken} from 'gho-core/gho/UpgradeableGhoToken.sol';
import {IGhoToken} from 'gho-core/gho/interfaces/IGhoToken.sol';

library Utils {
address public constant CCIP_ARM_PROXY = 0xC311a21e6fEf769344EB1515588B9d535662a145;
address public constant CCIP_ROUTER = 0x141fa059441E0ca23ce184B6A78bafD2A517DdE8;
uint256 public constant CCIP_BUCKET_CAPACITY = 1_000_000e18; // 1M
uint64 public constant CCIP_ETH_CHAIN_SELECTOR = 5009297550715157269;

function deployGhoToken() internal returns (address) {
address imple = address(new UpgradeableGhoToken());

bytes memory ghoTokenInitParams = abi.encodeWithSignature(
'initialize(address)',
GovernanceV3Arbitrum.EXECUTOR_LVL_1 // owner
);
return
address(new TransparentUpgradeableProxy(imple, MiscArbitrum.PROXY_ADMIN, ghoTokenInitParams));
}

function deployCcipTokenPool(address ghoToken) external returns (address) {
address imple = address(new UpgradeableBurnMintTokenPool(ghoToken, CCIP_ARM_PROXY, false));

bytes memory tokenPoolInitParams = abi.encodeWithSignature(
'initialize(address,address[],address)',
GovernanceV3Arbitrum.EXECUTOR_LVL_1, // owner
new address[](0), // allowList
CCIP_ROUTER // router
);
return
address(
new TransparentUpgradeableProxy(
imple, // logic
MiscArbitrum.PROXY_ADMIN, // proxy admin
tokenPoolInitParams // data
)
);
}
}

/**
* @title GHO Cross-Chain Launch
* @author Aave Labs
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0x2a6ffbcff41a5ef98b7542f99b207af9c1e79e61f859d0a62f3bf52d3280877a
* - Discussion: https://governance.aave.com/t/arfc-gho-cross-chain-launch/17616
* @dev This payload consists of the following set of actions:
* 1. Deploy GHO
* 2. Deploy BurnMintTokenPool
* 3. Accept ownership of CCIP TokenPool
* 4. Configure CCIP TokenPool
* 5. Add CCIP TokenPool as GHO Facilitator
*/
contract AaveV3Arbitrum_GHOCrossChainLaunch_20240528 is IProposalGenericExecutor {
function execute() external {
// 1. Deploy GHO
address ghoToken = Utils.deployGhoToken();

// 2. Deploy BurnMintTokenPool
address tokenPool = Utils.deployCcipTokenPool(ghoToken);

// 3. Accept TokenPool ownership
UpgradeableBurnMintTokenPool(tokenPool).acceptOwnership();

// 4. Configure CCIP TokenPool
_configureCcipTokenPool(tokenPool);

// 5. Add CCIP TokenPool as GHO Facilitator
IGhoToken(ghoToken).grantRole(
IGhoToken(ghoToken).FACILITATOR_MANAGER_ROLE(),
GovernanceV3Arbitrum.EXECUTOR_LVL_1
);
IGhoToken(ghoToken).grantRole(
IGhoToken(ghoToken).BUCKET_MANAGER_ROLE(),
GovernanceV3Arbitrum.EXECUTOR_LVL_1
);
IGhoToken(ghoToken).addFacilitator(
tokenPool,
'CCIP TokenPool',
uint128(Utils.CCIP_BUCKET_CAPACITY)
);
}

function _configureCcipTokenPool(address tokenPool) internal {
UpgradeableTokenPool.ChainUpdate[] memory chainUpdates = new UpgradeableTokenPool.ChainUpdate[](
1
);
RateLimiter.Config memory rateConfig = RateLimiter.Config({
isEnabled: false,
capacity: 0,
rate: 0
});
chainUpdates[0] = UpgradeableTokenPool.ChainUpdate({
remoteChainSelector: Utils.CCIP_ETH_CHAIN_SELECTOR,
allowed: true,
outboundRateLimiterConfig: rateConfig,
inboundRateLimiterConfig: rateConfig
});
UpgradeableBurnMintTokenPool(tokenPool).applyChainUpdates(chainUpdates);
}
}
Loading

0 comments on commit 7725647

Please sign in to comment.