-
Notifications
You must be signed in to change notification settings - Fork 79
chore: Foundry script for OP Adapter deloyment + deploy Ink adapter #1228
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
base: faisal/udpate-op-adapter
Are you sure you want to change the base?
Changes from all commits
a13c918
f60d98b
81301cd
5917380
b3a9f9f
5cc2dd5
29a38a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| { | ||
| "transactions": [ | ||
| { | ||
| "hash": "0x7ac780398b1c615d246de6de420d9c965c91ba23ea66e56282cda339fbcc458e", | ||
| "transactionType": "CREATE", | ||
| "contractName": "OP_Adapter", | ||
| "contractAddress": "0x44857a6b740d2c7eb362901017971d42427f3838", | ||
| "function": null, | ||
| "arguments": [ | ||
| "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", | ||
| "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", | ||
| "0x69d3Cf86B2Bf1a9e99875B7e2D9B6a84426c171f", | ||
| "0x88FF1e5b602916615391F55854588EFcBB7663f0", | ||
| "0x0000000000000000000000000000000000000000", | ||
| "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d", | ||
| "21" | ||
| ], | ||
| "transaction": { | ||
| "from": "0x9a8f92a830a5cb89a3816e3d267cb7791c16b04d", | ||
| "gas": "0xfbdda", | ||
| "value": "0x0", | ||
| "input": "0x610180806040523461026f5760e081610fa780380380916100208285610273565b83398101031261026f578051906001600160a01b038216820361026f576020810151916001600160a01b0383169081840361026f576040830151906001600160a01b038216820361026f576060840151906001600160a01b038216820361026f5760808501516001600160a01b0381169690939087850361026f5760a08701516001600160a01b0381169790919088830361026f5760c001519263ffffffff8416840361026f5760805260c05260e05260a0525f80604051602081019063011a412160e61b8252600481526100f6602482610273565b5190885afa3d15610268573d6001600160401b0381116102545760405190610128601f8201601f191660200183610273565b81523d5f602083013e5b81610248575b81610212575b50610100526101205261014052610160526101f4575b604051610d109081610297823960805181818160fa015261024b015260a0518181816102c90152818161060001526106ae015260c0518181816104a60152610a92015260e05181818161020701526104db015261010051818181610287015261057501526101205181818161035a0152610a510152610140518181816103c1015281816108b201526109cb0152610160518181816107f30152610a0e0152f35b15901514610203575f80610154565b635110d79160e01b5f5260045ffd5b9050602081519101519060208110610237575b506001600160a01b031615155f61013e565b5f199060200360031b1b165f610225565b80516020149150610138565b634e487b7160e01b5f52604160045260245ffd5b6060610132565b5f80fd5b601f909101601f19168101906001600160401b038211908210176102545760405256fe6080806040526004361015610012575f80fd5b5f905f3560e01c90816311eac85514610a75575080631efd482a14610a32578063299e9687146109ef57806335a2db6a146109ac57806352c8c75c1461030b5780635e743ef7146102ed5780636e400983146102ac578063775c0d031461026f578063927ede2d1461022b5780639748cf7c146101e75763e6eb8ade14610097575f80fd5b60403660031901126101e4576100ab610ab6565b6024359067ffffffffffffffff82116101e257366023830112156101e25781600401359067ffffffffffffffff82116101cf57602483019260248336920101116101cf57836001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691823b156101de57816001600160a01b0391604051928391633dbb202b60e01b835216948560048301526060602483015281838161015c606482018b8d610b02565b62030d40604483015203925af180156101d3576101ba575b50506101b47f9e6c52944e331ba6270e7fe4cea2a4086bae8f7a27e1cdba07f416806f5d0ac4936040519384938452604060208501526040840191610b02565b0390a180f35b816101c491610acc565b6101cf57835f610174565b8380fd5b6040513d84823e3d90fd5b5080fd5b825b80fd5b50346101e457806003193601126101e45760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101e457806003193601126101e45760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101e457806003193601126101e45760206040517f000000000000000000000000000000000000000000000000000000000000000015158152f35b50346101e457806003193601126101e457602060405163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101e457806003193601126101e457602060405162030d408152f35b50608036600319011261078157610320610ab6565b602435906001600160a01b0382168092036107815760443591606435906001600160a01b03821680920361078157846001600160a01b03807f0000000000000000000000000000000000000000000000000000000000000000169416938085145f1461049e57803b156101de57818091602460405180948193632e1a7d4d60e01b83528b60048401525af180156101d357610489575b506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156101de57818691608460405180948193639a2ac6d560e01b835289600484015262030d406024840152606060448401528560648401525af180156101d35761046a575b5050907fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b93608093925b604051938452602084015260408301526060820152a180f35b816104789195949395610acc565b610485579091845f610427565b8480fd5b8161049391610acc565b61048557845f6103b6565b5050929091927f00000000000000000000000000000000000000000000000000000000000000006001600160a01b038116908186145f146108a6577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169081156107e157848261051592610b22565b6040516332dd704760e21b8152602081600481855afa90811561078d578891610798575b509060206001600160a01b03926024604051809581936352b7631960e11b8352886004840152165afa91821561078d578892610755575b5090917f0000000000000000000000000000000000000000000000000000000000000000919085805b6105ce575050505050917fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9391608093610451565b8481111561074f57845b841561069857833b15610694578a604051634701287760e11b815282600482015263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201528a60448201528460648201528160848201528160a48201526107d060c4820152818160e481838a5af180156101d35761067f575b50505b810390811161066b5780610599565b634e487b7160e01b8a52601160045260248afd5b8161068991610acc565b610694578a5f610659565b8a80fd5b6040516337e9a82760e11b8152600481018290527f000000000000000000000000000000000000000000000000000000000000000063ffffffff166024820152604481018a9052606481018490526020816084818f895af1801561074457610701575b5061065c565b6020813d821161073c575b8161071960209383610acc565b81010312610738575167ffffffffffffffff811603610694575f6106fb565b8b80fd5b3d915061070c565b6040513d8e823e3d90fd5b806105d8565b9091506020813d602011610785575b8161077160209383610acc565b810103126107815751905f610570565b5f80fd5b3d9150610764565b6040513d8a823e3d90fd5b90506020813d6020116107d9575b816107b360209383610acc565b810103126107d55751906001600160a01b03821682036107d557906020610539565b8780fd5b3d91506107a6565b505050846001600160a01b03949392947f00000000000000000000000000000000000000000000000000000000000000001661081e868287610b22565b803b156101de5781809160646040518094819363262cc5ab60e11b83528960048401528b602484015262030d4060448401525af180156101d35761088b575b5050907fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9360809392610451565b816108999195949395610acc565b610485579091845f61085d565b50506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166108dd838287610b22565b803b15610781575f809160e46040518094819363041c592960e51b83528a600484015287602484015289604484015288606484015262030d40608484015260c060a48401528160c48401525af180156109a157610962575b50917fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9391608093610451565b608093919550916109955f7fd7e09655439c3932e55857df3220186e5a7f0980825f20691c2b35d941dee75b9694610acc565b5f959193509193610935565b6040513d5f823e3d90fd5b34610781575f3660031901126107815760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b34610781575f3660031901126107815760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b34610781575f3660031901126107815760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b34610781575f366003190112610781576020906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b600435906001600160a01b038216820361078157565b90601f8019910116810190811067ffffffffffffffff821117610aee57604052565b634e487b7160e01b5f52604160045260245ffd5b908060209392818452848401375f828201840152601f01601f1916010190565b6001600160a01b0316916001600160a01b0360405192636eb1769f60e11b84523060048501521690816024840152602083604481875afa9283156109a1575f93610c7b575b508201809211610c67575f809160405193602085019163095ea7b360e01b83526024860152604485015260448452610ba0606485610acc565b60405193610baf604086610acc565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020860152519082865af13d15610c5a573d9067ffffffffffffffff8211610aee57604051610c21949092610c13601f8201601f191660200185610acc565b83523d5f602085013e610caf565b8051908115918215610c37575b50501561078157565b819250906020918101031261078157602001518015158103610781575f80610c2e565b91610c2192606091610caf565b634e487b7160e01b5f52601160045260245ffd5b9092506020813d602011610ca7575b81610c9760209383610acc565b810103126107815751915f610b67565b3d9150610c8a565b91925015610ccb57815115610cc2575090565b3b156107815790565b50805190811561078157602001fdfea26469706673582212202da86657dbd069af56df4256fc04a91432db64a4f5f3b4928b86c4218111f15f64736f6c634300081e0033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000069d3cf86b2bf1a9e99875b7e2d9b6a84426c171f00000000000000000000000088ff1e5b602916615391f55854588efcbb7663f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d0000000000000000000000000000000000000000000000000000000000000015", | ||
| "nonce": "0x2db2", | ||
| "chainId": "0x1" | ||
| }, | ||
| "additionalContracts": [], | ||
| "isFixedGasLimit": false | ||
| } | ||
| ], | ||
| "receipts": [ | ||
| { | ||
| "status": "0x1", | ||
| "cumulativeGasUsed": "0x3730409", | ||
| "logs": [], | ||
| "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
| "type": "0x2", | ||
| "transactionHash": "0x7ac780398b1c615d246de6de420d9c965c91ba23ea66e56282cda339fbcc458e", | ||
| "transactionIndex": "0x1f6", | ||
| "blockHash": "0xdc8c82ec0ff950d0d271e8c0b95956488da24f84d5477fcf25f75eab7ba6aa18", | ||
| "blockNumber": "0x16f5e2e", | ||
| "gasUsed": "0xc1be3", | ||
| "effectiveGasPrice": "0x34aa39d", | ||
| "from": "0x9a8f92a830a5cb89a3816e3d267cb7791c16b04d", | ||
| "to": null, | ||
| "contractAddress": "0x44857a6b740d2c7eb362901017971d42427f3838" | ||
| } | ||
| ], | ||
| "libraries": [], | ||
| "pending": [], | ||
| "returns": {}, | ||
| "timestamp": 1766499077165, | ||
| "chain": 1, | ||
| "commit": "ab2a49a0" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ This file contains the latest deployed smart contract addresses from the broadca | |
| | LpTokenFactory | [0x7dB69eb9F52eD773E9b03f5068A1ea0275b2fD9d](https://etherscan.io/address/0x7dB69eb9F52eD773E9b03f5068A1ea0275b2fD9d) | | ||
| | Mode_Adapter | [0xf1B59868697f3925b72889ede818B9E7ba0316d0](https://etherscan.io/address/0xf1B59868697f3925b72889ede818B9E7ba0316d0) | | ||
| | MulticallHandler | [0x0F7Ae28dE1C8532170AD4ee566B5801485c13a0E](https://etherscan.io/address/0x0F7Ae28dE1C8532170AD4ee566B5801485c13a0E) | | ||
| | OP_Adapter_57073 | [0x44857a6b740D2c7eB362901017971D42427f3838](https://etherscan.io/address/0x44857a6b740D2c7eB362901017971D42427f3838) | | ||
| | Optimism_Adapter | [0xE1e74B3D6A8E2A479B62958D4E4E6eEaea5B612b](https://etherscan.io/address/0xE1e74B3D6A8E2A479B62958D4E4E6eEaea5B612b) | | ||
| | Optimism_Adapter | [0x3562e309C6C79626E5F0Cf746FB5Bf4f6b8EebE5](https://etherscan.io/address/0x3562e309C6C79626E5F0Cf746FB5Bf4f6b8EebE5) | | ||
|
Comment on lines
38
to
39
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Driveby comment - we shouldn't have two
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch, this is known problem, it only happens in the md file and the script needs to be updated to only take the latest one |
||
| | PermissionSplitterProxy | [0x0Bf07B2e415F02711fFBB32491f8ec9e5489B2e7](https://etherscan.io/address/0x0Bf07B2e415F02711fFBB32491f8ec9e5489B2e7) | | ||
|
|
@@ -105,12 +106,12 @@ This file contains the latest deployed smart contract addresses from the broadca | |
|
|
||
| ## Monad (143) | ||
|
|
||
| | Contract Name | Address | | ||
| | ------------------ | ----------------------------------------------------------------------------------------------------------------------- | | ||
| | Helios | [0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64](https://monadscan.com//address/0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64) | | ||
| | MulticallHandler | [0xeC41F75c686e376Ab2a4F18bde263ab5822c4511](https://monadscan.com//address/0xeC41F75c686e376Ab2a4F18bde263ab5822c4511) | | ||
| | SpokePool | [0xd2ecb3afe598b746F8123CaE365a598DA831A449](https://monadscan.com//address/0xd2ecb3afe598b746F8123CaE365a598DA831A449) | | ||
| | SpokePoolPeriphery | [0xe9b0666DFfC176Df6686726CB9aaC78fD83D20d7](https://monadscan.com//address/0xe9b0666DFfC176Df6686726CB9aaC78fD83D20d7) | | ||
| | Contract Name | Address | | ||
| | ------------------ | ------------------------------------------------------------------------------------------------------------------------ | | ||
| | Helios | [0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64](https://monadvision.com/address/0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64) | | ||
| | MulticallHandler | [0xeC41F75c686e376Ab2a4F18bde263ab5822c4511](https://monadvision.com/address/0xeC41F75c686e376Ab2a4F18bde263ab5822c4511) | | ||
| | SpokePool | [0xd2ecb3afe598b746F8123CaE365a598DA831A449](https://monadvision.com/address/0xd2ecb3afe598b746F8123CaE365a598DA831A449) | | ||
| | SpokePoolPeriphery | [0xe9b0666DFfC176Df6686726CB9aaC78fD83D20d7](https://monadvision.com/address/0xe9b0666DFfC176Df6686726CB9aaC78fD83D20d7) | | ||
|
|
||
| ## Lens (232) | ||
|
|
||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nb. the bones of this file were taken from script/024DeployBaseAdapter.s.sol. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import { Script } from "forge-std/Script.sol"; | ||
| import { Test } from "forge-std/Test.sol"; | ||
| import { console } from "forge-std/console.sol"; | ||
| import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; | ||
| import { IL1StandardBridge } from "@eth-optimism/contracts/L1/messaging/IL1StandardBridge.sol"; | ||
| import { IOpUSDCBridgeAdapter } from "../contracts/external/interfaces/IOpUSDCBridgeAdapter.sol"; | ||
| import { ITokenMessenger } from "../contracts/external/interfaces/CCTPInterfaces.sol"; | ||
| import { WETH9Interface } from "../contracts/external/interfaces/WETH9Interface.sol"; | ||
| import { OP_Adapter } from "../contracts/chain-adapters/OP_Adapter.sol"; | ||
| import { Constants } from "./utils/Constants.sol"; | ||
|
|
||
| // How to run: | ||
| // 1. `source .env` where `.env` has MNEMONIC="x x x ... x" and ETHERSCAN_API_KEY="x" entries | ||
| // 2. forge script script/056DeployOPAdapter.s.sol:DeployOPAdapter --rpc-url $NODE_URL_1 -vvvv | ||
| // 3. Verify the above works in simulation mode. | ||
| // 4. Deploy on mainnet by adding --broadcast --verify flags. | ||
| // 5. forge script script/056DeployOPAdapter.s.sol:DeployOPAdapter --rpc-url $NODE_URL_1 --broadcast --verify -vvvv | ||
| contract DeployOPAdapter is Script, Test, Constants { | ||
| function run() external { | ||
| string memory deployerMnemonic = vm.envString("MNEMONIC"); | ||
| uint256 spokeChainId = vm.envUint("SPOKE_CHAIN_ID"); | ||
| uint256 deployerPrivateKey = vm.deriveKey(deployerMnemonic, 0); | ||
|
|
||
| // Get the current chain ID | ||
| uint256 chainId = block.chainid; | ||
| bool hasCctpDomain = hasCctpDomain(destinationChainId); | ||
| uint32 cctpDomain = hasCctpDomain ? getCircleDomainId(spokeChainId) : CCTP_NO_DOMAIN; | ||
| address cctpTokenMessenger = hasCctpDomain ? getL1Addresses(chainId).cctpV2TokenMessenger : address(0); | ||
|
|
||
| // Verify this is being deployed on Ethereum mainnet or Sepolia | ||
| require( | ||
| chainId == getChainId("MAINNET") || chainId == getChainId("SEPOLIA"), | ||
| "Base_Adapter should only be deployed on Ethereum mainnet or Sepolia" | ||
| ); | ||
|
|
||
| address weth = getWrappedNativeToken(chainId); | ||
|
|
||
| // Get OP Stack addresses for hub and spoke chain IDs. | ||
| Constants.OpStackAddresses memory opStack = getOpStackAddresses(chainId, spokeChainId); | ||
|
|
||
| vm.startBroadcast(deployerPrivateKey); | ||
|
|
||
| // Deploy Base_Adapter with constructor parameters | ||
| OP_Adapter adapter = new OP_Adapter( | ||
| WETH9Interface(weth), // L1 WETH | ||
| IERC20(getUSDCAddress(chainId)), // L1 USDC | ||
| opStack.L1CrossDomainMessenger, // L1 Cross Domain Messenger | ||
| IL1StandardBridge(opStack.L1StandardBridge), // L1 Standard Bridge | ||
| IOpUSDCBridgeAdapter(opStack.L1OpUSDCBridgeAdapter), // L1 OP USDC Bridge | ||
| ITokenMessenger(cctpTokenMessenger), // CCTP (V2) Token Messenger | ||
| cctpDomain | ||
| ); | ||
|
|
||
| // Log the deployed addresses | ||
| console.log("Chain ID:", chainId); | ||
| console.log("OP Adapter deployed to:", address(adapter)); | ||
| console.log("L1 WETH:", weth); | ||
| console.log("L1 Cross Domain Messenger:", opStack.L1CrossDomainMessenger); | ||
| console.log("L1 Standard Bridge:", opStack.L1StandardBridge); | ||
| console.log("L1 USDC:", getUSDCAddress(chainId)); | ||
| console.log("CCTP Token Messenger:", getL1Addresses(chainId).cctpV2TokenMessenger); | ||
| console.log("CCTP Domain:", cctpDomain); | ||
|
|
||
| vm.stopBroadcast(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's inteded to add this; can easily drop it if not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine since we want to track the latest deployments and they are needs to generate
broadcast/deployed-addresses.json