-
Notifications
You must be signed in to change notification settings - Fork 0
feat: re add verification script #80
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
Changes from 15 commits
2f10afe
0ba9d73
27cf969
c36f051
bec88aa
9cc00a4
2829f2d
e6d06b1
7158c40
0410d89
29d5af6
c25f1c7
61a0c49
013ce86
e1d927e
ec8391b
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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| MAKEFLAGS += --no-print-directory | ||
|
|
||
| include report.mk | ||
| include tools/report.mk tools/verification.mk | ||
| -include .env | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| // SPDX-FileCopyrightText: 2025 IEXEC BLOCKCHAIN TECH <[email protected]> | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| pragma solidity ^0.8.22; | ||
|
|
||
| import {Script} from "forge-std/Script.sol"; | ||
| import {console} from "forge-std/console.sol"; | ||
| import {stdJson} from "forge-std/StdJson.sol"; | ||
| import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; | ||
|
|
||
| /** | ||
| * @title GetConfigInfo | ||
| * @dev Script to extract configuration information and proxy implementation addresses. | ||
| * Replaces bash scripts with type-safe Solidity implementation. | ||
| * | ||
| * Usage examples: | ||
| * - Get config field: forge script script/GetConfigInfo.s.sol --sig "getConfigField(string,string)" "sepolia" "rlcCrosschainTokenAddress" | ||
| * - Get implementation: forge script script/GetConfigInfo.s.sol --sig "getImplementationAddress(string,string)" "sepolia" "rlcCrosschainTokenAddress" | ||
| */ | ||
| contract GetConfigInfo is Script { | ||
| using stdJson for string; | ||
| /** | ||
| * @dev Get a configuration field value for a specific chain | ||
| * @param chain The chain identifier (e.g., "sepolia", "arbitrum_sepolia") | ||
| * @param field The field name to retrieve | ||
| */ | ||
|
|
||
| function getConfigField(string calldata chain, string calldata field) external view { | ||
| address value = _getConfigFieldAddress(chain, field); | ||
| console.log(value); | ||
| } | ||
|
||
|
|
||
| /** | ||
| * @dev Internal helper to get a configuration field value for a specific chain | ||
| * @param chain The chain identifier (e.g., "sepolia", "arbitrum_sepolia") | ||
| * @param field The field name to retrieve | ||
| * @return The address value for the specified field | ||
| */ | ||
| function _getConfigFieldAddress(string memory chain, string memory field) internal view returns (address) { | ||
| string memory config = vm.readFile("config/config.json"); | ||
| string memory prefix = string.concat(".chains.", chain); | ||
|
|
||
| bytes32 fieldHash = keccak256(bytes(field)); | ||
| if ( | ||
| fieldHash == keccak256("initialAdmin") || fieldHash == keccak256("initialPauser") | ||
| || fieldHash == keccak256("initialUpgrader") || fieldHash == keccak256("createxFactory") | ||
| ) { | ||
| return config.readAddress(string.concat(".", field)); | ||
| } | ||
| return config.readAddress(string.concat(prefix, ".", field)); | ||
| } | ||
|
|
||
| /** | ||
| * @dev Get the implementation address of a proxy contract | ||
| * @param chain The chain identifier | ||
| * @param proxyField The config field containing the proxy address | ||
| */ | ||
| function getImplementationAddress(string calldata chain, string calldata proxyField) external view { | ||
| address proxyAddress = _getConfigFieldAddress(chain, proxyField); | ||
| if (proxyAddress == address(0)) { | ||
| console.log("Error: Proxy address is zero for field '%s'", proxyField); | ||
| revert("Zero proxy address"); | ||
gfournierPro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| // Get implementation address using OpenZeppelin's Upgrades library | ||
| address impl = Upgrades.getImplementationAddress(proxyAddress); | ||
| console.log(impl); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,127 @@ | ||||||
|
|
||||||
| # ======================================================================== | ||||||
| # SMART CONTRACT VERIFICATION | ||||||
| # ======================================================================== | ||||||
| # Chain IDs for supported networks | ||||||
| SEPOLIA_CHAIN_ID := 11155111 | ||||||
| ARBITRUM_SEPOLIA_CHAIN_ID := 421614 | ||||||
|
|
||||||
| # ======================================================================== | ||||||
| # VERIFICATION FUNCTIONS | ||||||
| # ======================================================================== | ||||||
|
|
||||||
| # Verify ERC1967 proxy contracts | ||||||
| # Parameters: CONTRACT_NAME, NETWORK, CONFIG_KEY, CHAIN_ID, DISPLAY_NAME | ||||||
| define verify-proxy | ||||||
| @echo "Verifying $(1) Proxy on $(5)..." | ||||||
| forge verify-contract \ | ||||||
| --chain-id $(4) \ | ||||||
| --watch \ | ||||||
| --etherscan-api-key $(ETHERSCAN_API_KEY) \ | ||||||
| $$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string,string)" $(2) $(3) 2>/dev/null | grep "0x" | tail -n1) \ | ||||||
| lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy | ||||||
| @echo "Proxy verification completed for $(1) on $(5)" | ||||||
| endef | ||||||
|
|
||||||
| # Verify implementation contracts with optional constructor arguments | ||||||
| # Parameters: CONTRACT_NAME, NETWORK, CONFIG_KEY, CHAIN_ID, DISPLAY_NAME, CONTRACT_PATH, RPC_URL, CONSTRUCTOR_ARGS | ||||||
| define verify-impl | ||||||
| @echo "Verifying $(1) Implementation on $(5)..." | ||||||
| @proxy_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string,string)" $(2) $(3) 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
|
||||||
| @proxy_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string,string)" $(2) $(3) 2>/dev/null | grep "0x" | tail -n1); \ | |
| @proxy_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string,string)" $(2) $(3) 2>/dev/null | grep "0x" | tail -n1); |
And all others.
Outdated
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.
| impl_address=$$(forge script script/GetConfigInfo.s.sol --sig "getImplementationAddress(string,string)" $(2) $(3) --rpc-url $(7) 2>/dev/null | grep "0x" | tail -n1); \ | |
| @impl_address=$$(forge script script/GetConfigInfo.s.sol --sig "getImplementationAddress(string,string)" $(2) $(3) --rpc-url $(7) 2>/dev/null | grep "0x" | tail -n1); |
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.
Trying to do so but can't make it work
gfournierPro marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Jul 22, 2025
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.
Inconsistent tab usage in comment formatting. This line uses tabs while other comment lines use spaces for alignment.
| # COMPLETION TARGETS | |
| # COMPLETION TARGETS |
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.
Why not:
and call it with
.initialAdminand.chains.sepolia.rlcLiquidityUnifierAddress