Skip to content

Commit

Permalink
feat: stewards, base tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaSethi committed Dec 26, 2024
1 parent 514bde6 commit 59e1dd2
Show file tree
Hide file tree
Showing 4 changed files with 507 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGen
import {IUpgradeableBurnMintTokenPool_1_5_1} from 'src/interfaces/ccip/tokenPool/IUpgradeableBurnMintTokenPool.sol';
import {ITokenAdminRegistry} from 'src/interfaces/ccip/ITokenAdminRegistry.sol';
import {IRateLimiter} from 'src/interfaces/ccip/IRateLimiter.sol';
import {IGhoBucketSteward} from 'src/interfaces/IGhoBucketSteward.sol';
import {IGhoToken} from 'src/interfaces/IGhoToken.sol';

import {AaveV3Base} from 'aave-address-book/AaveV3Base.sol';
import {MiscBase} from 'aave-address-book/MiscBase.sol';
import {GovernanceV3Base} from 'aave-address-book/GovernanceV3Base.sol';
import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol';
Expand All @@ -36,44 +38,38 @@ contract AaveV3Base_GHOBaseLaunch_20241223 is IProposalGenericExecutor {
address public constant GHO_TOKEN_IMPL = 0xb0e1c7830aA781362f79225559Aa068E6bDaF1d1;
// predicted address, will be deployed in the AIP
IGhoToken public constant GHO_TOKEN_PROXY = IGhoToken(0x6F2216CB3Ca97b8756C5fD99bE27986f04CBd81D);

address public immutable GHO_AAVE_STEWARD;
address public immutable GHO_BUCKET_STEWARD;
address public immutable GHO_CCIP_STEWARD;

address public immutable REMOTE_TOKEN_POOL_ETH;
address public immutable REMOTE_TOKEN_POOL_ARB;

constructor(
address tokenPool,
address ghoCcipSteward,
address tokenPoolEth,
address tokenPoolArb
address tokenPoolArb,
address ghoAaveSteward,
address ghoBucketSteward,
address ghoCcipSteward
) {
TOKEN_POOL = IUpgradeableBurnMintTokenPool_1_5_1(tokenPool);
GHO_CCIP_STEWARD = ghoCcipSteward;
REMOTE_TOKEN_POOL_ETH = tokenPoolEth;
REMOTE_TOKEN_POOL_ARB = tokenPoolArb;
GHO_AAVE_STEWARD = ghoAaveSteward;
GHO_BUCKET_STEWARD = ghoBucketSteward;
GHO_CCIP_STEWARD = ghoCcipSteward;
}

function execute() external {
_acceptOwnership();
if (_deployAndInitializeGhoToken() != address(GHO_TOKEN_PROXY)) revert();

GHO_TOKEN_PROXY.grantRole(
GHO_TOKEN_PROXY.FACILITATOR_MANAGER_ROLE(),
GovernanceV3Base.EXECUTOR_LVL_1
);
GHO_TOKEN_PROXY.grantRole(
GHO_TOKEN_PROXY.BUCKET_MANAGER_ROLE(),
GovernanceV3Base.EXECUTOR_LVL_1
);
GHO_TOKEN_PROXY.addFacilitator(
address(TOKEN_POOL),
'CCIP TokenPool v1.5.1',
CCIP_BUCKET_CAPACITY
);
if (_deployAndInitializeGhoToken() != address(GHO_TOKEN_PROXY)) revert();

TOKEN_POOL.setRateLimitAdmin(address(GHO_CCIP_STEWARD));
_setupStewardsAndTokenPoolOnGho();

_setupRemoteTokenPools();
_setupRemoteTokenPools(); // eth & arb

TOKEN_ADMIN_REGISTRY.setPool(address(GHO_TOKEN_PROXY), address(TOKEN_POOL));
}
Expand All @@ -94,6 +90,39 @@ contract AaveV3Base_GHOBaseLaunch_20241223 is IProposalGenericExecutor {
);
}

