This repository was archived by the owner on Dec 11, 2025. It is now read-only.
forked from smartcontractkit/ccip
-
Notifications
You must be signed in to change notification settings - Fork 9
feat: deployment script #31
Open
DhairyaSethi
wants to merge
7
commits into
ccip-gho
Choose a base branch
from
feat/deploy-script
base: ccip-gho
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+155
−13
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f827a6d
feat: deployment script
DhairyaSethi 019dc9d
feat: use json input
DhairyaSethi 6a657f3
chore: cleanup
DhairyaSethi 9d110b0
feat: upgrade and use local oz
DhairyaSethi b4c0cfe
chore: add deployment static validations
DhairyaSethi f0cffe2
chore: nit
DhairyaSethi bbf72df
feat: decouple proxy admin owner
DhairyaSethi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {Script} from "forge-std/Script.sol"; | ||
| import {console2 as console} from "forge-std/console2.sol"; | ||
|
|
||
| import {TransparentUpgradeableProxy, ProxyAdmin} from "@oz/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
| import {UpgradeableBurnMintTokenPool} from "./../src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol"; | ||
|
|
||
| import {IERC20Metadata} from "solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol"; | ||
| import {ITypeAndVersion} from "./../src/v0.8/shared/interfaces/ITypeAndVersion.sol"; | ||
|
|
||
| struct Config { | ||
| address GHO_TOKEN; | ||
| address OWNER; | ||
| address PROXY_ADMIN_OWNER; | ||
| address RMN_PROXY; | ||
| address ROUTER; | ||
| } | ||
|
|
||
| /// @notice Deploys UpgradeableBurnMintTokenPool behind a transparent upgradable proxy for GHO. | ||
| /// Pre-requisite: add parameters to config.json, the with key as `chainId` of the target network. | ||
| /// Usage: FOUNDRY_PROFILE=ccip forge script DeployUpgradableBurnMintTokenPool --rpc-url <RPC_URL> --private-key <PRIVATE_KEY> --broadcast --verify --etherscan-api-key <ETHERSCAN_API_KEY> --slow | ||
| contract DeployUpgradableBurnMintTokenPool is Script { | ||
| function run() external { | ||
| Config memory config = _parseConfig(); | ||
|
|
||
| uint8 TOKEN_DECIMALS = IERC20Metadata(config.GHO_TOKEN).decimals(); | ||
| address[] memory ALLOW_LIST = new address[](0); | ||
| bool ALLOW_LIST_ENABLED = false; | ||
|
|
||
| vm.startBroadcast(); | ||
| address tokenPool = address( | ||
| new UpgradeableBurnMintTokenPool(config.GHO_TOKEN, TOKEN_DECIMALS, config.RMN_PROXY, ALLOW_LIST_ENABLED) | ||
| ); | ||
| address tokenPoolProxy = address( | ||
| new TransparentUpgradeableProxy({ | ||
| _logic: tokenPool, | ||
| initialOwner: config.PROXY_ADMIN_OWNER, | ||
| _data: abi.encodeCall(UpgradeableBurnMintTokenPool.initialize, (config.OWNER, ALLOW_LIST, config.ROUTER)) | ||
| }) | ||
| ); | ||
| vm.stopBroadcast(); | ||
|
|
||
| console.log("tokenPoolProxy ", tokenPoolProxy); | ||
| console.log("tokenPoolImplementation ", tokenPool); | ||
|
|
||
| _validate(tokenPoolProxy, config); | ||
| } | ||
|
|
||
| function _parseConfig() internal view returns (Config memory) { | ||
| string memory config = vm.readFile(string.concat(vm.projectRoot(), "/script/config.json")); | ||
| return _validate(abi.decode(vm.parseJson(config, string.concat(".", vm.toString(block.chainid))), (Config))); | ||
| } | ||
|
|
||
| function _validate(Config memory config) internal view returns (Config memory) { | ||
| require(address(config.OWNER) != address(0), "InvalidOwner"); | ||
| require(address(config.PROXY_ADMIN_OWNER) != address(0), "InvalidOwner"); | ||
| require(_cmp(IERC20Metadata(config.GHO_TOKEN).name(), "Gho Token"), "InvalidToken"); | ||
| require(_cmp(IERC20Metadata(config.GHO_TOKEN).symbol(), "GHO"), "InvalidToken"); | ||
| require(_cmp(ITypeAndVersion(config.RMN_PROXY).typeAndVersion(), "ARMProxy 1.0.0"), "InvalidRmnProxy"); | ||
| require(_cmp(ITypeAndVersion(config.ROUTER).typeAndVersion(), "Router 1.2.0"), "InvalidRouter"); | ||
| return config; | ||
| } | ||
|
|
||
| function _validate(address proxy, Config memory config) internal view { | ||
| require(_cmp(_getProxyAdmin(proxy).UPGRADE_INTERFACE_VERSION(), "5.0.0"), "InvalidProxyAdminVersion"); | ||
| require(_getProxyAdmin(proxy).owner() == config.PROXY_ADMIN_OWNER, "InvalidProxyAdminOwner"); | ||
| require(address(UpgradeableBurnMintTokenPool(proxy).getToken()) == config.GHO_TOKEN, "InvalidToken"); | ||
| require(UpgradeableBurnMintTokenPool(proxy).getRmnProxy() == config.RMN_PROXY, "InvalidRmnProxy"); | ||
| require(UpgradeableBurnMintTokenPool(proxy).getRouter() == config.ROUTER, "InvalidRouter"); | ||
| } | ||
|
|
||
| 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 _cmp(string memory a, string memory b) internal pure returns (bool) { | ||
| return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "42161": { | ||
| "GHO_TOKEN": "0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33", | ||
| "OWNER": "0xFF1137243698CaA18EE364Cc966CF0e02A4e6327", | ||
| "PROXY_ADMIN_OWNER": "0xFF1137243698CaA18EE364Cc966CF0e02A4e6327", | ||
| "RMN_PROXY": "0xC311a21e6fEf769344EB1515588B9d535662a145", | ||
| "ROUTER": "0x141fa059441E0ca23ce184B6A78bafD2A517DdE8" | ||
| }, | ||
| "8453": { | ||
| "GHO_TOKEN": "0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee", | ||
| "OWNER": "0x9390B1735def18560c509E2d0bc090E9d6BA257a", | ||
| "PROXY_ADMIN_OWNER": "0x9390B1735def18560c509E2d0bc090E9d6BA257a", | ||
| "RMN_PROXY": "0xC842c69d54F83170C42C4d556B4F6B2ca53Dd3E8", | ||
| "ROUTER": "0x881e3A65B4d4a04dD529061dd0071cf975F58bCD" | ||
| }, | ||
| "100": { | ||
| "GHO_TOKEN": "0xfc421aD3C883Bf9E7C4f42dE845C4e4405799e73", | ||
| "OWNER": "0x1dF462e2712496373A347f8ad10802a5E95f053D", | ||
| "PROXY_ADMIN_OWNER": "0x1dF462e2712496373A347f8ad10802a5E95f053D", | ||
| "RMN_PROXY": "0xf5e5e1676942520995c1e39aFaC58A75Fe1cd2bB", | ||
| "ROUTER": "0x4aAD6071085df840abD9Baf1697d5D5992bDadce" | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.