|
| 1 | + |
| 2 | +# ======================================================================== |
| 3 | +# SMART CONTRACT VERIFICATION |
| 4 | +# ======================================================================== |
| 5 | +# Chain IDs for supported networks |
| 6 | +SEPOLIA_CHAIN_ID := 11155111 |
| 7 | +ARBITRUM_SEPOLIA_CHAIN_ID := 421614 |
| 8 | + |
| 9 | +# ======================================================================== |
| 10 | +# VERIFICATION FUNCTIONS |
| 11 | +# ======================================================================== |
| 12 | + |
| 13 | +# Verify ERC1967 proxy contracts |
| 14 | +# Parameters: CONTRACT_NAME, NETWORK, CONFIG_KEY, CHAIN_ID, DISPLAY_NAME |
| 15 | +define verify-proxy |
| 16 | + @echo "Verifying $(1) Proxy on $(5)..." |
| 17 | + forge verify-contract \ |
| 18 | + --chain-id $(4) \ |
| 19 | + --watch \ |
| 20 | + --etherscan-api-key $(ETHERSCAN_API_KEY) \ |
| 21 | + $$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.$(2).$(3)" 2>/dev/null | grep "0x" | tail -n1) \ |
| 22 | + lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy |
| 23 | + @echo "Proxy verification completed for $(1) on $(5)" |
| 24 | +endef |
| 25 | + |
| 26 | +# Verify implementation contracts with optional constructor arguments |
| 27 | +# Parameters: CONTRACT_NAME, NETWORK, CONFIG_KEY, CHAIN_ID, DISPLAY_NAME, CONTRACT_PATH, RPC_URL, CONSTRUCTOR_ARGS |
| 28 | +define verify-impl |
| 29 | + @echo "Verifying $(1) Implementation on $(5)..." |
| 30 | + @proxy_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.$(2).$(3)" 2>/dev/null | grep "0x" | tail -n1); \ |
| 31 | + impl_address=$$(forge script script/GetConfigInfo.s.sol --sig "getImplementationAddress(string)" ".chains.$(2).$(3)" --rpc-url $(7) 2>/dev/null | grep "0x" | tail -n1); \ |
| 32 | + echo "Proxy address: $$proxy_address"; \ |
| 33 | + echo "Implementation address: $$impl_address"; \ |
| 34 | + forge verify-contract \ |
| 35 | + --chain-id $(4) \ |
| 36 | + --watch \ |
| 37 | + $(8) \ |
| 38 | + --etherscan-api-key $(ETHERSCAN_API_KEY) \ |
| 39 | + $$impl_address \ |
| 40 | + $(6); \ |
| 41 | + echo "Implementation verification completed for $(1) on $(5)"; \ |
| 42 | + echo "" |
| 43 | +endef |
| 44 | + |
| 45 | +# ======================================================================== |
| 46 | +# SEPOLIA NETWORK VERIFICATION |
| 47 | +# ======================================================================== |
| 48 | + |
| 49 | +# Proxy Verifications - Sepolia |
| 50 | +# ----------------------------- |
| 51 | +verify-rlc-liquidity-unifier-proxy-sepolia: |
| 52 | + $(call verify-proxy,RLCLiquidityUnifier,sepolia,rlcLiquidityUnifierAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan) |
| 53 | + |
| 54 | +verify-layerzero-bridge-proxy-sepolia: |
| 55 | + $(call verify-proxy,IexecLayerZeroBridge,sepolia,iexecLayerZeroBridgeAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan) |
| 56 | + |
| 57 | +# Implementation Verifications - Sepolia |
| 58 | +# -------------------------------------- |
| 59 | +verify-rlc-liquidity-unifier-impl-sepolia: |
| 60 | + @rlc_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.sepolia.rlcAddress" 2>/dev/null | grep "0x" | tail -n1); \ |
| 61 | + constructor_args=$$(cast abi-encode "constructor(address)" $$rlc_address); \ |
| 62 | + $(MAKE) _verify-rlc-liquidity-unifier-impl-sepolia CONSTRUCTOR_ARGS="--constructor-args $$constructor_args" |
| 63 | + |
| 64 | +_verify-rlc-liquidity-unifier-impl-sepolia: |
| 65 | + $(call verify-impl,RLCLiquidityUnifier,sepolia,rlcLiquidityUnifierAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan,src/RLCLiquidityUnifier.sol:RLCLiquidityUnifier,$(SEPOLIA_RPC_URL),$(CONSTRUCTOR_ARGS)) |
| 66 | + |
| 67 | +verify-layerzero-bridge-impl-sepolia: |
| 68 | + @echo "Building constructor arguments for IexecLayerZeroBridge..." |
| 69 | + @rlc_liquidity_unifier_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.sepolia.rlcLiquidityUnifierAddress" 2>/dev/null | grep "0x" | tail -n1); \ |
| 70 | + lz_endpoint_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.sepolia.lzEndpointAddress" 2>/dev/null | grep "0x" | tail -n1); \ |
| 71 | + constructor_args=$$(cast abi-encode "constructor(bool,address,address)" true $$rlc_liquidity_unifier_address $$lz_endpoint_address); \ |
| 72 | + $(MAKE) _verify-layerzero-bridge-impl-sepolia CONSTRUCTOR_ARGS="--constructor-args $$constructor_args" |
| 73 | + |
| 74 | +_verify-layerzero-bridge-impl-sepolia: |
| 75 | + $(call verify-impl,IexecLayerZeroBridge,sepolia,iexecLayerZeroBridgeAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan,src/bridges/layerZero/IexecLayerZeroBridge.sol:IexecLayerZeroBridge,$(SEPOLIA_RPC_URL),$(CONSTRUCTOR_ARGS)) |
| 76 | + |
| 77 | +# ======================================================================== |
| 78 | +# ARBITRUM SEPOLIA NETWORK VERIFICATION |
| 79 | +# ======================================================================== |
| 80 | + |
| 81 | +# Proxy Verifications - Arbitrum Sepolia |
| 82 | +# --------------------------------------- |
| 83 | +verify-rlc-crosschain-token-proxy-arbitrum-sepolia: |
| 84 | + $(call verify-proxy,RLCCrosschainToken,arbitrum_sepolia,rlcCrosschainTokenAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia) |
| 85 | + |
| 86 | +verify-layerzero-bridge-proxy-arbitrum-sepolia: |
| 87 | + $(call verify-proxy,IexecLayerZeroBridge,arbitrum_sepolia,iexecLayerZeroBridgeAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia) |
| 88 | + |
| 89 | +# Implementation Verifications - Arbitrum Sepolia |
| 90 | +# ------------------------------------------------ |
| 91 | +verify-rlc-crosschain-token-impl-arbitrum-sepolia: |
| 92 | + $(call verify-impl,RLCCrosschainToken,arbitrum_sepolia,rlcCrosschainTokenAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia,src/RLCCrosschainToken.sol:RLCCrosschainToken,$(ARBITRUM_SEPOLIA_RPC_URL),) |
| 93 | + |
| 94 | +verify-layerzero-bridge-impl-arbitrum-sepolia: |
| 95 | + @echo "Building constructor arguments for IexecLayerZeroBridge..." |
| 96 | + @rlc_crosschain_token_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.arbitrum_sepolia.rlcCrosschainTokenAddress" 2>/dev/null | grep "0x" | tail -n1); \ |
| 97 | + lz_endpoint_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.arbitrum_sepolia.lzEndpointAddress" 2>/dev/null | grep "0x" | tail -n1); \ |
| 98 | + constructor_args=$$(cast abi-encode "constructor(bool,address,address)" false $$rlc_crosschain_token_address $$lz_endpoint_address); \ |
| 99 | + $(MAKE) _verify-layerzero-bridge-impl-arbitrum-sepolia CONSTRUCTOR_ARGS="--constructor-args $$constructor_args" |
| 100 | + |
| 101 | +_verify-layerzero-bridge-impl-arbitrum-sepolia: |
| 102 | + $(call verify-impl,IexecLayerZeroBridge,arbitrum_sepolia,iexecLayerZeroBridgeAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia,src/bridges/layerZero/IexecLayerZeroBridge.sol:IexecLayerZeroBridge,$(ARBITRUM_SEPOLIA_RPC_URL),$(CONSTRUCTOR_ARGS)) |
| 103 | + |
| 104 | +# ======================================================================== |
| 105 | +# PROXY AND IMPLEMENTATION VERIFICATION |
| 106 | +# ======================================================================== |
| 107 | +verify-proxies-sepolia: verify-rlc-liquidity-unifier-proxy-sepolia verify-layerzero-bridge-proxy-sepolia |
| 108 | +verify-proxies-arbitrum-sepolia: verify-rlc-crosschain-token-proxy-arbitrum-sepolia verify-layerzero-bridge-proxy-arbitrum-sepolia |
| 109 | +verify-proxies-testnets: verify-proxies-sepolia verify-proxies-arbitrum-sepolia |
| 110 | + |
| 111 | +verify-implementations-sepolia: verify-rlc-liquidity-unifier-impl-sepolia verify-layerzero-bridge-impl-sepolia |
| 112 | +verify-implementations-arbitrum-sepolia: verify-rlc-crosschain-token-impl-arbitrum-sepolia verify-layerzero-bridge-impl-arbitrum-sepolia |
| 113 | +verify-implementations-testnets: verify-implementations-sepolia verify-implementations-arbitrum-sepolia |
| 114 | + |
| 115 | + |
| 116 | +# ======================================================================== |
| 117 | +# COMPLETION TARGETS |
| 118 | +# ======================================================================== |
| 119 | + |
| 120 | +verify-all-sepolia: verify-proxies-sepolia verify-implementations-sepolia |
| 121 | +verify-all-arbitrum-sepolia: verify-proxies-arbitrum-sepolia verify-implementations-arbitrum-sepolia |
| 122 | +verify-all-testnets: verify-all-sepolia verify-all-arbitrum-sepolia |
| 123 | + |
| 124 | + |
| 125 | +.PHONY: verify-all-testnets verify-all-sepolia verify-all-arbitrum-sepolia \ |
| 126 | + verify-proxies-sepolia verify-proxies-arbitrum-sepolia verify-proxies-testnets \ |
| 127 | + verify-implementations-sepolia verify-implementations-arbitrum-sepolia verify-implementations-testnets |
0 commit comments