function _setupStewardsAndTokenPoolOnGho() internal {
GHO_TOKEN_PROXY.grantRole(
GHO_TOKEN_PROXY.FACILITATOR_MANAGER_ROLE(),
GovernanceV3Base.EXECUTOR_LVL_1
);
GHO_TOKEN_PROXY.grantRole(
GHO_TOKEN_PROXY.BUCKET_MANAGER_ROLE(),
GovernanceV3Base.EXECUTOR_LVL_1
);

// Token Pool as facilitator with 20M GHO capacity
GHO_TOKEN_PROXY.addFacilitator(
address(TOKEN_POOL),
'CCIP TokenPool v1.5.1',
CCIP_BUCKET_CAPACITY
);

// Gho Aave Steward
AaveV3Base.ACL_MANAGER.grantRole(AaveV3Base.ACL_MANAGER.RISK_ADMIN_ROLE(), GHO_AAVE_STEWARD);

// Gho Bucket Steward
GHO_TOKEN_PROXY.grantRole(GHO_TOKEN_PROXY.BUCKET_MANAGER_ROLE(), GHO_BUCKET_STEWARD);
address[] memory facilitatorList = new address[](1);
facilitatorList[0] = address(TOKEN_POOL);
IGhoBucketSteward(GHO_BUCKET_STEWARD).setControlledFacilitator({
facilitatorList: facilitatorList,
approve: true
});

// Gho CCIP Steward
TOKEN_POOL.setRateLimitAdmin(GHO_CCIP_STEWARD);
}

function _setupRemoteTokenPools() internal {
IRateLimiter.Config memory emptyRateLimiterConfig = IRateLimiter.Config({
isEnabled: false,
Expand All @@ -102,12 +131,12 @@ contract AaveV3Base_GHOBaseLaunch_20241223 is IProposalGenericExecutor {
});

IUpgradeableBurnMintTokenPool_1_5_1.ChainUpdate[]
memory chains = new IUpgradeableBurnMintTokenPool_1_5_1.ChainUpdate[](2);
memory chainsToAdd = new IUpgradeableBurnMintTokenPool_1_5_1.ChainUpdate[](2);

{
bytes[] memory remotePoolAddresses = new bytes[](1);
remotePoolAddresses[0] = abi.encode(REMOTE_TOKEN_POOL_ETH);
chains[0] = IUpgradeableBurnMintTokenPool_1_5_1.ChainUpdate({
chainsToAdd[0] = IUpgradeableBurnMintTokenPool_1_5_1.ChainUpdate({
remoteChainSelector: ETH_CHAIN_SELECTOR,
remotePoolAddresses: remotePoolAddresses,
remoteTokenAddress: abi.encode(AaveV3EthereumAssets.GHO_UNDERLYING),
Expand All @@ -119,7 +148,7 @@ contract AaveV3Base_GHOBaseLaunch_20241223 is IProposalGenericExecutor {
{
bytes[] memory remotePoolAddresses = new bytes[](1);
remotePoolAddresses[0] = abi.encode(REMOTE_TOKEN_POOL_ARB);
chains[1] = IUpgradeableBurnMintTokenPool_1_5_1.ChainUpdate({
chainsToAdd[1] = IUpgradeableBurnMintTokenPool_1_5_1.ChainUpdate({
remoteChainSelector: ARB_CHAIN_SELECTOR,
remotePoolAddresses: remotePoolAddresses,
remoteTokenAddress: abi.encode(AaveV3ArbitrumAssets.GHO_UNDERLYING),
Expand All @@ -130,7 +159,7 @@ contract AaveV3Base_GHOBaseLaunch_20241223 is IProposalGenericExecutor {

TOKEN_POOL.applyChainUpdates({
remoteChainSelectorsToRemove: new uint64[](0),
chainsToAdd: chains
chainsToAdd: chainsToAdd
});
}
}
Loading

0 comments on commit 59e1dd2

Please sign in to comment.