diff --git a/evm/evm.nix b/evm/evm.nix index b8f9460193..1d3ad35463 100644 --- a/evm/evm.nix +++ b/evm/evm.nix @@ -319,11 +319,11 @@ _: { cp --no-preserve=mode -r ${self'.packages.evm-contracts}/* . cp --no-preserve=mode -r ${evmSources}/* . - jq -r 'to_entries | map([.key, .value]) | .[] | @tsv' "$PROJECT_ROOT"/contracts.json | \ - while IFS=$'\t' read -r contract address; do + jq -r 'to_entries | map([.key, .value.args, .value.contract]) | .[] | @tsv' "$PROJECT_ROOT"/contracts.json | \ + while IFS=$'\t' read -r address args contract; do PRIVATE_KEY=${private-key} \ FOUNDRY_PROFILE="script" \ - forge verify-contract --force --watch "$address" "$contract" --api-key "$3" \ + forge verify-contract --force --watch "$address" "$contract" --constructor-args "$args" --api-key "$3" \ --rpc-url ${rpc-url} done diff --git a/evm/scripts/Deploy.s.sol b/evm/scripts/Deploy.s.sol index 86fa0ea025..c2ad76843c 100644 --- a/evm/scripts/Deploy.s.sol +++ b/evm/scripts/Deploy.s.sol @@ -163,7 +163,7 @@ abstract contract UnionScript is UnionBase { Protocols.make(Protocols.UCS02), abi.encode( address(new UCS02NFT()), - abi.encodeCall(UCS01Relay.initialize, (handler, owner)) + abi.encodeCall(UCS02NFT.initialize, (handler, owner)) ) ) ); @@ -328,6 +328,7 @@ contract GetDeployed is Script { } function run() public { + address multicall = getDeployed(LIB.make(LIB.MULTICALL)); address handler = getDeployed(IBC.BASED); address cometblsClient = getDeployed(LightClients.make(LightClients.COMETBLS)); @@ -335,6 +336,9 @@ contract GetDeployed is Script { address ucs01 = getDeployed(Protocols.make(Protocols.UCS01)); address ucs02 = getDeployed(Protocols.make(Protocols.UCS02)); + console.log( + string(abi.encodePacked("Multicall: ", multicall.toHexString())) + ); console.log( string(abi.encodePacked("IBCHandler: ", handler.toHexString())) ); @@ -349,26 +353,141 @@ contract GetDeployed is Script { console.log(string(abi.encodePacked("UCS01: ", ucs01.toHexString()))); console.log(string(abi.encodePacked("UCS02: ", ucs02.toHexString()))); - string memory json = ""; - json.serialize( - "contracts/core/OwnableIBCHandler.sol:OwnableIBCHandler", - implOf(handler) + string memory impls = "base"; + + string memory proxyHandler = "proxyHandler"; + proxyHandler.serialize( + "contract", + string( + "libs/@openzeppelin/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + ) + ); + proxyHandler = proxyHandler.serialize( + "args", + abi.encode( + implOf(handler), abi.encodeCall(IBCHandler.initialize, sender) + ) + ); + impls.serialize(handler.toHexString(), proxyHandler); + + string memory proxyComet = "proxyComet"; + proxyComet.serialize( + "contract", + string( + "libs/@openzeppelin/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + ) + ); + proxyComet = proxyComet.serialize( + "args", + abi.encode( + implOf(cometblsClient), + abi.encodeCall(CometblsClient.initialize, (handler, sender)) + ) + ); + impls.serialize(cometblsClient.toHexString(), proxyComet); + + string memory proxyUCS00 = "proxyUCS00"; + proxyUCS00.serialize( + "contract", + string( + "libs/@openzeppelin/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + ) + ); + proxyUCS00 = proxyUCS00.serialize( + "args", + abi.encode( + implOf(ucs00), + abi.encodeCall( + PingPong.initialize, + (IIBCPacket(handler), sender, 100000000000000) + ) + ) + ); + impls.serialize(ucs00.toHexString(), proxyUCS00); + + string memory proxyUCS01 = "proxyUCS01"; + proxyUCS01.serialize( + "contract", + string( + "libs/@openzeppelin/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + ) + ); + proxyUCS01 = proxyUCS01.serialize( + "args", + abi.encode( + implOf(ucs01), + abi.encodeCall( + UCS01Relay.initialize, (IIBCPacket(handler), sender) + ) + ) + ); + impls.serialize(ucs01.toHexString(), proxyUCS01); + + string memory proxyUCS02 = "proxyUCS02"; + proxyUCS02.serialize( + "contract", + string( + "libs/@openzeppelin/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy" + ) + ); + proxyUCS02 = proxyUCS02.serialize( + "args", + abi.encode( + implOf(ucs02), + abi.encodeCall( + UCS02NFT.initialize, (IIBCPacket(handler), sender) + ) + ) + ); + impls.serialize(ucs02.toHexString(), proxyUCS02); + + string memory implMulticall = "implMulticall"; + implMulticall.serialize( + "contract", string("contracts/Multicall.sol:Multicall") ); - json.serialize( - "contracts/clients/CometblsClient.sol:CometblsClient", - implOf(cometblsClient) + implMulticall = implMulticall.serialize("args", bytes(hex"")); + impls.serialize(multicall.toHexString(), implMulticall); + + string memory implHandler = "implHandler"; + implHandler.serialize( + "contract", + string("contracts/core/OwnableIBCHandler.sol:OwnableIBCHandler") ); - json.serialize( - "contracts/apps/ucs/00-pingpong/PingPong.sol:PingPong", - implOf(ucs00) + implHandler = implHandler.serialize("args", bytes(hex"")); + impls.serialize(implOf(handler).toHexString(), implHandler); + + string memory implComet = "implComet"; + implComet.serialize( + "contract", + string("contracts/clients/CometblsClient.sol:CometblsClient") ); - json.serialize( - "contracts/apps/ucs/01-relay/Relay.sol:UCS01Relay", implOf(ucs01) + implComet = implComet.serialize("args", bytes(hex"")); + impls.serialize(implOf(cometblsClient).toHexString(), implComet); + + string memory implUCS00 = "implUCS00"; + implUCS00.serialize( + "contract", + string("contracts/apps/ucs/00-pingpong/PingPong.sol:PingPong") ); - json = json.serialize( - "contracts/apps/ucs/02-nft/NFT.sol:UCS02NFT", implOf(ucs02) + implUCS00 = implUCS00.serialize("args", bytes(hex"")); + impls.serialize(implOf(ucs00).toHexString(), implUCS00); + + string memory implUCS01 = "implUCS01"; + implUCS01.serialize( + "contract", + string("contracts/apps/ucs/01-relay/Relay.sol:UCS01Relay") ); - json.write(vm.envString("OUTPUT")); + implUCS01 = implUCS01.serialize("args", bytes(hex"")); + impls.serialize(implOf(ucs01).toHexString(), implUCS01); + + string memory implUCS02 = "implUCS02"; + implUCS02.serialize( + "contract", string("contracts/apps/ucs/02-nft/NFT.sol:UCS02NFT") + ); + implUCS02 = implUCS02.serialize("args", bytes(hex"")); + impls = impls.serialize(implOf(ucs01).toHexString(), implUCS02); + + impls.write(vm.envString("OUTPUT")); } }