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 AIP for GHO Cross-Chain Launch #350

Merged
merged 33 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 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
0e39df3
Merge branch 'bgd-labs:main' into main
miguelmtzinf May 28, 2024
f9a83f1
feat: Add AIP code
miguelmtzinf Jun 3, 2024
19c623b
fix: Fix AIP docs and imports
miguelmtzinf Jun 3, 2024
29d4a25
fix: Remove unnecesary test
miguelmtzinf Jun 3, 2024
1aa1fd6
fix: Updates risk params
miguelmtzinf Jun 4, 2024
76283d9
test: Add ccip e2e tests
miguelmtzinf Jun 5, 2024
17eb17c
fix: Fix Arbitrum payload max bytecode size exceeded
miguelmtzinf Jun 6, 2024
06b890f
feat: Add sophisticated defensive aave seed (#13)
miguelmtzinf Jun 10, 2024
a2e9336
fix: Reduce Utils lib bytecode size
miguelmtzinf Jun 10, 2024
3a94184
fix: Fix error in Utils
miguelmtzinf Jun 10, 2024
0c2e4cc
fix: Add Capped gho usd price oracle
miguelmtzinf Jun 10, 2024
fb77e1f
fix: Add AIP draft text
miguelmtzinf Jun 10, 2024
9ab927b
fix: Update block number for tests
miguelmtzinf Jun 11, 2024
14bc98b
fix: Remove unneeded files
miguelmtzinf Jun 11, 2024
345f5e7
fix: Install latest version of gho and ccip repos
miguelmtzinf Jun 11, 2024
e026d39
fix: Remove unused helper function
miguelmtzinf Jun 11, 2024
8d735ec
fix: Fix AIP text
miguelmtzinf Jun 11, 2024
d98dd50
fix: Remove defensive and use create2
miguelmtzinf Jun 12, 2024
1bfb95f
fix: Add fixed price oracle
miguelmtzinf Jun 12, 2024
f055eec
fix: Remove unnecessary memory variables
miguelmtzinf Jun 12, 2024
7bb0504
fix: Use create1 and move listing out
miguelmtzinf Jun 13, 2024
bed1298
fix: Remove listing aip
miguelmtzinf Jun 13, 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
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"]
miguelmtzinf marked this conversation as resolved.
Show resolved Hide resolved
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
Loading