Skip to content

Commit

Permalink
feat: use oz v5.1 proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaSethi committed Jan 8, 2025
1 parent 12ec93d commit c832f5d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ contract AaveV3Arbitrum_GHOCCIP151Upgrade_20241209 is IProposalGenericExecutor {
// https://arbiscan.io/address/0xF168B83598516A532a85995b52504a2Fa058C068
IUpgradeableBurnMintTokenPool_1_4 public constant EXISTING_TOKEN_POOL =
IUpgradeableBurnMintTokenPool_1_4(GhoArbitrum.GHO_CCIP_TOKEN_POOL); // will be updated in address-book after AIP
// https://arbiscan.io/address/0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee
// https://arbiscan.io/address/0xB94Ab28c6869466a46a42abA834ca2B3cECCA5eB
IUpgradeableBurnMintTokenPool_1_5_1 public constant NEW_TOKEN_POOL =
IUpgradeableBurnMintTokenPool_1_5_1(0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee);
IUpgradeableBurnMintTokenPool_1_5_1(0xB94Ab28c6869466a46a42abA834ca2B3cECCA5eB);

// https://arbiscan.io/address/0xcd04d93bea13921dad05240d577090b5ac36dfca
address public constant EXISTING_GHO_AAVE_STEWARD = 0xCd04D93bEA13921DaD05240D577090b5AC36DfCA;
// https://arbiscan.io/address/0x98217A06721Ebf727f2C8d9aD7718ec28b7aAe34
address public constant NEW_GHO_AAVE_STEWARD = 0x98217A06721Ebf727f2C8d9aD7718ec28b7aAe34;
// https://arbiscan.io/address/0xd2D586f849620ef042FE3aF52eAa10e9b78bf7De
address public constant NEW_GHO_AAVE_STEWARD = 0xd2D586f849620ef042FE3aF52eAa10e9b78bf7De;
// https://arbiscan.io/address/0xa9afaE6A53E90f9E4CE0717162DF5Bc3d9aBe7B2
IGhoBucketSteward public constant GHO_BUCKET_STEWARD =
IGhoBucketSteward(0xa9afaE6A53E90f9E4CE0717162DF5Bc3d9aBe7B2);
// https://arbiscan.io/address/0x3c47237479e7569653eF9beC4a7Cd2ee3F78b396
address public constant NEW_GHO_CCIP_STEWARD = 0x3c47237479e7569653eF9beC4a7Cd2ee3F78b396;
// https://arbiscan.io/address/0xCd5ab470AaC5c13e1063ee700503f3346b7C90Db
address public constant NEW_GHO_CCIP_STEWARD = 0xCd5ab470AaC5c13e1063ee700503f3346b7C90Db;

// https://etherscan.io/address/0x9Ec9F9804733df96D1641666818eFb5198eC50f0
address public constant EXISTING_REMOTE_POOL_ETH = 0x9Ec9F9804733df96D1641666818eFb5198eC50f0; // ProxyPool on ETH
// https://etherscan.io/address/0x20fd5f3FCac8883a3A0A2bBcD658A2d2c6EFa6B6
address public constant NEW_REMOTE_POOL_ETH = 0x20fd5f3FCac8883a3A0A2bBcD658A2d2c6EFa6B6;
// https://etherscan.io/address/0x06179f7C1be40863405f374E7f5F8806c728660A
address public constant NEW_REMOTE_POOL_ETH = 0x06179f7C1be40863405f374E7f5F8806c728660A;

// https://arbiscan.io/address/0xA5Ba213867E175A182a5dd6A9193C6158738105A
// https://github.com/aave/ccip/commit/ca73ec8c4f7dc0f6a99ae1ea0acde43776c7b9bb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol';
import {GhoArbitrum} from 'aave-address-book/GhoArbitrum.sol';
import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol';

import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol';
import {CCIPUtils} from './utils/CCIPUtils.sol';
import {AaveV3Arbitrum_GHOCCIP151Upgrade_20241209} from './AaveV3Arbitrum_GHOCCIP151Upgrade_20241209.sol';

Expand Down Expand Up @@ -61,21 +62,21 @@ contract AaveV3Arbitrum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
IGhoAaveSteward public constant EXISTING_GHO_AAVE_STEWARD =
IGhoAaveSteward(0xCd04D93bEA13921DaD05240D577090b5AC36DfCA);
IGhoAaveSteward public constant NEW_GHO_AAVE_STEWARD =
IGhoAaveSteward(0x98217A06721Ebf727f2C8d9aD7718ec28b7aAe34);
IGhoAaveSteward(0xd2D586f849620ef042FE3aF52eAa10e9b78bf7De);
IGhoBucketSteward internal constant GHO_BUCKET_STEWARD =
IGhoBucketSteward(0xa9afaE6A53E90f9E4CE0717162DF5Bc3d9aBe7B2);
IGhoCcipSteward internal constant EXISTING_GHO_CCIP_STEWARD =
IGhoCcipSteward(0xb329CEFF2c362F315900d245eC88afd24C4949D5);
IGhoCcipSteward internal constant NEW_GHO_CCIP_STEWARD =
IGhoCcipSteward(0x3c47237479e7569653eF9beC4a7Cd2ee3F78b396);
IGhoCcipSteward(0xCd5ab470AaC5c13e1063ee700503f3346b7C90Db);

IProxyPool internal constant EXISTING_PROXY_POOL =
IProxyPool(0x26329558f08cbb40d6a4CCA0E0C67b29D64A8c50);
IUpgradeableBurnMintTokenPool_1_4 internal constant EXISTING_TOKEN_POOL =
IUpgradeableBurnMintTokenPool_1_4(0xF168B83598516A532a85995b52504a2Fa058C068); // GhoArbitrum.GHO_CCIP_TOKEN_POOL; will be updated in address-book after AIP
IUpgradeableBurnMintTokenPool_1_5_1 internal constant NEW_TOKEN_POOL =
IUpgradeableBurnMintTokenPool_1_5_1(0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee);
address internal constant NEW_REMOTE_POOL_ETH = 0x20fd5f3FCac8883a3A0A2bBcD658A2d2c6EFa6B6;
IUpgradeableBurnMintTokenPool_1_5_1(0xB94Ab28c6869466a46a42abA834ca2B3cECCA5eB);
address internal constant NEW_REMOTE_POOL_ETH = 0x06179f7C1be40863405f374E7f5F8806c728660A;

AaveV3Arbitrum_GHOCCIP151Upgrade_20241209 internal proposal;

Expand All @@ -88,7 +89,7 @@ contract AaveV3Arbitrum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
event CCIPSendRequested(IInternal.EVM2EVMMessage message);

function setUp() public virtual {
vm.createSelectFork(vm.rpcUrl('arbitrum'), 292550754);
vm.createSelectFork(vm.rpcUrl('arbitrum'), 293345614);
proposal = new AaveV3Arbitrum_GHOCCIP151Upgrade_20241209();

// pre-req - chainlink transfers gho token pool ownership on token admin registry
Expand Down Expand Up @@ -148,11 +149,11 @@ contract AaveV3Arbitrum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
assertEq(IOwnable(address(NEW_GHO_AAVE_STEWARD)).owner(), GovernanceV3Arbitrum.EXECUTOR_LVL_1);
assertEq(
NEW_GHO_AAVE_STEWARD.POOL_ADDRESSES_PROVIDER(),
EXISTING_GHO_AAVE_STEWARD.POOL_ADDRESSES_PROVIDER()
address(AaveV3Arbitrum.POOL_ADDRESSES_PROVIDER)
);
assertEq(
NEW_GHO_AAVE_STEWARD.POOL_DATA_PROVIDER(),
EXISTING_GHO_AAVE_STEWARD.POOL_DATA_PROVIDER()
address(AaveV3Arbitrum.AAVE_PROTOCOL_DATA_PROVIDER)
);
assertEq(NEW_GHO_AAVE_STEWARD.RISK_COUNCIL(), EXISTING_GHO_AAVE_STEWARD.RISK_COUNCIL());
assertEq(
Expand All @@ -174,6 +175,8 @@ contract AaveV3Arbitrum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
abi.encode(NEW_GHO_CCIP_STEWARD.getCcipTimelocks()),
abi.encode(IGhoCcipSteward.CcipDebounce(0, 0))
);

assertEq(_getProxyAdmin(address(NEW_TOKEN_POOL)).UPGRADE_INTERFACE_VERSION(), '5.0.0');
}

function _getTokenMessage(
Expand Down Expand Up @@ -240,6 +243,11 @@ contract AaveV3Arbitrum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
return address(uint160(uint256(vm.load(proxy, slot))));
}

function _getProxyAdmin(address proxy) internal view returns (ProxyAdmin) {
bytes32 slot = bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1);
return ProxyAdmin(address(uint160(uint256(vm.load(proxy, slot)))));
}

