diff --git a/package.json b/package.json index 7c5b46e112..dfa903bbd8 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "**/@typechain/*", "**/@openzeppelin/contracts-upgradeable", "**/@openzeppelin/contracts", + "**/@synapsecns/solidity-devops", "**/ds-test", "**/forge-std" ] diff --git a/packages/contracts-communication/.env.example b/packages/contracts-communication/.env.example new file mode 100644 index 0000000000..3827871f17 --- /dev/null +++ b/packages/contracts-communication/.env.example @@ -0,0 +1,43 @@ +# Use the structure from this file in the .env of the package that is using solidity-devops + +# Wallets +# Define as many wallets as needed. For every wallet following env vars are needed: +# - WALLET_ADDR: the address of the account to use for signing +# - WALLET_TYPE: the wallet type: "keystore", "ledger","trezor" or "pk". +# Any other value triggers the interactive prompt to enter the private key. +# - keystore: use the encrypted keystore file. +# - WALLET_JSON: the keystore file path +# - ledger, trezor: use HW wallet for signing +# TODO: find out if ledger/trezor specific options are needed +# - pk: use the plaintext private key. STRONGLY DISCOURAGED for production usage, meant for local devnet purposes. +# - WALLET_PK: the private key to the wallet in 0x format. + +# This will make wallet with name "deployer" available to run the scripts: +DEPLOYER_ADDR=0x1234567890123456789012345678901234567890 +DEPLOYER_TYPE=keystore +DEPLOYER_JSON=path/to/keystore.json + +# Chains +# For every chain following env vars are needed: +# - CHAIN_RPC: the RPC endpoint +# - CHAIN_VERIFIER: verifier for the smart contracts. Possible values are: etherscan, blockscout, sourcify +# - CHAIN_VERIFIER_URL: the Verifier API endpoint (required if verifier is not sourcify) +# - CHAIN_VERIFIER_KEY: the Verifier API key (required if verifier is not sourcify) +# NOTE: Blockcout URL needs to end with "api?" for the verification to work +# NOTE: Use any non-empty string for Blockscout API key: it is not required per se, but foundry will complain if it's empty + +# MAINNET CHAINS +# TODO: add mainnet chains + +# TESTNET CHAINS +# Ethereum Sepolia Testnet +ETH_SEPOLIA_RPC=https://rpc.sepolia.org +ETH_SEPOLIA_VERIFIER=etherscan +ETH_SEPOLIA_VERIFIER_URL=https://api-sepolia.etherscan.io/api +ETH_SEPOLIA_VERIFIER_KEY=YourEtherScanKey + +# Optimism Sepolia Testnet +OP_SEPOLIA_RPC=https://optimism-sepolia.blockpi.network/v1/rpc/public +OP_SEPOLIA_VERIFIER=etherscan +OP_SEPOLIA_VERIFIER_URL=https://api-sepolia-optimistic.etherscan.io/api +OP_SEPOLIA_VERIFIER_KEY=YourOptimismEtherScanKey diff --git a/packages/contracts-communication/.gitignore b/packages/contracts-communication/.gitignore index 96ccd4d89b..743349a8e0 100644 --- a/packages/contracts-communication/.gitignore +++ b/packages/contracts-communication/.gitignore @@ -1 +1,3 @@ flattened/ +.deployments +broadcast \ No newline at end of file diff --git a/packages/contracts-communication/configs/global/ExecutionService.testnet.json b/packages/contracts-communication/configs/global/ExecutionService.testnet.json new file mode 100644 index 0000000000..d4293802bc --- /dev/null +++ b/packages/contracts-communication/configs/global/ExecutionService.testnet.json @@ -0,0 +1,4 @@ +{ + "executorEOA": "0xD0D45E468ADF3aCB8A98391ff47267783220ba6F", + "gasOracleName": "GasOracleMock" +} diff --git a/packages/contracts-communication/configs/global/InterchainAppExample.testnet.json b/packages/contracts-communication/configs/global/InterchainAppExample.testnet.json new file mode 100644 index 0000000000..469296811b --- /dev/null +++ b/packages/contracts-communication/configs/global/InterchainAppExample.testnet.json @@ -0,0 +1,8 @@ +{ + "chains": ["eth_sepolia", "op_sepolia"], + "trustedModules": ["SynapseModule"], + "appConfig": { + "0_requiredResponses": 1, + "1_optimisticPeriod": 30 + } +} diff --git a/packages/contracts-communication/configs/global/InterchainClientV1.testnet.json b/packages/contracts-communication/configs/global/InterchainClientV1.testnet.json new file mode 100644 index 0000000000..019c749ab1 --- /dev/null +++ b/packages/contracts-communication/configs/global/InterchainClientV1.testnet.json @@ -0,0 +1,3 @@ +{ + "chains": ["eth_sepolia", "op_sepolia"] +} diff --git a/packages/contracts-communication/configs/global/SynapseModule.testnet.json b/packages/contracts-communication/configs/global/SynapseModule.testnet.json new file mode 100644 index 0000000000..0ad395d094 --- /dev/null +++ b/packages/contracts-communication/configs/global/SynapseModule.testnet.json @@ -0,0 +1,18 @@ +{ + "claimFeeBPS": 10, + "feeCollector": "0xD0D45E468ADF3aCB8A98391ff47267783220ba6F", + "gasOracleName": "GasOracleMock", + "threshold": 6, + "verifiers": [ + "0x0E399F695d72033d598aC2911B8A5e9986d6cbaD", + "0x107a281D135ff74eC7d43c5A50B902EF762b20dE", + "0x217238ca74d2fba6cc7466f93d691834a252a3ff", + "0x48217d9b7ff1048915b09f21d0d818e6e347de6a", + "0x65b23e9678f8b3ef331a554865df045ee49a6365", + "0x8372eed424f90dca45325362e474def7483d55ba", + "0xae61329ce0affa55a7174916214fc2560a1cdd9f", + "0xb9a96627bd4b0a8954ac16670ee70eed26b104dc", + "0xe144dd3ce6bf60f70d98bc96400c0fea5c3193ac", + "0xe29c07938d623621ff9824e2a327a6f811386880" + ] +} diff --git a/packages/contracts-communication/deployments/eth_sepolia/.chainId b/packages/contracts-communication/deployments/eth_sepolia/.chainId new file mode 100644 index 0000000000..bd8d1cd44c --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/.chainId @@ -0,0 +1 @@ +11155111 \ No newline at end of file diff --git a/packages/contracts-communication/deployments/eth_sepolia/ExecutionFees.json b/packages/contracts-communication/deployments/eth_sepolia/ExecutionFees.json new file mode 100644 index 0000000000..00f3dc84db --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/ExecutionFees.json @@ -0,0 +1,518 @@ +{ + "address": "0x2b9440dFD5Dbc20163Ac81C66177999c6764e2F6", + "constructorArgs": "0x000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0x455ec24ada71b81fa0e026dbcbd95d659ee5b402baf880e5724356a76ce90815", + "blockNumber": 5389230 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "admin", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "RECORDER_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accumulatedRewards", + "inputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "totalAccumulated", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "addExecutionFee", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "claimExecutionFees", + "inputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "executionFee", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "fee", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "hasRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "recordExecutor", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "recordedExecutor", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "callerConfirmation", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "unclaimedRewards", + "inputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "totalClaimed", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "event", + "name": "ExecutionFeeAdded", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "totalFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutionFeesAwarded", + "inputs": [ + { + "name": "executor", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutionFeesClaimed", + "inputs": [ + { + "name": "executor", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutorRecorded", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "executor", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AccessControlBadConfirmation", + "inputs": [] + }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "neededRole", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "AddressInsufficientBalance", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ExecutionFees__AlreadyRecorded", + "inputs": [] + }, + { + "type": "error", + "name": "ExecutionFees__ZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "ExecutionFees__ZeroAmount", + "inputs": [] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/eth_sepolia/ExecutionService.json b/packages/contracts-communication/deployments/eth_sepolia/ExecutionService.json new file mode 100644 index 0000000000..72f5c4bc76 --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/ExecutionService.json @@ -0,0 +1,304 @@ +{ + "address": "0xc498906989031be63a933d92CDB4e21d5c5C06dE", + "constructorArgs": "0x000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0x99c51e629c1f4f0eb25351026f22254836d6b97d31f20d61bdff119d99e9fd51", + "blockNumber": 5389238 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "executorEOA", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "gasOracle", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract IGasOracle" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getExecutionFee", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "txPayloadSize", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interchainClient", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "requestExecution", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "txPayloadSize", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "executionFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setExecutorEOA", + "inputs": [ + { + "name": "_executorEOA", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setGasOracle", + "inputs": [ + { + "name": "_gasOracle", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setInterchainClient", + "inputs": [ + { + "name": "_interchainClient", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ExecutionRequested", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "client", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutorEOAUpdated", + "inputs": [ + { + "name": "executorEOA", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GasOracleUpdated", + "inputs": [ + { + "name": "gasOracle", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainClientUpdated", + "inputs": [ + { + "name": "interchainClient", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "OptionsLib__IncorrectVersion", + "inputs": [ + { + "name": "version", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/eth_sepolia/GasOracleMock.json b/packages/contracts-communication/deployments/eth_sepolia/GasOracleMock.json new file mode 100644 index 0000000000..204f8f287b --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/GasOracleMock.json @@ -0,0 +1,92 @@ +{ + "address": "0x2da1dc487Ec1F1e51a1b86cE53cE71E8EE9DC978", + "constructorArgs": "0x", + "receipt": { + "hash": "0x5381ffd258b1e78434ca298af9d17a2e27a8109696b3c2020790c78b13420001", + "blockNumber": 5394842 + }, + "abi": [ + { + "type": "function", + "name": "convertRemoteValueToLocalUnits", + "inputs": [ + { + "name": "remoteChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "estimateTxCostInLocalUnits", + "inputs": [ + { + "name": "remoteChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "calldataSize", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "estimateTxCostInRemoteUnits", + "inputs": [ + { + "name": "remoteChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "calldataSize", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + } + ] +} diff --git a/packages/contracts-communication/deployments/eth_sepolia/InterchainAppExample.json b/packages/contracts-communication/deployments/eth_sepolia/InterchainAppExample.json new file mode 100644 index 0000000000..c2863941fa --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/InterchainAppExample.json @@ -0,0 +1,648 @@ +{ + "address": "0x7E4089b247a05F6ee61ebc5f5AbC0907AC1A0f43", + "constructorArgs": "0x000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0x5674d3a90e665aaa36daeccadebea20bf2a36414ff1b93dd05d6b780472bc02c", + "blockNumber": 5389207 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addTrustedModule", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "appReceive", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "getAppConfigV1", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct AppConfigV1", + "components": [ + { + "name": "requiredResponses", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "optimisticPeriod", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAppVersion", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "getExecutionService", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getLinkedApp", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getReceivingConfig", + "inputs": [], + "outputs": [ + { + "name": "appConfig", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "modules", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getReceivingModules", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSendingModules", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interchain", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isAllowedSender", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "linkRemoteApp", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "remoteApp", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "linkRemoteAppEVM", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "remoteApp", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "removeTrustedModule", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "sendMessage", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "setAppConfigV1", + "inputs": [ + { + "name": "appConfig", + "type": "tuple", + "internalType": "struct AppConfigV1", + "components": [ + { + "name": "requiredResponses", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "optimisticPeriod", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setExecutionService", + "inputs": [ + { + "name": "executionService", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setInterchainClient", + "inputs": [ + { + "name": "interchain_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "AppConfigV1Set", + "inputs": [ + { + "name": "requiredResponses", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "optimisticPeriod", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "AppLinked", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "remoteApp", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutionServiceSet", + "inputs": [ + { + "name": "executionService", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainClientSet", + "inputs": [ + { + "name": "interchainClient", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MessageReceived", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "message", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MessageSent", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TrustedModuleAdded", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TrustedModuleRemoved", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "InterchainApp__BalanceTooLow", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expected", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__CallerNotInterchainClient", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__InterchainClientNotSet", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainApp__ModuleAlreadyAdded", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__ModuleNotAdded", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__ReceiverNotSet", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__SameChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__SenderNotAllowed", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/eth_sepolia/InterchainClientV1.json b/packages/contracts-communication/deployments/eth_sepolia/InterchainClientV1.json new file mode 100644 index 0000000000..4d83c2e120 --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/InterchainClientV1.json @@ -0,0 +1,772 @@ +{ + "address": "0x1BF437868d70C0F1E5811EdbC75DEE016B371202", + "constructorArgs": "0x000000000000000000000000d1020faf46d8d92107200c2bcd85818844d99099000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0xcf19819b81e2ef863a2a6176eb9a133a933aa7d8988d0909d648599310d53670", + "blockNumber": 5389216 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "interchainDB", + "type": "address", + "internalType": "address" + }, + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "INTERCHAIN_DB", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "decodeOptions", + "inputs": [ + { + "name": "encodedOptions", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct OptionsV1", + "components": [ + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasAirdrop", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "encodeTransaction", + "inputs": [ + { + "name": "icTx", + "type": "tuple", + "internalType": "struct InterchainTransaction", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcSender", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dstReceiver", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ] + } + ], + "outputs": [ + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "executionFees", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getExecutor", + "inputs": [ + { + "name": "encodedTx", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getExecutorById", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getInterchainFee", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcExecutionService", + "type": "address", + "internalType": "address" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "fee", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getLinkedClient", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getLinkedClientEVM", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "linkedClientEVM", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interchainExecute", + "inputs": [ + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transaction", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "interchainSend", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "srcExecutionService", + "type": "address", + "internalType": "address" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "interchainSendEVM", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "address", + "internalType": "address" + }, + { + "name": "srcExecutionService", + "type": "address", + "internalType": "address" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "isExecutable", + "inputs": [ + { + "name": "encodedTx", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setExecutionFees", + "inputs": [ + { + "name": "executionFees_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setLinkedClient", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "client", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "writeExecutionProof", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ExecutionProofWritten", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "executor", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainTransactionReceived", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcSender", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dstReceiver", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainTransactionSent", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcSender", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dstReceiver", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "verificationFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "executionFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AppConfigLib__IncorrectVersion", + "inputs": [ + { + "name": "version", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__FeeAmountTooLow", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__IncorrectDstChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__IncorrectMsgValue", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NoLinkedClient", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NotEVMClient", + "inputs": [ + { + "name": "client", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NotEnoughResponses", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NotRemoteChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__TxAlreadyExecuted", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__TxNotExecuted", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "OptionsLib__IncorrectVersion", + "inputs": [ + { + "name": "version", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/eth_sepolia/InterchainDB.json b/packages/contracts-communication/deployments/eth_sepolia/InterchainDB.json new file mode 100644 index 0000000000..4ce832e0aa --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/InterchainDB.json @@ -0,0 +1,408 @@ +{ + "address": "0xD1020FaF46D8D92107200c2bcD85818844d99099", + "constructorArgs": "0x", + "receipt": { + "hash": "0x0f9b28ee4b25774c641966aa35e1dcdac385ca83431540523d9bbb630142ea38", + "blockNumber": 5389191 + }, + "abi": [ + { + "type": "function", + "name": "getDBNonce", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getEntry", + "inputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getInterchainFee", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [ + { + "name": "fee", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "readEntry", + "inputs": [ + { + "name": "dstModule", + "type": "address", + "internalType": "address" + }, + { + "name": "entry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "outputs": [ + { + "name": "moduleVerifiedAt", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "requestVerification", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "verifyEntry", + "inputs": [ + { + "name": "entry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "writeEntry", + "inputs": [ + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "writeEntryWithVerification", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "InterchainEntryVerified", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainEntryWritten", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainVerificationRequested", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcModules", + "type": "address[]", + "indexed": false, + "internalType": "address[]" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "InterchainDB__ConflictingEntries", + "inputs": [ + { + "name": "existingEntryValue", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "newEntry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ] + }, + { + "type": "error", + "name": "InterchainDB__EntryDoesNotExist", + "inputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainDB__IncorrectFeeAmount", + "inputs": [ + { + "name": "actualFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expectedFee", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainDB__NoModulesSpecified", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainDB__SameChainId", + "inputs": [] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/eth_sepolia/SynapseModule.json b/packages/contracts-communication/deployments/eth_sepolia/SynapseModule.json new file mode 100644 index 0000000000..9049a8251b --- /dev/null +++ b/packages/contracts-communication/deployments/eth_sepolia/SynapseModule.json @@ -0,0 +1,781 @@ +{ + "address": "0x522339aBe2910ee854FA1ffe7654bBF337a592Be", + "constructorArgs": "0x000000000000000000000000d1020faf46d8d92107200c2bcd85818844d99099000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0xaa3dc2d0b130b9c38015ba92522dab6c9600a5beaecac9cc94bb5e591585f1c9", + "blockNumber": 5389222 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "interchainDB", + "type": "address", + "internalType": "address" + }, + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_VERIFY_GAS_LIMIT", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "INTERCHAIN_DB", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "addVerifier", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addVerifiers", + "inputs": [ + { + "name": "verifiers", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "claimFees", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "feeCollector", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "gasOracle", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getClaimFeeAmount", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getClaimFeeFraction", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getModuleFee", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getThreshold", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getVerifiers", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getVerifyGasLimit", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isVerifier", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "removeVerifier", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "removeVerifiers", + "inputs": [ + { + "name": "verifiers", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "requestVerification", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "setClaimFeeFraction", + "inputs": [ + { + "name": "claimFeeFraction", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFeeCollector", + "inputs": [ + { + "name": "feeCollector_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setGasOracle", + "inputs": [ + { + "name": "gasOracle_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setThreshold", + "inputs": [ + { + "name": "threshold", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setVerifyGasLimit", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "verifyEntry", + "inputs": [ + { + "name": "encodedEntry", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "signatures", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ClaimFeeFractionChanged", + "inputs": [ + { + "name": "claimFeeFraction", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "EntryVerified", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "entry", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + }, + { + "name": "ethSignedEntryHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "FeeCollectorChanged", + "inputs": [ + { + "name": "feeCollector", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "FeesClaimed", + "inputs": [ + { + "name": "feeCollector", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "collectedFees", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "claimer", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "claimerFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GasOracleChanged", + "inputs": [ + { + "name": "gasOracle", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ThresholdChanged", + "inputs": [ + { + "name": "threshold", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerificationRequested", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "entry", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + }, + { + "name": "ethSignedEntryHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifierAdded", + "inputs": [ + { + "name": "verifier", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifierRemoved", + "inputs": [ + { + "name": "verifier", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifyGasLimitChanged", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressInsufficientBalance", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainModule__IncorrectSourceChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainModule__InsufficientFee", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainModule__NotInterchainDB", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainModule__SameChainId", + "inputs": [] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SynapseModule__ClaimFeeFractionExceedsMax", + "inputs": [ + { + "name": "claimFeeFraction", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "SynapseModule__FeeCollectorNotSet", + "inputs": [] + }, + { + "type": "error", + "name": "SynapseModule__GasOracleNotContract", + "inputs": [ + { + "name": "gasOracle", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SynapseModule__NoFeesToClaim", + "inputs": [] + }, + { + "type": "error", + "name": "ThresholdECDSA__AlreadySigner", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__IncorrectSignaturesLength", + "inputs": [ + { + "name": "length", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__InvalidSignature", + "inputs": [ + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__NotEnoughSignatures", + "inputs": [ + { + "name": "threshold", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__NotSigner", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__RecoveredSignersNotSorted", + "inputs": [] + }, + { + "type": "error", + "name": "ThresholdECDSA__ZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "ThresholdECDSA__ZeroThreshold", + "inputs": [] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/.chainId b/packages/contracts-communication/deployments/op_sepolia/.chainId new file mode 100644 index 0000000000..03f37de825 --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/.chainId @@ -0,0 +1 @@ +11155420 \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/ExecutionFees.json b/packages/contracts-communication/deployments/op_sepolia/ExecutionFees.json new file mode 100644 index 0000000000..fd45f1df27 --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/ExecutionFees.json @@ -0,0 +1,518 @@ +{ + "address": "0xc498906989031be63a933d92CDB4e21d5c5C06dE", + "constructorArgs": "0x000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0xa4a209dc8fa84b2a2482ecc8d72fb10ed0684fd3cc00f2d79cd2ce6619009576", + "blockNumber": 8718259 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "admin", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "RECORDER_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "accumulatedRewards", + "inputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "totalAccumulated", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "addExecutionFee", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "claimExecutionFees", + "inputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "executionFee", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "fee", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "hasRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "recordExecutor", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "recordedExecutor", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "callerConfirmation", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "unclaimedRewards", + "inputs": [ + { + "name": "executor", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "totalClaimed", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "event", + "name": "ExecutionFeeAdded", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "totalFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutionFeesAwarded", + "inputs": [ + { + "name": "executor", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutionFeesClaimed", + "inputs": [ + { + "name": "executor", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutorRecorded", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "executor", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AccessControlBadConfirmation", + "inputs": [] + }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "neededRole", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "AddressInsufficientBalance", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ExecutionFees__AlreadyRecorded", + "inputs": [] + }, + { + "type": "error", + "name": "ExecutionFees__ZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "ExecutionFees__ZeroAmount", + "inputs": [] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/ExecutionService.json b/packages/contracts-communication/deployments/op_sepolia/ExecutionService.json new file mode 100644 index 0000000000..71b4f1d391 --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/ExecutionService.json @@ -0,0 +1,304 @@ +{ + "address": "0x2da1dc487Ec1F1e51a1b86cE53cE71E8EE9DC978", + "constructorArgs": "0x000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0x721a5a31dae4f8c8441b6c7906b52e3dbd34a2482b874082e4b6b7a539d66850", + "blockNumber": 8718272 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "executorEOA", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "gasOracle", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract IGasOracle" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getExecutionFee", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "txPayloadSize", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interchainClient", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "requestExecution", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "txPayloadSize", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "executionFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setExecutorEOA", + "inputs": [ + { + "name": "_executorEOA", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setGasOracle", + "inputs": [ + { + "name": "_gasOracle", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setInterchainClient", + "inputs": [ + { + "name": "_interchainClient", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ExecutionRequested", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "client", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutorEOAUpdated", + "inputs": [ + { + "name": "executorEOA", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GasOracleUpdated", + "inputs": [ + { + "name": "gasOracle", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainClientUpdated", + "inputs": [ + { + "name": "interchainClient", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "OptionsLib__IncorrectVersion", + "inputs": [ + { + "name": "version", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/GasOracleMock.json b/packages/contracts-communication/deployments/op_sepolia/GasOracleMock.json new file mode 100644 index 0000000000..90da6abaa9 --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/GasOracleMock.json @@ -0,0 +1,92 @@ +{ + "address": "0xDac7412fD9E16b2C31DBDB986d95bDf0df804817", + "constructorArgs": "0x", + "receipt": { + "hash": "0xe6c5efd467f4bb41765dc6506b869fbc5a1e89baadd813fb9ffcfab1196b9a71", + "blockNumber": 8750213 + }, + "abi": [ + { + "type": "function", + "name": "convertRemoteValueToLocalUnits", + "inputs": [ + { + "name": "remoteChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "estimateTxCostInLocalUnits", + "inputs": [ + { + "name": "remoteChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "calldataSize", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "estimateTxCostInRemoteUnits", + "inputs": [ + { + "name": "remoteChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "calldataSize", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/InterchainAppExample.json b/packages/contracts-communication/deployments/op_sepolia/InterchainAppExample.json new file mode 100644 index 0000000000..8f0ce04f92 --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/InterchainAppExample.json @@ -0,0 +1,648 @@ +{ + "address": "0x1BF437868d70C0F1E5811EdbC75DEE016B371202", + "constructorArgs": "0x000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0x373ff01a84170108c48db7d70c1273730042144ae3f4a6a006533c2982f87ecd", + "blockNumber": 8718133 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addTrustedModule", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "appReceive", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "getAppConfigV1", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct AppConfigV1", + "components": [ + { + "name": "requiredResponses", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "optimisticPeriod", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAppVersion", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "getExecutionService", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getLinkedApp", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getReceivingConfig", + "inputs": [], + "outputs": [ + { + "name": "appConfig", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "modules", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getReceivingModules", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSendingModules", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interchain", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isAllowedSender", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "linkRemoteApp", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "remoteApp", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "linkRemoteAppEVM", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "remoteApp", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "removeTrustedModule", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "sendMessage", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "setAppConfigV1", + "inputs": [ + { + "name": "appConfig", + "type": "tuple", + "internalType": "struct AppConfigV1", + "components": [ + { + "name": "requiredResponses", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "optimisticPeriod", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setExecutionService", + "inputs": [ + { + "name": "executionService", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setInterchainClient", + "inputs": [ + { + "name": "interchain_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "AppConfigV1Set", + "inputs": [ + { + "name": "requiredResponses", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "optimisticPeriod", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "AppLinked", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "remoteApp", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutionServiceSet", + "inputs": [ + { + "name": "executionService", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainClientSet", + "inputs": [ + { + "name": "interchainClient", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MessageReceived", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "message", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MessageSent", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "transactionId", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TrustedModuleAdded", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TrustedModuleRemoved", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "InterchainApp__BalanceTooLow", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expected", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__CallerNotInterchainClient", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__InterchainClientNotSet", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainApp__ModuleAlreadyAdded", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__ModuleNotAdded", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__ReceiverNotSet", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__SameChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainApp__SenderNotAllowed", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sender", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/InterchainClientV1.json b/packages/contracts-communication/deployments/op_sepolia/InterchainClientV1.json new file mode 100644 index 0000000000..172472beaa --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/InterchainClientV1.json @@ -0,0 +1,772 @@ +{ + "address": "0x522339aBe2910ee854FA1ffe7654bBF337a592Be", + "constructorArgs": "0x0000000000000000000000007e4089b247a05f6ee61ebc5f5abc0907ac1a0f43000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0x20b275b02af54e702d0a270cbab5b174907ab3c919a2c1f297d3302fbc7fbabc", + "blockNumber": 8718150 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "interchainDB", + "type": "address", + "internalType": "address" + }, + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "INTERCHAIN_DB", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "decodeOptions", + "inputs": [ + { + "name": "encodedOptions", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct OptionsV1", + "components": [ + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasAirdrop", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "encodeTransaction", + "inputs": [ + { + "name": "icTx", + "type": "tuple", + "internalType": "struct InterchainTransaction", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcSender", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dstReceiver", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ] + } + ], + "outputs": [ + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "executionFees", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getExecutor", + "inputs": [ + { + "name": "encodedTx", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getExecutorById", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getInterchainFee", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcExecutionService", + "type": "address", + "internalType": "address" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "fee", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getLinkedClient", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getLinkedClientEVM", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "linkedClientEVM", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "interchainExecute", + "inputs": [ + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "transaction", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "interchainSend", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "srcExecutionService", + "type": "address", + "internalType": "address" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "interchainSendEVM", + "inputs": [ + { + "name": "dstChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "receiver", + "type": "address", + "internalType": "address" + }, + { + "name": "srcExecutionService", + "type": "address", + "internalType": "address" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + }, + { + "name": "options", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "isExecutable", + "inputs": [ + { + "name": "encodedTx", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setExecutionFees", + "inputs": [ + { + "name": "executionFees_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setLinkedClient", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "client", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "writeExecutionProof", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ExecutionProofWritten", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "executor", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainTransactionReceived", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcSender", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dstReceiver", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainTransactionSent", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "dstChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcSender", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dstReceiver", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "verificationFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "executionFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "options", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + }, + { + "name": "message", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AppConfigLib__IncorrectVersion", + "inputs": [ + { + "name": "version", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__FeeAmountTooLow", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__IncorrectDstChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__IncorrectMsgValue", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NoLinkedClient", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NotEVMClient", + "inputs": [ + { + "name": "client", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NotEnoughResponses", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__NotRemoteChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__TxAlreadyExecuted", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "InterchainClientV1__TxNotExecuted", + "inputs": [ + { + "name": "transactionId", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "OptionsLib__IncorrectVersion", + "inputs": [ + { + "name": "version", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/InterchainDB.json b/packages/contracts-communication/deployments/op_sepolia/InterchainDB.json new file mode 100644 index 0000000000..543cd733f7 --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/InterchainDB.json @@ -0,0 +1,408 @@ +{ + "address": "0x7E4089b247a05F6ee61ebc5f5AbC0907AC1A0f43", + "constructorArgs": "0x", + "receipt": { + "hash": "0x1129f112b97ea5c7e877a4c717842a37246680076f1680376f45e2368ff8bebb", + "blockNumber": 8718119 + }, + "abi": [ + { + "type": "function", + "name": "getDBNonce", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getEntry", + "inputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getInterchainFee", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [ + { + "name": "fee", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "readEntry", + "inputs": [ + { + "name": "dstModule", + "type": "address", + "internalType": "address" + }, + { + "name": "entry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "outputs": [ + { + "name": "moduleVerifiedAt", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "requestVerification", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "verifyEntry", + "inputs": [ + { + "name": "entry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "writeEntry", + "inputs": [ + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "writeEntryWithVerification", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "srcModules", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "InterchainEntryVerified", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainEntryWritten", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "InterchainVerificationRequested", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "srcModules", + "type": "address[]", + "indexed": false, + "internalType": "address[]" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "InterchainDB__ConflictingEntries", + "inputs": [ + { + "name": "existingEntryValue", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "newEntry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ] + }, + { + "type": "error", + "name": "InterchainDB__EntryDoesNotExist", + "inputs": [ + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainDB__IncorrectFeeAmount", + "inputs": [ + { + "name": "actualFee", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expectedFee", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainDB__NoModulesSpecified", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainDB__SameChainId", + "inputs": [] + } + ] +} \ No newline at end of file diff --git a/packages/contracts-communication/deployments/op_sepolia/SynapseModule.json b/packages/contracts-communication/deployments/op_sepolia/SynapseModule.json new file mode 100644 index 0000000000..fba16ba00e --- /dev/null +++ b/packages/contracts-communication/deployments/op_sepolia/SynapseModule.json @@ -0,0 +1,781 @@ +{ + "address": "0x2b9440dFD5Dbc20163Ac81C66177999c6764e2F6", + "constructorArgs": "0x0000000000000000000000007e4089b247a05f6ee61ebc5f5abc0907ac1a0f43000000000000000000000000e7353bedc72d29f99d6ca5cde69f807cce5d57e4", + "receipt": { + "hash": "0x0783af8476e3d3c83006503d2a0e902da62f6b334ba889970eec196dce7f6e65", + "blockNumber": 8718163 + }, + "abi": [ + { + "type": "constructor", + "inputs": [ + { + "name": "interchainDB", + "type": "address", + "internalType": "address" + }, + { + "name": "owner_", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_VERIFY_GAS_LIMIT", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "INTERCHAIN_DB", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "addVerifier", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addVerifiers", + "inputs": [ + { + "name": "verifiers", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "claimFees", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "feeCollector", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "gasOracle", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getClaimFeeAmount", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getClaimFeeFraction", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getModuleFee", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getThreshold", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getVerifiers", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address[]", + "internalType": "address[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getVerifyGasLimit", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isVerifier", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "removeVerifier", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "removeVerifiers", + "inputs": [ + { + "name": "verifiers", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "requestVerification", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entry", + "type": "tuple", + "internalType": "struct InterchainEntry", + "components": [ + { + "name": "srcChainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dbNonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "srcWriter", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "dataHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "setClaimFeeFraction", + "inputs": [ + { + "name": "claimFeeFraction", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setFeeCollector", + "inputs": [ + { + "name": "feeCollector_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setGasOracle", + "inputs": [ + { + "name": "gasOracle_", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setThreshold", + "inputs": [ + { + "name": "threshold", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setVerifyGasLimit", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "verifyEntry", + "inputs": [ + { + "name": "encodedEntry", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "signatures", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ClaimFeeFractionChanged", + "inputs": [ + { + "name": "claimFeeFraction", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "EntryVerified", + "inputs": [ + { + "name": "srcChainId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "entry", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + }, + { + "name": "ethSignedEntryHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "FeeCollectorChanged", + "inputs": [ + { + "name": "feeCollector", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "FeesClaimed", + "inputs": [ + { + "name": "feeCollector", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "collectedFees", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "claimer", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "claimerFee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GasOracleChanged", + "inputs": [ + { + "name": "gasOracle", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ThresholdChanged", + "inputs": [ + { + "name": "threshold", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerificationRequested", + "inputs": [ + { + "name": "destChainId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "entry", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + }, + { + "name": "ethSignedEntryHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifierAdded", + "inputs": [ + { + "name": "verifier", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifierRemoved", + "inputs": [ + { + "name": "verifier", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifyGasLimitChanged", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "gasLimit", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressInsufficientBalance", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainModule__IncorrectSourceChainId", + "inputs": [ + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainModule__InsufficientFee", + "inputs": [ + { + "name": "actual", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "required", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InterchainModule__NotInterchainDB", + "inputs": [] + }, + { + "type": "error", + "name": "InterchainModule__SameChainId", + "inputs": [] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SynapseModule__ClaimFeeFractionExceedsMax", + "inputs": [ + { + "name": "claimFeeFraction", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "SynapseModule__FeeCollectorNotSet", + "inputs": [] + }, + { + "type": "error", + "name": "SynapseModule__GasOracleNotContract", + "inputs": [ + { + "name": "gasOracle", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SynapseModule__NoFeesToClaim", + "inputs": [] + }, + { + "type": "error", + "name": "ThresholdECDSA__AlreadySigner", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__IncorrectSignaturesLength", + "inputs": [ + { + "name": "length", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__InvalidSignature", + "inputs": [ + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__NotEnoughSignatures", + "inputs": [ + { + "name": "threshold", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__NotSigner", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ThresholdECDSA__RecoveredSignersNotSorted", + "inputs": [] + }, + { + "type": "error", + "name": "ThresholdECDSA__ZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "ThresholdECDSA__ZeroThreshold", + "inputs": [] + } + ] +} diff --git a/packages/contracts-communication/devops.json b/packages/contracts-communication/devops.json new file mode 100644 index 0000000000..73bf54e2e2 --- /dev/null +++ b/packages/contracts-communication/devops.json @@ -0,0 +1,24 @@ +{ + "chains": { + "arbitrum": "--with-gas-price 100000000", + "aurora": "--legacy --slow", + "base": "--with-gas-price 100000000", + "boba": "--legacy --skip-simulation --slow", + "canto": "--legacy --slow", + "cronos": "--slow", + "dfk": "--slow", + "dogechain": "--legacy --slow", + "harmony": "--legacy --slow", + "klaytn": "--skip-simulation", + "metis": "--legacy", + "moonbeam": "--skip-simulation --slow", + "moonriver": "--skip-simulation --slow", + "optimism": "--with-gas-price 100000000", + "polygon": "--slow", + "op_sepolia": "--with-gas-price 100000000" + }, + "deployConfigs": "configs", + "deployments": "deployments", + "forgeArtifacts": "out", + "freshDeployments": ".deployments" +} diff --git a/packages/contracts-communication/foundry.toml b/packages/contracts-communication/foundry.toml index 8b2b6c18f4..ef18ef768b 100644 --- a/packages/contracts-communication/foundry.toml +++ b/packages/contracts-communication/foundry.toml @@ -5,11 +5,24 @@ block_timestamp = 1_704_067_200 evm_version = "paris" src = 'contracts' out = 'out' -libs = ["lib"] +libs = ["lib", "node_modules"] +ffi = true +fs_permissions = [ + { access = "read", path = "./" }, + { access = "read-write", path = "./.deployments" } +] [fmt] line_length = 120 multiline_func_header = 'all' number_underscore = 'thousands' +[rpc_endpoints] +eth_sepolia = "${ETH_SEPOLIA_RPC}" +op_sepolia = "${OP_SEPOLIA_RPC}" + +[etherscan] +eth_sepolia = { key = "${ETH_SEPOLIA_VERIFIER_KEY}", url = "${ETH_SEPOLIA_VERIFIER_URL}" } +op_sepolia = { key = "${OP_SEPOLIA_VERIFIER_KEY}", url = "${OP_SEPOLIA_VERIFIER_URL}" } + # See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file diff --git a/packages/contracts-communication/package.json b/packages/contracts-communication/package.json index 104c336839..2e065adfc8 100644 --- a/packages/contracts-communication/package.json +++ b/packages/contracts-communication/package.json @@ -17,6 +17,7 @@ "test:coverage": "echo 'Please use foundry'" }, "devDependencies": { + "@synapsecns/solidity-devops": "^0.1.3", "solhint": "^4.1.1" } } diff --git a/packages/contracts-communication/script/config/ConfigureAppExample.s.sol b/packages/contracts-communication/script/config/ConfigureAppExample.s.sol new file mode 100644 index 0000000000..bc5392496e --- /dev/null +++ b/packages/contracts-communication/script/config/ConfigureAppExample.s.sol @@ -0,0 +1,111 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {InterchainAppExample, AppConfigV1} from "../../contracts/apps/InterchainAppExample.sol"; +import {TypeCasts} from "../../contracts/libs/TypeCasts.sol"; + +import {stdJson, SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +// solhint-disable code-complexity +contract ConfigureAppExample is SynapseScript { + using stdJson for string; + + string public constant NAME = "InterchainAppExample"; + + string public config; + InterchainAppExample public app; + + function run(string memory environment) external broadcastWithHooks { + loadConfig(environment); + linkRemoteChains(); + syncTrustedModules(); + setAppConfig(); + } + + function loadConfig(string memory environment) internal { + app = InterchainAppExample(getDeploymentAddress({contractName: NAME, revertIfNotFound: true})); + config = readGlobalDeployConfig({contractName: NAME, globalProperty: environment, revertIfNotFound: true}); + } + + function linkRemoteChains() internal { + printLog("Linking remote chains"); + string[] memory chains = config.readStringArray(".chains"); + for (uint256 i = 0; i < chains.length; i++) { + string memory chain = chains[i]; + uint256 chainId = chainIds[chain]; + require(chainId != 0, string.concat("Chain not found: ", chain)); + // Skip current chain + if (chainId == blockChainId()) continue; + address remoteApp = getDeploymentAddress({chain: chain, contractName: NAME, revertIfNotFound: true}); + bytes32 linkedApp = app.getLinkedApp(chainId); + if (TypeCasts.addressToBytes32(remoteApp) != linkedApp) { + app.linkRemoteAppEVM(chainId, remoteApp); + printSuccessWithIndent(string.concat("Linked ", vm.toString(remoteApp), " on ", chain)); + } else { + printSkipWithIndent(string.concat("already linked to ", vm.toString(remoteApp), " on ", chain)); + } + } + } + + function syncTrustedModules() internal { + printLog("Syncing trusted modules"); + string[] memory moduleNames = config.readStringArray(".trustedModules"); + address[] memory trustedModules = new address[](moduleNames.length); + for (uint256 i = 0; i < moduleNames.length; i++) { + trustedModules[i] = getDeploymentAddress({contractName: moduleNames[i], revertIfNotFound: true}); + } + address[] memory existingModules = app.getReceivingModules(); + // Remove modules that are not in the config + uint256 removed = 0; + for (uint256 i = 0; i < existingModules.length; i++) { + if (!contains(trustedModules, existingModules[i])) { + app.removeTrustedModule(existingModules[i]); + printSuccessWithIndent(string.concat("Removed ", vm.toString(existingModules[i]))); + removed++; + } + } + // Add modules that are in the config but not in the app + uint256 added = 0; + for (uint256 i = 0; i < trustedModules.length; i++) { + if (!contains(existingModules, trustedModules[i])) { + printSuccessWithIndent( + string.concat("Added ", vm.toString(trustedModules[i]), " [", moduleNames[i], "]") + ); + app.addTrustedModule(trustedModules[i]); + added++; + } + } + if (removed + added == 0) { + printSkipWithIndent("modules are up to date"); + } else { + printLog(string.concat("Added ", vm.toString(added), " modules, removed ", vm.toString(removed))); + } + } + + function setAppConfig() internal { + printLog("Setting app config"); + increaseIndent(); + bytes memory rawConfig = config.parseRaw(".appConfig"); + AppConfigV1 memory appConfig = abi.decode(rawConfig, (AppConfigV1)); + printLog(string.concat("Required responses: ", vm.toString(appConfig.requiredResponses))); + printLog(string.concat("Optimistic period: ", vm.toString(appConfig.optimisticPeriod))); + AppConfigV1 memory existingConfig = app.getAppConfigV1(); + if ( + appConfig.requiredResponses == existingConfig.requiredResponses + && appConfig.optimisticPeriod == existingConfig.optimisticPeriod + ) { + printSkipWithIndent("config is already set"); + } else { + app.setAppConfigV1(appConfig); + printSuccessWithIndent("Config set"); + } + decreaseIndent(); + } + + function contains(address[] memory array, address value) internal pure returns (bool) { + for (uint256 i = 0; i < array.length; i++) { + if (array[i] == value) return true; + } + return false; + } +} diff --git a/packages/contracts-communication/script/config/ConfigureClientV1.s.sol b/packages/contracts-communication/script/config/ConfigureClientV1.s.sol new file mode 100644 index 0000000000..71364fc2e7 --- /dev/null +++ b/packages/contracts-communication/script/config/ConfigureClientV1.s.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {InterchainClientV1} from "../../contracts/InterchainClientV1.sol"; +import {TypeCasts} from "../../contracts/libs/TypeCasts.sol"; + +import {stdJson, SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +contract ConfigureClientV1 is SynapseScript { + using stdJson for string; + + string public constant NAME = "InterchainClientV1"; + + InterchainClientV1 public client; + string public config; + + function run(string memory environment) external broadcastWithHooks { + loadConfig(environment); + linkRemoteChains(); + setExecutionFees(); + } + + function loadConfig(string memory environment) internal { + config = readGlobalDeployConfig({contractName: NAME, globalProperty: environment, revertIfNotFound: true}); + client = InterchainClientV1(getDeploymentAddress({contractName: NAME, revertIfNotFound: true})); + } + + function linkRemoteChains() internal { + printLog("Linking remote chains"); + string[] memory chains = config.readStringArray(".chains"); + for (uint256 i = 0; i < chains.length; i++) { + string memory chain = chains[i]; + uint256 chainId = chainIds[chain]; + require(chainId != 0, string.concat("Chain not found: ", chain)); + // Skip current chain + if (chainId == blockChainId()) continue; + address remoteClientEVM = getDeploymentAddress({chain: chain, contractName: NAME, revertIfNotFound: true}); + bytes32 remoteClient = TypeCasts.addressToBytes32(remoteClientEVM); + bytes32 linkedClient = client.getLinkedClient(chainId); + if (remoteClient != linkedClient) { + client.setLinkedClient(chainId, remoteClient); + printSuccessWithIndent(string.concat("Linked ", vm.toString(remoteClientEVM), " on ", chain)); + } else { + printSkipWithIndent(string.concat("already linked to ", vm.toString(remoteClientEVM), " on ", chain)); + } + } + } + + function setExecutionFees() internal { + printLog("Setting ExecutionFees"); + address executionFees = getDeploymentAddress({contractName: "ExecutionFees", revertIfNotFound: true}); + if (client.executionFees() != executionFees) { + client.setExecutionFees(executionFees); + printSuccessWithIndent(string.concat("Set ExecutionFees to ", vm.toString(executionFees))); + } else { + printSkipWithIndent(string.concat("already set to ", vm.toString(executionFees))); + } + } +} diff --git a/packages/contracts-communication/script/config/ConfigureExecutionFees.s.sol b/packages/contracts-communication/script/config/ConfigureExecutionFees.s.sol new file mode 100644 index 0000000000..92c3d813f5 --- /dev/null +++ b/packages/contracts-communication/script/config/ConfigureExecutionFees.s.sol @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {ExecutionFees} from "../../contracts/ExecutionFees.sol"; + +import {SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +contract ConfigureExecutionFees is SynapseScript { + string public constant NAME = "ExecutionFees"; + + ExecutionFees public executionFees; + + function run() external broadcastWithHooks { + executionFees = ExecutionFees(getDeploymentAddress({contractName: NAME, revertIfNotFound: true})); + addClientAsRecorder(); + } + + function addClientAsRecorder() internal { + printLog("Adding InterchainClientV1 as Recorder"); + address client = getDeploymentAddress({contractName: "InterchainClientV1", revertIfNotFound: true}); + bytes32 role = executionFees.RECORDER_ROLE(); + if (!executionFees.hasRole(role, client)) { + executionFees.grantRole(role, client); + printSuccessWithIndent(string.concat("Added ", vm.toString(client), " as Recorder")); + } else { + printSkipWithIndent(string.concat(vm.toString(client), " already has Recorder role")); + } + } +} diff --git a/packages/contracts-communication/script/config/ConfigureExecutionService.s.sol b/packages/contracts-communication/script/config/ConfigureExecutionService.s.sol new file mode 100644 index 0000000000..63dc07d7ec --- /dev/null +++ b/packages/contracts-communication/script/config/ConfigureExecutionService.s.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {ExecutionService} from "../../contracts/ExecutionService.sol"; + +import {SynapseScript, stdJson} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +contract ConfigureExecutionFees is SynapseScript { + using stdJson for string; + + string public constant NAME = "ExecutionService"; + + ExecutionService public service; + string public config; + + function run(string memory environment) external broadcastWithHooks { + loadConfig(environment); + setExecutorEOA(); + setGasOracle(); + } + + function loadConfig(string memory environment) internal { + config = readGlobalDeployConfig({contractName: NAME, globalProperty: environment, revertIfNotFound: true}); + service = ExecutionService(getDeploymentAddress({contractName: NAME, revertIfNotFound: true})); + } + + function setExecutorEOA() internal { + printLog("Setting ExecutorEOA"); + address executorEOA = config.readAddress(".executorEOA"); + if (service.executorEOA() != executorEOA) { + service.setExecutorEOA(executorEOA); + printSuccessWithIndent(string.concat("Set ExecutorEOA to ", vm.toString(executorEOA))); + } else { + printSkipWithIndent(string.concat("already set to ", vm.toString(executorEOA))); + } + } + + function setGasOracle() internal { + string memory gasOracleName = config.readString(".gasOracleName"); + printLog(string.concat("Setting GasOracle to ", gasOracleName)); + address gasOracle = getDeploymentAddress({contractName: gasOracleName, revertIfNotFound: true}); + if (address(service.gasOracle()) != gasOracle) { + service.setGasOracle(gasOracle); + printSuccessWithIndent(string.concat("Set GasOracle to ", vm.toString(gasOracle))); + } else { + printSkipWithIndent(string.concat("already set to ", vm.toString(gasOracle))); + } + } +} diff --git a/packages/contracts-communication/script/config/ConfigureSynapseModule.s.sol b/packages/contracts-communication/script/config/ConfigureSynapseModule.s.sol new file mode 100644 index 0000000000..5e0284c988 --- /dev/null +++ b/packages/contracts-communication/script/config/ConfigureSynapseModule.s.sol @@ -0,0 +1,125 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {SynapseModule} from "../../contracts/modules/SynapseModule.sol"; + +import {stdJson, SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +contract ConfigureSynapseModule is SynapseScript { + using stdJson for string; + + string public constant NAME = "SynapseModule"; + + string public config; + SynapseModule public module; + + address[] public removedVerifiers; + address[] public addedVerifiers; + + function run(string memory environment) external broadcastWithHooks { + loadConfig(environment); + setClaimFeeFraction(); + setFeeCollector(); + setGasOracle(); + setThreshold(); + syncVerifiers(); + } + + function loadConfig(string memory environment) internal { + config = readGlobalDeployConfig({contractName: NAME, globalProperty: environment, revertIfNotFound: true}); + module = SynapseModule(getDeploymentAddress({contractName: NAME, revertIfNotFound: true})); + } + + function setClaimFeeFraction() internal { + printLog("Setting claimFeeFraction"); + uint256 claimFeeBPS = config.readUint(".claimFeeBPS"); + // Convert from basis points to wei + uint256 claimFeeFraction = claimFeeBPS * 1e18 / 10_000; + string memory desc = string.concat(vm.toString(claimFeeFraction), " [", vm.toString(claimFeeBPS), " BPS]"); + if (module.getClaimFeeFraction() != claimFeeFraction) { + module.setClaimFeeFraction(claimFeeFraction); + printSuccessWithIndent(string.concat("Set claimFeeFraction to ", desc)); + } else { + printSkipWithIndent(string.concat("already set to ", desc)); + } + } + + function setFeeCollector() internal { + printLog("Setting feeCollector"); + address feeCollector = config.readAddress(".feeCollector"); + if (module.feeCollector() != feeCollector) { + module.setFeeCollector(feeCollector); + printSuccessWithIndent(string.concat("Set feeCollector to ", vm.toString(feeCollector))); + } else { + printSkipWithIndent(string.concat("already set to ", vm.toString(feeCollector))); + } + } + + function setGasOracle() internal { + string memory gasOracleName = config.readString(".gasOracleName"); + printLog(string.concat("Setting GasOracle to ", gasOracleName)); + address gasOracle = getDeploymentAddress({contractName: gasOracleName, revertIfNotFound: true}); + if (module.gasOracle() != gasOracle) { + module.setGasOracle(gasOracle); + printSuccessWithIndent(string.concat("Set gasOracle to ", vm.toString(gasOracle))); + } else { + printSkipWithIndent(string.concat("already set to ", vm.toString(gasOracle))); + } + } + + function setThreshold() internal { + printLog("Setting threshold"); + uint256 threshold = config.readUint(".threshold"); + if (module.getThreshold() != threshold) { + module.setThreshold(threshold); + printSuccessWithIndent(string.concat("Set threshold to ", vm.toString(threshold))); + } else { + printSkipWithIndent(string.concat("already set to ", vm.toString(threshold))); + } + } + + function syncVerifiers() internal { + printLog("Syncing verifiers"); + address[] memory verifiers = config.readAddressArray(".verifiers"); + address[] memory existingVerifiers = module.getVerifiers(); + // Remove verifiers that are not in the config + for (uint256 i = 0; i < existingVerifiers.length; i++) { + if (!contains(verifiers, existingVerifiers[i])) { + removedVerifiers.push(existingVerifiers[i]); + printSuccessWithIndent(string.concat("Removing ", vm.toString(existingVerifiers[i]))); + } + } + if (removedVerifiers.length > 0) { + module.removeVerifiers(removedVerifiers); + } + // Add verifiers that are in the config but not in the module + for (uint256 i = 0; i < verifiers.length; i++) { + if (!contains(existingVerifiers, verifiers[i])) { + addedVerifiers.push(verifiers[i]); + printSuccessWithIndent(string.concat("Adding ", vm.toString(verifiers[i]))); + } + } + if (addedVerifiers.length > 0) { + module.addVerifiers(addedVerifiers); + } + if (removedVerifiers.length + addedVerifiers.length == 0) { + printSkipWithIndent("verifiers are up to date"); + } else { + printLog( + string.concat( + "Added ", + vm.toString(addedVerifiers.length), + " verifiers, removed ", + vm.toString(removedVerifiers.length) + ) + ); + } + } + + function contains(address[] memory array, address value) internal pure returns (bool) { + for (uint256 i = 0; i < array.length; i++) { + if (array[i] == value) return true; + } + return false; + } +} diff --git a/packages/contracts-communication/script/deploy/DeployInterchainClientV1.s.sol b/packages/contracts-communication/script/deploy/DeployInterchainClientV1.s.sol new file mode 100644 index 0000000000..7fd52c20ae --- /dev/null +++ b/packages/contracts-communication/script/deploy/DeployInterchainClientV1.s.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {InterchainClientV1} from "../../contracts/InterchainClientV1.sol"; + +import {SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +contract DeployInterchainClientV1 is SynapseScript { + address public interchainDB; + + function run() external broadcastWithHooks { + deployAndSave("InterchainClientV1", cdDeployInterchainClientV1); + } + + function beforeExecution() internal override { + super.beforeExecution(); + interchainDB = getDeploymentAddress({contractName: "InterchainDB", revertIfNotFound: true}); + } + + function cdDeployInterchainClientV1() internal returns (address deployedAt, bytes memory constructorArgs) { + deployedAt = address(new InterchainClientV1(interchainDB, msg.sender)); + constructorArgs = abi.encode(interchainDB, msg.sender); + } +} diff --git a/packages/contracts-communication/script/deploy/DeployNoArgs.s.sol b/packages/contracts-communication/script/deploy/DeployNoArgs.s.sol new file mode 100644 index 0000000000..71dec63d8f --- /dev/null +++ b/packages/contracts-communication/script/deploy/DeployNoArgs.s.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +/// @notice Deploys a contract that takes no arguments in its constructor. +contract DeployNoArgs is SynapseScript { + function run(string memory contractName) external broadcastWithHooks { + bytes memory constructorArgs = ""; + deployAndSave(contractName, constructorArgs, cbDeploy); + } +} diff --git a/packages/contracts-communication/script/deploy/DeploySynapseModule.s.sol b/packages/contracts-communication/script/deploy/DeploySynapseModule.s.sol new file mode 100644 index 0000000000..65c9251519 --- /dev/null +++ b/packages/contracts-communication/script/deploy/DeploySynapseModule.s.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {SynapseModule} from "../../contracts/modules/SynapseModule.sol"; + +import {SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +contract DeploySynapseModule is SynapseScript { + address public interchainDB; + + function run() external broadcastWithHooks { + deployAndSave("SynapseModule", cdDeploySynapseModule); + } + + function beforeExecution() internal override { + super.beforeExecution(); + interchainDB = getDeploymentAddress({contractName: "InterchainDB", revertIfNotFound: true}); + } + + function cdDeploySynapseModule() internal returns (address deployedAt, bytes memory constructorArgs) { + deployedAt = address(new SynapseModule(interchainDB, msg.sender)); + constructorArgs = abi.encode(interchainDB, msg.sender); + } +} diff --git a/packages/contracts-communication/script/deploy/DeployWithMsgSender.s.sol b/packages/contracts-communication/script/deploy/DeployWithMsgSender.s.sol new file mode 100644 index 0000000000..cbe7c2e67f --- /dev/null +++ b/packages/contracts-communication/script/deploy/DeployWithMsgSender.s.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.20; + +import {SynapseScript} from "@synapsecns/solidity-devops/src/SynapseScript.sol"; + +/// @notice Deploys a contract that takes a single address argument in its constructor. +/// The address is the sender of the transaction that deploys the contract. +contract DeployWithMsgSender is SynapseScript { + function run(string memory contractName) external broadcastWithHooks { + bytes memory constructorArgs = abi.encode(msg.sender); + deployAndSave(contractName, constructorArgs, cbDeploy); + } +} diff --git a/packages/contracts-communication/script/testnet-config.sh b/packages/contracts-communication/script/testnet-config.sh new file mode 100755 index 0000000000..aa9e88a125 --- /dev/null +++ b/packages/contracts-communication/script/testnet-config.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Usage: ./script/testnet-deploy.sh +# Parse command line arguments +chainName=$1 +walletName=$2 +# Check that both arguments are provided +if [ -z "$chainName" ] || [ -z "$walletName" ]; then + echo "Usage: ./script/testnet-config.sh " + exit 1 +fi +# Get the rest of the options +shift 2 +options="$*" + +yarn fsr-str script/config/ConfigureAppExample.s.sol "$chainName" "$walletName" "testnet" "$options" +yarn fsr-str script/config/ConfigureClientV1.s.sol "$chainName" "$walletName" "testnet" "$options" +yarn fsr script/config/ConfigureExecutionFees.s.sol "$chainName" "$walletName" "$options" +yarn fsr-str script/config/ConfigureExecutionService.s.sol "$chainName" "$walletName" "testnet" "$options" +yarn fsr-str script/config/ConfigureSynapseModule.s.sol "$chainName" "$walletName" "testnet" "$options" diff --git a/packages/contracts-communication/script/testnet-deploy.sh b/packages/contracts-communication/script/testnet-deploy.sh new file mode 100755 index 0000000000..7ea97525ba --- /dev/null +++ b/packages/contracts-communication/script/testnet-deploy.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Usage: ./script/testnet-deploy.sh +# Parse command line arguments +chainName=$1 +walletName=$2 +# Check that both arguments are provided +if [ -z "$chainName" ] || [ -z "$walletName" ]; then + echo "Usage: ./script/testnet-deploy.sh " + exit 1 +fi +# Get the rest of the options +shift 2 +options="$*" + +yarn fsr-str script/deploy/DeployNoArgs.s.sol "$chainName" "$walletName" "InterchainDB" "$options" + +yarn fsr-str script/deploy/DeployWithMsgSender.s.sol "$chainName" "$walletName" "InterchainAppExample" "$options" + +yarn fsr script/deploy/DeployInterchainClientV1.s.sol "$chainName" "$walletName" "$options" +yarn fsr script/deploy/DeploySynapseModule.s.sol "$chainName" "$walletName" "$options" + +yarn fsr-str script/deploy/DeployWithMsgSender.s.sol "$chainName" "$walletName" "ExecutionFees" "$options" +yarn fsr-str script/deploy/DeployWithMsgSender.s.sol "$chainName" "$walletName" "ExecutionService" "$options" + +yarn fsr-str script/deploy/DeployNoArgs.s.sol "$chainName" "$walletName" "GasOracleMock" "$options"