From 612ebe4a373c806e00d8230122f00422f7fbc0af Mon Sep 17 00:00:00 2001 From: CheyenneAtapour Date: Tue, 9 Jul 2024 16:27:01 -0700 Subject: [PATCH] test: deploy gho pool in base test --- src/test/TestGhoBase.t.sol | 38 ++++++++++++++++++++++++++++++++- src/test/TestGhoStewardV2.t.sol | 1 + 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/test/TestGhoBase.t.sol b/src/test/TestGhoBase.t.sol index e793024e..0e753a62 100644 --- a/src/test/TestGhoBase.t.sol +++ b/src/test/TestGhoBase.t.sol @@ -79,6 +79,9 @@ import {SampleLiquidator} from '../contracts/facilitators/gsm/misc/SampleLiquida import {SampleSwapFreezer} from '../contracts/facilitators/gsm/misc/SampleSwapFreezer.sol'; import {GsmRegistry} from '../contracts/facilitators/gsm/misc/GsmRegistry.sol'; +// CCIP contracts +import {UpgradeableLockReleaseTokenPool} from 'ccip/v0.8/ccip/pools/GHO/UpgradeableLockReleaseTokenPool.sol'; + contract TestGhoBase is Test, Constants, Events { using WadRayMath for uint256; using SafeCast for uint256; @@ -127,6 +130,7 @@ contract TestGhoBase is Test, Constants, Events { GhoSteward GHO_STEWARD; GhoStewardV2 GHO_STEWARD_V2; FixedRateStrategyFactory FIXED_RATE_STRATEGY_FACTORY; + UpgradeableLockReleaseTokenPool GHO_TOKEN_POOL; constructor() { setupGho(); @@ -292,11 +296,43 @@ contract TestGhoBase is Test, Constants, Events { ); GHO_TOKEN.grantRole(GHO_TOKEN_BUCKET_MANAGER_ROLE, address(GHO_STEWARD)); FIXED_RATE_STRATEGY_FACTORY = new FixedRateStrategyFactory(address(PROVIDER)); + // Deploy Gho Token Pool + address ARM_PROXY = makeAddr('ARM_PROXY'); + address OWNER = makeAddr('OWNER'); + address ROUTER = makeAddr('ROUTER'); + address PROXY_ADMIN = makeAddr('PROXY_ADMIN'); + uint256 INITIAL_BRIDGE_LIMIT = 100e6 * 1e18; + UpgradeableLockReleaseTokenPool tokenPoolImpl = new UpgradeableLockReleaseTokenPool( + address(GHO_TOKEN), + ARM_PROXY, + false, + true + ); + // proxy deploy and init + address[] memory emptyArray = new address[](0); + bytes memory tokenPoolInitParams = abi.encodeWithSignature( + 'initialize(address,address[],address,uint256)', + OWNER, + emptyArray, + ROUTER, + INITIAL_BRIDGE_LIMIT + ); + TransparentUpgradeableProxy tokenPoolProxy = new TransparentUpgradeableProxy( + address(tokenPoolImpl), + PROXY_ADMIN, + tokenPoolInitParams + ); + + // Manage ownership + vm.prank(OWNER); + UpgradeableLockReleaseTokenPool(address(tokenPoolProxy)).acceptOwnership(); + GHO_TOKEN_POOL = UpgradeableLockReleaseTokenPool(address(tokenPoolProxy)); + GHO_STEWARD_V2 = new GhoStewardV2( SHORT_EXECUTOR, address(PROVIDER), address(GHO_TOKEN), - address(0x004), // TODO: Mock the CCIP token pool + address(GHO_TOKEN_POOL), address(FIXED_RATE_STRATEGY_FACTORY), RISK_COUNCIL ); diff --git a/src/test/TestGhoStewardV2.t.sol b/src/test/TestGhoStewardV2.t.sol index 88ce13b9..e6cd24a9 100644 --- a/src/test/TestGhoStewardV2.t.sol +++ b/src/test/TestGhoStewardV2.t.sol @@ -20,6 +20,7 @@ contract TestGhoStewardV2 is TestGhoBase { assertEq(GHO_STEWARD.owner(), SHORT_EXECUTOR); assertEq(GHO_STEWARD_V2.POOL_ADDRESSES_PROVIDER(), address(PROVIDER)); assertEq(GHO_STEWARD_V2.GHO_TOKEN(), address(GHO_TOKEN)); + assertEq(GHO_STEWARD_V2.GHO_TOKEN_POOL(), address(GHO_TOKEN_POOL)); assertEq(GHO_STEWARD_V2.FIXED_RATE_STRATEGY_FACTORY(), address(FIXED_RATE_STRATEGY_FACTORY)); assertEq(GHO_STEWARD_V2.RISK_COUNCIL(), RISK_COUNCIL);