function _readInitialized(address proxy) internal view returns (uint8) {
return uint8(uint256(vm.load(proxy, bytes32(0))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ contract AaveV3E2E_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
event Minted(address indexed sender, address indexed recipient, uint256 amount);

function setUp() public virtual {
l1.c.forkId = vm.createFork(vm.rpcUrl('mainnet'), 21564756);
l2.c.forkId = vm.createFork(vm.rpcUrl('arbitrum'), 292550754);
l1.c.forkId = vm.createFork(vm.rpcUrl('mainnet'), 21581477);
l2.c.forkId = vm.createFork(vm.rpcUrl('arbitrum'), 293345614);

vm.selectFork(l1.c.forkId);
l1.proposal = new AaveV3Ethereum_GHOCCIP151Upgrade_20241209();
l1.existingTokenPool = IUpgradeableLockReleaseTokenPool_1_4(
0x5756880B6a1EAba0175227bf02a7E87c1e02B28C
); // MiscEthereum.GHO_CCIP_TOKEN_POOL; will be updated in address-book after AIP
l1.newTokenPool = IUpgradeableLockReleaseTokenPool_1_5_1(
0x20fd5f3FCac8883a3A0A2bBcD658A2d2c6EFa6B6
0x06179f7C1be40863405f374E7f5F8806c728660A
);
l1.c.router = IRouter(l1.existingTokenPool.getRouter());
l2.c.chainSelector = l1.existingTokenPool.getSupportedChains()[0];
Expand All @@ -114,7 +114,7 @@ contract AaveV3E2E_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
0xF168B83598516A532a85995b52504a2Fa058C068
); // MiscArbitrum.GHO_CCIP_TOKEN_POOL; will be updated in address-book after AIP
l2.newTokenPool = IUpgradeableBurnMintTokenPool_1_5_1(
0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee
0xB94Ab28c6869466a46a42abA834ca2B3cECCA5eB
);
l2.c.router = IRouter(l2.existingTokenPool.getRouter());
l1.c.chainSelector = l2.existingTokenPool.getSupportedChains()[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ contract AaveV3Ethereum_GHOCCIP151Upgrade_20241209 is IProposalGenericExecutor {
// https://etherscan.io/address/0x5756880B6a1EAba0175227bf02a7E87c1e02B28C
IUpgradeableLockReleaseTokenPool_1_4 public constant EXISTING_TOKEN_POOL =
IUpgradeableLockReleaseTokenPool_1_4(GhoEthereum.GHO_CCIP_TOKEN_POOL); // will be updated in address-book after AIP
// https://etherscan.io/address/0x20fd5f3FCac8883a3A0A2bBcD658A2d2c6EFa6B6
// https://etherscan.io/address/0x06179f7C1be40863405f374E7f5F8806c728660A
IUpgradeableLockReleaseTokenPool_1_5_1 public constant NEW_TOKEN_POOL =
IUpgradeableLockReleaseTokenPool_1_5_1(0x20fd5f3FCac8883a3A0A2bBcD658A2d2c6EFa6B6);
IUpgradeableLockReleaseTokenPool_1_5_1(0x06179f7C1be40863405f374E7f5F8806c728660A);

// https://etherscan.io/address/0xFEb4e54591660F42288312AE8eB59e9f2B746b66
address public constant EXISTING_GHO_AAVE_STEWARD = 0xFEb4e54591660F42288312AE8eB59e9f2B746b66;
// https://etherscan.io/address/0x6e637e1E48025E51315d50ab96d5b3be1971A715
address public constant NEW_GHO_AAVE_STEWARD = 0x6e637e1E48025E51315d50ab96d5b3be1971A715;
// https://etherscan.io/address/0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee
address public constant NEW_GHO_CCIP_STEWARD = 0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee;
// https://etherscan.io/address/0x98217A06721Ebf727f2C8d9aD7718ec28b7aAe34
address public constant NEW_GHO_AAVE_STEWARD = 0x98217A06721Ebf727f2C8d9aD7718ec28b7aAe34;
// https://etherscan.io/address/0xC5BcC58BE6172769ca1a78B8A45752E3C5059c39
address public constant NEW_GHO_CCIP_STEWARD = 0xC5BcC58BE6172769ca1a78B8A45752E3C5059c39;

// https://arbiscan.io/address/0x26329558f08cbb40d6a4CCA0E0C67b29D64A8c50
address public constant EXISTING_REMOTE_POOL_ARB = 0x26329558f08cbb40d6a4CCA0E0C67b29D64A8c50; // ProxyPool on Arb
// https://arbiscan.io/address/0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee
address public constant NEW_REMOTE_POOL_ARB = 0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee;
// https://arbiscan.io/address/0xB94Ab28c6869466a46a42abA834ca2B3cECCA5eB
address public constant NEW_REMOTE_POOL_ARB = 0xB94Ab28c6869466a46a42abA834ca2B3cECCA5eB;

// Token Rate Limit Capacity: 300_000 GHO
uint128 public constant CCIP_RATE_LIMIT_CAPACITY = 300_000e18;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol';
import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol';

import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol';
import {CCIPUtils} from './utils/CCIPUtils.sol';
import {AaveV3Ethereum_GHOCCIP151Upgrade_20241209} from './AaveV3Ethereum_GHOCCIP151Upgrade_20241209.sol';

Expand Down Expand Up @@ -61,19 +62,19 @@ contract AaveV3Ethereum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
IGhoAaveSteward public constant EXISTING_GHO_AAVE_STEWARD =
IGhoAaveSteward(0xFEb4e54591660F42288312AE8eB59e9f2B746b66);
IGhoAaveSteward public constant NEW_GHO_AAVE_STEWARD =
IGhoAaveSteward(0x6e637e1E48025E51315d50ab96d5b3be1971A715);
IGhoAaveSteward(0x98217A06721Ebf727f2C8d9aD7718ec28b7aAe34);
IGhoCcipSteward internal constant EXISTING_GHO_CCIP_STEWARD =
IGhoCcipSteward(0x101Efb7b9Beb073B1219Cd5473a7C8A2f2EB84f4);
IGhoCcipSteward internal constant NEW_GHO_CCIP_STEWARD =
IGhoCcipSteward(0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee);
IGhoCcipSteward(0xC5BcC58BE6172769ca1a78B8A45752E3C5059c39);

IProxyPool internal constant EXISTING_PROXY_POOL =
IProxyPool(0x9Ec9F9804733df96D1641666818eFb5198eC50f0);
IUpgradeableLockReleaseTokenPool_1_4 internal constant EXISTING_TOKEN_POOL =
IUpgradeableLockReleaseTokenPool_1_4(0x5756880B6a1EAba0175227bf02a7E87c1e02B28C); // GhoEthereum.GHO_CCIP_TOKEN_POOL; will be updated in address-book after AIP
IUpgradeableLockReleaseTokenPool_1_5_1 internal constant NEW_TOKEN_POOL =
IUpgradeableLockReleaseTokenPool_1_5_1(0x20fd5f3FCac8883a3A0A2bBcD658A2d2c6EFa6B6);
address internal constant NEW_REMOTE_POOL_ARB = 0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee;
IUpgradeableLockReleaseTokenPool_1_5_1(0x06179f7C1be40863405f374E7f5F8806c728660A);
address internal constant NEW_REMOTE_POOL_ARB = 0xB94Ab28c6869466a46a42abA834ca2B3cECCA5eB;

AaveV3Ethereum_GHOCCIP151Upgrade_20241209 internal proposal;

Expand All @@ -88,7 +89,7 @@ contract AaveV3Ethereum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
error BridgeLimitExceeded(uint256 limit);

function setUp() public virtual {
vm.createSelectFork(vm.rpcUrl('mainnet'), 21564756);
vm.createSelectFork(vm.rpcUrl('mainnet'), 21581477);
proposal = new AaveV3Ethereum_GHOCCIP151Upgrade_20241209();

// pre-req - chainlink transfers gho token pool ownership on token admin registry
Expand Down Expand Up @@ -142,11 +143,11 @@ contract AaveV3Ethereum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
assertEq(IOwnable(address(NEW_GHO_AAVE_STEWARD)).owner(), GovernanceV3Ethereum.EXECUTOR_LVL_1);
assertEq(
NEW_GHO_AAVE_STEWARD.POOL_ADDRESSES_PROVIDER(),
EXISTING_GHO_AAVE_STEWARD.POOL_ADDRESSES_PROVIDER()
address(AaveV3Ethereum.POOL_ADDRESSES_PROVIDER)
);
assertEq(
NEW_GHO_AAVE_STEWARD.POOL_DATA_PROVIDER(),
EXISTING_GHO_AAVE_STEWARD.POOL_DATA_PROVIDER()
address(AaveV3Ethereum.AAVE_PROTOCOL_DATA_PROVIDER)
);
assertEq(NEW_GHO_AAVE_STEWARD.RISK_COUNCIL(), EXISTING_GHO_AAVE_STEWARD.RISK_COUNCIL());
assertEq(
Expand All @@ -168,6 +169,8 @@ contract AaveV3Ethereum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
abi.encode(NEW_GHO_CCIP_STEWARD.getCcipTimelocks()),
abi.encode(IGhoCcipSteward.CcipDebounce(0, 0))
);

assertEq(_getProxyAdmin(address(NEW_TOKEN_POOL)).UPGRADE_INTERFACE_VERSION(), '5.0.0');
}

function _getTokenMessage(
Expand Down Expand Up @@ -248,6 +251,10 @@ contract AaveV3Ethereum_GHOCCIP151Upgrade_20241209_Base is ProtocolV3TestBase {
function _readInitialized(address proxy) internal view returns (uint8) {
return uint8(uint256(vm.load(proxy, bytes32(0))));
}
function _getProxyAdmin(address proxy) internal view returns (ProxyAdmin) {
bytes32 slot = bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1);
return ProxyAdmin(address(uint160(uint256(vm.load(proxy, slot)))));
}

function _getRateLimiterConfig() internal view returns (IRateLimiter.Config memory) {
return
Expand Down Expand Up @@ -706,7 +713,7 @@ contract AaveV3Ethereum_GHOCCIP151Upgrade_20241209_PostUpgrade is
IDefaultInterestRateStrategyV2.InterestRateData
memory currentRateData = IDefaultInterestRateStrategyV2.InterestRateData({
optimalUsageRatio: 99_00,
baseVariableBorrowRate: 12_50,
baseVariableBorrowRate: 11_50,
variableRateSlope1: 0,
variableRateSlope2: 0
});
Expand Down
4 changes: 2 additions & 2 deletions src/20241209_Multi_GHOCCIP151Upgrade/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const config: ConfigFile = {
votingNetwork: 'POLYGON',
},
poolOptions: {
AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 21564756}},
AaveV3Arbitrum: {configs: {OTHERS: {}}, cache: {blockNumber: 292550754}},
AaveV3Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 21581477}},
AaveV3Arbitrum: {configs: {OTHERS: {}}, cache: {blockNumber: 293345614}},
},
};

0 comments on commit c832f5d

Please sign in to comment.