From 75c14e92671b2545e4c78f0772eac02791550e4a Mon Sep 17 00:00:00 2001 From: danijelTxFusion Date: Tue, 5 Sep 2023 20:57:00 +0200 Subject: [PATCH] feat: migrate to ethers v6 --- .gitignore | 4 + README.md | 27 +- abi/ContractDeployer.json | 412 +++ abi/IAllowList.json | 283 ++ abi/IERC1271.json | 28 + abi/IERC20.json | 226 ++ abi/IEthToken.json | 198 ++ abi/IL1Bridge.json | 267 ++ abi/IL1Messenger.json | 48 + abi/IL2Bridge.json | 173 ++ abi/IPaymasterFlow.json | 40 + abi/IZkSync.json | 2094 +++++++++++++++ abi/update-abi.sh | 21 + package.json | 36 + src/adapters.ts | 739 ++++++ src/calldata.ts | 102 + src/contract.ts | 93 + src/format.ts | 313 +++ src/index.ts | 6 + src/paymaster-utils.ts | 37 + src/provider.ts | 575 ++++ src/signer.ts | 251 ++ src/types.ts | 395 +++ src/utils.ts | 556 ++++ src/wallet.ts | 115 + tests/const.test.ts | 101 + tests/files/wallet.json | 21 + tests/integration/provider.test.ts | 326 +++ tests/integration/wallet.test.ts | 330 +++ tests/setup.test.ts | 31 + tests/unit/util.test.ts | 24 + tsconfig.json | 19 + typechain/ContractDeployer.ts | 511 ++++ typechain/IAllowList.ts | 398 +++ typechain/IERC1271.ts | 98 + typechain/IERC20.ts | 286 ++ typechain/IEthToken.ts | 296 +++ typechain/IL1Bridge.ts | 377 +++ typechain/IL1Messenger.ts | 126 + typechain/IL2Bridge.ts | 271 ++ typechain/IPaymasterFlow.ts | 107 + typechain/IZkSync.ts | 2335 +++++++++++++++++ typechain/common.ts | 131 + .../factories/ContractDeployer__factory.ts | 433 +++ typechain/factories/IAllowList__factory.ts | 298 +++ typechain/factories/IERC1271__factory.ts | 43 + .../factories/IERC20Metadata__factory.ts | 247 ++ typechain/factories/IERC20__factory.ts | 241 ++ typechain/factories/IEthToken__factory.ts | 213 ++ typechain/factories/IL1Bridge__factory.ts | 282 ++ typechain/factories/IL1Messenger__factory.ts | 66 + typechain/factories/IL2Bridge__factory.ts | 188 ++ .../factories/IPaymasterFlow__factory.ts | 61 + typechain/factories/IZkSync__factory.ts | 2109 +++++++++++++++ typechain/factories/index.ts | 13 + typechain/index.ts | 24 + yarn.lock | 987 +++++++ 57 files changed, 18031 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 abi/ContractDeployer.json create mode 100644 abi/IAllowList.json create mode 100644 abi/IERC1271.json create mode 100644 abi/IERC20.json create mode 100644 abi/IEthToken.json create mode 100644 abi/IL1Bridge.json create mode 100644 abi/IL1Messenger.json create mode 100644 abi/IL2Bridge.json create mode 100644 abi/IPaymasterFlow.json create mode 100644 abi/IZkSync.json create mode 100755 abi/update-abi.sh create mode 100644 package.json create mode 100644 src/adapters.ts create mode 100644 src/calldata.ts create mode 100644 src/contract.ts create mode 100644 src/format.ts create mode 100644 src/index.ts create mode 100644 src/paymaster-utils.ts create mode 100644 src/provider.ts create mode 100644 src/signer.ts create mode 100644 src/types.ts create mode 100644 src/utils.ts create mode 100644 src/wallet.ts create mode 100644 tests/const.test.ts create mode 100644 tests/files/wallet.json create mode 100644 tests/integration/provider.test.ts create mode 100644 tests/integration/wallet.test.ts create mode 100644 tests/setup.test.ts create mode 100644 tests/unit/util.test.ts create mode 100644 tsconfig.json create mode 100644 typechain/ContractDeployer.ts create mode 100644 typechain/IAllowList.ts create mode 100644 typechain/IERC1271.ts create mode 100644 typechain/IERC20.ts create mode 100644 typechain/IEthToken.ts create mode 100644 typechain/IL1Bridge.ts create mode 100644 typechain/IL1Messenger.ts create mode 100644 typechain/IL2Bridge.ts create mode 100644 typechain/IPaymasterFlow.ts create mode 100644 typechain/IZkSync.ts create mode 100644 typechain/common.ts create mode 100644 typechain/factories/ContractDeployer__factory.ts create mode 100644 typechain/factories/IAllowList__factory.ts create mode 100644 typechain/factories/IERC1271__factory.ts create mode 100644 typechain/factories/IERC20Metadata__factory.ts create mode 100644 typechain/factories/IERC20__factory.ts create mode 100644 typechain/factories/IEthToken__factory.ts create mode 100644 typechain/factories/IL1Bridge__factory.ts create mode 100644 typechain/factories/IL1Messenger__factory.ts create mode 100644 typechain/factories/IL2Bridge__factory.ts create mode 100644 typechain/factories/IPaymasterFlow__factory.ts create mode 100644 typechain/factories/IZkSync__factory.ts create mode 100644 typechain/factories/index.ts create mode 100644 typechain/index.ts create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7af5d83 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build +node_modules + +.idea \ No newline at end of file diff --git a/README.md b/README.md index dceddf2..2cd0dca 100644 --- a/README.md +++ b/README.md @@ -1 +1,26 @@ -# zksync2-js \ No newline at end of file +zkSync 2 JavaScript SDK +=== + + +## Requirements + +- `ethers`: ^6.7.1 + + +## Installation + +Add this package to your project: + +```shell +$ yarn add zksync2-js +``` +or + +```shell +$ npm install zksync2-js +``` + + +## Documentation and examples + +The documentation and examples with various use cases are available [here](https://era.zksync.io/docs/api/js/). \ No newline at end of file diff --git a/abi/ContractDeployer.json b/abi/ContractDeployer.json new file mode 100644 index 0000000..15dfc3d --- /dev/null +++ b/abi/ContractDeployer.json @@ -0,0 +1,412 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "accountAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IContractDeployer.AccountNonceOrdering", + "name": "nonceOrdering", + "type": "uint8" + } + ], + "name": "AccountNonceOrderingUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "accountAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IContractDeployer.AccountAbstractionVersion", + "name": "aaVersion", + "type": "uint8" + } + ], + "name": "AccountVersionUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "deployerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "bytecodeHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "contractAddress", + "type": "address" + } + ], + "name": "ContractDeployed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_salt", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_bytecodeHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_input", + "type": "bytes" + } + ], + "name": "create", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_salt", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_bytecodeHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_input", + "type": "bytes" + } + ], + "name": "create2", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_salt", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_bytecodeHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_input", + "type": "bytes" + }, + { + "internalType": "enum IContractDeployer.AccountAbstractionVersion", + "name": "_aaVersion", + "type": "uint8" + } + ], + "name": "create2Account", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_bytecodeHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_input", + "type": "bytes" + }, + { + "internalType": "enum IContractDeployer.AccountAbstractionVersion", + "name": "_aaVersion", + "type": "uint8" + } + ], + "name": "createAccount", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "extendedAccountVersion", + "outputs": [ + { + "internalType": "enum IContractDeployer.AccountAbstractionVersion", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "bytecodeHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "newAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "callConstructor", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "input", + "type": "bytes" + } + ], + "internalType": "struct ContractDeployer.ForceDeployment", + "name": "_deployment", + "type": "tuple" + }, + { + "internalType": "address", + "name": "_sender", + "type": "address" + } + ], + "name": "forceDeployOnAddress", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "bytecodeHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "newAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "callConstructor", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "input", + "type": "bytes" + } + ], + "internalType": "struct ContractDeployer.ForceDeployment[]", + "name": "_deployments", + "type": "tuple[]" + } + ], + "name": "forceDeployOnAddresses", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "getAccountInfo", + "outputs": [ + { + "components": [ + { + "internalType": "enum IContractDeployer.AccountAbstractionVersion", + "name": "supportedAAVersion", + "type": "uint8" + }, + { + "internalType": "enum IContractDeployer.AccountNonceOrdering", + "name": "nonceOrdering", + "type": "uint8" + } + ], + "internalType": "struct IContractDeployer.AccountInfo", + "name": "info", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_senderNonce", + "type": "uint256" + } + ], + "name": "getNewAddressCreate", + "outputs": [ + { + "internalType": "address", + "name": "newAddress", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_bytecodeHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "_salt", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_input", + "type": "bytes" + } + ], + "name": "getNewAddressCreate2", + "outputs": [ + { + "internalType": "address", + "name": "newAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IContractDeployer.AccountAbstractionVersion", + "name": "_version", + "type": "uint8" + } + ], + "name": "updateAccountVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IContractDeployer.AccountNonceOrdering", + "name": "_nonceOrdering", + "type": "uint8" + } + ], + "name": "updateNonceOrdering", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/abi/IAllowList.json b/abi/IAllowList.json new file mode 100644 index 0000000..abc5a14 --- /dev/null +++ b/abi/IAllowList.json @@ -0,0 +1,283 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": false, + "internalType": "enum IAllowList.AccessMode", + "name": "previousMode", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "enum IAllowList.AccessMode", + "name": "newMode", + "type": "uint8" + } + ], + "name": "UpdateAccessMode", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "target", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes4", + "name": "functionSig", + "type": "bytes4" + }, + { + "indexed": false, + "internalType": "bool", + "name": "status", + "type": "bool" + } + ], + "name": "UpdateCallPermission", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_caller", + "type": "address" + }, + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "_functionSig", + "type": "bytes4" + } + ], + "name": "canCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_target", + "type": "address" + } + ], + "name": "getAccessMode", + "outputs": [ + { + "internalType": "enum IAllowList.AccessMode", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + } + ], + "name": "getTokenDepositLimitData", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "depositLimitation", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "depositCap", + "type": "uint256" + } + ], + "internalType": "struct IAllowList.Deposit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_caller", + "type": "address" + }, + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "_functionSig", + "type": "bytes4" + } + ], + "name": "hasSpecialAccessToCall", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "enum IAllowList.AccessMode", + "name": "_accessMode", + "type": "uint8" + } + ], + "name": "setAccessMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_targets", + "type": "address[]" + }, + { + "internalType": "enum IAllowList.AccessMode[]", + "name": "_accessMode", + "type": "uint8[]" + } + ], + "name": "setBatchAccessMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_callers", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "_targets", + "type": "address[]" + }, + { + "internalType": "bytes4[]", + "name": "_functionSigs", + "type": "bytes4[]" + }, + { + "internalType": "bool[]", + "name": "_enables", + "type": "bool[]" + } + ], + "name": "setBatchPermissionToCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "bool", + "name": "_depositLimitation", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_depositCap", + "type": "uint256" + } + ], + "name": "setDepositLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_caller", + "type": "address" + }, + { + "internalType": "address", + "name": "_target", + "type": "address" + }, + { + "internalType": "bytes4", + "name": "_functionSig", + "type": "bytes4" + }, + { + "internalType": "bool", + "name": "_enable", + "type": "bool" + } + ], + "name": "setPermissionToCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/abi/IERC1271.json b/abi/IERC1271.json new file mode 100644 index 0000000..5e15311 --- /dev/null +++ b/abi/IERC1271.json @@ -0,0 +1,28 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "internalType": "bytes4", + "name": "magicValue", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/abi/IERC20.json b/abi/IERC20.json new file mode 100644 index 0000000..2fc7246 --- /dev/null +++ b/abi/IERC20.json @@ -0,0 +1,226 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/abi/IEthToken.json b/abi/IEthToken.json new file mode 100644 index 0000000..f9bb264 --- /dev/null +++ b/abi/IEthToken.json @@ -0,0 +1,198 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_l2Sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_l1Receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "Withdrawal", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transferFromTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Receiver", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ] +} diff --git a/abi/IL1Bridge.json b/abi/IL1Bridge.json new file mode 100644 index 0000000..8908bec --- /dev/null +++ b/abi/IL1Bridge.json @@ -0,0 +1,267 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ClaimedFailedDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "l2DepositTxHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositInitiated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawalFinalized", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositSender", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_l2TxHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "claimFailedDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l2Receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2TxGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2TxGasPerPubdataByte", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_refundRecipient", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "bytes32", + "name": "txHash", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "finalizeWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + } + ], + "name": "isWithdrawalFinalized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2Bridge", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + } + ], + "name": "l2TokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ] +} diff --git a/abi/IL1Messenger.json b/abi/IL1Messenger.json new file mode 100644 index 0000000..b2bbdd5 --- /dev/null +++ b/abi/IL1Messenger.json @@ -0,0 +1,48 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_message", + "type": "bytes" + } + ], + "name": "L1MessageSent", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + } + ], + "name": "sendToL1", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/abi/IL2Bridge.json b/abi/IL2Bridge.json new file mode 100644 index 0000000..d6ca3ce --- /dev/null +++ b/abi/IL2Bridge.json @@ -0,0 +1,173 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "l1Sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l2Receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "FinalizeDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "l2Sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l2Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawalInitiated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Sender", + "type": "address" + }, + { + "internalType": "address", + "name": "_l2Receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "finalizeDeposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "l1Bridge", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l2Token", + "type": "address" + } + ], + "name": "l1TokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + } + ], + "name": "l2TokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "_l2Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/abi/IPaymasterFlow.json b/abi/IPaymasterFlow.json new file mode 100644 index 0000000..c78e121 --- /dev/null +++ b/abi/IPaymasterFlow.json @@ -0,0 +1,40 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minAllowance", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_innerInput", + "type": "bytes" + } + ], + "name": "approvalBased", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "input", + "type": "bytes" + } + ], + "name": "general", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/abi/IZkSync.json b/abi/IZkSync.json new file mode 100644 index 0000000..b553291 --- /dev/null +++ b/abi/IZkSync.json @@ -0,0 +1,2094 @@ +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "BlockCommit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "BlockExecution", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "totalBlocksCommitted", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBlocksVerified", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalBlocksExecuted", + "type": "uint256" + } + ], + "name": "BlocksRevert", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "previousLastVerifiedBlock", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "currentLastVerifiedBlock", + "type": "uint256" + } + ], + "name": "BlocksVerification", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "proposalHash", + "type": "bytes32" + } + ], + "name": "CancelUpgradeProposal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "EthWithdrawalFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "proposalHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "proposalSalt", + "type": "bytes32" + } + ], + "name": "ExecuteUpgrade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Freeze", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "isPorterAvailable", + "type": "bool" + } + ], + "name": "IsPorterAvailableStatusUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldAllowList", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newAllowList", + "type": "address" + } + ], + "name": "NewAllowList", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "NewGovernor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "previousBytecodeHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newBytecodeHash", + "type": "bytes32" + } + ], + "name": "NewL2BootloaderBytecodeHash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "previousBytecodeHash", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newBytecodeHash", + "type": "bytes32" + } + ], + "name": "NewL2DefaultAccountBytecodeHash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldPendingGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newPendingGovernor", + "type": "address" + } + ], + "name": "NewPendingGovernor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "txId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "txHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "expirationTimestamp", + "type": "uint64" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "txType", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "from", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "to", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gasPerPubdataByteLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymaster", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256[4]", + "name": "reserved", + "type": "uint256[4]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "factoryDeps", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "paymasterInput", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "reservedDynamic", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct IMailbox.L2CanonicalTransaction", + "name": "transaction", + "type": "tuple" + }, + { + "indexed": false, + "internalType": "bytes[]", + "name": "factoryDeps", + "type": "bytes[]" + } + ], + "name": "NewPriorityRequest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldPriorityTxMaxGasLimit", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPriorityTxMaxGasLimit", + "type": "uint256" + } + ], + "name": "NewPriorityTxMaxGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldVerifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newVerifier", + "type": "address" + } + ], + "name": "NewVerifier", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "recursionNodeLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionLeafLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionCircuitsSetVksHash", + "type": "bytes32" + } + ], + "indexed": false, + "internalType": "struct VerifierParams", + "name": "oldVerifierParams", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "recursionNodeLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionLeafLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionCircuitsSetVksHash", + "type": "bytes32" + } + ], + "indexed": false, + "internalType": "struct VerifierParams", + "name": "newVerifierParams", + "type": "tuple" + } + ], + "name": "NewVerifierParams", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "proposalHash", + "type": "bytes32" + } + ], + "name": "ProposeShadowUpgrade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + }, + { + "internalType": "enum Diamond.Action", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "isFreezable", + "type": "bool" + }, + { + "internalType": "bytes4[]", + "name": "selectors", + "type": "bytes4[]" + } + ], + "internalType": "struct Diamond.FacetCut[]", + "name": "facetCuts", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "initAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "initCalldata", + "type": "bytes" + } + ], + "indexed": false, + "internalType": "struct Diamond.DiamondCutData", + "name": "diamondCut", + "type": "tuple" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "proposalSalt", + "type": "bytes32" + } + ], + "name": "ProposeTransparentUpgrade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "proposalHash", + "type": "bytes32" + } + ], + "name": "SecurityCouncilUpgradeApprove", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "Unfreeze", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "validatorAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isActive", + "type": "bool" + } + ], + "name": "ValidatorStatusUpdate", + "type": "event" + }, + { + "inputs": [], + "name": "acceptGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_proposedUpgradeHash", + "type": "bytes32" + } + ], + "name": "cancelUpgradeProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint64", + "name": "blockNumber", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "indexRepeatedStorageChanges", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "numberOfLayer1Txs", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "priorityOperationsHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "l2LogsTreeRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "internalType": "struct IExecutor.StoredBlockInfo", + "name": "_lastCommittedBlockData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "blockNumber", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "indexRepeatedStorageChanges", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "newStateRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "numberOfLayer1Txs", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "l2LogsTreeRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "priorityOperationsHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "initialStorageChanges", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "repeatedStorageChanges", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "l2Logs", + "type": "bytes" + }, + { + "internalType": "bytes[]", + "name": "l2ArbitraryLengthMessages", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "factoryDeps", + "type": "bytes[]" + } + ], + "internalType": "struct IExecutor.CommitBlockInfo[]", + "name": "_newBlocksData", + "type": "tuple[]" + } + ], + "name": "commitBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint64", + "name": "blockNumber", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "indexRepeatedStorageChanges", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "numberOfLayer1Txs", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "priorityOperationsHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "l2LogsTreeRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "internalType": "struct IExecutor.StoredBlockInfo[]", + "name": "_blocksData", + "type": "tuple[]" + } + ], + "name": "executeBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + }, + { + "internalType": "enum Diamond.Action", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "isFreezable", + "type": "bool" + }, + { + "internalType": "bytes4[]", + "name": "selectors", + "type": "bytes4[]" + } + ], + "internalType": "struct Diamond.FacetCut[]", + "name": "facetCuts", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "initAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "initCalldata", + "type": "bytes" + } + ], + "internalType": "struct Diamond.DiamondCutData", + "name": "_diamondCut", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "_proposalSalt", + "type": "bytes32" + } + ], + "name": "executeUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facets", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "selectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IGetters.Facet[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "finalizeEthWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "freezeDiamond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getAllowList", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCurrentProposalId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFirstUnprocessedPriorityTx", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getL2BootloaderBytecodeHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getL2DefaultAccountBytecodeHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPendingGovernor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPriorityQueueSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPriorityTxMaxGasLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProposedUpgradeHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProposedUpgradeTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSecurityCouncil", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBlocksCommitted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBlocksExecuted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalBlocksVerified", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalPriorityTxs", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUpgradeProposalState", + "outputs": [ + { + "internalType": "enum UpgradeState", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVerifier", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVerifierParams", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "recursionNodeLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionLeafLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionCircuitsSetVksHash", + "type": "bytes32" + } + ], + "internalType": "struct VerifierParams", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isApprovedBySecurityCouncil", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isDiamondStorageFrozen", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + } + ], + "name": "isEthWithdrawalFinalized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "isFacetFreezable", + "outputs": [ + { + "internalType": "bool", + "name": "isFreezable", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "isFunctionFreezable", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "isValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "l2LogsRootHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2GasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2GasPerPubdataByteLimit", + "type": "uint256" + } + ], + "name": "l2TransactionBaseCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "priorityQueueFrontOperation", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "canonicalTxHash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expirationTimestamp", + "type": "uint64" + }, + { + "internalType": "uint192", + "name": "layer2Tip", + "type": "uint192" + } + ], + "internalType": "struct PriorityOperation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_proposalHash", + "type": "bytes32" + }, + { + "internalType": "uint40", + "name": "_proposalId", + "type": "uint40" + } + ], + "name": "proposeShadowUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + }, + { + "internalType": "enum Diamond.Action", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "isFreezable", + "type": "bool" + }, + { + "internalType": "bytes4[]", + "name": "selectors", + "type": "bytes4[]" + } + ], + "internalType": "struct Diamond.FacetCut[]", + "name": "facetCuts", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "initAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "initCalldata", + "type": "bytes" + } + ], + "internalType": "struct Diamond.DiamondCutData", + "name": "_diamondCut", + "type": "tuple" + }, + { + "internalType": "uint40", + "name": "_proposalId", + "type": "uint40" + } + ], + "name": "proposeTransparentUpgrade", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint64", + "name": "blockNumber", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "indexRepeatedStorageChanges", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "numberOfLayer1Txs", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "priorityOperationsHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "l2LogsTreeRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "internalType": "struct IExecutor.StoredBlockInfo", + "name": "_prevBlock", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "blockNumber", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "indexRepeatedStorageChanges", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "numberOfLayer1Txs", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "priorityOperationsHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "l2LogsTreeRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "internalType": "struct IExecutor.StoredBlockInfo[]", + "name": "_committedBlocks", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "uint256[]", + "name": "recursiveAggregationInput", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "serializedProof", + "type": "uint256[]" + } + ], + "internalType": "struct IExecutor.ProofInput", + "name": "_proof", + "type": "tuple" + } + ], + "name": "proveBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_l2TxHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + }, + { + "internalType": "enum TxStatus", + "name": "_status", + "type": "uint8" + } + ], + "name": "proveL1ToL2TransactionStatus", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint8", + "name": "l2ShardId", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "isService", + "type": "bool" + }, + { + "internalType": "uint16", + "name": "txNumberInBlock", + "type": "uint16" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "value", + "type": "bytes32" + } + ], + "internalType": "struct L2Log", + "name": "_log", + "type": "tuple" + }, + { + "internalType": "bytes32[]", + "name": "_proof", + "type": "bytes32[]" + } + ], + "name": "proveL2LogInclusion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint16", + "name": "txNumberInBlock", + "type": "uint16" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "internalType": "struct L2Message", + "name": "_message", + "type": "tuple" + }, + { + "internalType": "bytes32[]", + "name": "_proof", + "type": "bytes32[]" + } + ], + "name": "proveL2MessageInclusion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractL2", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_l2Value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_l2GasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2GasPerPubdataByteLimit", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "_factoryDeps", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "_refundRecipient", + "type": "address" + } + ], + "name": "requestL2Transaction", + "outputs": [ + { + "internalType": "bytes32", + "name": "canonicalTxHash", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newLastBlock", + "type": "uint256" + } + ], + "name": "revertBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_upgradeProposalHash", + "type": "bytes32" + } + ], + "name": "securityCouncilUpgradeApprove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IAllowList", + "name": "_newAllowList", + "type": "address" + } + ], + "name": "setAllowList", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_l2BootloaderBytecodeHash", + "type": "bytes32" + } + ], + "name": "setL2BootloaderBytecodeHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_l2DefaultAccountBytecodeHash", + "type": "bytes32" + } + ], + "name": "setL2DefaultAccountBytecodeHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newPendingGovernor", + "type": "address" + } + ], + "name": "setPendingGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_zkPorterIsAvailable", + "type": "bool" + } + ], + "name": "setPorterAvailability", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newPriorityTxMaxGasLimit", + "type": "uint256" + } + ], + "name": "setPriorityTxMaxGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_validator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_active", + "type": "bool" + } + ], + "name": "setValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract Verifier", + "name": "_newVerifier", + "type": "address" + } + ], + "name": "setVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "recursionNodeLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionLeafLevelVkHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "recursionCircuitsSetVksHash", + "type": "bytes32" + } + ], + "internalType": "struct VerifierParams", + "name": "_newVerifierParams", + "type": "tuple" + } + ], + "name": "setVerifierParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_blockNumber", + "type": "uint256" + } + ], + "name": "storedBlockHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unfreezeDiamond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "address", + "name": "facet", + "type": "address" + }, + { + "internalType": "enum Diamond.Action", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bool", + "name": "isFreezable", + "type": "bool" + }, + { + "internalType": "bytes4[]", + "name": "selectors", + "type": "bytes4[]" + } + ], + "internalType": "struct Diamond.FacetCut[]", + "name": "facetCuts", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "initAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "initCalldata", + "type": "bytes" + } + ], + "internalType": "struct Diamond.DiamondCutData", + "name": "_diamondCut", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "_proposalId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_salt", + "type": "bytes32" + } + ], + "name": "upgradeProposalHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + } + ] +} diff --git a/abi/update-abi.sh b/abi/update-abi.sh new file mode 100755 index 0000000..5961ae3 --- /dev/null +++ b/abi/update-abi.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +cd `dirname $0` + +OPEN_ZEPPELIN_CONTRACTS=$ZKSYNC_HOME/contracts/ethereum/artifacts/@openzeppelin/contracts +ETHEREUM_CONTRACTS=$ZKSYNC_HOME/contracts/ethereum/artifacts/cache/solpp-generated-contracts +ZKSYNC_CONTRACTS=$ZKSYNC_HOME/contracts/zksync/artifacts-zk/cache-zk/solpp-generated-contracts +SYSTEM_CONTRACTS=$ZKSYNC_HOME/etc/system-contracts/artifacts-zk/cache-zk/solpp-generated-contracts + +cat $OPEN_ZEPPELIN_CONTRACTS/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.json | jq '{ abi: .abi}' > IERC20.json + +cat $ETHEREUM_CONTRACTS/bridge/interfaces/IL1Bridge.sol/IL1Bridge.json | jq '{ abi: .abi}' > IL1Bridge.json +cat $ETHEREUM_CONTRACTS/zksync/interfaces/IZkSync.sol/IZkSync.json | jq '{ abi: .abi}' > IZkSync.json +cat $ETHEREUM_CONTRACTS/common/interfaces/IAllowList.sol/IAllowList.json | jq '{ abi: .abi}' > IAllowList.json + +cat $ZKSYNC_CONTRACTS/bridge/interfaces/IL2Bridge.sol/IL2Bridge.json | jq '{ abi: .abi}' > IL2Bridge.json +cat $ZKSYNC_CONTRACTS/interfaces/IPaymasterFlow.sol/IPaymasterFlow.json | jq '{ abi: .abi}' > IPaymasterFlow.json + +cat $SYSTEM_CONTRACTS/interfaces/IL1Messenger.sol/IL1Messenger.json | jq '{ abi: .abi}' > IL1Messenger.json +cat $SYSTEM_CONTRACTS/interfaces/IEthToken.sol/IEthToken.json | jq '{ abi: .abi}' > IEthToken.json +cat $SYSTEM_CONTRACTS/ContractDeployer.sol/ContractDeployer.json | jq '{ abi: .abi}' > ContractDeployer.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..0b72eb4 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "zksync2-js", + "version": "0.1.0", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "files": [ + "build/", + "abi/", + "src/", + "typechain/" + ], + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "@typechain/ethers-v6": "^0.5.0", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.2", + "chai": "^4.3.7", + "ethers": "^6.7.1", + "mocha": "^10.2.0", + "ncp": "^2.0.0", + "ts-node": "^10.9.1", + "typechain": "^8.3.1", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "ethers": "^6.7.1" + }, + "scripts": { + "tests": "mocha -r ts-node/register --bail tests/setup.test.ts tests/unit/*.test.ts tests/integration/*.test.ts", + "build": "yarn types && tsc && ncp ./abi ./build/abi", + "watch": "tsc --watch", + "types": "typechain --target ethers-v6 --out-dir typechain abi/*.json" + } +} diff --git a/src/adapters.ts b/src/adapters.ts new file mode 100644 index 0000000..1e41ca8 --- /dev/null +++ b/src/adapters.ts @@ -0,0 +1,739 @@ +import { + BigNumberish, + BlockTag, + BytesLike, + ethers, + FetchUrlFeeDataNetworkPlugin, + TransactionRequest as EthersTransactionRequest +} from 'ethers'; +import {Provider} from './provider'; +import { + BOOTLOADER_FORMAL_ADDRESS, + checkBaseCost, + DEFAULT_GAS_PER_PUBDATA_LIMIT, estimateCustomBridgeDepositL2Gas, estimateDefaultBridgeDepositL2Gas, + ETH_ADDRESS, getERC20DefaultBridgeData, + isETH, + L1_MESSENGER_ADDRESS, L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT, L1_RECOMMENDED_MIN_ETH_DEPOSIT_GAS_LIMIT, + layer1TxDefaults, + REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT, scaleGasLimit, + undoL1ToL2Alias +} from './utils'; +import { + IERC20__factory, + IL1Bridge__factory, + IL2Bridge__factory, + IZkSync__factory +} from '../typechain'; +import {Address, BalancesMap, Eip712Meta, FullDepositFee, Log, PriorityOpResponse, TransactionResponse} from './types'; + +type Constructor = new (...args: any[]) => T; + +interface TxSender { + sendTransaction(tx: EthersTransactionRequest): Promise; + + getAddress(): Promise
; +} + +export function AdapterL1>(Base: TBase) { + return class Adapter extends Base { + _providerL2(): Provider { + throw new Error('Must be implemented by the derived class!'); + } + + _providerL1(): ethers.Provider { + throw new Error('Must be implemented by the derived class!'); + } + + _signerL1(): ethers.Signer { + throw new Error('Must be implemented by the derived class!'); + } + + async getMainContract() { + const address = await this._providerL2().getMainContractAddress(); + return IZkSync__factory.connect(address, this._signerL1()); + } + + async getL1BridgeContracts() { + const addresses = await this._providerL2().getDefaultBridgeAddresses(); + return { + erc20: IL1Bridge__factory.connect(addresses.erc20L1, this._signerL1()) + }; + } + + async getBalanceL1(token?: Address, blockTag?: BlockTag): Promise { + token ??= ETH_ADDRESS; + if (isETH(token)) { + return await this._providerL1().getBalance(await this.getAddress(), blockTag); + } else { + const erc20contract = IERC20__factory.connect(token, this._providerL1()); + return await erc20contract.balanceOf(await this.getAddress()); + } + } + + async getAllowanceL1( + token: Address, + bridgeAddress?: Address, + blockTag?: ethers.BlockTag + ): Promise { + const erc20contract = IERC20__factory.connect(token, this._providerL1()); + bridgeAddress ??= (await (await this.getL1BridgeContracts()).erc20.getAddress()); + return await erc20contract.allowance(await this.getAddress(), bridgeAddress, { blockTag }); + } + + async l2TokenAddress(token: Address) { + if (token == ETH_ADDRESS) { + return ETH_ADDRESS; + } else { + const erc20Bridge = (await this.getL1BridgeContracts()).erc20; + return await erc20Bridge.l2TokenAddress(token); + } + } + + async approveERC20( + token: Address, + amount: BigNumberish, + overrides?: ethers.Overrides & { bridgeAddress?: Address } + ): Promise { + if (isETH(token)) { + throw new Error("ETH token can't be approved. The address of the token does not exist on L1."); + } + + overrides ??= {}; + let bridgeAddress = overrides?.bridgeAddress; + const erc20contract = IERC20__factory.connect(token, this._signerL1()); + + if (bridgeAddress == null) { + bridgeAddress = (await this._providerL2().getDefaultBridgeAddresses()).erc20L1; + } else { + delete overrides.bridgeAddress; + } + + return await erc20contract.approve(bridgeAddress, amount, overrides); + } + + async getBaseCost(params: { + gasLimit: BigNumberish; + gasPerPubdataByte?: BigNumberish; + gasPrice?: BigNumberish; + }): Promise { + const zksyncContract = await this.getMainContract(); + const parameters = {...layer1TxDefaults(), ...params}; + parameters.gasPrice ??= (await this._providerL1().getFeeData()).gasPrice; + parameters.gasPerPubdataByte ??= REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT; + + return await zksyncContract.l2TransactionBaseCost( + parameters.gasPrice, + parameters.gasLimit, + parameters.gasPerPubdataByte + ); + } + + async deposit(transaction: { + token: Address; + amount: BigNumberish; + to?: Address; + operatorTip?: BigNumberish; + bridgeAddress?: Address; + approveERC20?: boolean; + l2GasLimit?: BigNumberish; + gasPerPubdataByte?: BigNumberish; + refundRecipient?: Address; + overrides?: ethers.Overrides; + approveOverrides?: ethers.Overrides; + customBridgeData?: BytesLike; + }): Promise { + const depositTx = await this.getDepositTx(transaction); + + if (transaction.token == ETH_ADDRESS) { + const baseGasLimit = await this.estimateGasRequestExecute(depositTx); + const gasLimit = scaleGasLimit(baseGasLimit); + + depositTx.overrides ??= {}; + depositTx.overrides.gasLimit ??= gasLimit; + + return this.requestExecute(depositTx); + } else { + const bridgeContracts = await this.getL1BridgeContracts(); + if (transaction.approveERC20) { + const bridgeAddress = transaction.bridgeAddress + ? transaction.bridgeAddress + : await bridgeContracts.erc20.getAddress(); + + // We only request the allowance if the current one is not enough. + const allowance = await this.getAllowanceL1(transaction.token, bridgeAddress); + if (allowance < BigInt(transaction.amount)) { + const approveTx = await this.approveERC20(transaction.token, transaction.amount, { + bridgeAddress, + ...transaction.approveOverrides + }); + await approveTx.wait(); + } + } + + const baseGasLimit = await this._providerL1().estimateGas(depositTx); + const gasLimit = scaleGasLimit(baseGasLimit); + + depositTx.gasLimit ??= gasLimit; + + return await this._providerL2().getPriorityOpResponse( + await this._signerL1().sendTransaction(depositTx) + ); + } + } + + async estimateGasDeposit(transaction: { + token: Address; + amount: BigNumberish; + to?: Address; + operatorTip?: BigNumberish; + bridgeAddress?: Address; + customBridgeData?: BytesLike; + l2GasLimit?: BigNumberish; + gasPerPubdataByte?: BigNumberish; + refundRecipient?: Address; + overrides?: ethers.Overrides; + }): Promise { + const depositTx = await this.getDepositTx(transaction); + + let baseGasLimit: bigint; + if (transaction.token == ETH_ADDRESS) { + baseGasLimit = await this.estimateGasRequestExecute(depositTx); + } else { + baseGasLimit = await this._providerL1().estimateGas(depositTx); + } + + return scaleGasLimit(baseGasLimit); + } + + async getDepositTx(transaction: { + token: Address; + amount: BigNumberish; + to?: Address; + operatorTip?: BigNumberish; + bridgeAddress?: Address; + l2GasLimit?: BigNumberish; + gasPerPubdataByte?: BigNumberish; + customBridgeData?: BytesLike; + refundRecipient?: Address; + overrides?: ethers.Overrides; + }): Promise { + const bridgeContracts = await this.getL1BridgeContracts(); + if (transaction.bridgeAddress != null) { + bridgeContracts.erc20.attach(transaction.bridgeAddress); + } + + const { ...tx } = transaction; + tx.to ??= await this.getAddress(); + tx.operatorTip ??= 0; + tx.overrides ??= {}; + tx.overrides.from ??= await this.getAddress(); + tx.gasPerPubdataByte ??= REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT; + if (tx.bridgeAddress != null) { + const customBridgeData = + tx.customBridgeData ?? (await getERC20DefaultBridgeData(tx.token, this._providerL1())); + let bridge = IL1Bridge__factory.connect(tx.bridgeAddress, this._signerL1()); + let l2Address = await bridge.l2Bridge(); + tx.l2GasLimit ??= await estimateCustomBridgeDepositL2Gas( + this._providerL2(), + tx.bridgeAddress, + l2Address, + tx.token, + tx.amount, + tx.to, + customBridgeData, + await this.getAddress(), + tx.gasPerPubdataByte + ); + } else { + tx.l2GasLimit ??= await estimateDefaultBridgeDepositL2Gas( + this._providerL1(), + this._providerL2(), + tx.token, + tx.amount, + tx.to, + await this.getAddress(), + tx.gasPerPubdataByte + ); + } + + const { to, token, amount, operatorTip, overrides } = tx; + + await insertGasPrice(this._providerL1(), overrides); + const gasPriceForEstimation = overrides.maxFeePerGas || overrides.gasPrice; + + const zksyncContract = await this.getMainContract(); + + const baseCost = await zksyncContract.l2TransactionBaseCost( + await gasPriceForEstimation, + tx.l2GasLimit, + tx.gasPerPubdataByte + ); + + if (token == ETH_ADDRESS) { + overrides.value ??= baseCost + BigInt(operatorTip) + BigInt(amount); + + return { + contractAddress: to, + calldata: '0x', + l2Value: amount, + // For some reason typescript can not deduce that we've already set the tx.l2GasLimit + l2GasLimit: tx.l2GasLimit!, + ...tx + }; + } else { + let refundRecipient = tx.refundRecipient ?? ethers.ZeroAddress; + const args: [Address, Address, BigNumberish, BigNumberish, BigNumberish, Address] = [ + to, + token, + amount, + tx.l2GasLimit, + tx.gasPerPubdataByte, + refundRecipient + ]; + + overrides.value ??= baseCost + BigInt(operatorTip); + await checkBaseCost(baseCost, overrides.value); + overrides.from ??= await this.getAddress() + + return await bridgeContracts.erc20.deposit.populateTransaction(...args, overrides); + } + } + + // Retrieves the full needed ETH fee for the deposit. + // Returns the L1 fee and the L2 fee. + async getFullRequiredDepositFee(transaction: { + token: Address; + to?: Address; + bridgeAddress?: Address; + customBridgeData?: BytesLike; + gasPerPubdataByte?: BigNumberish; + overrides?: ethers.Overrides; + }): Promise { + // It is assumed that the L2 fee for the transaction does not depend on its value. + const dummyAmount = 1n; + + const { ...tx } = transaction; + const zksyncContract = await this.getMainContract(); + + tx.overrides ??= {}; + await insertGasPrice(this._providerL1(), tx.overrides); + const gasPriceForMessages = (await tx.overrides.maxFeePerGas) || (await tx.overrides.gasPrice); + + tx.to ??= await this.getAddress(); + tx.gasPerPubdataByte ??= REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT; + + let l2GasLimit = 0n; + if (tx.bridgeAddress != null) { + const customBridgeData = + tx.customBridgeData ?? (await getERC20DefaultBridgeData(tx.token, this._providerL1())); + let bridge = IL1Bridge__factory.connect(tx.bridgeAddress, this._signerL1()); + let l2Address = await bridge.l2Bridge(); + l2GasLimit ??= await estimateCustomBridgeDepositL2Gas( + this._providerL2(), + tx.bridgeAddress, + l2Address, + tx.token, + dummyAmount, + tx.to, + customBridgeData, + await this.getAddress(), + tx.gasPerPubdataByte + ); + } else { + l2GasLimit ??= await estimateDefaultBridgeDepositL2Gas( + this._providerL1(), + this._providerL2(), + tx.token, + dummyAmount, + tx.to, + await this.getAddress(), + tx.gasPerPubdataByte + ); + } + + const baseCost = await zksyncContract.l2TransactionBaseCost( + gasPriceForMessages, + l2GasLimit, + tx.gasPerPubdataByte + ); + + const selfBalanceETH = await this.getBalanceL1(); + + // We could zero in, because the final fee will anyway be bigger than + if (baseCost >= selfBalanceETH + dummyAmount) { + const recommendedETHBalance = BigInt( + tx.token == ETH_ADDRESS + ? L1_RECOMMENDED_MIN_ETH_DEPOSIT_GAS_LIMIT + : L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT + ) * BigInt(gasPriceForMessages) + baseCost; + const formattedRecommendedBalance = ethers.formatEther(recommendedETHBalance); + throw new Error( + `Not enough balance for deposit. Under the provided gas price, the recommended balance to perform a deposit is ${formattedRecommendedBalance} ETH` + ); + } + + // For ETH token the value that the user passes to the estimation is the one which has the + // value for the L2 commission subtracted. + let amountForEstimate: bigint; + if (isETH(tx.token)) { + amountForEstimate = dummyAmount; + } else { + amountForEstimate = dummyAmount; + + if ((await this.getAllowanceL1(tx.token)) < amountForEstimate) { + throw new Error('Not enough allowance to cover the deposit'); + } + } + + // Deleting the explicit gas limits in the fee estimation + // in order to prevent the situation where the transaction + // fails because the user does not have enough balance + const estimationOverrides = { ...tx.overrides }; + delete estimationOverrides.gasPrice; + delete estimationOverrides.maxFeePerGas; + delete estimationOverrides.maxPriorityFeePerGas; + + const l1GasLimit = await this.estimateGasDeposit({ + ...tx, + amount: amountForEstimate, + overrides: estimationOverrides, + l2GasLimit + }); + + const fullCost: FullDepositFee = { + baseCost, + l1GasLimit, + l2GasLimit + }; + + if (tx.overrides.gasPrice) { + fullCost.gasPrice = BigInt(await tx.overrides.gasPrice); + } else { + fullCost.maxFeePerGas = BigInt(await tx.overrides.maxFeePerGas); + fullCost.maxPriorityFeePerGas = BigInt(await tx.overrides.maxPriorityFeePerGas); + } + + return fullCost; + } + + async _getWithdrawalLog(withdrawalHash: BytesLike, index: number = 0) { + const hash = ethers.hexlify(withdrawalHash); + const receipt = await this._providerL2().getTransactionReceipt(hash); + const log = receipt.logs.filter( + (log) => + log.address == L1_MESSENGER_ADDRESS && + log.topics[0] == ethers.id('L1MessageSent(address,bytes32,bytes)') + )[index]; + + return { + log, + l1BatchTxId: receipt.l1BatchTxIndex + }; + } + + async _getWithdrawalL2ToL1Log(withdrawalHash: BytesLike, index: number = 0) { + const hash = ethers.hexlify(withdrawalHash); + const receipt = await this._providerL2().getTransactionReceipt(hash); + const messages = Array.from(receipt.l2ToL1Logs.entries()).filter( + ([_, log]) => log.sender == L1_MESSENGER_ADDRESS + ); + const [l2ToL1LogIndex, l2ToL1Log] = messages[index]; + + return { + l2ToL1LogIndex, + l2ToL1Log + }; + } + + async finalizeWithdrawalParams(withdrawalHash: BytesLike, index: number = 0) { + const {log, l1BatchTxId} = await this._getWithdrawalLog(withdrawalHash, index); + const {l2ToL1LogIndex} = await this._getWithdrawalL2ToL1Log(withdrawalHash, index); + const sender = ethers.dataSlice(log.topics[1], 12); + const proof = await this._providerL2().getLogProof(withdrawalHash, l2ToL1LogIndex); + const message = ethers.AbiCoder.defaultAbiCoder().decode(['bytes'], log.data)[0]; + return { + l1BatchNumber: log.l1BatchNumber, + l2MessageIndex: proof.id, + l2TxNumberInBlock: l1BatchTxId, + message, + sender, + proof: proof.proof + }; + } + + async finalizeWithdrawal(withdrawalHash: BytesLike, index: number = 0, overrides?: ethers.Overrides) { + const {l1BatchNumber, l2MessageIndex, l2TxNumberInBlock, message, sender, proof} = + await this.finalizeWithdrawalParams(withdrawalHash, index); + + if (isETH(sender)) { + const contractAddress = await this._providerL2().getMainContractAddress(); + const zksync = IZkSync__factory.connect(contractAddress, this._signerL1()); + + return await zksync.finalizeEthWithdrawal( + l1BatchNumber, + l2MessageIndex, + l2TxNumberInBlock, + message, + proof, + overrides ?? {} + ); + } + + const l2Bridge = IL2Bridge__factory.connect(sender, this._providerL2()); + const l1Bridge = IL1Bridge__factory.connect(await l2Bridge.l1Bridge(), this._signerL1()); + return await l1Bridge.finalizeWithdrawal( + l1BatchNumber, + l2MessageIndex, + l2TxNumberInBlock, + message, + proof, + overrides ?? {} + ); + } + + async isWithdrawalFinalized(withdrawalHash: BytesLike, index: number = 0) { + const {log} = await this._getWithdrawalLog(withdrawalHash, index); + const {l2ToL1LogIndex} = await this._getWithdrawalL2ToL1Log(withdrawalHash, index); + const sender = ethers.dataSlice(log.topics[1], 12); + // `getLogProof` is called not to get proof but + // to get the index of the corresponding L2->L1 log, + // which is returned as `proof.id`. + const proof = await this._providerL2().getLogProof(withdrawalHash, l2ToL1LogIndex); + + if (isETH(sender)) { + const contractAddress = await this._providerL2().getMainContractAddress(); + const zksync = IZkSync__factory.connect(contractAddress, this._signerL1()); + + return await zksync.isEthWithdrawalFinalized(log.l1BatchNumber, proof.id); + } + + const l2Bridge = IL2Bridge__factory.connect(sender, this._providerL2()); + const l1Bridge = IL1Bridge__factory.connect(await l2Bridge.l1Bridge(), this._providerL1()); + + return await l1Bridge.isWithdrawalFinalized(log.l1BatchNumber, proof.id); + } + + async claimFailedDeposit(depositHash: BytesLike, overrides?: ethers.Overrides) { + const receipt = await this._providerL2().getTransactionReceipt(ethers.hexlify(depositHash)); + const successL2ToL1LogIndex = receipt.l2ToL1Logs.findIndex( + (l2ToL1log) => l2ToL1log.sender == BOOTLOADER_FORMAL_ADDRESS && l2ToL1log.key == depositHash + ); + const successL2ToL1Log = receipt.l2ToL1Logs[successL2ToL1LogIndex]; + if (successL2ToL1Log.value != ethers.ZeroHash) { + throw new Error('Cannot claim successful deposit'); + } + + const tx = await this._providerL2().getTransaction(ethers.hexlify(depositHash)); + + // Undo the aliasing, since the Mailbox contract set it as for contract address. + const l1BridgeAddress = undoL1ToL2Alias(receipt.from); + const l2BridgeAddress = receipt.to; + + const l1Bridge = IL1Bridge__factory.connect(l1BridgeAddress, this._signerL1()); + const l2Bridge = IL2Bridge__factory.connect(l2BridgeAddress, this._providerL2()); + + const calldata = l2Bridge.interface.decodeFunctionData('finalizeDeposit', tx.data); + + const proof = await this._providerL2().getLogProof(depositHash, successL2ToL1LogIndex); + return await l1Bridge.claimFailedDeposit( + calldata['_l1Sender'], + calldata['_l1Token'], + depositHash, + receipt.l1BatchNumber, + proof.id, + receipt.l1BatchTxIndex, + proof.proof, + overrides ?? {} + ); + } + + async requestExecute(transaction: { + contractAddress: Address; + calldata: string; + l2GasLimit: BigNumberish; + l2Value?: BigNumberish; + factoryDeps?: ethers.BytesLike[]; + operatorTip?: BigNumberish; + gasPerPubdataByte?: BigNumberish; + refundRecipient?: Address; + overrides?: ethers.Overrides; + }): Promise { + const requestExecuteTx = await this.getRequestExecuteTx(transaction); + return this._providerL2().getPriorityOpResponse(await this._signerL1().sendTransaction(requestExecuteTx)); + } + + async estimateGasRequestExecute(transaction: { + contractAddress: Address; + calldata: string; + l2GasLimit?: BigNumberish; + l2Value?: BigNumberish; + factoryDeps?: ethers.BytesLike[]; + operatorTip?: BigNumberish; + gasPerPubdataByte?: BigNumberish; + refundRecipient?: Address; + overrides?: ethers.Overrides; + }): Promise { + const requestExecuteTx = await this.getRequestExecuteTx(transaction); + + delete requestExecuteTx.gasPrice; + delete requestExecuteTx.maxFeePerGas; + delete requestExecuteTx.maxPriorityFeePerGas; + + return this._providerL1().estimateGas(requestExecuteTx); + } + + async getRequestExecuteTx(transaction: { + contractAddress: Address; + calldata: string; + l2GasLimit?: BigNumberish; + l2Value?: BigNumberish; + factoryDeps?: ethers.BytesLike[]; + operatorTip?: BigNumberish; + gasPerPubdataByte?: BigNumberish; + refundRecipient?: Address; + overrides?: ethers.Overrides; + }): Promise { + const zksyncContract = await this.getMainContract(); + + const {...tx} = transaction; + tx.l2Value ??= 0; + tx.operatorTip ??= 0; + tx.factoryDeps ??= []; + tx.overrides ??= {}; + tx.overrides.from ??= await this.getAddress(); + tx.gasPerPubdataByte ??= REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT; + tx.refundRecipient ??= await this.getAddress(); + tx.l2GasLimit ??= await this._providerL2().estimateL1ToL2Execute(transaction); + + const { + contractAddress, + l2Value, + calldata, + l2GasLimit, + factoryDeps, + operatorTip, + overrides, + gasPerPubdataByte, + refundRecipient + } = tx; + + await insertGasPrice(this._providerL1(), overrides); + const gasPriceForEstimation = overrides.maxFeePerGas || overrides.gasPrice; + + const baseCost = await this.getBaseCost({ + gasPrice: await gasPriceForEstimation, + gasPerPubdataByte, + gasLimit: l2GasLimit + }); + + overrides.value ??= baseCost + BigInt(operatorTip) + BigInt(l2Value); + + await checkBaseCost(baseCost, overrides.value); + + return await zksyncContract.requestL2Transaction.populateTransaction( + contractAddress, + l2Value, + calldata, + l2GasLimit, + REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT, + factoryDeps, + refundRecipient, + overrides + ); + } + }; + +} + +export function AdapterL2>(Base: TBase) { + return class Adapter extends Base { + _providerL2(): Provider { + throw new Error('Must be implemented by the derived class!'); + } + + _signerL2(): ethers.Signer { + throw new Error('Must be implemented by the derived class!'); + } + + async getBalance(token?: Address, blockTag: BlockTag = 'committed') { + return await this._providerL2().getBalance(await this.getAddress(), blockTag, token); + } + + async getAllBalances(): Promise { + return await this._providerL2().getAllAccountBalances(await this.getAddress()); + } + + async getL2BridgeContracts() { + const addresses = await this._providerL2().getDefaultBridgeAddresses(); + return { + erc20: IL2Bridge__factory.connect(addresses.erc20L2, this._signerL2()) + }; + } + + _fillCustomData(data: Eip712Meta): Eip712Meta { + const customData = {...data}; + customData.gasPerPubdata ??= DEFAULT_GAS_PER_PUBDATA_LIMIT; + customData.factoryDeps ??= []; + return customData; + } + + async withdraw(transaction: { + token: Address; + amount: BigNumberish; + to?: Address; + bridgeAddress?: Address; + overrides?: ethers.Overrides; + }): Promise { + const withdrawTx = await this._providerL2().getWithdrawTx({ + from: await this.getAddress(), + ...transaction + }); + return (await this.sendTransaction(withdrawTx)) as TransactionResponse; + } + + async transfer(transaction: { + to: Address; + amount: BigNumberish; + token?: Address; + overrides?: ethers.Overrides; + }): Promise { + const transferTx = await this._providerL2().getTransferTx({ + from: await this.getAddress(), + ...transaction + }); + return (await this.sendTransaction(transferTx)) as TransactionResponse; + } + }; +} + +/// @dev This method checks if the overrides contain a gasPrice (or maxFeePerGas), if not it will insert +/// the maxFeePerGas +async function insertGasPrice(l1Provider: ethers.Provider, overrides: ethers.Overrides) { + if (!overrides.gasPrice && !overrides.maxFeePerGas) { + const l1FeeData = await l1Provider.getFeeData(); + + // check if plugin is used to fetch fee data + const network = await l1Provider.getNetwork(); + const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + if (plugin) { + overrides.gasPrice = l1FeeData.gasPrice + overrides.maxFeePerGas = l1FeeData.maxFeePerGas + overrides.maxPriorityFeePerGas = l1FeeData.maxPriorityFeePerGas + return + } + + // Sometimes baseFeePerGas is not available, so we use gasPrice instead. + const baseFee = l1FeeData.maxFeePerGas ? getBaseCostFromFeeData(l1FeeData) : l1FeeData.gasPrice; + + + // ethers.js by default uses multiplication by 2, but since the price for the L2 part + // will depend on the L1 part, doubling base fee is typically too much. + overrides.maxFeePerGas = baseFee * 3n / 2n + l1FeeData.maxPriorityFeePerGas; + overrides.maxPriorityFeePerGas = l1FeeData.maxPriorityFeePerGas; + } +} + +function getBaseCostFromFeeData(feeData: ethers.FeeData): bigint { + // reverse the logic implemented in the abstract-provider.ts (line 917) + return (feeData.maxFeePerGas - feeData.maxPriorityFeePerGas) / 2n +} \ No newline at end of file diff --git a/src/calldata.ts b/src/calldata.ts new file mode 100644 index 0000000..70de5ca --- /dev/null +++ b/src/calldata.ts @@ -0,0 +1,102 @@ +import { BigNumberish, ethers } from 'ethers'; + +interface CallDataParams { + constructorCall?: boolean; +} + +interface CallData extends CallDataParams { + hash?: BigNumberish; + input: BigNumberish[]; +} + +const CONSTRUCTOR_DATA_OFFSET = 8; +const FIELD_SIZE = 32; + +const SELECTOR_SIZE_BYTES = 4; +const OFFSET_DATA = 1; +const OFFSET_HEADER = 0; + +function toLeBytes(x: BigNumberish): Uint8Array { + return ethers.toBeArray(BigInt(x)).reverse(); +} + +// This function parses calldata generated for a solidity contract call. +// Format is described in details here: https://docs.soliditylang.org/en/latest/abi-spec.html +// This function might incorrectly handle complex types. +export function parseCalldata(calldata: ethers.BytesLike, params?: CallDataParams): CallData { + const bytes = ethers.getBytes(calldata); + + // The first four bytes of the call data for a function call specifies the function to be called. + // It is the first four bytes of the Keccak-256 hash of the signature of the function. + if (bytes.length < 4) { + throw new Error('No function selector found'); + } + + const selector = ethers.hexlify(bytes.slice(0, 4)); + + // All the arguments follow the selector and are encoded as defined in the ABI spec. + // Arguments are aligned to 32 bytes each. + if (bytes.length % 32 !== 4) { + throw new Error('Unsupported arguments alignment'); + } + + const input: string[] = []; + + for (let i = 4; i < bytes.length; i += 32) { + input.push(ethers.hexlify(bytes.slice(i, i + 32))); + } + + return { + hash: selector, + input, + ...params + }; +} + +// Spec: https://www.notion.so/matterlabs/Contract-ABI-21cfe71b2e3346029f4b591ae33332b4 +export function calldataBytes(calldata: CallData): Uint8Array { + let buffer: Uint8Array; + let calldataSize: number; + + if (calldata.constructorCall) { + const size = (OFFSET_DATA + calldata.input.length) * FIELD_SIZE; + buffer = new Uint8Array(size); + + buffer[CONSTRUCTOR_DATA_OFFSET] |= 0b00000001; + + let calldataOffset = OFFSET_DATA * FIELD_SIZE; + calldata.input.forEach((value) => { + toLeBytes(value).forEach((byte, index) => { + buffer[index + calldataOffset] = byte; + }); + calldataOffset += FIELD_SIZE; + }); + + calldataSize = calldata.input.length * FIELD_SIZE; + } else { + const size = (OFFSET_DATA + 1 + calldata.input.length) * FIELD_SIZE; + buffer = new Uint8Array(size); + + const entryHashOffset = (OFFSET_DATA + 1) * FIELD_SIZE - SELECTOR_SIZE_BYTES; + toLeBytes(calldata.hash!).forEach((byte, index) => { + buffer[index + entryHashOffset] = byte; + }); + + for (let i = 0; i < calldata.input.length; i++) { + const offset = (OFFSET_DATA + i) * FIELD_SIZE; + const argument = toLeBytes(calldata.input[i]); + + buffer.set(argument.slice(SELECTOR_SIZE_BYTES), offset); + buffer.set(argument.slice(0, SELECTOR_SIZE_BYTES), offset + 2 * FIELD_SIZE - SELECTOR_SIZE_BYTES); + } + + calldataSize = SELECTOR_SIZE_BYTES + calldata.input.length * FIELD_SIZE; + } + + const calldataSizeOffset = OFFSET_HEADER * FIELD_SIZE; + toLeBytes(calldataSize).forEach((byte, index) => { + buffer[calldataSizeOffset + index] = byte; + }); + + return buffer; +} diff --git a/src/contract.ts b/src/contract.ts new file mode 100644 index 0000000..0b03d61 --- /dev/null +++ b/src/contract.ts @@ -0,0 +1,93 @@ +import { BytesLike, Contract, InterfaceAbi, Interface, ethers, ContractRunner, ContractTransaction } from 'ethers'; +import { + hashBytecode, + CONTRACT_DEPLOYER, + CONTRACT_DEPLOYER_ADDRESS, + EIP712_TX_TYPE, + getDeployedContracts, + DEFAULT_GAS_PER_PUBDATA_LIMIT +} from './utils'; +import { AccountAbstractionVersion, DeploymentType } from './types'; +export { Contract } from 'ethers'; + +export class ContractFactory extends ethers.ContractFactory { + readonly deploymentType: DeploymentType; + + constructor( + abi: Interface | InterfaceAbi, + bytecode: ethers.BytesLike, + runner?: ContractRunner, + deploymentType?: DeploymentType + ) { + super(abi, bytecode, runner); + this.deploymentType = deploymentType || 'create'; + } + + private encodeCalldata(salt: BytesLike, bytecodeHash: BytesLike, constructorCalldata: BytesLike) { + if (this.deploymentType == 'create') { + return CONTRACT_DEPLOYER.encodeFunctionData('create', [salt, bytecodeHash, constructorCalldata]); + } else if (this.deploymentType == 'createAccount') { + return CONTRACT_DEPLOYER.encodeFunctionData('createAccount', [ + salt, + bytecodeHash, + constructorCalldata, + AccountAbstractionVersion.Version1 + ]); + } else { + throw new Error(`Unsupported deployment type ${this.deploymentType}`); + } + } + + override async getDeployTransaction(...args: any[]): Promise { + // TODO (SMA-1585): Users should be able to provide the salt. + let salt = '0x0000000000000000000000000000000000000000000000000000000000000000'; + + // The overrides will be popped out in this call: + const txRequest = await super.getDeployTransaction(...args); + // Removing overrides + if (this.interface.deploy.inputs.length + 1 == args.length) { + args.pop(); + } + + // Salt argument is not used, so we provide a placeholder value. + const bytecodeHash = hashBytecode(this.bytecode); + const constructorCalldata = ethers.getBytes(this.interface.encodeDeploy(args)); + + const deployCalldata = this.encodeCalldata(salt, bytecodeHash, constructorCalldata); + + const tx = { + ...txRequest, + to: CONTRACT_DEPLOYER_ADDRESS, + data: deployCalldata, + type: EIP712_TX_TYPE + }; + + txRequest.customData ??= {}; + txRequest.customData.factoryDeps ??= []; + txRequest.customData.gasPerPubdata ??= DEFAULT_GAS_PER_PUBDATA_LIMIT; + + // The number of factory deps is relatively low, so it is efficient enough. + if (!tx.customData.factoryDeps.includes(this.bytecode)) { + tx.customData.factoryDeps.push(this.bytecode); + } + + return tx; + } + + override async deploy(...args: Array): Promise { + const contract = await super.deploy(...args); + + const deployTxReceipt = await contract.deploymentTransaction().wait(); + + const deployedAddresses = getDeployedContracts(deployTxReceipt).map((info) => info.deployedAddress); + + const contractWithCorrectAddress = new ethers.Contract( + deployedAddresses[deployedAddresses.length - 1], + contract.interface.fragments, + contract.runner + ); + + contractWithCorrectAddress.deploymentTransaction = () => contract.deploymentTransaction(); + return contractWithCorrectAddress; + } +} diff --git a/src/format.ts b/src/format.ts new file mode 100644 index 0000000..598cd36 --- /dev/null +++ b/src/format.ts @@ -0,0 +1,313 @@ +import { + accessListify, + assert, + assertArgument, + BlockParams, + getAddress, + getBigInt, + getCreateAddress, + getNumber, + hexlify, + isHexString, + LogParams, + Signature, + TransactionReceiptParams, + TransactionResponseParams, + zeroPadValue +} from 'ethers'; + +const BN_0 = BigInt(0); + +export type FormatFunc = (value: any) => any; + +export function allowNull(format: FormatFunc, nullValue?: any): FormatFunc { + return function (value: any) { + if (value == null) { + return nullValue; + } + return format(value); + }; +} + +export function arrayOf(format: FormatFunc): FormatFunc { + return (array: any) => { + if (!Array.isArray(array)) { + throw new Error('not an array'); + } + return array.map((i) => format(i)); + }; +} + +// Requires an object which matches a fleet of other formatters +// Any FormatFunc may return `undefined` to have the value omitted +// from the result object. Calls preserve `this`. +export function object(format: Record, altNames?: Record>): FormatFunc { + return (value: any) => { + const result: any = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } catch (error) { + const message = error instanceof Error ? error.message : 'not-an-error'; + assert(false, `invalid value for value.${key} (${message})`, 'BAD_DATA', {value}); + } + } + return result; + }; +} + +export function formatBoolean(value: any): boolean { + switch (value) { + case true: + case 'true': + return true; + case false: + case 'false': + return false; + } + assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, 'value', value); +} + +export function formatData(value: string): string { + assertArgument(isHexString(value, true), 'invalid data', 'value', value); + return value; +} + +export function formatHash(value: any): string { + assertArgument(isHexString(value, 32), 'invalid hash', 'value', value); + return value; +} + +export function formatUint256(value: any): string { + if (!isHexString(value)) { + throw new Error('invalid uint256'); + } + return zeroPadValue(value, 32); +} + +const _formatLog = object( + { + address: getAddress, + blockHash: formatHash, + blockNumber: getNumber, + data: formatData, + index: getNumber, + removed: formatBoolean, + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: getNumber, + l1BatchNumber: allowNull(getNumber) + }, + { + index: ['logIndex'] + } +); + +export function formatLog(value: any): LogParams { + return _formatLog(value); +} + +const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + number: getNumber, + + timestamp: getNumber, + nonce: allowNull(formatData), + difficulty: getBigInt, + + gasLimit: getBigInt, + gasUsed: getBigInt, + + miner: allowNull(getAddress), + extraData: formatData, + + baseFeePerGas: allowNull(getBigInt), + + l1BatchNumber: allowNull(getNumber), + l1BatchTimestamp: allowNull(getNumber) +}); + +export function formatBlock(value: any): BlockParams { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx: string | TransactionResponseParams) => { + if (typeof tx === 'string') { + return tx; + } + return formatTransactionResponse(tx); + }); + return result; +} + +const _formatReceiptLog = object( + { + transactionIndex: getNumber, + blockNumber: getNumber, + transactionHash: formatHash, + address: getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: getNumber, + blockHash: formatHash, + l1BatchNumber: allowNull(getNumber) + }, + { + index: ['logIndex'] + } +); + +export function formatReceiptLog(value: any): LogParams { + return _formatReceiptLog(value); +} + +const formatL2ToL1Log = object({ + blockNumber: getNumber, + blockHash: formatHash, + l1BatchNumber: allowNull(getNumber), + transactionIndex: getNumber, + shardId: getNumber, + isService: formatBoolean, + sender: getAddress, + key: formatHash, + value: formatHash, + transactionHash: formatHash, + logIndex: getNumber +}); + +const _formatTransactionReceipt = object( + { + to: allowNull(getAddress, null), + from: allowNull(getAddress, null), + contractAddress: allowNull(getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: getNumber, + root: allowNull(hexlify), + gasUsed: getBigInt, + logsBloom: allowNull(formatData), + blockHash: allowNull(formatHash,null), + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: allowNull(getNumber, null), + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: getBigInt, + effectiveGasPrice: allowNull(getBigInt), + status: allowNull(getNumber), + type: allowNull(getNumber, 0), + l1BatchNumber: allowNull(getNumber), + l1BatchTxIndex: allowNull(getNumber), + l2ToL1Logs: arrayOf(formatL2ToL1Log) + }, + { + effectiveGasPrice: ['gasPrice'], + hash: ['transactionHash'], + index: ['transactionIndex'] + } +); + +export function formatTransactionReceipt(value: any): TransactionReceiptParams { + return _formatTransactionReceipt(value); +} + +export function formatTransactionResponse(value: any): TransactionResponseParams { + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && getBigInt(value.to) === BN_0) { + value.to = '0x0000000000000000000000000000000000000000'; + } + + const result = object( + { + hash: formatHash, + + type: (value: any) => { + if (value === '0x' || value == null) { + return 0; + } + return getNumber(value); + }, + accessList: allowNull(accessListify, null), + + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(getNumber, null), + transactionIndex: allowNull(getNumber, null), + + //confirmations: allowNull(getNumber, null), + + from: getAddress, + + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(getBigInt), + maxPriorityFeePerGas: allowNull(getBigInt), + maxFeePerGas: allowNull(getBigInt), + + gasLimit: getBigInt, + to: allowNull(getAddress, null), + value: getBigInt, + nonce: getNumber, + data: formatData, + + creates: allowNull(getAddress, null), + + chainId: allowNull(getBigInt, null), + + l1BatchNumber: allowNull(getNumber), + l1BatchTxIndex: allowNull(getNumber) + }, + { + data: ['input'], + gasLimit: ['gas'] + } + )(value); + + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = getCreateAddress(result); + } + + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = []; + } + + // Compute the signature + try { + if (value.signature) { + result.signature = Signature.from(value.signature); + } else { + result.signature = Signature.from(value); + } + } catch (e) { + // DepositL2 transactions does not have V,R,S values + // which causes signature computation to fail + result.signature = Signature.from(null); + } + + + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { + result.chainId = chainId; + } + } + + // 0x0000... should actually be null + if (result.blockHash && getBigInt(result.blockHash) === BN_0) { + result.blockHash = null; + } + + return result; +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..83c9553 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,6 @@ +export * as utils from './utils'; +export * as types from './types'; +export { EIP712Signer, Signer, L1Signer } from './signer'; +export { Wallet } from './wallet'; +export { BrowserProvider, Provider } from './provider'; +export { ContractFactory, Contract } from './contract'; diff --git a/src/paymaster-utils.ts b/src/paymaster-utils.ts new file mode 100644 index 0000000..bacfe40 --- /dev/null +++ b/src/paymaster-utils.ts @@ -0,0 +1,37 @@ +import { BytesLike, ethers } from 'ethers'; + +import { + Address, + ApprovalBasedPaymasterInput, + GeneralPaymasterInput, + PaymasterInput, + PaymasterParams +} from './types'; + +export const IPaymasterFlow = new ethers.Interface(require('../abi/IPaymasterFlow.json').abi); + +export function getApprovalBasedPaymasterInput(paymasterInput: ApprovalBasedPaymasterInput): BytesLike { + return IPaymasterFlow.encodeFunctionData('approvalBased', [ + paymasterInput.token, + paymasterInput.minimalAllowance, + paymasterInput.innerInput + ]); +} + +export function getGeneralPaymasterInput(paymasterInput: GeneralPaymasterInput): BytesLike { + return IPaymasterFlow.encodeFunctionData('general', [paymasterInput.innerInput]); +} + +export function getPaymasterParams(paymasterAddress: Address, paymasterInput: PaymasterInput): PaymasterParams { + if (paymasterInput.type == 'General') { + return { + paymaster: paymasterAddress, + paymasterInput: getGeneralPaymasterInput(paymasterInput) + }; + } else { + return { + paymaster: paymasterAddress, + paymasterInput: getApprovalBasedPaymasterInput(paymasterInput) + }; + } +} diff --git a/src/provider.ts b/src/provider.ts new file mode 100644 index 0000000..4fa5990 --- /dev/null +++ b/src/provider.ts @@ -0,0 +1,575 @@ +import { + ethers, + BigNumberish, + BytesLike, + Contract, + BlockTag, + Filter, + FilterByBlockHash, + TransactionRequest as EthersTransactionRequest, + JsonRpcTransactionRequest, + Networkish, + Eip1193Provider, + JsonRpcError, + JsonRpcResult, + JsonRpcPayload +} from 'ethers'; +import { IERC20__factory, IEthToken__factory, IL2Bridge__factory } from '../typechain'; +import { + Address, + TransactionResponse, + TransactionRequest, + TransactionStatus, + Token, + PriorityOpResponse, + BalancesMap, + MessageProof, + TransactionReceipt, + Block, + Log, + TransactionDetails, + BlockDetails, + ContractAccountInfo, + Network as ZkSyncNetwork, BatchDetails, Fee +} from './types'; +import { + isETH, + getL2HashFromPriorityOp, + CONTRACT_DEPLOYER_ADDRESS, + CONTRACT_DEPLOYER, + ETH_ADDRESS, + sleep, + L2_ETH_TOKEN_ADDRESS, + EIP712_TX_TYPE, + REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT +} from './utils'; +import { Signer } from './signer'; + +import { formatLog, formatBlock, formatTransactionResponse, formatTransactionReceipt } from './format'; + +export class Provider extends ethers.JsonRpcProvider { + protected contractAddresses: { + mainContract?: Address; + erc20BridgeL1?: Address; + erc20BridgeL2?: Address; + }; + + override _getBlockTag(blockTag?: BlockTag): string | Promise { + if (blockTag == "committed") { return "committed"; } + return super._getBlockTag(blockTag); + } + + override _wrapLog(value: any, network: ethers.Network): Log { + const log: any = formatLog(value); + return new Log(super._wrapLog(log, network), this); + } + + override _wrapBlock(value: any, network: ethers.Network): Block { + const block: any = formatBlock(value); + return new Block(super._wrapBlock(block, network), this); + } + + override _wrapTransactionResponse(value: any, network: ethers.Network): TransactionResponse { + const tx: any = formatTransactionResponse(value); + return new TransactionResponse(super._wrapTransactionResponse(tx, network), this); + } + + override _wrapTransactionReceipt(value: any, network: ethers.Network): TransactionReceipt { + const receipt: any = formatTransactionReceipt(value); + return new TransactionReceipt(receipt, this); + } + + override async getTransactionReceipt(txHash: string): Promise { + return (await super.getTransactionReceipt(txHash)) as TransactionReceipt; + } + + override async getTransaction(txHash: string): Promise { + return (await super.getTransaction(txHash)) as TransactionResponse; + } + + override async getBlock(blockHashOrBlockTag: BlockTag, includeTxs?: boolean): Promise { + return (await super.getBlock(blockHashOrBlockTag, includeTxs)) as Block; + } + + override async getLogs(filter: Filter | FilterByBlockHash): Promise { + return (await super.getLogs(filter)) as Log[]; + } + + override async getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address) { + if (tokenAddress == null || isETH(tokenAddress)) { + // requesting ETH balance + return await super.getBalance(address, blockTag); + } else { + try { + let token = IERC20__factory.connect(tokenAddress, this); + return await token.balanceOf(address, { blockTag }); + } catch { + return 0n; + } + } + } + + async l2TokenAddress(token: Address) { + if (token == ETH_ADDRESS) { + return ETH_ADDRESS; + } else { + const erc20BridgeAddress = (await this.getDefaultBridgeAddresses()).erc20L2; + const erc20Bridge = IL2Bridge__factory.connect(erc20BridgeAddress!, this); + return await erc20Bridge.l2TokenAddress(token); + } + } + + async l1TokenAddress(token: Address) { + if (token == ETH_ADDRESS) { + return ETH_ADDRESS; + } else { + const erc20BridgeAddress = (await this.getDefaultBridgeAddresses()).erc20L2; + const erc20Bridge = IL2Bridge__factory.connect(erc20BridgeAddress!, this); + return await erc20Bridge.l1TokenAddress(token); + } + } + + async estimateGasL1(transaction: TransactionRequest): Promise { + return await this.send('zks_estimateGasL1ToL2', [this.getRpcTransaction(transaction)]); + } + + async estimateFee(transaction: TransactionRequest): Promise { + return await this.send('zks_estimateFee', [transaction]); + } + + async getGasPrice(): Promise { + const feeData = await this.getFeeData(); + return feeData.gasPrice!; + } + + constructor(url?: ethers.FetchRequest | string, network?: Networkish, options?: any) { + super(url, network, options); + this.pollingInterval = 500; + this.contractAddresses = {}; + } + + async getMessageProof( + blockNumber: number, + sender: Address, + messageHash: BytesLike, + logIndex?: number + ): Promise { + return await this.send('zks_getL2ToL1MsgProof', [blockNumber, sender, ethers.hexlify(messageHash), logIndex]); + } + + async getLogProof(txHash: BytesLike, index?: number): Promise { + return await this.send('zks_getL2ToL1LogProof', [ethers.hexlify(txHash), index]); + } + + async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | null> { + const range = await this.send('zks_getL1BatchBlockRange', [l1BatchNumber]); + if (range == null) { + return null; + } + return [parseInt(range[0], 16), parseInt(range[1], 16)]; + } + + async getMainContractAddress(): Promise
{ + if (!this.contractAddresses.mainContract) { + this.contractAddresses.mainContract = await this.send('zks_getMainContract', []); + } + return this.contractAddresses.mainContract!; + } + + async getTestnetPaymasterAddress(): Promise
{ + // Unlike contract's addresses, the testnet paymaster is not cached, since it can be trivially changed + // on the fly by the server and should not be relied on to be constant + return await this.send('zks_getTestnetPaymaster', []); + } + + async getDefaultBridgeAddresses() { + if (!this.contractAddresses.erc20BridgeL1) { + let addresses = await this.send('zks_getBridgeContracts', []); + this.contractAddresses.erc20BridgeL1 = addresses.l1Erc20DefaultBridge; + this.contractAddresses.erc20BridgeL2 = addresses.l2Erc20DefaultBridge; + } + return { + erc20L1: this.contractAddresses.erc20BridgeL1, + erc20L2: this.contractAddresses.erc20BridgeL2 + }; + } + + async getConfirmedTokens(start: number = 0, limit: number = 255): Promise { + const tokens: Token[] = await this.send('zks_getConfirmedTokens', [start, limit]); + return tokens.map((token) => ({ address: token.l2Address, ...token })); + } + + async getTokenPrice(token: Address): Promise { + return await this.send('zks_getTokenPrice', [token]); + } + + async getAllAccountBalances(address: Address): Promise { + let balances = await this.send('zks_getAllAccountBalances', [address]); + for (let token in balances) { + balances[token] = BigInt(balances[token]); + } + return balances; + } + + async l1ChainId(): Promise { + const res = await this.send('zks_L1ChainId', []); + return Number(res); + } + + async getL1BatchNumber(): Promise { + const number = await this.send('zks_L1BatchNumber', []); + return Number(number); + } + + async getL1BatchDetails(number: number): Promise { + return await this.send('zks_getL1BatchDetails', [number]); + } + + async getBlockDetails(number: number): Promise { + return await this.send('zks_getBlockDetails', [number]); + } + + async getTransactionDetails(txHash: BytesLike): Promise { + return await this.send('zks_getTransactionDetails', [txHash]); + } + + async getWithdrawTx(transaction: { + token: Address; + amount: BigNumberish; + from?: Address; + to?: Address; + bridgeAddress?: Address; + overrides?: ethers.Overrides; + }): Promise { + const { ...tx } = transaction; + + if (tx.to == null && tx.from == null) { + throw new Error('withdrawal target address is undefined'); + } + + tx.to ??= tx.from; + tx.overrides ??= {}; + tx.overrides.from ??= tx.from; + + if (isETH(tx.token)) { + if (!tx.overrides.value) { + tx.overrides.value = tx.amount; + } + const passedValue = BigInt(tx.overrides.value); + + if (passedValue != BigInt(tx.amount)) { + // To avoid users shooting themselves into the foot, we will always use the amount to withdraw + // as the value + + throw new Error('The tx.value is not equal to the value withdrawn'); + } + + const ethL2Token = IEthToken__factory.connect(L2_ETH_TOKEN_ADDRESS, this); + return ethL2Token.withdraw.populateTransaction(tx.to, tx.overrides); + } + + if (tx.bridgeAddress == null) { + const bridges = await this.getDefaultBridgeAddresses(); + tx.bridgeAddress = bridges.erc20L2; + } + + const bridge = IL2Bridge__factory.connect(tx.bridgeAddress!, this); + return bridge.withdraw.populateTransaction(tx.to, tx.token, tx.amount, tx.overrides); + } + + async estimateGasWithdraw(transaction: { + token: Address; + amount: BigNumberish; + from?: Address; + to?: Address; + bridgeAddress?: Address; + overrides?: ethers.Overrides; + }): Promise { + const withdrawTx = await this.getWithdrawTx(transaction); + return await this.estimateGas(withdrawTx); + } + + async getTransferTx(transaction: { + to: Address; + amount: BigNumberish; + from?: Address; + token?: Address; + overrides?: ethers.Overrides; + }): Promise { + const { ...tx } = transaction; + tx.overrides ??= {}; + tx.overrides.from ??= tx.from; + + if (tx.token == null || tx.token == ETH_ADDRESS) { + return { + ...tx.overrides, + to: tx.to, + value: tx.amount + }; + } else { + const token = IERC20__factory.connect(tx.token, this); + return await token.transfer.populateTransaction(tx.to, tx.amount, tx.overrides); + } + } + + async estimateGasTransfer(transaction: { + to: Address; + amount: BigNumberish; + from?: Address; + token?: Address; + overrides?: ethers.Overrides; + }): Promise { + const transferTx = await this.getTransferTx(transaction); + return await this.estimateGas(transferTx); + } + + static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost) { + if (process.env.ZKSYNC_WEB3_API_URL) { + return new Provider(process.env.ZKSYNC_WEB3_API_URL); + } + switch (zksyncNetwork) { + case ZkSyncNetwork.Localhost: + return new Provider('http://localhost:3050'); + case ZkSyncNetwork.Goerli: + return new Provider('https://zksync2-testnet.zksync.dev'); + case ZkSyncNetwork.Mainnet: + return new Provider('https://zksync2-mainnet.zksync.io/'); + } + } + + async newFilter(filter: FilterByBlockHash | Filter): Promise { + const id = await this.send('eth_newFilter', [await this._getFilter(filter)]); + return BigInt(id); + } + + async newBlockFilter(): Promise { + const id = await this.send('eth_newBlockFilter', []); + return BigInt(id); + } + + async newPendingTransactionsFilter(): Promise { + const id = await this.send('eth_newPendingTransactionFilter', []); + return BigInt(id); + } + + async getFilterChanges(idx: bigint): Promise> { + const logs = await this.send('eth_getFilterChanges', [ethers.toBeHex(idx)]); + const network = await this.getNetwork(); + return typeof logs[0] === 'string' ? logs : logs.map((log: any) => this._wrapLog(log, network)); + } + + // This is inefficient. Status should probably be indicated in the transaction receipt. + async getTransactionStatus(txHash: string) { + const tx = await this.getTransaction(txHash); + if (tx == null) { + return TransactionStatus.NotFound; + } + if (tx.blockNumber == null) { + return TransactionStatus.Processing; + } + const verifiedBlock = await this.getBlock('finalized'); + if (tx.blockNumber <= verifiedBlock.number) { + return TransactionStatus.Finalized; + } + return TransactionStatus.Committed; + } + + override async broadcastTransaction(signedTx: string): Promise { + return (await super.broadcastTransaction(signedTx)) as TransactionResponse; + } + + async getL2TransactionFromPriorityOp(l1TxResponse: ethers.TransactionResponse): Promise { + const receipt = await l1TxResponse.wait(); + const l2Hash = getL2HashFromPriorityOp(receipt, await this.getMainContractAddress()); + + let status = null; + do { + status = await this.getTransactionStatus(l2Hash); + await sleep(this.pollingInterval); + } while (status == TransactionStatus.NotFound); + + return await this.getTransaction(l2Hash); + } + + async getPriorityOpResponse(l1TxResponse: ethers.TransactionResponse): Promise { + const l2Response = { ...l1TxResponse } as PriorityOpResponse; + + l2Response.waitL1Commit = l2Response.wait; + l2Response.wait = async () => { + const l2Tx = await this.getL2TransactionFromPriorityOp(l1TxResponse); + return await l2Tx.wait(); + }; + l2Response.waitFinalize = async () => { + const l2Tx = await this.getL2TransactionFromPriorityOp(l1TxResponse); + return await l2Tx.waitFinalize(); + }; + + return l2Response; + } + + async getContractAccountInfo(address: Address): Promise { + const deployerContract = new Contract(CONTRACT_DEPLOYER_ADDRESS, CONTRACT_DEPLOYER.fragments, this); + const data = await deployerContract.getAccountInfo(address); + + return { + supportedAAVersion: data.supportedAAVersion, + nonceOrdering: data.nonceOrdering + }; + } + + // TODO (EVM-3): support refundRecipient for fee estimation + async estimateL1ToL2Execute(transaction: { + contractAddress: Address; + calldata: string; + caller?: Address; + l2Value?: BigNumberish; + factoryDeps?: ethers.BytesLike[]; + gasPerPubdataByte?: BigNumberish; + overrides?: ethers.Overrides; + }): Promise { + transaction.gasPerPubdataByte ??= REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT; + + // If the `from` address is not provided, we use a random address, because + // due to storage slot aggregation, the gas estimation will depend on the address + // and so estimation for the zero address may be smaller than for the sender. + transaction.caller ??= ethers.Wallet.createRandom().address; + + const customData = { + gasPerPubdata: transaction.gasPerPubdataByte + }; + if (transaction.factoryDeps) { + Object.assign(customData, { factoryDeps: transaction.factoryDeps }); + } + + return await this.estimateGasL1({ + from: transaction.caller, + data: transaction.calldata, + to: transaction.contractAddress, + value: transaction.l2Value, + customData + }); + } + + override getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest { + const result: any = super.getRpcTransaction(tx); + if (tx.customData == null) { + return result; + } + result.eip712Meta = { + gasPerPubdata: ethers.toBeHex(tx.customData.gasPerPubdata ?? 0) + } as any; + if (tx.customData.factoryDeps) { + result.eip712Meta.factoryDeps = tx.customData.factoryDeps.map((dep: ethers.BytesLike) => + // TODO (SMA-1605): we arraify instead of hexlifying because server expects Vec. + // We should change deserialization there. + Array.from(ethers.getBytes(dep)) + ); + } + if (tx.customData.paymasterParams) { + // @ts-ignore + result.eip712Meta.paymasterParams = { + paymaster: ethers.hexlify(tx.customData.paymasterParams.paymaster), + paymasterInput: Array.from(ethers.getBytes(tx.customData.paymasterParams.paymasterInput)) + }; + } + return result; + } +} + +export class BrowserProvider extends Provider { + #request: (method: string, params: Array | Record) => Promise; + + constructor(ethereum: Eip1193Provider, network?: Networkish) { + super(null, network, { batchMaxCount: 1 }); + + this.#request = async (method: string, params: Array | Record) => { + const payload = { method, params }; + this.emit('debug', { action: 'sendEip1193Request', payload }); + try { + const result = await ethereum.request(payload); + this.emit('debug', { action: 'receiveEip1193Result', result }); + return result; + } catch (e: any) { + const error = new Error(e.message); + (error).code = e.code; + (error).data = e.data; + (error).payload = payload; + this.emit('debug', { action: 'receiveEip1193Error', error }); + throw error; + } + }; + } + + // @ts-ignore + override async _send( + payload: JsonRpcPayload | Array + ): Promise> { + ethers.assertArgument(!Array.isArray(payload), 'EIP-1193 does not support batch request', 'payload', payload); + + try { + const result = await this.#request(payload.method, payload.params || []); + return [{ id: payload.id, result }]; + } catch (e: any) { + return [ + { + id: payload.id, + error: { code: e.code, data: e.data, message: e.message } + } + ]; + } + } + + override getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error { + error = JSON.parse(JSON.stringify(error)); + + // EIP-1193 gives us some machine-readable error codes, so rewrite them + switch (error.error.code || -1) { + case 4001: + error.error.message = `ethers-user-denied: ${error.error.message}`; + break; + case 4200: + error.error.message = `ethers-unsupported: ${error.error.message}`; + break; + } + + return super.getRpcError(payload, error); + } + + async hasSigner(address: number | string): Promise { + if (address == null) { + address = 0; + } + + const accounts = await this.send('eth_accounts', []); + if (typeof address === 'number') { + return accounts.length > address; + } + + address = address.toLowerCase(); + return accounts.filter((a: string) => a.toLowerCase() === address).length !== 0; + } + + override async getSigner(address?: number | string): Promise { + if (address == null) { + address = 0; + } + + if (!(await this.hasSigner(address))) { + try { + await this.#request('eth_requestAccounts', []); + } catch (error: any) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + + return Signer.from((await super.getSigner(address)) as any); + } + + override async estimateGas(transaction: TransactionRequest) { + const gas = await super.estimateGas(transaction); + const metamaskMinimum = 21000n; + const isEIP712 = transaction.customData != null || transaction.type == EIP712_TX_TYPE; + return gas > metamaskMinimum || isEIP712 ? gas : metamaskMinimum; + } +} diff --git a/src/signer.ts b/src/signer.ts new file mode 100644 index 0000000..e8b3209 --- /dev/null +++ b/src/signer.ts @@ -0,0 +1,251 @@ +import {ethers} from 'ethers'; +import {Provider} from './provider'; +import {DEFAULT_GAS_PER_PUBDATA_LIMIT, EIP712_TX_TYPE, hashBytecode, serializeEip712} from './utils'; +import {Signature, TransactionLike, TransactionRequest, TransactionResponse} from './types'; +import {AdapterL1, AdapterL2} from './adapters'; + +export const eip712Types = { + Transaction: [ + { name: 'txType', type: 'uint256' }, + { name: 'from', type: 'uint256' }, + { name: 'to', type: 'uint256' }, + { name: 'gasLimit', type: 'uint256' }, + { name: 'gasPerPubdataByteLimit', type: 'uint256' }, + { name: 'maxFeePerGas', type: 'uint256' }, + { name: 'maxPriorityFeePerGas', type: 'uint256' }, + { name: 'paymaster', type: 'uint256' }, + { name: 'nonce', type: 'uint256' }, + { name: 'value', type: 'uint256' }, + { name: 'data', type: 'bytes' }, + { name: 'factoryDeps', type: 'bytes32[]' }, + { name: 'paymasterInput', type: 'bytes' } + ] +}; + +export class EIP712Signer { + private eip712Domain: Promise; + constructor(private ethSigner: ethers.Signer, chainId: number | Promise) { + this.eip712Domain = Promise.resolve(chainId).then((chainId) => ({ + name: 'zkSync', + version: '2', + chainId + })); + } + + static getSignInput(transaction: TransactionRequest) { + const maxFeePerGas = transaction.maxFeePerGas || transaction.gasPrice; + const maxPriorityFeePerGas = transaction.maxPriorityFeePerGas || maxFeePerGas; + const gasPerPubdataByteLimit = transaction.customData?.gasPerPubdata || DEFAULT_GAS_PER_PUBDATA_LIMIT; + return { + txType: transaction.type, + from: transaction.from, + to: transaction.to, + gasLimit: transaction.gasLimit, + gasPerPubdataByteLimit: gasPerPubdataByteLimit, + maxFeePerGas, + maxPriorityFeePerGas, + paymaster: transaction.customData?.paymasterParams?.paymaster || ethers.ZeroAddress, + nonce: transaction.nonce, + value: transaction.value, + data: transaction.data, + factoryDeps: transaction.customData?.factoryDeps?.map((dep: any) => hashBytecode(dep)) || [], + paymasterInput: transaction.customData?.paymasterParams?.paymasterInput || '0x' + }; + } + + async sign(transaction: TransactionRequest): Promise { + return await this.ethSigner.signTypedData( + await this.eip712Domain, + eip712Types, + EIP712Signer.getSignInput(transaction) + ); + } + + static getSignedDigest(transaction: TransactionRequest): ethers.BytesLike { + if (!transaction.chainId) { + throw Error("Transaction chainId isn't set"); + } + const domain = { + name: 'zkSync', + version: '2', + chainId: transaction.chainId + }; + return ethers.TypedDataEncoder.hash(domain, eip712Types, EIP712Signer.getSignInput(transaction)); + } +} + +// This class is to be used on the frontend, with metamask injection. +// It only contains L2 operations. For L1 operations, see L1Signer. +// Sample usage: +// const provider = new BrowserProvider(window.ethereum); +// const signer = provider.getSigner(); +// const tx = await signer.sendTransaction({ ... }); +export class Signer extends AdapterL2(ethers.JsonRpcSigner) { + public override provider: Provider; + public eip712: EIP712Signer; + + override _signerL2() { + return this; + } + + override _providerL2() { + return this.provider; + } + + static from(signer: ethers.JsonRpcSigner & { provider: Provider }): Signer { + const newSigner: Signer = Object.setPrototypeOf(signer, Signer.prototype); + // @ts-ignore + newSigner.eip712 = new EIP712Signer(newSigner, newSigner.getChainId()); + return newSigner; + } + + override async sendTransaction(transaction: TransactionRequest): Promise { + if (transaction.customData == null && transaction.type == null) { + // use legacy txs by default + transaction.type = 0; + } + if (transaction.customData == null && transaction.type != EIP712_TX_TYPE) { + return (await super.sendTransaction(transaction)) as TransactionResponse; + } else { + const address = await this.getAddress(); + const from = await ethers.resolveAddress(transaction.from); + if (from.toLowerCase() != address.toLowerCase()) { + throw new Error('Transaction `from` address mismatch'); + } + const tx: TransactionLike = { + type: transaction.type ?? EIP712_TX_TYPE, + value: transaction.value ?? 0, + data: transaction.data ?? '0x', + nonce: transaction.nonce ?? (await this.getNonce()), + gasPrice: transaction.gasPrice ?? (await this.provider.getGasPrice()), + gasLimit: transaction.gasLimit ?? (await this.provider.estimateGas(transaction)), + chainId: transaction.chainId ?? (await this.provider.getNetwork()).chainId, + to: await ethers.resolveAddress(transaction.to), + customData: this._fillCustomData(transaction.customData), + from + }; + tx.customData.customSignature = await this.eip712.sign(tx); + + const txBytes = serializeEip712(tx); + return await this.provider.broadcastTransaction(txBytes); + } + } +} + +// This class is to be used on the frontend with metamask injection. +// It only contains L1 operations. For L2 operations, see Signer. +// Sample usage: +// const ethProvider = new ethers.BrowserProvider(window.ethereum); +// const provider = new Provider(''); +// const signer = L1Signer.from(ethProvider.getSigner(), provider); +// const tx = await signer.deposit({ ... }); +export class L1Signer extends AdapterL1(ethers.JsonRpcSigner) { + public providerL2: Provider; + override _providerL2() { + return this.providerL2; + } + + override _providerL1() { + return this.provider; + } + + override _signerL1() { + return this; + } + + static from(signer: ethers.JsonRpcSigner, zksyncProvider: Provider): L1Signer { + const newSigner: L1Signer = Object.setPrototypeOf(signer, L1Signer.prototype); + newSigner.providerL2 = zksyncProvider; + return newSigner; + } + + connectToL2(provider: Provider): this { + this.providerL2 = provider; + return this; + } +} + +export class L2VoidSigner extends AdapterL2(ethers.VoidSigner) { + public override provider: Provider; + public eip712: EIP712Signer; + + override _signerL2() { + return this; + } + + override _providerL2() { + return this.provider; + } + + static from(signer: ethers.VoidSigner & { provider: Provider }): L2VoidSigner { + const newSigner: L2VoidSigner = Object.setPrototypeOf(signer, L2VoidSigner.prototype); + // @ts-ignore + newSigner.eip712 = new EIP712Signer(newSigner, newSigner.getChainId()); + return newSigner; + } + + override async sendTransaction(transaction: TransactionRequest): Promise { + if (transaction.customData == null && transaction.type == null) { + // use legacy txs by default + transaction.type = 0; + } + if (transaction.customData == null && transaction.type != EIP712_TX_TYPE) { + return (await super.sendTransaction(transaction)) as TransactionResponse; + } else { + const address = await this.getAddress(); + const from = await ethers.resolveAddress(transaction.from); + if (from.toLowerCase() != address.toLowerCase()) { + throw new Error('Transaction `from` address mismatch'); + } + const tx: TransactionLike = { + type: transaction.type ?? EIP712_TX_TYPE, + value: transaction.value ?? 0, + data: transaction.data ?? '0x', + nonce: transaction.nonce ?? (await this.getNonce()), + gasPrice: transaction.gasPrice ?? (await this.provider.getGasPrice()), + gasLimit: transaction.gasLimit ?? (await this.provider.estimateGas(transaction)), + chainId: transaction.chainId ?? (await this.provider.getNetwork()).chainId, + to: await ethers.resolveAddress(transaction.to), + customData: this._fillCustomData(transaction.customData), + from + }; + tx.customData.customSignature = await this.eip712.sign(tx); + + const txBytes = serializeEip712(tx); + return await this.provider.broadcastTransaction(txBytes); + } + } +} + +// This class is to be used on the frontend with metamask injection. +// It only contains L1 operations. For L2 operations, see Signer. +// Sample usage: +// const ethProvider = new ethers.BrowserProvider(window.ethereum); +// const provider = new Provider(''); +// const signer = L1Signer.from(provider.getSigner(), zksyncProvider); +// const tx = await signer.deposit({ ... }); +export class L1VoidSigner extends AdapterL1(ethers.VoidSigner) { + public providerL2: Provider; + override _providerL2() { + return this.providerL2; + } + + override _providerL1() { + return this.provider; + } + + override _signerL1() { + return this; + } + + static from(signer: ethers.VoidSigner, zksyncProvider: Provider): L1VoidSigner { + const newSigner: L1VoidSigner = Object.setPrototypeOf(signer, L1VoidSigner.prototype); + newSigner.providerL2 = zksyncProvider; + return newSigner; + } + + connectToL2(provider: Provider): this { + this.providerL2 = provider; + return this; + } +} \ No newline at end of file diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..8fbf426 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,395 @@ +import { BytesLike, BigNumberish, ethers, TransactionRequest as EthersTransactionRequest } from 'ethers'; +import {serializeEip712, EIP712_TX_TYPE, parseEip712, sleep} from './utils'; + +// 0x-prefixed, hex encoded, ethereum account address +export type Address = string; +// 0x-prefixed, hex encoded, ECDSA signature. +export type Signature = string; + +// Ethereum network +export enum Network { + Mainnet = 1, + Ropsten = 3, + Rinkeby = 4, + Goerli = 5, + Localhost = 9 +} + +export enum PriorityQueueType { + Deque = 0, + HeapBuffer = 1, + Heap = 2 +} + +export enum PriorityOpTree { + Full = 0, + Rollup = 1 +} + +export enum TransactionStatus { + NotFound = 'not-found', + Processing = 'processing', + Committed = 'committed', + Finalized = 'finalized' +} + +export type PaymasterParams = { + paymaster: Address; + paymasterInput: BytesLike; +}; + +export type Eip712Meta = { + gasPerPubdata?: BigNumberish; + factoryDeps?: BytesLike[]; + customSignature?: BytesLike; + paymasterParams?: PaymasterParams; +}; + +export type BlockTag = + | BigNumberish + | string // block hash + | 'committed' + | 'finalized' + | 'latest' + | 'earliest' + | 'pending'; + +// TODO (SMA-1585): Support create2 variants. +export type DeploymentType = 'create' | 'createAccount'; + +export interface Token { + l1Address: Address; + l2Address: Address; + name: string; + symbol: string; + decimals: number; +} + +export interface Fee { + readonly gasLimit: bigint; + readonly gasPerPubdataLimit: bigint; + readonly maxPriorityFeePerGas: bigint; + readonly maxFeePerGas: bigint; + +} + +export interface MessageProof { + id: number; + proof: string[]; + root: string; +} + +export class TransactionResponse extends ethers.TransactionResponse { + readonly l1BatchNumber: null | number; + readonly l1BatchTxIndex: null | number; + + constructor(params: any, provider: ethers.Provider) { + super(params, provider); + this.l1BatchNumber = params.l1BatchNumber; + this.l1BatchTxIndex = params.l1BatchTxIndex; + } + + override async wait(confirmations?: number): Promise { + return (await super.wait(confirmations)) as TransactionReceipt; + } + + override async getTransaction(): Promise { + return (await super.getTransaction()) as TransactionResponse; + } + + override replaceableTransaction(startBlock: number): TransactionResponse { + return new TransactionResponse(super.replaceableTransaction(startBlock), this.provider); + } + + override async getBlock(): Promise { + return (await super.getBlock()) as Block; + } + + async waitFinalize(): Promise { + while (true) { + const receipt = await this.wait(); + const block = await this.provider.getBlock('finalized'); + if (receipt.blockNumber && receipt.blockNumber <= block!.number) { + return (await this.provider.getTransactionReceipt(receipt.hash)) as TransactionReceipt; + } else { + await sleep(500); + } + } + } + + override toJSON(): any { + const { l1BatchNumber, l1BatchTxIndex } = this; + + return { + ...super.toJSON(), + l1BatchNumber, + l1BatchTxIndex + }; + } +} + +export class TransactionReceipt extends ethers.TransactionReceipt { + readonly l1BatchNumber: null | number; + readonly l1BatchTxIndex: null | number; + readonly l2ToL1Logs: L2ToL1Log[]; + readonly _logs: ReadonlyArray; + + constructor(params: any, provider: ethers.Provider) { + super(params, provider); + this.l1BatchNumber = params.l1BatchNumber; + this.l1BatchTxIndex = params.l1BatchTxIndex; + this.l2ToL1Logs = params.l2ToL1Logs; + this._logs = Object.freeze(params.logs.map((log) => { + return new Log(log, provider); + })); + } + + override get logs(): ReadonlyArray { + return this._logs; + } + + override getBlock(): Promise { + return super.getBlock() as Promise; + } + + override getTransaction(): Promise { + return super.getTransaction() as Promise; + } + + override toJSON(): any { + const { l1BatchNumber, l1BatchTxIndex, l2ToL1Logs } = this; + return { + ...super.toJSON(), + l1BatchNumber, + l1BatchTxIndex, + l2ToL1Logs + }; + } +} + +export class Block extends ethers.Block { + readonly l1BatchNumber: null | number; + readonly l1BatchTimestamp: null | number; + + constructor(params: any, provider: ethers.Provider) { + super(params, provider); + this.l1BatchNumber = params.l1BatchNumber; + this.l1BatchTimestamp = params.l1BatchTxIndex; + } + + override toJSON(): any { + const { l1BatchNumber, l1BatchTimestamp: l1BatchTxIndex } = this; + return { + ...super.toJSON(), + l1BatchNumber, + l1BatchTxIndex + }; + } + + override get prefetchedTransactions(): TransactionResponse[] { + return super.prefetchedTransactions as TransactionResponse[]; + } + + override getTransaction(indexOrHash: number | string): Promise { + return super.getTransaction(indexOrHash) as Promise; + } +} + +export class Log extends ethers.Log { + readonly l1BatchNumber: null | number; + + constructor(params: any, provider: ethers.Provider) { + super(params, provider); + this.l1BatchNumber = params.l1BatchNumber; + } + + override toJSON(): any { + const { l1BatchNumber } = this; + return { + ...super.toJSON(), + l1BatchNumber + }; + } + + override async getBlock(): Promise { + return (await super.getBlock()) as Block; + } + + override async getTransaction(): Promise { + return (await super.getTransaction()) as TransactionResponse; + } + + override async getTransactionReceipt(): Promise { + return (await super.getTransactionReceipt()) as TransactionReceipt; + } +} + +export interface TransactionLike extends ethers.TransactionLike { + customData?: null | Eip712Meta; +} + +export class Transaction extends ethers.Transaction { + customData: null | Eip712Meta; + + static override from(value: string | TransactionLike): Transaction { + if (typeof value === 'string') { + const payload = ethers.getBytes(value); + if (payload[0] !== EIP712_TX_TYPE) { + return Transaction.from(ethers.Transaction.from(value)); + } else { + return Transaction.from(parseEip712(payload)); + } + } else { + const tx = ethers.Transaction.from(value) as Transaction; + tx.customData = value?.customData ?? null; + return tx; + } + } + + override get serialized(): string { + if (this.customData == null && this.type != EIP712_TX_TYPE) { + return super.serialized; + } + return serializeEip712(this, this.signature); + } + + override get unsignedSerialized(): string { + if (this.customData == null && this.type != EIP712_TX_TYPE) { + return super.unsignedSerialized; + } + return serializeEip712(this); + } + + override toJSON(): any { + const { customData } = this; + return { + ...super.toJSON(), + customData + }; + } + + override get typeName(): string { + if (this.type === EIP712_TX_TYPE) { + return 'zksync'; + } else { + return super.typeName; + } + } +} + +export interface L2ToL1Log { + blockNumber: number; + blockHash: string; + l1BatchNumber: number; + transactionIndex: number; + shardId: number; + isService: boolean; + sender: string; + key: string; + value: string; + transactionHash: string; + logIndex: number; +} + +export interface TransactionRequest extends EthersTransactionRequest { + customData?: Eip712Meta; +} + +export interface PriorityOpResponse extends TransactionResponse { + waitL1Commit(confirmation?: number): Promise; +} + +export type BalancesMap = { [key: string]: bigint }; + +export interface DeploymentInfo { + sender: Address; + bytecodeHash: string; + deployedAddress: Address; +} + +export interface ApprovalBasedPaymasterInput { + type: 'ApprovalBased'; + token: Address; + minimalAllowance: BigNumberish; + innerInput: BytesLike; +} + +export interface GeneralPaymasterInput { + type: 'General'; + innerInput: BytesLike; +} + +export interface EthereumSignature { + v: number; + r: BytesLike; + s: BytesLike; +} + +export type PaymasterInput = ApprovalBasedPaymasterInput | GeneralPaymasterInput; + +export enum AccountAbstractionVersion { + None = 0, + Version1 = 1 +} + +export enum AccountNonceOrdering { + Sequential = 0, + Arbitrary = 1 +} + +export interface ContractAccountInfo { + supportedAAVersion: AccountAbstractionVersion; + nonceOrdering: AccountNonceOrdering; +} + +export interface BatchDetails { + number: number; + timestamp: number; + l1TxCount: number; + l2TxCount: number; + rootHash?: string; + status: string; + commitTxHash?: string; + committedAt?: Date; + proveTxHash?: string; + provenAt?: Date; + executeTxHash?: string; + executedAt?: Date; + l1GasPrice: number; + l2FairGasPrice: number; +} + +export interface BlockDetails { + number: number; + timestamp: number; + l1TxCount: number; + l2TxCount: number; + rootHash?: string; + status: string; + commitTxHash?: string; + committedAt?: Date; + proveTxHash?: string; + provenAt?: Date; + executeTxHash?: string; + executedAt?: Date; +} + +export interface TransactionDetails { + isL1Originated: boolean; + status: string; + fee: BigNumberish; + initiatorAddress: Address; + receivedAt: Date; + ethCommitTxHash?: string; + ethProveTxHash?: string; + ethExecuteTxHash?: string; +} + +export interface FullDepositFee { + maxFeePerGas?: BigInt; + maxPriorityFeePerGas?: BigInt; + gasPrice?: BigInt; + baseCost: BigInt; + l1GasLimit: BigInt; + l2GasLimit: BigInt; +} \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..3e6b83e --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,556 @@ +import {AbiCoder, BigNumberish, BytesLike, ethers, SignatureLike} from 'ethers'; +import { + Address, + DeploymentInfo, + Eip712Meta, + EthereumSignature, + PaymasterParams, + PriorityOpTree, + PriorityQueueType, + TransactionLike +} from './types'; +import {Provider} from './provider'; +import {EIP712Signer} from './signer'; +import {IERC20__factory} from '../typechain'; + +export * from './paymaster-utils'; + +export const ETH_ADDRESS = '0x0000000000000000000000000000000000000000'; + +export const ZKSYNC_MAIN_ABI = new ethers.Interface(require('../abi/IZkSync.json').abi); +export const CONTRACT_DEPLOYER = new ethers.Interface(require('../abi/ContractDeployer.json').abi); +export const L1_MESSENGER = new ethers.Interface(require('../abi/IL1Messenger.json').abi); +export const IERC20 = new ethers.Interface(require('../abi/IERC20.json').abi); +export const IERC1271 = new ethers.Interface(require('../abi/IERC1271.json').abi); +export const L1_BRIDGE_ABI = new ethers.Interface(require('../abi/IL1Bridge.json').abi); +export const L2_BRIDGE_ABI = new ethers.Interface(require('../abi/IL2Bridge.json').abi); + +export const BOOTLOADER_FORMAL_ADDRESS = '0x0000000000000000000000000000000000008001'; +export const CONTRACT_DEPLOYER_ADDRESS = '0x0000000000000000000000000000000000008006'; +export const L1_MESSENGER_ADDRESS = '0x0000000000000000000000000000000000008008'; +export const L2_ETH_TOKEN_ADDRESS = '0x000000000000000000000000000000000000800a'; + +export const L1_TO_L2_ALIAS_OFFSET = '0x1111000000000000000000000000000000001111'; + +export const EIP1271_MAGIC_VALUE = '0x1626ba7e'; + +export const EIP712_TX_TYPE = 0x71; +export const PRIORITY_OPERATION_L2_TX_TYPE = 0xff; + +export const MAX_BYTECODE_LEN_BYTES = ((1 << 16) - 1) * 32; + +// Currently, for some reason the SDK may return slightly smaller L1 gas limit than required for initiating L1->L2 +// transaction. We use a coefficient to ensure that the transaction will be accepted. +export const L1_FEE_ESTIMATION_COEF_NUMERATOR = 12; +export const L1_FEE_ESTIMATION_COEF_DENOMINATOR = 10; + +// This gas limit will be used for displaying the error messages when the users do not have enough fee. +export const L1_RECOMMENDED_MIN_ERC20_DEPOSIT_GAS_LIMIT = 400_000; +export const L1_RECOMMENDED_MIN_ETH_DEPOSIT_GAS_LIMIT = 200_000; + +// The large L2 gas per pubdata to sign. This gas is enough to ensure that +// any reasonable limit will be accepted. Note, that the operator is NOT required to +// use the honest value of gas per pubdata, and it can use any value up to the one signed by the user. +// In the future releases, we will provide a way to estimate the current gasPerPubdata. +export const DEFAULT_GAS_PER_PUBDATA_LIMIT = 50_000; + +// It is possible to provide practically any gasPerPubdataByte for L1->L2 transactions, since +// the cost per gas will be adjusted respectively. We will use 800 as a relatively optimal value for now. +export const REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_LIMIT = 800; + +export function isETH(token: Address) { + return token.toLowerCase() == ETH_ADDRESS || token.toLowerCase() == L2_ETH_TOKEN_ADDRESS; +} + +export function sleep(millis: number) { + return new Promise((resolve) => setTimeout(resolve, millis)); +} + +export function layer1TxDefaults() { + return { + queueType: PriorityQueueType.Deque, + opTree: PriorityOpTree.Full + }; +} + +export function getHashedL2ToL1Msg(sender: Address, msg: BytesLike, txNumberInBlock: number) { + const encodedMsg = new Uint8Array([ + 0, // l2ShardId + 1, // isService + ...ethers.getBytes(ethers.zeroPadBytes(ethers.toBeHex(txNumberInBlock), 2)), + ...ethers.getBytes(L1_MESSENGER_ADDRESS), + ...ethers.getBytes(ethers.zeroPadBytes(sender, 32)), + ...ethers.getBytes(ethers.keccak256(msg)) + ]); + + return ethers.keccak256(encodedMsg); +} + +export function getDeployedContracts(receipt: ethers.TransactionReceipt): DeploymentInfo[] { + const addressBytesLen = 40; + return receipt.logs + .filter( + (log) => + log.topics[0] == ethers.id('ContractDeployed(address,bytes32,address)') && + log.address == CONTRACT_DEPLOYER_ADDRESS + ) + // Take the last topic (deployed contract address as U256) and extract address from it (U160). + .map((log) => { + const sender = `0x${log.topics[1].slice(log.topics[1].length - addressBytesLen)}`; + const bytesCodehash = log.topics[2]; + const address = `0x${log.topics[3].slice(log.topics[3].length - addressBytesLen)}`; + return { + sender: ethers.getAddress(sender), + bytecodeHash: bytesCodehash, + deployedAddress: ethers.getAddress(address) + }; + }); +} + +export function create2Address(sender: Address, bytecodeHash: BytesLike, salt: BytesLike, input: BytesLike) { + const prefix = ethers.keccak256(ethers.toUtf8Bytes('zksyncCreate2')); + const inputHash = ethers.keccak256(input); + const addressBytes = ethers + .keccak256(ethers.concat([prefix, ethers.zeroPadBytes(sender, 32), salt, bytecodeHash, inputHash])) + .slice(26); + return ethers.getAddress(addressBytes); +} + +export function createAddress(sender: Address, senderNonce: BigNumberish) { + const prefix = ethers.keccak256(ethers.toUtf8Bytes('zksyncCreate')); + const addressBytes = ethers + .keccak256( + ethers.concat([ + prefix, + ethers.zeroPadBytes(sender, 32), + ethers.zeroPadBytes(ethers.toBeHex(senderNonce), 32) + ]) + ) + .slice(26); + + return ethers.getAddress(addressBytes); +} + +export async function checkBaseCost( + baseCost: ethers.BigNumberish, + value: ethers.BigNumberish | Promise +) { + if (baseCost > (await value)) { + throw new Error( + `The base cost of performing the priority operation is higher than the provided value parameter ` + + `for the transaction: baseCost: ${baseCost}, provided value: ${value}` + ); + } +} + +export function serializeEip712(transaction: TransactionLike, signature?: ethers.SignatureLike) { + if (!transaction.chainId) { + throw Error("Transaction chainId isn't set"); + } + + if (!transaction.from) { + throw new Error('Explicitly providing `from` field is reqiured for EIP712 transactions'); + } + const from = transaction.from; + + const meta: Eip712Meta = transaction.customData; + + let maxFeePerGas = transaction.maxFeePerGas || transaction.gasPrice || 0; + let maxPriorityFeePerGas = transaction.maxPriorityFeePerGas || maxFeePerGas; + + const fields: any[] = [ + ethers.toBeArray(transaction.nonce || 0), + ethers.toBeArray(maxPriorityFeePerGas), + ethers.toBeArray(maxFeePerGas), + ethers.toBeArray(transaction.gasLimit || 0), + transaction.to != null ? ethers.getAddress(transaction.to) : '0x', + ethers.toBeArray(transaction.value || 0), + transaction.data || '0x' + ]; + + if (signature) { + const sig = ethers.Signature.from(signature); + fields.push(sig.yParity); + fields.push(ethers.toBeArray(sig.r)); + fields.push(ethers.toBeArray(sig.s)); + } else { + fields.push(ethers.toBeArray(transaction.chainId)); + fields.push('0x'); + fields.push('0x'); + } + fields.push(ethers.toBeArray(transaction.chainId)); + fields.push(ethers.getAddress(from)); + + // Add meta + fields.push(ethers.toBeArray(meta.gasPerPubdata || DEFAULT_GAS_PER_PUBDATA_LIMIT)); + fields.push((meta.factoryDeps ?? []).map((dep) => ethers.hexlify(dep))); + + if (meta.customSignature && ethers.getBytes(meta.customSignature).length == 0) { + throw new Error('Empty signatures are not supported'); + } + fields.push(meta.customSignature || '0x'); + + if (meta.paymasterParams) { + fields.push([meta.paymasterParams.paymaster, ethers.hexlify(meta.paymasterParams.paymasterInput)]); + } else { + fields.push([]); + } + + return ethers.concat([new Uint8Array([EIP712_TX_TYPE]), ethers.encodeRlp(fields)]); +} + +export function hashBytecode(bytecode: ethers.BytesLike): Uint8Array { + // For getting the consistent length we first convert the bytecode to UInt8Array + const bytecodeAsArray = ethers.getBytes(bytecode); + + if (bytecodeAsArray.length % 32 != 0) { + throw new Error('The bytecode length in bytes must be divisible by 32'); + } + + if (bytecodeAsArray.length > MAX_BYTECODE_LEN_BYTES) { + throw new Error(`Bytecode can not be longer than ${MAX_BYTECODE_LEN_BYTES} bytes`); + } + + const hashStr = ethers.sha256(bytecodeAsArray); + const hash = ethers.getBytes(hashStr); + + // Note that the length of the bytecode + // should be provided in 32-byte words. + const bytecodeLengthInWords = bytecodeAsArray.length / 32; + if (bytecodeLengthInWords % 2 == 0) { + throw new Error('Bytecode length in 32-byte words must be odd'); + } + + const bytecodeLength = ethers.toBeArray(bytecodeLengthInWords); + + // The bytecode should always take the first 2 bytes of the bytecode hash, + // so we pad it from the left in case the length is smaller than 2 bytes. + const bytecodeLengthPadded = ethers.getBytes(ethers.zeroPadBytes(bytecodeLength, 2)); + + const codeHashVersion = new Uint8Array([1, 0]); + hash.set(codeHashVersion, 0); + hash.set(bytecodeLengthPadded, 2); + + return hash; +} + +// TODO: extend ethers.Transaction and add custom fields +export function parseEip712(payload: ethers.BytesLike): TransactionLike { + function handleAddress(value: string): string { + if (value === '0x') { + return null; + } + return ethers.getAddress(value); + } + + function handleNumber(value: string): bigint { + if (value === '0x') { + return 0n; + } + return BigInt(value); + } + + function arrayToPaymasterParams(arr: string[]): PaymasterParams | undefined { + if (arr.length == 0) { + return undefined; + } + if (arr.length != 2) { + throw new Error(`Invalid paymaster parameters, expected to have length of 2, found ${arr.length}`); + } + + return { + paymaster: ethers.getAddress(arr[0]), + paymasterInput: ethers.getBytes(arr[1]) + }; + } + + const bytes = ethers.getBytes(payload); + const raw = ethers.decodeRlp(bytes.slice(1)) as string[]; + const transaction: TransactionLike = { + type: EIP712_TX_TYPE, + nonce: Number(handleNumber(raw[0])), + maxPriorityFeePerGas: handleNumber(raw[1]), + maxFeePerGas: handleNumber(raw[2]), + gasLimit: handleNumber(raw[3]), + to: handleAddress(raw[4]), + value: handleNumber(raw[5]), + data: raw[6], + chainId: handleNumber(raw[10]), + from: handleAddress(raw[11]), + customData: { + gasPerPubdata: handleNumber(raw[12]), + factoryDeps: raw[13] as unknown as string[], + customSignature: raw[14], + // @ts-ignore + paymasterParams: arrayToPaymasterParams(raw[15]) + } + }; + + const ethSignature = { + v: Number(handleNumber(raw[7])), + r: raw[8], + s: raw[9] + }; + + if ( + (ethers.hexlify(ethSignature.r) == '0x' || ethers.hexlify(ethSignature.s) == '0x') && + !transaction.customData.customSignature + ) { + return transaction; + } + + if (ethSignature.v !== 0 && ethSignature.v !== 1 && !transaction.customData.customSignature) { + throw new Error('Failed to parse signature'); + } + + if (!transaction.customData.customSignature) { + transaction.signature = ethers.Signature.from(ethSignature); + } + + transaction.hash = eip712TxHash(transaction, ethSignature); + + return transaction; +} + +function getSignature(transaction: any, ethSignature?: EthereumSignature): Uint8Array { + if (transaction?.customData?.customSignature && transaction.customData.customSignature.length) { + return ethers.getBytes(transaction.customData.customSignature); + } + + if (!ethSignature) { + throw new Error('No signature provided'); + } + + const r = ethers.getBytes(ethers.zeroPadBytes(ethSignature.r, 32)); + const s = ethers.getBytes(ethers.zeroPadBytes(ethSignature.s, 32)); + const v = ethSignature.v; + + return new Uint8Array([...r, ...s, v]); +} + +function eip712TxHash(transaction: any, ethSignature?: EthereumSignature) { + const signedDigest = EIP712Signer.getSignedDigest(transaction); + const hashedSignature = ethers.keccak256(getSignature(transaction, ethSignature)); + + return ethers.keccak256(ethers.concat([signedDigest, hashedSignature])); +} + +export function getL2HashFromPriorityOp(txReceipt: ethers.TransactionReceipt, zkSyncAddress: Address): string { + let txHash: string = null; + for (const log of txReceipt.logs) { + if (log.address.toLowerCase() != zkSyncAddress.toLowerCase()) { + continue; + } + + try { + const priorityQueueLog = ZKSYNC_MAIN_ABI.parseLog({ + topics: log.topics as string[], + data: log.data + }); + if (priorityQueueLog && priorityQueueLog.args.txHash != null) { + txHash = priorityQueueLog.args.txHash; + } + } catch { + } + } + if (!txHash) { + throw new Error('Failed to parse tx logs'); + } + + return txHash; +} + +const ADDRESS_MODULO = 2n ** 160n; + +export function applyL1ToL2Alias(address: string): string { + return ethers.hexlify(ethers.toBeHex((BigInt(address) + BigInt(L1_TO_L2_ALIAS_OFFSET)) % ADDRESS_MODULO)); +} + +export function undoL1ToL2Alias(address: string): string { + let result = BigInt(address) - BigInt(L1_TO_L2_ALIAS_OFFSET); + if (result < 0n) { + result += ADDRESS_MODULO; + } + return ethers.hexlify(ethers.toBeHex(result)); +} + +/// Getters data used to correctly initialize the L1 token counterpart on L2 +export async function getERC20DefaultBridgeData( + l1TokenAddress: string, + provider: ethers.Provider +): Promise { + const token = IERC20__factory.connect(l1TokenAddress, provider); + + const name = await token.name(); + const symbol = await token.symbol(); + const decimals = await token.decimals(); + + const coder = new AbiCoder(); + + const nameBytes = coder.encode(['string'], [name]); + const symbolBytes = coder.encode(['string'], [symbol]); + const decimalsBytes = coder.encode(['uint256'], [decimals]); + + return coder.encode(['bytes', 'bytes', 'bytes'], [nameBytes, symbolBytes, decimalsBytes]); +} + +/// The method that returns the calldata that will be sent by an L1 ERC20 bridge to its L2 counterpart +/// during bridging of a token. +export async function getERC20BridgeCalldata( + l1TokenAddress: string, + l1Sender: string, + l2Receiver: string, + amount: BigNumberish, + bridgeData: BytesLike +): Promise { + return L2_BRIDGE_ABI.encodeFunctionData('finalizeDeposit', [ + l1Sender, + l2Receiver, + l1TokenAddress, + amount, + bridgeData + ]); +} + +// The method with similar functionality is already available in ethers.js, +// the only difference is that we provide additional `try { } catch { }` +// for error-resilience. +// +// It will also pave the road for allowing future EIP-1271 signature verification, by +// letting our SDK have functionality to verify signatures. +function isECDSASignatureCorrect(address: string, msgHash: string, signature: SignatureLike): boolean { + try { + return address == ethers.recoverAddress(msgHash, signature); + } catch { + // In case ECDSA signature verification has thrown an error, + // we simply consider the signature as incorrect. + return false; + } +} + +async function isEIP1271SignatureCorrect( + provider: Provider, + address: string, + msgHash: string, + signature: SignatureLike +): Promise { + const accountContract = new ethers.Contract(address, IERC1271.fragments, provider); + + // This line may throw an exception if the contract does not implement the EIP1271 correctly. + // But it may also throw an exception in case the internet connection is lost. + // It is the caller's responsibility to handle the exception. + const result = await accountContract.isValidSignature(msgHash, signature); + + return result == EIP1271_MAGIC_VALUE; +} + +async function isSignatureCorrect( + provider: Provider, + address: string, + msgHash: string, + signature: SignatureLike +): Promise { + let isContractAccount = false; + + const code = await provider.getCode(address); + isContractAccount = ethers.getBytes(code).length != 0; + + if (!isContractAccount) { + return isECDSASignatureCorrect(address, msgHash, signature); + } else { + return await isEIP1271SignatureCorrect(provider, address, msgHash, signature); + } +} + +// Returns `true` or `false` depending on whether the account abstraction's +// signature is correct. Note, that while currently it does not do any `async` actions. +// in the future it will. That's why the `Promise` is returned. +export async function isMessageSignatureCorrect( + provider: Provider, + address: string, + message: Uint8Array | string, + signature: SignatureLike +): Promise { + const msgHash = ethers.hashMessage(message); + return await isSignatureCorrect(provider, address, msgHash, signature); +} + +// Returns `true` or `false` depending on whether the account abstraction's +// EIP712 signature is correct. Note, that while currently it does not do any `async` actions. +// in the future it will. That's why the `Promise` is returned. +export async function isTypedDataSignatureCorrect( + provider: Provider, + address: string, + domain: ethers.TypedDataDomain, + types: Record>, + value: Record, + signature: SignatureLike +): Promise { + const msgHash = ethers.TypedDataEncoder.hash(domain, types, value); + return await isSignatureCorrect(provider, address, msgHash, signature); +} + + +export async function estimateDefaultBridgeDepositL2Gas( + providerL1: ethers.Provider, + providerL2: Provider, + token: Address, + amount: BigNumberish, + to: Address, + from?: Address, + gasPerPubdataByte?: BigNumberish +): Promise { + // If the `from` address is not provided, we use a random address, because + // due to storage slot aggregation, the gas estimation will depend on the address + // and so estimation for the zero address may be smaller than for the sender. + from ??= ethers.Wallet.createRandom().address; + + if (token == ETH_ADDRESS) { + return await providerL2.estimateL1ToL2Execute({ + contractAddress: to, + gasPerPubdataByte: gasPerPubdataByte, + caller: from, + calldata: '0x', + l2Value: amount + }); + } else { + const l1ERC20BridgeAddresses = (await providerL2.getDefaultBridgeAddresses()).erc20L1; + const erc20BridgeAddress = (await providerL2.getDefaultBridgeAddresses()).erc20L2; + const bridgeData = await getERC20DefaultBridgeData(token, providerL1); + return await estimateCustomBridgeDepositL2Gas( + providerL2, + l1ERC20BridgeAddresses, + erc20BridgeAddress, + token, + amount, + to, + bridgeData, + from, + gasPerPubdataByte + ); + } +} + +export function scaleGasLimit(gasLimit: bigint): bigint { + return gasLimit * BigInt(L1_FEE_ESTIMATION_COEF_NUMERATOR) / BigInt(L1_FEE_ESTIMATION_COEF_DENOMINATOR); +} + +export async function estimateCustomBridgeDepositL2Gas( + providerL2: Provider, + l1BridgeAddress: Address, + l2BridgeAddress: Address, + token: Address, + amount: BigNumberish, + to: Address, + bridgeData: BytesLike, + from?: Address, + gasPerPubdataByte?: BigNumberish +): Promise { + const calldata = await getERC20BridgeCalldata(token, from, to, amount, bridgeData); + return await providerL2.estimateL1ToL2Execute({ + caller: applyL1ToL2Alias(l1BridgeAddress), + contractAddress: l2BridgeAddress, + gasPerPubdataByte: gasPerPubdataByte, + calldata: calldata + }); +} \ No newline at end of file diff --git a/src/wallet.ts b/src/wallet.ts new file mode 100644 index 0000000..848b72c --- /dev/null +++ b/src/wallet.ts @@ -0,0 +1,115 @@ +import { EIP712Signer } from './signer'; +import { Provider } from './provider'; +import { EIP712_TX_TYPE, serializeEip712 } from './utils'; +import { ethers, ProgressCallback } from 'ethers'; +import { TransactionResponse, TransactionRequest, Transaction, TransactionLike } from './types'; +import { AdapterL1, AdapterL2 } from './adapters'; + +export class Wallet extends AdapterL2(AdapterL1(ethers.Wallet)) { + override readonly provider: Provider; + providerL1?: ethers.Provider; + public eip712: EIP712Signer; + + override _providerL1() { + if (this.providerL1 == null) { + throw new Error('L1 provider missing: use `connectToL1` to specify'); + } + return this.providerL1; + } + + override _providerL2() { + return this.provider; + } + + override _signerL1() { + return this.ethWallet(); + } + + override _signerL2() { + return this; + } + + ethWallet() { + return new ethers.Wallet(this.signingKey, this._providerL1()); + } + + override connect(provider: Provider) { + return new Wallet(this.signingKey, provider, this.providerL1); + } + + connectToL1(provider: ethers.Provider) { + return new Wallet(this.signingKey, this.provider, provider); + } + + static fromMnemonic(mnemonic: string, provider?: ethers.Provider): Wallet { + const wallet = super.fromPhrase(mnemonic, provider); + return new Wallet(wallet.signingKey, null, wallet.provider); + } + + static override async fromEncryptedJson(json: string, password: string | Uint8Array, callback?: ProgressCallback) { + const wallet = await super.fromEncryptedJson(json, password, callback); + return new Wallet(wallet.signingKey); + } + + static override fromEncryptedJsonSync(json: string, password: string | Uint8Array) { + const wallet = super.fromEncryptedJsonSync(json, password); + return new Wallet(wallet.signingKey); + } + + constructor(privateKey: string | ethers.SigningKey, providerL2?: Provider, providerL1?: ethers.Provider) { + super(privateKey, providerL2); + if (this.provider != null) { + const network = this.provider.getNetwork(); + // @ts-ignore + this.eip712 = new EIP712Signer( + this, + network.then((n) => Number(n.chainId)) + ); + } + this.providerL1 = providerL1; + } + + override async populateTransaction(transaction: TransactionRequest): Promise { + if (transaction.type == null && transaction.customData == null) { + // use legacy txs by default + transaction.type = 0; + } + const populated = (await super.populateTransaction(transaction)) as TransactionLike; + if (transaction.customData == null && transaction.type != EIP712_TX_TYPE) { + return populated; + } + + populated.type = EIP712_TX_TYPE; + populated.value ??= 0; + populated.data ??= '0x'; + populated.customData = this._fillCustomData(transaction.customData); + populated.gasPrice = await this.provider.getGasPrice(); + return populated; + } + + override async signTransaction(transaction: TransactionRequest): Promise { + if (transaction.customData == null && transaction.type != EIP712_TX_TYPE) { + if (transaction.type == 2 && transaction.maxFeePerGas == null) { + transaction.maxFeePerGas = await this.provider.getGasPrice(); + } + return await super.signTransaction(transaction); + } else { + transaction.from ??= this.address; + let from = await ethers.resolveAddress(transaction.from); + if (from.toLowerCase() != this.address.toLowerCase()) { + throw new Error('Transaction `from` address mismatch'); + } + transaction.customData.customSignature = await this.eip712.sign(transaction); + const populated = await this.populateTransaction(transaction); + + return serializeEip712(populated); + } + } + + override async sendTransaction(tx: TransactionRequest): Promise { + const pop = await this.populateTransaction(tx); + delete pop.from; + const txObj = Transaction.from(pop); + return await this.provider.broadcastTransaction(await this.signTransaction(txObj)); + } +} diff --git a/tests/const.test.ts b/tests/const.test.ts new file mode 100644 index 0000000..3934147 --- /dev/null +++ b/tests/const.test.ts @@ -0,0 +1,101 @@ +export const TOKENS = { + DAI: { + "name": "DAI", + "symbol": "DAI", + "decimals": 18, + "address": "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9", + }, + wBTC: { + "name": "wBTC", + "symbol": "wBTC", + "decimals": 8, + "address": "0x3fad2B2E21eA1c96618Cc76a42Fb5a77c3f71c6F" + }, + BAT: { + "name": "BAT", + "symbol": "BAT", + "decimals": 18, + "address": "0x2c7E84980191210883d2dF3167A3AB6A2cc15E01" + }, + GNT: { + "name": "GNT", + "symbol": "GNT", + "decimals": 18, + "address": "0x5C55e2cf0a4243b9C7676e0aD8687C308959A153" + }, + MLTT: { + "name": "MLTT", + "symbol": "MLTT", + "decimals": 18, + "address": "0xa1453A97EF37FD456c0698e9aF0b745c669Ad8Ee" + }, + DAIK: { + "name": "DAIK", + "symbol": "DAIK", + "decimals": 18, + "address": "0x66F85dC64Ead7f86fb3288489E48Ae520eDaa774" + }, + wBTCK: { + "name": "wBTCK", + "symbol": "wBTCK", + "decimals": 8, + "address": "0x23AB565D319E9A82ba5F05b783ACe9E6960516be" + }, + BATK: { + "name": "BATK", + "symbol": "BATS", + "decimals": 18, + "address": "0xEAF2734b6c1DF7AD8F45569e50dc70179727D604" + }, + GNTK: { + "name": "GNTK", + "symbol": "GNTS", + "decimals": 18, + "address": "0x2FDfd23587B1b60FB9b427bd47b34427ca33210F" + }, + MLTTK: { + "name": "MLTTK", + "symbol": "MLTTS", + "decimals": 18, + "address": "0x1f54bd31077A42f00f5530A012b8eDE0992F7cdD" + }, + DAIL: { + "name": "DAIL", + "symbol": "DAIL", + "decimals": 18, + "address": "0x6Cec063Ec6099C3B7428F031f9B4d206E1eC0a4b" + }, + wBTCL: { + "name": "wBTCL", + "symbol": "wBTCP", + "decimals": 8, + "address": "0x20902cA38AD7Ab02e4423B7c5A251AEBBa966e6b" + }, + BATL: { + "name": "BATL", + "symbol": "BATW", + "decimals": 18, + "address": "0xaB27993C34F0053852dafF017cFb7bF977509D38" + }, + GNTL: { + "name": "GNTL", + "symbol": "GNTW", + "decimals": 18, + "address": "0x6e77E09aa1d75ad2D00196452E66d19A972aC462" + }, + MLTTL: { + "name": "MLTTL", + "symbol": "MLTTW", + "decimals": 18, + "address": "0xFFe5ef7d6da85DF52EA904876552792bed79adcB" + }, + WETH: { + "name": "Wrapped Ether", + "symbol": "WETH", + "decimals": 18, + "address": "0x2F85d7963Bb149Df2097C500CE8Cc7b417F95926" + } +} + + + diff --git a/tests/files/wallet.json b/tests/files/wallet.json new file mode 100644 index 0000000..39c4247 --- /dev/null +++ b/tests/files/wallet.json @@ -0,0 +1,21 @@ +{ + "address": "36615cf349d7f6344891b1e7ca7c72883f5dc049", + "id": "c52e8433-8d62-4207-9f4f-5fdbc7841f14", + "version": 3, + "Crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "39934986cb6f1925f18dff20ba6c556b" + }, + "ciphertext": "cecb4a7fa07cd9fb59756d914e2d912950c8b346138b72bd65712ca0e13c2069", + "kdf": "scrypt", + "kdfparams": { + "salt": "93a386883f94c24ddd5ddd1cde22f224907a2ab872fdbfa972cb17b4e682a57d", + "n": 131072, + "dklen": 32, + "p": 1, + "r": 8 + }, + "mac": "76809466758e4f08ec709e37e1d573cce56101bcffea6615e24f985465d7e0d2" + } +} \ No newline at end of file diff --git a/tests/integration/provider.test.ts b/tests/integration/provider.test.ts new file mode 100644 index 0000000..6b279bc --- /dev/null +++ b/tests/integration/provider.test.ts @@ -0,0 +1,326 @@ +import {expect} from 'chai'; +import {Provider, types, utils, Wallet} from "../../src"; +import {ethers} from "ethers"; + + +describe('Provider', () => { + const PUBLIC_KEY = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; + const PRIVATE_KEY = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; + const RECEIVER = "0xa61464658AfeAf65CccaaFD3a512b69A83B77618"; + + const provider = Provider.getDefaultProvider(types.Network.Localhost); + const wallet = new Wallet(PRIVATE_KEY, provider); + + let tx = null; + + before('setup', async () => { + tx = await wallet.transfer({ + token: utils.ETH_ADDRESS, + to: RECEIVER, + amount: 1_000_000, + }); + await tx.wait(); + }); + + + describe('#getMainContractAddress()', () => { + it('should return the address of main contract', async () => { + const result = await provider.getMainContractAddress(); + expect(result).not.to.be.null; + }); + }); + + describe('#getTestnetPaymasterAddress()', () => { + it('should return the address of testnet paymaster', async () => { + const TESTNET_PAYMASTER = "0x0f9acdb01827403765458b4685de6d9007580d15"; + const result = await provider.getTestnetPaymasterAddress(); + expect(result).to.be.equal(TESTNET_PAYMASTER); + }); + }); + + describe('#l1ChainId()', () => { + it('should return L1 chain ID', async () => { + const L1_CHAIN_ID = 9; + const result = await provider.l1ChainId(); + expect(result).to.be.equal(L1_CHAIN_ID); + }); + }); + + describe('getBlockNumber()', () => { + it('should return block number', async () => { + const result = await provider.getBlockNumber(); + expect(result).to.be.greaterThan(0); + }); + }); + + describe('#getTokenPrice()', () => { + it('should return `token` price', async () => { + const TOKEN_PRICE = "1500.00"; + const result = await provider.getTokenPrice(utils.ETH_ADDRESS); + expect(result).to.be.equal(TOKEN_PRICE); + }); + }); + + describe('#getGasPrice()', () => { + it('should return gas price', async () => { + const GAS_PRICE = BigInt(2_500_000_00); + const result = await provider.getGasPrice(); + expect(result).to.be.equal(GAS_PRICE); + }); + }); + + describe('#getL1BatchNumber()', () => { + it('should return L1 batch number', async () => { + const result = await provider.getL1BatchNumber(); + expect(result).to.be.greaterThan(0); + }); + }); + + describe('#getBalance()', () => { + it('should return balance of the account at `address`', async () => { + const result = await provider.getBalance(PUBLIC_KEY); + expect(result > 0).to.be.true; + }); + }); + + describe('#getAllAccountBalances()', () => { + it('should return all balances of the account at `address`', async () => { + const result = await provider.getAllAccountBalances(PUBLIC_KEY); + expect(Object.keys(result)).to.have.lengthOf(2); + }); + }); + + describe('#getBlockDetails()', () => { + it('should return block details', async () => { + const result = await provider.getBlockDetails(1); + expect(result).not.to.be.null; + }); + }); + + describe('#getTransactionDetails(txHash)', () => { + it('should return transaction details', async () => { + const result = await provider.getTransactionDetails(tx.hash); + expect(result).not.to.be.null; + }); + }); + + describe('#getTransactionStatus(txHash)', () => { + it('should return transaction status', async () => { + const result = await provider.getTransactionStatus(tx.hash); + expect(result).not.to.be.null; + }); + }); + + describe('#getTransaction()', () => { + it('should return transaction', async () => { + const result = await provider.getTransaction(tx.hash); + expect(result).not.to.be.null; + }); + }); + + describe('#getTransactionReceipt()', () => { + it('should return transaction receipt', async () => { + const result = await provider.getTransaction(tx.hash); + expect(result).not.to.be.null; + }); + }); + + describe('#getConfirmedTokens()', () => { + it('should return confirmed tokens', async () => { + const result = await provider.getConfirmedTokens(); + expect(result).to.have.lengthOf(2); + }); + }); + + describe('#getDefaultBridgeAddresses()', () => { + it('should return default bridges', async () => { + const result = await provider.getDefaultBridgeAddresses(); + expect(result).not.to.be.null; + }); + }); + + describe('#newBlockFilter()', () => { + it('should return new block filter', async () => { + const result = await provider.newBlockFilter(); + expect(result).not.to.be.null; + }); + }); + + describe('#newPendingTransactionsFilter()', () => { + it('should return new pending block filter', async () => { + const result = await provider.newPendingTransactionsFilter(); + expect(result).not.to.be.null; + }); + }); + + describe('#newFilter()', () => { + it('should return new filter', async () => { + const result = await provider.newFilter({ + fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS + }); + expect(result).not.to.be.null; + }); + }); + + describe('#getContractAccountInfo()', () => { + it('should return contract account info', async () => { + const TESTNET_PAYMASTER = "0x0f9acdb01827403765458b4685de6d9007580d15"; + const result = await provider.getContractAccountInfo(TESTNET_PAYMASTER); + expect(result).not.to.be.null; + }); + }); + + describe('#l2TokenAddress()', () => { + it('should return L2 token address', async () => { + const result = await provider.l2TokenAddress(utils.ETH_ADDRESS); + expect(result).to.be.equal(utils.ETH_ADDRESS); + }); + }); + + describe('#l1TokenAddress()', () => { + it('should return L1 token address', async () => { + const result = await provider.l1TokenAddress(utils.ETH_ADDRESS); + expect(result).to.be.equal(utils.ETH_ADDRESS); + }); + }); + + describe('#getBlock()', () => { + it('should return block with transactions', async () => { + const result = await provider.getBlock("latest", true); + expect(result).not.to.be.null; + }); + }); + + describe('#getBlockDetails()', () => { + it('should return block with transactions', async () => { + const result = await provider.getBlockDetails(await provider.getBlockNumber()); + expect(result).not.to.be.null; + }); + }); + + describe('#getL1BatchBlockRange()', () => { + it('should return L1 batch block range', async () => { + const l1BatchNumber = await provider.getL1BatchNumber(); + const result = await provider.getL1BatchBlockRange(l1BatchNumber); + expect(result).not.to.be.null; + }); + }); + + describe('#getL1BatchDetails()', () => { + it('should return L1 batch details', async () => { + const l1BatchNumber = await provider.getL1BatchNumber(); + const result = await provider.getL1BatchDetails(l1BatchNumber); + expect(result).not.to.be.null; + }); + }); + + describe('#getLogs(filter)', () => { + it('should return logs', async () => { + const result = await provider.getLogs({ + fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS + }); + expect(result).not.to.be.null; + }); + }); + + describe('#getWithdrawTx(tx)', () => { + it('return withdraw transaction', async () => { + const WITHDRAW_TX = { + "from": "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + "value": BigInt(7000000), + "to": "0x000000000000000000000000000000000000800a", + "data": "0x51cff8d900000000000000000000000036615cf349d7f6344891b1e7ca7c72883f5dc049" + }; + const result = await provider.getWithdrawTx({ + token: utils.ETH_ADDRESS, + amount: 7_000_000, + to: PUBLIC_KEY, + from: PUBLIC_KEY + }); + expect(result).to.be.deep.equal(WITHDRAW_TX); + }); + }); + + describe('#getTransferTx()', () => { + it('should return transfer transaction', async () => { + const TRANSFER_TX = { + "from": "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + "to": RECEIVER, + "value": 7_000_000 + }; + const result = await provider.getTransferTx({ + token: utils.ETH_ADDRESS, + amount: 7_000_000, + to: RECEIVER, + from: PUBLIC_KEY + }); + expect(result).to.be.deep.equal(TRANSFER_TX); + }); + }); + + describe('#estimateGasWithdraw()', () => { + it('should return gas estimation of withdraw transaction', async () => { + const WITHDRAW_GAS = BigInt(408_530); + const result = await provider.estimateGasWithdraw({ + token: utils.ETH_ADDRESS, + amount: 7_000_000, + to: PUBLIC_KEY, + from: PUBLIC_KEY + }); + expect(result).to.be.equal(WITHDRAW_GAS); + }); + }); + + + describe('#estimateGasTransfer()', () => { + it('should return gas estimation of transfer transaction', async () => { + const TRANSFER_GAS = BigInt(177_084); + const result = await provider.estimateGasTransfer({ + token: utils.ETH_ADDRESS, + amount: 7_000_000, + to: RECEIVER, + from: PUBLIC_KEY + }); + expect(result).to.be.equal(TRANSFER_GAS); + }); + }); + + describe('#estimateGasL1()', () => { + it('should return gas estimation of L1 transaction', async () => { + const ESTIMATE_GAS_L1 = BigInt(777_396); + const result = await provider.estimateGasL1({ + from: PUBLIC_KEY, + to: await provider.getMainContractAddress(), + value: 7_000_000_000, + customData: { + gasPerPubdata: 800 + } + }); + expect(BigInt(result)).to.be.equal(ESTIMATE_GAS_L1); + }); + }); + + describe('#estimateL1ToL2Execute()', () => { + it('should return gas estimation of L1 to L2 transaction', async () => { + const ESTIMATE_GAS_L1_TO_L2 = BigInt(777_396); + const result = await provider.estimateL1ToL2Execute({ + contractAddress: await provider.getMainContractAddress(), + calldata: '0x', + caller: PUBLIC_KEY, + l2Value: 7_000_000_000, + }); + expect(BigInt(result)).to.be.equal(ESTIMATE_GAS_L1_TO_L2); + }); + }); + + describe('#getFilterChanges()', () => { + it('should return filtered logs', async () => { + const filter = await provider.newFilter({ + address: utils.L2_ETH_TOKEN_ADDRESS, + topics: [ethers.id("Transfer(address,address,uint256)")] + }); + const result = await provider.getFilterChanges(filter); + expect(result).not.to.be.null; + }); + }); +}); \ No newline at end of file diff --git a/tests/integration/wallet.test.ts b/tests/integration/wallet.test.ts new file mode 100644 index 0000000..817efae --- /dev/null +++ b/tests/integration/wallet.test.ts @@ -0,0 +1,330 @@ +import {expect} from 'chai'; +import {Provider, types, utils, Wallet} from "../../src"; +import {ethers} from "ethers"; +import * as fs from "fs"; +import {TOKENS} from "../const.test"; + +describe('Wallet', () => { + const ADDRESS = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; + const PRIVATE_KEY = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; + const MNEMONIC = "stuff slice staff easily soup parent arm payment cotton trade scatter struggle"; + const RECEIVER = "0xa61464658AfeAf65CccaaFD3a512b69A83B77618"; + + const provider = Provider.getDefaultProvider(types.Network.Localhost); + const ethProvider = ethers.getDefaultProvider("http://localhost:8545"); + const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); + + describe('#constructor()', () => { + it('`Wallet(privateKey, provider)` should return a `Wallet` with L2 provider', async () => { + const wallet = new Wallet(PRIVATE_KEY, provider); + + expect(wallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + expect(wallet.provider).to.be.equal(provider); + }); + + it('`Wallet(privateKey, provider, ethProvider)` should return a `Wallet` with L1 and L2 provider', async () => { + const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); + + expect(wallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + expect(wallet.provider).to.be.equal(provider); + expect(wallet.providerL1).to.be.equal(ethProvider); + }); + }); + + describe('#getMainContract()', () => { + it('should return the main contract', async () => { + const result = await wallet.getMainContract(); + expect(result).not.to.be.null; + }); + }); + + describe('#getL1BridgeContracts()', () => { + it('should return a L1 bridge contracts', async () => { + const result = await wallet.getL1BridgeContracts(); + expect(result).not.to.be.null; + }); + }); + + describe('#getBalanceL1()', () => { + it('should return a L1 balance', async () => { + const result = await wallet.getBalanceL1(); + expect(result > 0).to.be.true; + }); + }); + + describe('#getAllowanceL1()', () => { + it('should return allowance of L1 token', async () => { + const result = await wallet.getAllowanceL1(TOKENS.DAI.address); + expect(result >= 0).to.be.true; + }); + }); + + describe('#l2TokenAddress()', () => { + it('should return a L2 token address', async () => { + const result = await wallet.l2TokenAddress(utils.ETH_ADDRESS); + expect(result).to.be.equal(utils.ETH_ADDRESS); + }); + }); + + describe('#approveERC20()', () => { + it('should approve a L1 token', async () => { + const tx = await wallet.approveERC20(TOKENS.DAI.address, 5); + const result = await tx.wait(); + expect(result).not.to.be.null; + }).timeout(5_000); + }); + + describe('#getBaseCost()', () => { + it('should return base cost of L1 transaction', async () => { + const result = await wallet.getBaseCost({gasLimit: 100_000}); + expect(result).not.to.be.null; + }); + }); + + describe('#getBalance()', () => { + it('should return the `Wallet` balance', async () => { + const result = await wallet.getBalance(); + expect(result > 0).to.be.true; + }); + }); + + describe('#getAllBalances()', () => { + it('should return all balance', async () => { + const result = await wallet.getAllBalances(); + expect(Object.keys(result)).to.have.lengthOf(2); + }); + }); + + describe('#getL2BridgeContracts()', () => { + it('should return a L2 bridge contracts', async () => { + const result = await wallet.getL2BridgeContracts(); + expect(result).not.to.be.null; + }); + }); + + describe('#getAddress()', () => { + it('should return a `Wallet` address', async () => { + const result = await wallet.getAddress(); + expect(result).to.be.equal(ADDRESS); + }); + }); + + describe('#ethWallet()', () => { + it('should return a L1 `Wallet`', async () => { + const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); + const ethWallet = wallet.ethWallet(); + expect(ethWallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + expect(ethWallet.provider).to.be.equal(ethProvider); + }); + }); + + describe('#connect()', () => { + it('should return a `Wallet` with provided `provider` as L2 provider', async () => { + let wallet = new Wallet(PRIVATE_KEY); + wallet = wallet.connect(provider); + expect(wallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + expect(wallet.provider).to.be.equal(provider); + }); + }); + + describe('#connectL1(provider)', () => { + it('should return a `Wallet` with provided `provider` as L1 provider', async () => { + let wallet = new Wallet(PRIVATE_KEY); + wallet = wallet.connectToL1(ethProvider); + expect(wallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + expect(wallet.providerL1).to.be.equal(ethProvider); + }); + }); + + describe('#populateTransaction()', () => { + it('should return populated transaction with default values if are omitted', async () => { + const tx = { + to: RECEIVER, + value: BigInt(7_000_000), + type: 0, + from: '0x36615Cf349d7F6344891B1e7CA7C72883F5dc049', + nonce: await wallet.getNonce("pending"), + gasLimit: BigInt(177_084), + chainId: BigInt(270), + gasPrice: BigInt(250_000_000) + } + const result = await wallet.populateTransaction({ + to: RECEIVER, value: 7_000_000 + }); + expect(result).to.be.deep.equal(tx); + }); + }); + + describe('#fromMnemonic()', () => { + it('should return a `Wallet` with the `provider` as L1 provider and a private key that is built from the `mnemonic` passphrase', async () => { + const wallet = Wallet.fromMnemonic(MNEMONIC, ethProvider); + expect(wallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + expect(wallet.providerL1).to.be.equal(ethProvider); + }); + }); + + describe('#fromEncryptedJson()', () => { + it('should return a `Wallet` from encrypted `json` file using provided `password`', async () => { + const wallet = await Wallet.fromEncryptedJson(fs.readFileSync("tests/files/wallet.json", "utf8"), "password"); + expect(wallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + }).timeout(5_000); + }); + + describe('#fromEncryptedJsonSync()', () => { + it('should return a `Wallet` from encrypted `json` file using provided `password`', async () => { + const wallet = Wallet.fromEncryptedJsonSync(fs.readFileSync("tests/files/wallet.json", "utf8"), "password"); + expect(wallet.signingKey.privateKey).to.be.equal(PRIVATE_KEY); + }).timeout(5_000); + }); + + describe('#createRandom()', () => { + it('should return a random `Wallet` with L2 provider', async () => { + const wallet = Wallet.createRandom(provider); + expect(wallet.signingKey.privateKey).not.to.be.null; + expect(wallet.provider).to.be.equal(provider); + }); + }); + + describe('#getDepositTx()', () => { + it('should return ETH deposit transaction', async () => { + const tx = { + contractAddress: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + calldata: "0x", + l2Value: 7000000, + l2GasLimit: "0xa542f", + token: "0x0000000000000000000000000000000000000000", + to: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + amount: 7000000, + refundRecipient: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + operatorTip: 0, + overrides: { + from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + maxFeePerGas: BigInt(1000000010), + maxPriorityFeePerGas: BigInt(1000000000), + value: BigInt(338455507000000) + }, + gasPerPubdataByte: 800 + } + const result = await wallet.getDepositTx({ + token: utils.ETH_ADDRESS, + to: await wallet.getAddress(), + amount: 7_000_000, + refundRecipient: await wallet.getAddress() + }); + expect(result).to.be.deep.equal(tx); + }); + + it('should return DAI deposit transaction', async () => { + const tx = { + maxFeePerGas: BigInt(1000000010), + maxPriorityFeePerGas: BigInt(1000000000), + value: BigInt(347023500000000), + from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + to: await (await wallet.getL1BridgeContracts()).erc20.getAddress(), + data: "0xe8b99b1b00000000000000000000000036615cf349d7f6344891b1e7ca7c72883f5dc0490000000000000000000000005e6d086f5ec079adff4fb3774cdf3e8d6a34f7e9000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000a971f000000000000000000000000000000000000000000000000000000000000032000000000000000000000000036615cf349d7f6344891b1e7ca7c72883f5dc049" + } + const result = await wallet.getDepositTx({ + token: TOKENS.DAI.address, + to: await wallet.getAddress(), + amount: 5, + refundRecipient: await wallet.getAddress() + }); + expect(result).to.be.deep.equal(tx); + }); + }); + + describe('#estimateGasDeposit()', () => { + it('should return gas estimation for ETH deposit transaction', async () => { + const result = await wallet.estimateGasDeposit({ + token: utils.ETH_ADDRESS, + to: await wallet.getAddress(), + amount: 5, + refundRecipient: await wallet.getAddress() + }); + expect(result).to.be.equal(BigInt(149115)); + }); + + it('should return gas estimation for DAI deposit transaction', async () => { + const result = await wallet.estimateGasDeposit({ + token: TOKENS.DAI.address, + to: await wallet.getAddress(), + amount: 5, + refundRecipient: await wallet.getAddress() + }); + expect(result).to.be.equal(BigInt(280566)); + }); + }); + + describe('#deposit()', () => { + it('should deposit ETH to L2 network', async () => { + const tx = await wallet.deposit({ + token: utils.ETH_ADDRESS, + to: await wallet.getAddress(), + amount: 700_000_000, + refundRecipient: await wallet.getAddress() + }); + const result = await tx.wait(); + expect(result).not.to.be.null; + }).timeout(10_000); + + it('should deposit DAI to L2 network', async () => { + const tx = await wallet.deposit({ + token: TOKENS.DAI.address, + to: await wallet.getAddress(), + amount: 5, + approveERC20: true, + refundRecipient: await wallet.getAddress() + }); + const result = await tx.wait(); + expect(result).not.to.be.null; + }).timeout(10_000); + }); + + // describe('#getFullRequiredDepositFee()', () => { + // it('should return fee for ETH token deposit', async () => { + // const result = await wallet.getFullRequiredDepositFee({ + // token: utils.ETH_ADDRESS, + // to: await wallet.getAddress(), + // }); + // console.log(result); + // // expect(result).to.be.equal(BigInt(280566)); + // }); + // + // it('should return fee for DAI token deposit', async () => { + // const result = await wallet.getFullRequiredDepositFee({ + // token: TOKENS.DAI.address, + // to: await wallet.getAddress(), + // }); + // console.log(result); + // // expect(result).to.be.equal(BigInt(280566)); + // }); + // }); + + describe('#withdraw()', () => { + it('should withdraw ETH to L1 network', async () => { + const withdrawTx = await wallet.withdraw({ + token: utils.ETH_ADDRESS, + to: await wallet.getAddress(), + amount: 700_000_000, + }); + await withdrawTx.waitFinalize(); + const finalizeWithdrawTx = await wallet.finalizeWithdrawal(withdrawTx.hash); + const result = await finalizeWithdrawTx.wait(); + expect(result).not.to.be.null; + }).timeout(25_000); + + it('should withdraw DAI to L1 network', async () => { + const withdrawTx = await wallet.deposit({ + token: await provider.l2TokenAddress(TOKENS.DAI.address), + to: await wallet.getAddress(), + amount: 5, + approveERC20: true, + refundRecipient: await wallet.getAddress() + }); + await withdrawTx.waitFinalize(); + const finalizeWithdrawTx = await wallet.finalizeWithdrawal(withdrawTx.hash); + const result = await finalizeWithdrawTx.wait(); + expect(result).not.to.be.null; + }).timeout(25_000); + }); +}); \ No newline at end of file diff --git a/tests/setup.test.ts b/tests/setup.test.ts new file mode 100644 index 0000000..0e43cb0 --- /dev/null +++ b/tests/setup.test.ts @@ -0,0 +1,31 @@ +import {expect} from 'chai'; +import {Provider, types, utils, Wallet} from "../src"; +import {ethers} from "ethers"; +import {TOKENS} from "./const.test"; + +// This should be run first before all other tests, +// which is why it's specified first in the test command in package.json. +describe('setup', () => { + const ADDRESS = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; + const PRIVATE_KEY = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; + + const provider = Provider.getDefaultProvider(types.Network.Localhost); + const ethProvider = ethers.getDefaultProvider("http://localhost:8545"); + + const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); + + it('deploy DAI token on L2 if not exists using deposit', async () => { + const l2DAI = await provider.getCode(await provider.l2TokenAddress(TOKENS.DAI.address)); + if (l2DAI === "0x") { + const priorityOpResponse = await wallet.deposit({ + token: TOKENS.DAI.address, + to: await wallet.getAddress(), + amount: 5, + approveERC20: true, + refundRecipient: await wallet.getAddress() + }); + const receipt = await priorityOpResponse.waitFinalize(); + expect(receipt).not.to.be.null; + } + }).timeout(10_000); +}); \ No newline at end of file diff --git a/tests/unit/util.test.ts b/tests/unit/util.test.ts new file mode 100644 index 0000000..65b626b --- /dev/null +++ b/tests/unit/util.test.ts @@ -0,0 +1,24 @@ +import {expect} from 'chai'; +import {Provider, types, utils, Wallet} from "../../src"; +import {ethers} from "ethers"; + + +describe('utils', () => { + + describe('#applyL1ToL2Alias()', () => { + it('should return the L2 contract address based on provided L1 contract address', async () => { + const l1ContractAddress = "0x702942B8205E5dEdCD3374E5f4419843adA76Eeb"; + const l2ContractAddress = utils.applyL1ToL2Alias(l1ContractAddress); + expect(l2ContractAddress).not.to.be.equal("0x813A42B8205E5DedCd3374e5f4419843ADa77FFC"); + }); + }); + + describe('#undoL1ToL2Alias()', () => { + it('should return the L1 contract address based on provided L2 contract address', async () => { + const l2ContractAddress= "0x813A42B8205E5DedCd3374e5f4419843ADa77FFC"; + const l1ContractAddress = utils.undoL1ToL2Alias(l2ContractAddress); + expect(l2ContractAddress).not.to.be.equal("0x702942B8205E5dEdCD3374E5f4419843adA76Eeb"); + }); + }); + +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1b659a6 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "CommonJS", + "target": "ES2020", + "moduleResolution": "Node16", + + "outDir": "./build", + "esModuleInterop": true, + "declaration": true, + + "preserveSymlinks": true, + "preserveWatchOutput": true, + + "noImplicitOverride": true + }, + "files": [ + "./src/index.ts" + ] +} diff --git a/typechain/ContractDeployer.ts b/typechain/ContractDeployer.ts new file mode 100644 index 0000000..3b58404 --- /dev/null +++ b/typechain/ContractDeployer.ts @@ -0,0 +1,511 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export declare namespace ContractDeployer { + export type ForceDeploymentStruct = { + bytecodeHash: BytesLike; + newAddress: AddressLike; + callConstructor: boolean; + value: BigNumberish; + input: BytesLike; + }; + + export type ForceDeploymentStructOutput = [ + bytecodeHash: string, + newAddress: string, + callConstructor: boolean, + value: bigint, + input: string + ] & { + bytecodeHash: string; + newAddress: string; + callConstructor: boolean; + value: bigint; + input: string; + }; +} + +export declare namespace IContractDeployer { + export type AccountInfoStruct = { + supportedAAVersion: BigNumberish; + nonceOrdering: BigNumberish; + }; + + export type AccountInfoStructOutput = [ + supportedAAVersion: bigint, + nonceOrdering: bigint + ] & { supportedAAVersion: bigint; nonceOrdering: bigint }; +} + +export interface ContractDeployerInterface extends Interface { + getFunction( + nameOrSignature: + | "create" + | "create2" + | "create2Account" + | "createAccount" + | "extendedAccountVersion" + | "forceDeployOnAddress" + | "forceDeployOnAddresses" + | "getAccountInfo" + | "getNewAddressCreate" + | "getNewAddressCreate2" + | "updateAccountVersion" + | "updateNonceOrdering" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "AccountNonceOrderingUpdated" + | "AccountVersionUpdated" + | "ContractDeployed" + ): EventFragment; + + encodeFunctionData( + functionFragment: "create", + values: [BytesLike, BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "create2", + values: [BytesLike, BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "create2Account", + values: [BytesLike, BytesLike, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "createAccount", + values: [BytesLike, BytesLike, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "extendedAccountVersion", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "forceDeployOnAddress", + values: [ContractDeployer.ForceDeploymentStruct, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "forceDeployOnAddresses", + values: [ContractDeployer.ForceDeploymentStruct[]] + ): string; + encodeFunctionData( + functionFragment: "getAccountInfo", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "getNewAddressCreate", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getNewAddressCreate2", + values: [AddressLike, BytesLike, BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "updateAccountVersion", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "updateNonceOrdering", + values: [BigNumberish] + ): string; + + decodeFunctionResult(functionFragment: "create", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "create2", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "create2Account", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "createAccount", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "extendedAccountVersion", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "forceDeployOnAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "forceDeployOnAddresses", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getAccountInfo", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getNewAddressCreate", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getNewAddressCreate2", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "updateAccountVersion", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "updateNonceOrdering", + data: BytesLike + ): Result; +} + +export namespace AccountNonceOrderingUpdatedEvent { + export type InputTuple = [ + accountAddress: AddressLike, + nonceOrdering: BigNumberish + ]; + export type OutputTuple = [accountAddress: string, nonceOrdering: bigint]; + export interface OutputObject { + accountAddress: string; + nonceOrdering: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace AccountVersionUpdatedEvent { + export type InputTuple = [ + accountAddress: AddressLike, + aaVersion: BigNumberish + ]; + export type OutputTuple = [accountAddress: string, aaVersion: bigint]; + export interface OutputObject { + accountAddress: string; + aaVersion: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ContractDeployedEvent { + export type InputTuple = [ + deployerAddress: AddressLike, + bytecodeHash: BytesLike, + contractAddress: AddressLike + ]; + export type OutputTuple = [ + deployerAddress: string, + bytecodeHash: string, + contractAddress: string + ]; + export interface OutputObject { + deployerAddress: string; + bytecodeHash: string; + contractAddress: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface ContractDeployer extends BaseContract { + connect(runner?: ContractRunner | null): ContractDeployer; + waitForDeployment(): Promise; + + interface: ContractDeployerInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + create: TypedContractMethod< + [_salt: BytesLike, _bytecodeHash: BytesLike, _input: BytesLike], + [string], + "payable" + >; + + create2: TypedContractMethod< + [_salt: BytesLike, _bytecodeHash: BytesLike, _input: BytesLike], + [string], + "payable" + >; + + create2Account: TypedContractMethod< + [ + _salt: BytesLike, + _bytecodeHash: BytesLike, + _input: BytesLike, + _aaVersion: BigNumberish + ], + [string], + "payable" + >; + + createAccount: TypedContractMethod< + [ + arg0: BytesLike, + _bytecodeHash: BytesLike, + _input: BytesLike, + _aaVersion: BigNumberish + ], + [string], + "payable" + >; + + extendedAccountVersion: TypedContractMethod< + [_address: AddressLike], + [bigint], + "view" + >; + + forceDeployOnAddress: TypedContractMethod< + [_deployment: ContractDeployer.ForceDeploymentStruct, _sender: AddressLike], + [void], + "payable" + >; + + forceDeployOnAddresses: TypedContractMethod< + [_deployments: ContractDeployer.ForceDeploymentStruct[]], + [void], + "payable" + >; + + getAccountInfo: TypedContractMethod< + [_address: AddressLike], + [IContractDeployer.AccountInfoStructOutput], + "view" + >; + + getNewAddressCreate: TypedContractMethod< + [_sender: AddressLike, _senderNonce: BigNumberish], + [string], + "view" + >; + + getNewAddressCreate2: TypedContractMethod< + [ + _sender: AddressLike, + _bytecodeHash: BytesLike, + _salt: BytesLike, + _input: BytesLike + ], + [string], + "view" + >; + + updateAccountVersion: TypedContractMethod< + [_version: BigNumberish], + [void], + "nonpayable" + >; + + updateNonceOrdering: TypedContractMethod< + [_nonceOrdering: BigNumberish], + [void], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "create" + ): TypedContractMethod< + [_salt: BytesLike, _bytecodeHash: BytesLike, _input: BytesLike], + [string], + "payable" + >; + getFunction( + nameOrSignature: "create2" + ): TypedContractMethod< + [_salt: BytesLike, _bytecodeHash: BytesLike, _input: BytesLike], + [string], + "payable" + >; + getFunction( + nameOrSignature: "create2Account" + ): TypedContractMethod< + [ + _salt: BytesLike, + _bytecodeHash: BytesLike, + _input: BytesLike, + _aaVersion: BigNumberish + ], + [string], + "payable" + >; + getFunction( + nameOrSignature: "createAccount" + ): TypedContractMethod< + [ + arg0: BytesLike, + _bytecodeHash: BytesLike, + _input: BytesLike, + _aaVersion: BigNumberish + ], + [string], + "payable" + >; + getFunction( + nameOrSignature: "extendedAccountVersion" + ): TypedContractMethod<[_address: AddressLike], [bigint], "view">; + getFunction( + nameOrSignature: "forceDeployOnAddress" + ): TypedContractMethod< + [_deployment: ContractDeployer.ForceDeploymentStruct, _sender: AddressLike], + [void], + "payable" + >; + getFunction( + nameOrSignature: "forceDeployOnAddresses" + ): TypedContractMethod< + [_deployments: ContractDeployer.ForceDeploymentStruct[]], + [void], + "payable" + >; + getFunction( + nameOrSignature: "getAccountInfo" + ): TypedContractMethod< + [_address: AddressLike], + [IContractDeployer.AccountInfoStructOutput], + "view" + >; + getFunction( + nameOrSignature: "getNewAddressCreate" + ): TypedContractMethod< + [_sender: AddressLike, _senderNonce: BigNumberish], + [string], + "view" + >; + getFunction( + nameOrSignature: "getNewAddressCreate2" + ): TypedContractMethod< + [ + _sender: AddressLike, + _bytecodeHash: BytesLike, + _salt: BytesLike, + _input: BytesLike + ], + [string], + "view" + >; + getFunction( + nameOrSignature: "updateAccountVersion" + ): TypedContractMethod<[_version: BigNumberish], [void], "nonpayable">; + getFunction( + nameOrSignature: "updateNonceOrdering" + ): TypedContractMethod<[_nonceOrdering: BigNumberish], [void], "nonpayable">; + + getEvent( + key: "AccountNonceOrderingUpdated" + ): TypedContractEvent< + AccountNonceOrderingUpdatedEvent.InputTuple, + AccountNonceOrderingUpdatedEvent.OutputTuple, + AccountNonceOrderingUpdatedEvent.OutputObject + >; + getEvent( + key: "AccountVersionUpdated" + ): TypedContractEvent< + AccountVersionUpdatedEvent.InputTuple, + AccountVersionUpdatedEvent.OutputTuple, + AccountVersionUpdatedEvent.OutputObject + >; + getEvent( + key: "ContractDeployed" + ): TypedContractEvent< + ContractDeployedEvent.InputTuple, + ContractDeployedEvent.OutputTuple, + ContractDeployedEvent.OutputObject + >; + + filters: { + "AccountNonceOrderingUpdated(address,uint8)": TypedContractEvent< + AccountNonceOrderingUpdatedEvent.InputTuple, + AccountNonceOrderingUpdatedEvent.OutputTuple, + AccountNonceOrderingUpdatedEvent.OutputObject + >; + AccountNonceOrderingUpdated: TypedContractEvent< + AccountNonceOrderingUpdatedEvent.InputTuple, + AccountNonceOrderingUpdatedEvent.OutputTuple, + AccountNonceOrderingUpdatedEvent.OutputObject + >; + + "AccountVersionUpdated(address,uint8)": TypedContractEvent< + AccountVersionUpdatedEvent.InputTuple, + AccountVersionUpdatedEvent.OutputTuple, + AccountVersionUpdatedEvent.OutputObject + >; + AccountVersionUpdated: TypedContractEvent< + AccountVersionUpdatedEvent.InputTuple, + AccountVersionUpdatedEvent.OutputTuple, + AccountVersionUpdatedEvent.OutputObject + >; + + "ContractDeployed(address,bytes32,address)": TypedContractEvent< + ContractDeployedEvent.InputTuple, + ContractDeployedEvent.OutputTuple, + ContractDeployedEvent.OutputObject + >; + ContractDeployed: TypedContractEvent< + ContractDeployedEvent.InputTuple, + ContractDeployedEvent.OutputTuple, + ContractDeployedEvent.OutputObject + >; + }; +} diff --git a/typechain/IAllowList.ts b/typechain/IAllowList.ts new file mode 100644 index 0000000..660a2b9 --- /dev/null +++ b/typechain/IAllowList.ts @@ -0,0 +1,398 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export declare namespace IAllowList { + export type DepositStruct = { + depositLimitation: boolean; + depositCap: BigNumberish; + }; + + export type DepositStructOutput = [ + depositLimitation: boolean, + depositCap: bigint + ] & { depositLimitation: boolean; depositCap: bigint }; +} + +export interface IAllowListInterface extends Interface { + getFunction( + nameOrSignature: + | "canCall" + | "getAccessMode" + | "getTokenDepositLimitData" + | "hasSpecialAccessToCall" + | "setAccessMode" + | "setBatchAccessMode" + | "setBatchPermissionToCall" + | "setDepositLimit" + | "setPermissionToCall" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: "UpdateAccessMode" | "UpdateCallPermission" + ): EventFragment; + + encodeFunctionData( + functionFragment: "canCall", + values: [AddressLike, AddressLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "getAccessMode", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "getTokenDepositLimitData", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "hasSpecialAccessToCall", + values: [AddressLike, AddressLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setAccessMode", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setBatchAccessMode", + values: [AddressLike[], BigNumberish[]] + ): string; + encodeFunctionData( + functionFragment: "setBatchPermissionToCall", + values: [AddressLike[], AddressLike[], BytesLike[], boolean[]] + ): string; + encodeFunctionData( + functionFragment: "setDepositLimit", + values: [AddressLike, boolean, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setPermissionToCall", + values: [AddressLike, AddressLike, BytesLike, boolean] + ): string; + + decodeFunctionResult(functionFragment: "canCall", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getAccessMode", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTokenDepositLimitData", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "hasSpecialAccessToCall", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setAccessMode", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setBatchAccessMode", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setBatchPermissionToCall", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setDepositLimit", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setPermissionToCall", + data: BytesLike + ): Result; +} + +export namespace UpdateAccessModeEvent { + export type InputTuple = [ + target: AddressLike, + previousMode: BigNumberish, + newMode: BigNumberish + ]; + export type OutputTuple = [ + target: string, + previousMode: bigint, + newMode: bigint + ]; + export interface OutputObject { + target: string; + previousMode: bigint; + newMode: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace UpdateCallPermissionEvent { + export type InputTuple = [ + caller: AddressLike, + target: AddressLike, + functionSig: BytesLike, + status: boolean + ]; + export type OutputTuple = [ + caller: string, + target: string, + functionSig: string, + status: boolean + ]; + export interface OutputObject { + caller: string; + target: string; + functionSig: string; + status: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface IAllowList extends BaseContract { + connect(runner?: ContractRunner | null): IAllowList; + waitForDeployment(): Promise; + + interface: IAllowListInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + canCall: TypedContractMethod< + [_caller: AddressLike, _target: AddressLike, _functionSig: BytesLike], + [boolean], + "view" + >; + + getAccessMode: TypedContractMethod<[_target: AddressLike], [bigint], "view">; + + getTokenDepositLimitData: TypedContractMethod< + [_l1Token: AddressLike], + [IAllowList.DepositStructOutput], + "view" + >; + + hasSpecialAccessToCall: TypedContractMethod< + [_caller: AddressLike, _target: AddressLike, _functionSig: BytesLike], + [boolean], + "view" + >; + + setAccessMode: TypedContractMethod< + [_target: AddressLike, _accessMode: BigNumberish], + [void], + "nonpayable" + >; + + setBatchAccessMode: TypedContractMethod< + [_targets: AddressLike[], _accessMode: BigNumberish[]], + [void], + "nonpayable" + >; + + setBatchPermissionToCall: TypedContractMethod< + [ + _callers: AddressLike[], + _targets: AddressLike[], + _functionSigs: BytesLike[], + _enables: boolean[] + ], + [void], + "nonpayable" + >; + + setDepositLimit: TypedContractMethod< + [ + _l1Token: AddressLike, + _depositLimitation: boolean, + _depositCap: BigNumberish + ], + [void], + "nonpayable" + >; + + setPermissionToCall: TypedContractMethod< + [ + _caller: AddressLike, + _target: AddressLike, + _functionSig: BytesLike, + _enable: boolean + ], + [void], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "canCall" + ): TypedContractMethod< + [_caller: AddressLike, _target: AddressLike, _functionSig: BytesLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "getAccessMode" + ): TypedContractMethod<[_target: AddressLike], [bigint], "view">; + getFunction( + nameOrSignature: "getTokenDepositLimitData" + ): TypedContractMethod< + [_l1Token: AddressLike], + [IAllowList.DepositStructOutput], + "view" + >; + getFunction( + nameOrSignature: "hasSpecialAccessToCall" + ): TypedContractMethod< + [_caller: AddressLike, _target: AddressLike, _functionSig: BytesLike], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "setAccessMode" + ): TypedContractMethod< + [_target: AddressLike, _accessMode: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setBatchAccessMode" + ): TypedContractMethod< + [_targets: AddressLike[], _accessMode: BigNumberish[]], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setBatchPermissionToCall" + ): TypedContractMethod< + [ + _callers: AddressLike[], + _targets: AddressLike[], + _functionSigs: BytesLike[], + _enables: boolean[] + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setDepositLimit" + ): TypedContractMethod< + [ + _l1Token: AddressLike, + _depositLimitation: boolean, + _depositCap: BigNumberish + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setPermissionToCall" + ): TypedContractMethod< + [ + _caller: AddressLike, + _target: AddressLike, + _functionSig: BytesLike, + _enable: boolean + ], + [void], + "nonpayable" + >; + + getEvent( + key: "UpdateAccessMode" + ): TypedContractEvent< + UpdateAccessModeEvent.InputTuple, + UpdateAccessModeEvent.OutputTuple, + UpdateAccessModeEvent.OutputObject + >; + getEvent( + key: "UpdateCallPermission" + ): TypedContractEvent< + UpdateCallPermissionEvent.InputTuple, + UpdateCallPermissionEvent.OutputTuple, + UpdateCallPermissionEvent.OutputObject + >; + + filters: { + "UpdateAccessMode(address,uint8,uint8)": TypedContractEvent< + UpdateAccessModeEvent.InputTuple, + UpdateAccessModeEvent.OutputTuple, + UpdateAccessModeEvent.OutputObject + >; + UpdateAccessMode: TypedContractEvent< + UpdateAccessModeEvent.InputTuple, + UpdateAccessModeEvent.OutputTuple, + UpdateAccessModeEvent.OutputObject + >; + + "UpdateCallPermission(address,address,bytes4,bool)": TypedContractEvent< + UpdateCallPermissionEvent.InputTuple, + UpdateCallPermissionEvent.OutputTuple, + UpdateCallPermissionEvent.OutputObject + >; + UpdateCallPermission: TypedContractEvent< + UpdateCallPermissionEvent.InputTuple, + UpdateCallPermissionEvent.OutputTuple, + UpdateCallPermissionEvent.OutputObject + >; + }; +} diff --git a/typechain/IERC1271.ts b/typechain/IERC1271.ts new file mode 100644 index 0000000..71f9df5 --- /dev/null +++ b/typechain/IERC1271.ts @@ -0,0 +1,98 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BytesLike, + FunctionFragment, + Result, + Interface, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface IERC1271Interface extends Interface { + getFunction(nameOrSignature: "isValidSignature"): FunctionFragment; + + encodeFunctionData( + functionFragment: "isValidSignature", + values: [BytesLike, BytesLike] + ): string; + + decodeFunctionResult( + functionFragment: "isValidSignature", + data: BytesLike + ): Result; +} + +export interface IERC1271 extends BaseContract { + connect(runner?: ContractRunner | null): IERC1271; + waitForDeployment(): Promise; + + interface: IERC1271Interface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + isValidSignature: TypedContractMethod< + [hash: BytesLike, signature: BytesLike], + [string], + "view" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "isValidSignature" + ): TypedContractMethod< + [hash: BytesLike, signature: BytesLike], + [string], + "view" + >; + + filters: {}; +} diff --git a/typechain/IERC20.ts b/typechain/IERC20.ts new file mode 100644 index 0000000..783ad43 --- /dev/null +++ b/typechain/IERC20.ts @@ -0,0 +1,286 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface IERC20Interface extends Interface { + getFunction( + nameOrSignature: + | "allowance" + | "approve" + | "balanceOf" + | "decimals" + | "name" + | "symbol" + | "totalSupply" + | "transfer" + | "transferFrom" + ): FunctionFragment; + + getEvent(nameOrSignatureOrTopic: "Approval" | "Transfer"): EventFragment; + + encodeFunctionData( + functionFragment: "allowance", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "approve", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "balanceOf", + values: [AddressLike] + ): string; + encodeFunctionData(functionFragment: "decimals", values?: undefined): string; + encodeFunctionData(functionFragment: "name", values?: undefined): string; + encodeFunctionData(functionFragment: "symbol", values?: undefined): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transfer", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [AddressLike, AddressLike, BigNumberish] + ): string; + + decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike + ): Result; +} + +export namespace ApprovalEvent { + export type InputTuple = [ + owner: AddressLike, + spender: AddressLike, + value: BigNumberish + ]; + export type OutputTuple = [owner: string, spender: string, value: bigint]; + export interface OutputObject { + owner: string; + spender: string; + value: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferEvent { + export type InputTuple = [ + from: AddressLike, + to: AddressLike, + value: BigNumberish + ]; + export type OutputTuple = [from: string, to: string, value: bigint]; + export interface OutputObject { + from: string; + to: string; + value: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface IERC20 extends BaseContract { + connect(runner?: ContractRunner | null): IERC20; + waitForDeployment(): Promise; + + interface: IERC20Interface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + allowance: TypedContractMethod< + [owner: AddressLike, spender: AddressLike], + [bigint], + "view" + >; + + approve: TypedContractMethod< + [spender: AddressLike, amount: BigNumberish], + [boolean], + "nonpayable" + >; + + balanceOf: TypedContractMethod<[account: AddressLike], [bigint], "view">; + + decimals: TypedContractMethod<[], [bigint], "view">; + + name: TypedContractMethod<[], [string], "view">; + + symbol: TypedContractMethod<[], [string], "view">; + + totalSupply: TypedContractMethod<[], [bigint], "view">; + + transfer: TypedContractMethod< + [to: AddressLike, amount: BigNumberish], + [boolean], + "nonpayable" + >; + + transferFrom: TypedContractMethod< + [from: AddressLike, to: AddressLike, amount: BigNumberish], + [boolean], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "allowance" + ): TypedContractMethod< + [owner: AddressLike, spender: AddressLike], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "approve" + ): TypedContractMethod< + [spender: AddressLike, amount: BigNumberish], + [boolean], + "nonpayable" + >; + getFunction( + nameOrSignature: "balanceOf" + ): TypedContractMethod<[account: AddressLike], [bigint], "view">; + getFunction( + nameOrSignature: "decimals" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "name" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "symbol" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "totalSupply" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "transfer" + ): TypedContractMethod< + [to: AddressLike, amount: BigNumberish], + [boolean], + "nonpayable" + >; + getFunction( + nameOrSignature: "transferFrom" + ): TypedContractMethod< + [from: AddressLike, to: AddressLike, amount: BigNumberish], + [boolean], + "nonpayable" + >; + + getEvent( + key: "Approval" + ): TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + getEvent( + key: "Transfer" + ): TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + + filters: { + "Approval(address,address,uint256)": TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + Approval: TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + + "Transfer(address,address,uint256)": TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + Transfer: TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + }; +} diff --git a/typechain/IEthToken.ts b/typechain/IEthToken.ts new file mode 100644 index 0000000..f04fb8b --- /dev/null +++ b/typechain/IEthToken.ts @@ -0,0 +1,296 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface IEthTokenInterface extends Interface { + getFunction( + nameOrSignature: + | "balanceOf" + | "decimals" + | "mint" + | "name" + | "symbol" + | "totalSupply" + | "transferFromTo" + | "withdraw" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: "Mint" | "Transfer" | "Withdrawal" + ): EventFragment; + + encodeFunctionData( + functionFragment: "balanceOf", + values: [BigNumberish] + ): string; + encodeFunctionData(functionFragment: "decimals", values?: undefined): string; + encodeFunctionData( + functionFragment: "mint", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "name", values?: undefined): string; + encodeFunctionData(functionFragment: "symbol", values?: undefined): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transferFromTo", + values: [AddressLike, AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "withdraw", + values: [AddressLike] + ): string; + + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferFromTo", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "withdraw", data: BytesLike): Result; +} + +export namespace MintEvent { + export type InputTuple = [account: AddressLike, amount: BigNumberish]; + export type OutputTuple = [account: string, amount: bigint]; + export interface OutputObject { + account: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferEvent { + export type InputTuple = [ + from: AddressLike, + to: AddressLike, + value: BigNumberish + ]; + export type OutputTuple = [from: string, to: string, value: bigint]; + export interface OutputObject { + from: string; + to: string; + value: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace WithdrawalEvent { + export type InputTuple = [ + _l2Sender: AddressLike, + _l1Receiver: AddressLike, + _amount: BigNumberish + ]; + export type OutputTuple = [ + _l2Sender: string, + _l1Receiver: string, + _amount: bigint + ]; + export interface OutputObject { + _l2Sender: string; + _l1Receiver: string; + _amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface IEthToken extends BaseContract { + connect(runner?: ContractRunner | null): IEthToken; + waitForDeployment(): Promise; + + interface: IEthTokenInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + balanceOf: TypedContractMethod<[arg0: BigNumberish], [bigint], "view">; + + decimals: TypedContractMethod<[], [bigint], "view">; + + mint: TypedContractMethod< + [_account: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + + name: TypedContractMethod<[], [string], "view">; + + symbol: TypedContractMethod<[], [string], "view">; + + totalSupply: TypedContractMethod<[], [bigint], "view">; + + transferFromTo: TypedContractMethod< + [_from: AddressLike, _to: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + + withdraw: TypedContractMethod<[_l1Receiver: AddressLike], [void], "payable">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "balanceOf" + ): TypedContractMethod<[arg0: BigNumberish], [bigint], "view">; + getFunction( + nameOrSignature: "decimals" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "mint" + ): TypedContractMethod< + [_account: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "name" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "symbol" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "totalSupply" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "transferFromTo" + ): TypedContractMethod< + [_from: AddressLike, _to: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "withdraw" + ): TypedContractMethod<[_l1Receiver: AddressLike], [void], "payable">; + + getEvent( + key: "Mint" + ): TypedContractEvent< + MintEvent.InputTuple, + MintEvent.OutputTuple, + MintEvent.OutputObject + >; + getEvent( + key: "Transfer" + ): TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + getEvent( + key: "Withdrawal" + ): TypedContractEvent< + WithdrawalEvent.InputTuple, + WithdrawalEvent.OutputTuple, + WithdrawalEvent.OutputObject + >; + + filters: { + "Mint(address,uint256)": TypedContractEvent< + MintEvent.InputTuple, + MintEvent.OutputTuple, + MintEvent.OutputObject + >; + Mint: TypedContractEvent< + MintEvent.InputTuple, + MintEvent.OutputTuple, + MintEvent.OutputObject + >; + + "Transfer(address,address,uint256)": TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + Transfer: TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + + "Withdrawal(address,address,uint256)": TypedContractEvent< + WithdrawalEvent.InputTuple, + WithdrawalEvent.OutputTuple, + WithdrawalEvent.OutputObject + >; + Withdrawal: TypedContractEvent< + WithdrawalEvent.InputTuple, + WithdrawalEvent.OutputTuple, + WithdrawalEvent.OutputObject + >; + }; +} diff --git a/typechain/IL1Bridge.ts b/typechain/IL1Bridge.ts new file mode 100644 index 0000000..2e5cc52 --- /dev/null +++ b/typechain/IL1Bridge.ts @@ -0,0 +1,377 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface IL1BridgeInterface extends Interface { + getFunction( + nameOrSignature: + | "claimFailedDeposit" + | "deposit" + | "finalizeWithdrawal" + | "isWithdrawalFinalized" + | "l2Bridge" + | "l2TokenAddress" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "ClaimedFailedDeposit" + | "DepositInitiated" + | "WithdrawalFinalized" + ): EventFragment; + + encodeFunctionData( + functionFragment: "claimFailedDeposit", + values: [ + AddressLike, + AddressLike, + BytesLike, + BigNumberish, + BigNumberish, + BigNumberish, + BytesLike[] + ] + ): string; + encodeFunctionData( + functionFragment: "deposit", + values: [ + AddressLike, + AddressLike, + BigNumberish, + BigNumberish, + BigNumberish, + AddressLike + ] + ): string; + encodeFunctionData( + functionFragment: "finalizeWithdrawal", + values: [BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike[]] + ): string; + encodeFunctionData( + functionFragment: "isWithdrawalFinalized", + values: [BigNumberish, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "l2Bridge", values?: undefined): string; + encodeFunctionData( + functionFragment: "l2TokenAddress", + values: [AddressLike] + ): string; + + decodeFunctionResult( + functionFragment: "claimFailedDeposit", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "deposit", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "finalizeWithdrawal", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isWithdrawalFinalized", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "l2Bridge", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "l2TokenAddress", + data: BytesLike + ): Result; +} + +export namespace ClaimedFailedDepositEvent { + export type InputTuple = [ + to: AddressLike, + l1Token: AddressLike, + amount: BigNumberish + ]; + export type OutputTuple = [to: string, l1Token: string, amount: bigint]; + export interface OutputObject { + to: string; + l1Token: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace DepositInitiatedEvent { + export type InputTuple = [ + l2DepositTxHash: BytesLike, + from: AddressLike, + to: AddressLike, + l1Token: AddressLike, + amount: BigNumberish + ]; + export type OutputTuple = [ + l2DepositTxHash: string, + from: string, + to: string, + l1Token: string, + amount: bigint + ]; + export interface OutputObject { + l2DepositTxHash: string; + from: string; + to: string; + l1Token: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace WithdrawalFinalizedEvent { + export type InputTuple = [ + to: AddressLike, + l1Token: AddressLike, + amount: BigNumberish + ]; + export type OutputTuple = [to: string, l1Token: string, amount: bigint]; + export interface OutputObject { + to: string; + l1Token: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface IL1Bridge extends BaseContract { + connect(runner?: ContractRunner | null): IL1Bridge; + waitForDeployment(): Promise; + + interface: IL1BridgeInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + claimFailedDeposit: TypedContractMethod< + [ + _depositSender: AddressLike, + _l1Token: AddressLike, + _l2TxHash: BytesLike, + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _merkleProof: BytesLike[] + ], + [void], + "nonpayable" + >; + + deposit: TypedContractMethod< + [ + _l2Receiver: AddressLike, + _l1Token: AddressLike, + _amount: BigNumberish, + _l2TxGasLimit: BigNumberish, + _l2TxGasPerPubdataByte: BigNumberish, + _refundRecipient: AddressLike + ], + [string], + "payable" + >; + + finalizeWithdrawal: TypedContractMethod< + [ + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _message: BytesLike, + _merkleProof: BytesLike[] + ], + [void], + "nonpayable" + >; + + isWithdrawalFinalized: TypedContractMethod< + [_l2BlockNumber: BigNumberish, _l2MessageIndex: BigNumberish], + [boolean], + "view" + >; + + l2Bridge: TypedContractMethod<[], [string], "view">; + + l2TokenAddress: TypedContractMethod< + [_l1Token: AddressLike], + [string], + "view" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "claimFailedDeposit" + ): TypedContractMethod< + [ + _depositSender: AddressLike, + _l1Token: AddressLike, + _l2TxHash: BytesLike, + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _merkleProof: BytesLike[] + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "deposit" + ): TypedContractMethod< + [ + _l2Receiver: AddressLike, + _l1Token: AddressLike, + _amount: BigNumberish, + _l2TxGasLimit: BigNumberish, + _l2TxGasPerPubdataByte: BigNumberish, + _refundRecipient: AddressLike + ], + [string], + "payable" + >; + getFunction( + nameOrSignature: "finalizeWithdrawal" + ): TypedContractMethod< + [ + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _message: BytesLike, + _merkleProof: BytesLike[] + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "isWithdrawalFinalized" + ): TypedContractMethod< + [_l2BlockNumber: BigNumberish, _l2MessageIndex: BigNumberish], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "l2Bridge" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "l2TokenAddress" + ): TypedContractMethod<[_l1Token: AddressLike], [string], "view">; + + getEvent( + key: "ClaimedFailedDeposit" + ): TypedContractEvent< + ClaimedFailedDepositEvent.InputTuple, + ClaimedFailedDepositEvent.OutputTuple, + ClaimedFailedDepositEvent.OutputObject + >; + getEvent( + key: "DepositInitiated" + ): TypedContractEvent< + DepositInitiatedEvent.InputTuple, + DepositInitiatedEvent.OutputTuple, + DepositInitiatedEvent.OutputObject + >; + getEvent( + key: "WithdrawalFinalized" + ): TypedContractEvent< + WithdrawalFinalizedEvent.InputTuple, + WithdrawalFinalizedEvent.OutputTuple, + WithdrawalFinalizedEvent.OutputObject + >; + + filters: { + "ClaimedFailedDeposit(address,address,uint256)": TypedContractEvent< + ClaimedFailedDepositEvent.InputTuple, + ClaimedFailedDepositEvent.OutputTuple, + ClaimedFailedDepositEvent.OutputObject + >; + ClaimedFailedDeposit: TypedContractEvent< + ClaimedFailedDepositEvent.InputTuple, + ClaimedFailedDepositEvent.OutputTuple, + ClaimedFailedDepositEvent.OutputObject + >; + + "DepositInitiated(bytes32,address,address,address,uint256)": TypedContractEvent< + DepositInitiatedEvent.InputTuple, + DepositInitiatedEvent.OutputTuple, + DepositInitiatedEvent.OutputObject + >; + DepositInitiated: TypedContractEvent< + DepositInitiatedEvent.InputTuple, + DepositInitiatedEvent.OutputTuple, + DepositInitiatedEvent.OutputObject + >; + + "WithdrawalFinalized(address,address,uint256)": TypedContractEvent< + WithdrawalFinalizedEvent.InputTuple, + WithdrawalFinalizedEvent.OutputTuple, + WithdrawalFinalizedEvent.OutputObject + >; + WithdrawalFinalized: TypedContractEvent< + WithdrawalFinalizedEvent.InputTuple, + WithdrawalFinalizedEvent.OutputTuple, + WithdrawalFinalizedEvent.OutputObject + >; + }; +} diff --git a/typechain/IL1Messenger.ts b/typechain/IL1Messenger.ts new file mode 100644 index 0000000..40937d5 --- /dev/null +++ b/typechain/IL1Messenger.ts @@ -0,0 +1,126 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface IL1MessengerInterface extends Interface { + getFunction(nameOrSignature: "sendToL1"): FunctionFragment; + + getEvent(nameOrSignatureOrTopic: "L1MessageSent"): EventFragment; + + encodeFunctionData(functionFragment: "sendToL1", values: [BytesLike]): string; + + decodeFunctionResult(functionFragment: "sendToL1", data: BytesLike): Result; +} + +export namespace L1MessageSentEvent { + export type InputTuple = [ + _sender: AddressLike, + _hash: BytesLike, + _message: BytesLike + ]; + export type OutputTuple = [_sender: string, _hash: string, _message: string]; + export interface OutputObject { + _sender: string; + _hash: string; + _message: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface IL1Messenger extends BaseContract { + connect(runner?: ContractRunner | null): IL1Messenger; + waitForDeployment(): Promise; + + interface: IL1MessengerInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + sendToL1: TypedContractMethod<[_message: BytesLike], [string], "nonpayable">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "sendToL1" + ): TypedContractMethod<[_message: BytesLike], [string], "nonpayable">; + + getEvent( + key: "L1MessageSent" + ): TypedContractEvent< + L1MessageSentEvent.InputTuple, + L1MessageSentEvent.OutputTuple, + L1MessageSentEvent.OutputObject + >; + + filters: { + "L1MessageSent(address,bytes32,bytes)": TypedContractEvent< + L1MessageSentEvent.InputTuple, + L1MessageSentEvent.OutputTuple, + L1MessageSentEvent.OutputObject + >; + L1MessageSent: TypedContractEvent< + L1MessageSentEvent.InputTuple, + L1MessageSentEvent.OutputTuple, + L1MessageSentEvent.OutputObject + >; + }; +} diff --git a/typechain/IL2Bridge.ts b/typechain/IL2Bridge.ts new file mode 100644 index 0000000..5d46ca4 --- /dev/null +++ b/typechain/IL2Bridge.ts @@ -0,0 +1,271 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface IL2BridgeInterface extends Interface { + getFunction( + nameOrSignature: + | "finalizeDeposit" + | "l1Bridge" + | "l1TokenAddress" + | "l2TokenAddress" + | "withdraw" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: "FinalizeDeposit" | "WithdrawalInitiated" + ): EventFragment; + + encodeFunctionData( + functionFragment: "finalizeDeposit", + values: [AddressLike, AddressLike, AddressLike, BigNumberish, BytesLike] + ): string; + encodeFunctionData(functionFragment: "l1Bridge", values?: undefined): string; + encodeFunctionData( + functionFragment: "l1TokenAddress", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "l2TokenAddress", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "withdraw", + values: [AddressLike, AddressLike, BigNumberish] + ): string; + + decodeFunctionResult( + functionFragment: "finalizeDeposit", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "l1Bridge", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "l1TokenAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "l2TokenAddress", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "withdraw", data: BytesLike): Result; +} + +export namespace FinalizeDepositEvent { + export type InputTuple = [ + l1Sender: AddressLike, + l2Receiver: AddressLike, + l2Token: AddressLike, + amount: BigNumberish + ]; + export type OutputTuple = [ + l1Sender: string, + l2Receiver: string, + l2Token: string, + amount: bigint + ]; + export interface OutputObject { + l1Sender: string; + l2Receiver: string; + l2Token: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace WithdrawalInitiatedEvent { + export type InputTuple = [ + l2Sender: AddressLike, + l1Receiver: AddressLike, + l2Token: AddressLike, + amount: BigNumberish + ]; + export type OutputTuple = [ + l2Sender: string, + l1Receiver: string, + l2Token: string, + amount: bigint + ]; + export interface OutputObject { + l2Sender: string; + l1Receiver: string; + l2Token: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface IL2Bridge extends BaseContract { + connect(runner?: ContractRunner | null): IL2Bridge; + waitForDeployment(): Promise; + + interface: IL2BridgeInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + finalizeDeposit: TypedContractMethod< + [ + _l1Sender: AddressLike, + _l2Receiver: AddressLike, + _l1Token: AddressLike, + _amount: BigNumberish, + _data: BytesLike + ], + [void], + "payable" + >; + + l1Bridge: TypedContractMethod<[], [string], "view">; + + l1TokenAddress: TypedContractMethod< + [_l2Token: AddressLike], + [string], + "view" + >; + + l2TokenAddress: TypedContractMethod< + [_l1Token: AddressLike], + [string], + "view" + >; + + withdraw: TypedContractMethod< + [_l1Receiver: AddressLike, _l2Token: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "finalizeDeposit" + ): TypedContractMethod< + [ + _l1Sender: AddressLike, + _l2Receiver: AddressLike, + _l1Token: AddressLike, + _amount: BigNumberish, + _data: BytesLike + ], + [void], + "payable" + >; + getFunction( + nameOrSignature: "l1Bridge" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "l1TokenAddress" + ): TypedContractMethod<[_l2Token: AddressLike], [string], "view">; + getFunction( + nameOrSignature: "l2TokenAddress" + ): TypedContractMethod<[_l1Token: AddressLike], [string], "view">; + getFunction( + nameOrSignature: "withdraw" + ): TypedContractMethod< + [_l1Receiver: AddressLike, _l2Token: AddressLike, _amount: BigNumberish], + [void], + "nonpayable" + >; + + getEvent( + key: "FinalizeDeposit" + ): TypedContractEvent< + FinalizeDepositEvent.InputTuple, + FinalizeDepositEvent.OutputTuple, + FinalizeDepositEvent.OutputObject + >; + getEvent( + key: "WithdrawalInitiated" + ): TypedContractEvent< + WithdrawalInitiatedEvent.InputTuple, + WithdrawalInitiatedEvent.OutputTuple, + WithdrawalInitiatedEvent.OutputObject + >; + + filters: { + "FinalizeDeposit(address,address,address,uint256)": TypedContractEvent< + FinalizeDepositEvent.InputTuple, + FinalizeDepositEvent.OutputTuple, + FinalizeDepositEvent.OutputObject + >; + FinalizeDeposit: TypedContractEvent< + FinalizeDepositEvent.InputTuple, + FinalizeDepositEvent.OutputTuple, + FinalizeDepositEvent.OutputObject + >; + + "WithdrawalInitiated(address,address,address,uint256)": TypedContractEvent< + WithdrawalInitiatedEvent.InputTuple, + WithdrawalInitiatedEvent.OutputTuple, + WithdrawalInitiatedEvent.OutputObject + >; + WithdrawalInitiated: TypedContractEvent< + WithdrawalInitiatedEvent.InputTuple, + WithdrawalInitiatedEvent.OutputTuple, + WithdrawalInitiatedEvent.OutputObject + >; + }; +} diff --git a/typechain/IPaymasterFlow.ts b/typechain/IPaymasterFlow.ts new file mode 100644 index 0000000..adf54dd --- /dev/null +++ b/typechain/IPaymasterFlow.ts @@ -0,0 +1,107 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface IPaymasterFlowInterface extends Interface { + getFunction(nameOrSignature: "approvalBased" | "general"): FunctionFragment; + + encodeFunctionData( + functionFragment: "approvalBased", + values: [AddressLike, BigNumberish, BytesLike] + ): string; + encodeFunctionData(functionFragment: "general", values: [BytesLike]): string; + + decodeFunctionResult( + functionFragment: "approvalBased", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "general", data: BytesLike): Result; +} + +export interface IPaymasterFlow extends BaseContract { + connect(runner?: ContractRunner | null): IPaymasterFlow; + waitForDeployment(): Promise; + + interface: IPaymasterFlowInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + approvalBased: TypedContractMethod< + [_token: AddressLike, _minAllowance: BigNumberish, _innerInput: BytesLike], + [void], + "nonpayable" + >; + + general: TypedContractMethod<[input: BytesLike], [void], "nonpayable">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "approvalBased" + ): TypedContractMethod< + [_token: AddressLike, _minAllowance: BigNumberish, _innerInput: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "general" + ): TypedContractMethod<[input: BytesLike], [void], "nonpayable">; + + filters: {}; +} diff --git a/typechain/IZkSync.ts b/typechain/IZkSync.ts new file mode 100644 index 0000000..ba4c04c --- /dev/null +++ b/typechain/IZkSync.ts @@ -0,0 +1,2335 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export type VerifierParamsStruct = { + recursionNodeLevelVkHash: BytesLike; + recursionLeafLevelVkHash: BytesLike; + recursionCircuitsSetVksHash: BytesLike; +}; + +export type VerifierParamsStructOutput = [ + recursionNodeLevelVkHash: string, + recursionLeafLevelVkHash: string, + recursionCircuitsSetVksHash: string +] & { + recursionNodeLevelVkHash: string; + recursionLeafLevelVkHash: string; + recursionCircuitsSetVksHash: string; +}; + +export type PriorityOperationStruct = { + canonicalTxHash: BytesLike; + expirationTimestamp: BigNumberish; + layer2Tip: BigNumberish; +}; + +export type PriorityOperationStructOutput = [ + canonicalTxHash: string, + expirationTimestamp: bigint, + layer2Tip: bigint +] & { canonicalTxHash: string; expirationTimestamp: bigint; layer2Tip: bigint }; + +export type L2LogStruct = { + l2ShardId: BigNumberish; + isService: boolean; + txNumberInBlock: BigNumberish; + sender: AddressLike; + key: BytesLike; + value: BytesLike; +}; + +export type L2LogStructOutput = [ + l2ShardId: bigint, + isService: boolean, + txNumberInBlock: bigint, + sender: string, + key: string, + value: string +] & { + l2ShardId: bigint; + isService: boolean; + txNumberInBlock: bigint; + sender: string; + key: string; + value: string; +}; + +export type L2MessageStruct = { + txNumberInBlock: BigNumberish; + sender: AddressLike; + data: BytesLike; +}; + +export type L2MessageStructOutput = [ + txNumberInBlock: bigint, + sender: string, + data: string +] & { txNumberInBlock: bigint; sender: string; data: string }; + +export declare namespace IMailbox { + export type L2CanonicalTransactionStruct = { + txType: BigNumberish; + from: BigNumberish; + to: BigNumberish; + gasLimit: BigNumberish; + gasPerPubdataByteLimit: BigNumberish; + maxFeePerGas: BigNumberish; + maxPriorityFeePerGas: BigNumberish; + paymaster: BigNumberish; + nonce: BigNumberish; + value: BigNumberish; + reserved: [BigNumberish, BigNumberish, BigNumberish, BigNumberish]; + data: BytesLike; + signature: BytesLike; + factoryDeps: BigNumberish[]; + paymasterInput: BytesLike; + reservedDynamic: BytesLike; + }; + + export type L2CanonicalTransactionStructOutput = [ + txType: bigint, + from: bigint, + to: bigint, + gasLimit: bigint, + gasPerPubdataByteLimit: bigint, + maxFeePerGas: bigint, + maxPriorityFeePerGas: bigint, + paymaster: bigint, + nonce: bigint, + value: bigint, + reserved: [bigint, bigint, bigint, bigint], + data: string, + signature: string, + factoryDeps: bigint[], + paymasterInput: string, + reservedDynamic: string + ] & { + txType: bigint; + from: bigint; + to: bigint; + gasLimit: bigint; + gasPerPubdataByteLimit: bigint; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + paymaster: bigint; + nonce: bigint; + value: bigint; + reserved: [bigint, bigint, bigint, bigint]; + data: string; + signature: string; + factoryDeps: bigint[]; + paymasterInput: string; + reservedDynamic: string; + }; +} + +export declare namespace Diamond { + export type FacetCutStruct = { + facet: AddressLike; + action: BigNumberish; + isFreezable: boolean; + selectors: BytesLike[]; + }; + + export type FacetCutStructOutput = [ + facet: string, + action: bigint, + isFreezable: boolean, + selectors: string[] + ] & { + facet: string; + action: bigint; + isFreezable: boolean; + selectors: string[]; + }; + + export type DiamondCutDataStruct = { + facetCuts: Diamond.FacetCutStruct[]; + initAddress: AddressLike; + initCalldata: BytesLike; + }; + + export type DiamondCutDataStructOutput = [ + facetCuts: Diamond.FacetCutStructOutput[], + initAddress: string, + initCalldata: string + ] & { + facetCuts: Diamond.FacetCutStructOutput[]; + initAddress: string; + initCalldata: string; + }; +} + +export declare namespace IExecutor { + export type StoredBlockInfoStruct = { + blockNumber: BigNumberish; + blockHash: BytesLike; + indexRepeatedStorageChanges: BigNumberish; + numberOfLayer1Txs: BigNumberish; + priorityOperationsHash: BytesLike; + l2LogsTreeRoot: BytesLike; + timestamp: BigNumberish; + commitment: BytesLike; + }; + + export type StoredBlockInfoStructOutput = [ + blockNumber: bigint, + blockHash: string, + indexRepeatedStorageChanges: bigint, + numberOfLayer1Txs: bigint, + priorityOperationsHash: string, + l2LogsTreeRoot: string, + timestamp: bigint, + commitment: string + ] & { + blockNumber: bigint; + blockHash: string; + indexRepeatedStorageChanges: bigint; + numberOfLayer1Txs: bigint; + priorityOperationsHash: string; + l2LogsTreeRoot: string; + timestamp: bigint; + commitment: string; + }; + + export type CommitBlockInfoStruct = { + blockNumber: BigNumberish; + timestamp: BigNumberish; + indexRepeatedStorageChanges: BigNumberish; + newStateRoot: BytesLike; + numberOfLayer1Txs: BigNumberish; + l2LogsTreeRoot: BytesLike; + priorityOperationsHash: BytesLike; + initialStorageChanges: BytesLike; + repeatedStorageChanges: BytesLike; + l2Logs: BytesLike; + l2ArbitraryLengthMessages: BytesLike[]; + factoryDeps: BytesLike[]; + }; + + export type CommitBlockInfoStructOutput = [ + blockNumber: bigint, + timestamp: bigint, + indexRepeatedStorageChanges: bigint, + newStateRoot: string, + numberOfLayer1Txs: bigint, + l2LogsTreeRoot: string, + priorityOperationsHash: string, + initialStorageChanges: string, + repeatedStorageChanges: string, + l2Logs: string, + l2ArbitraryLengthMessages: string[], + factoryDeps: string[] + ] & { + blockNumber: bigint; + timestamp: bigint; + indexRepeatedStorageChanges: bigint; + newStateRoot: string; + numberOfLayer1Txs: bigint; + l2LogsTreeRoot: string; + priorityOperationsHash: string; + initialStorageChanges: string; + repeatedStorageChanges: string; + l2Logs: string; + l2ArbitraryLengthMessages: string[]; + factoryDeps: string[]; + }; + + export type ProofInputStruct = { + recursiveAggregationInput: BigNumberish[]; + serializedProof: BigNumberish[]; + }; + + export type ProofInputStructOutput = [ + recursiveAggregationInput: bigint[], + serializedProof: bigint[] + ] & { recursiveAggregationInput: bigint[]; serializedProof: bigint[] }; +} + +export declare namespace IGetters { + export type FacetStruct = { addr: AddressLike; selectors: BytesLike[] }; + + export type FacetStructOutput = [addr: string, selectors: string[]] & { + addr: string; + selectors: string[]; + }; +} + +export interface IZkSyncInterface extends Interface { + getFunction( + nameOrSignature: + | "acceptGovernor" + | "cancelUpgradeProposal" + | "commitBlocks" + | "executeBlocks" + | "executeUpgrade" + | "facetAddress" + | "facetAddresses" + | "facetFunctionSelectors" + | "facets" + | "finalizeEthWithdrawal" + | "freezeDiamond" + | "getAllowList" + | "getCurrentProposalId" + | "getFirstUnprocessedPriorityTx" + | "getGovernor" + | "getL2BootloaderBytecodeHash" + | "getL2DefaultAccountBytecodeHash" + | "getPendingGovernor" + | "getPriorityQueueSize" + | "getPriorityTxMaxGasLimit" + | "getProposedUpgradeHash" + | "getProposedUpgradeTimestamp" + | "getSecurityCouncil" + | "getTotalBlocksCommitted" + | "getTotalBlocksExecuted" + | "getTotalBlocksVerified" + | "getTotalPriorityTxs" + | "getUpgradeProposalState" + | "getVerifier" + | "getVerifierParams" + | "isApprovedBySecurityCouncil" + | "isDiamondStorageFrozen" + | "isEthWithdrawalFinalized" + | "isFacetFreezable" + | "isFunctionFreezable" + | "isValidator" + | "l2LogsRootHash" + | "l2TransactionBaseCost" + | "priorityQueueFrontOperation" + | "proposeShadowUpgrade" + | "proposeTransparentUpgrade" + | "proveBlocks" + | "proveL1ToL2TransactionStatus" + | "proveL2LogInclusion" + | "proveL2MessageInclusion" + | "requestL2Transaction" + | "revertBlocks" + | "securityCouncilUpgradeApprove" + | "setAllowList" + | "setL2BootloaderBytecodeHash" + | "setL2DefaultAccountBytecodeHash" + | "setPendingGovernor" + | "setPorterAvailability" + | "setPriorityTxMaxGasLimit" + | "setValidator" + | "setVerifier" + | "setVerifierParams" + | "storedBlockHash" + | "unfreezeDiamond" + | "upgradeProposalHash" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: + | "BlockCommit" + | "BlockExecution" + | "BlocksRevert" + | "BlocksVerification" + | "CancelUpgradeProposal" + | "EthWithdrawalFinalized" + | "ExecuteUpgrade" + | "Freeze" + | "IsPorterAvailableStatusUpdate" + | "NewAllowList" + | "NewGovernor" + | "NewL2BootloaderBytecodeHash" + | "NewL2DefaultAccountBytecodeHash" + | "NewPendingGovernor" + | "NewPriorityRequest" + | "NewPriorityTxMaxGasLimit" + | "NewVerifier" + | "NewVerifierParams" + | "ProposeShadowUpgrade" + | "ProposeTransparentUpgrade" + | "SecurityCouncilUpgradeApprove" + | "Unfreeze" + | "ValidatorStatusUpdate" + ): EventFragment; + + encodeFunctionData( + functionFragment: "acceptGovernor", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "cancelUpgradeProposal", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "commitBlocks", + values: [IExecutor.StoredBlockInfoStruct, IExecutor.CommitBlockInfoStruct[]] + ): string; + encodeFunctionData( + functionFragment: "executeBlocks", + values: [IExecutor.StoredBlockInfoStruct[]] + ): string; + encodeFunctionData( + functionFragment: "executeUpgrade", + values: [Diamond.DiamondCutDataStruct, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "facetAddress", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "facetAddresses", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "facetFunctionSelectors", + values: [AddressLike] + ): string; + encodeFunctionData(functionFragment: "facets", values?: undefined): string; + encodeFunctionData( + functionFragment: "finalizeEthWithdrawal", + values: [BigNumberish, BigNumberish, BigNumberish, BytesLike, BytesLike[]] + ): string; + encodeFunctionData( + functionFragment: "freezeDiamond", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getAllowList", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getCurrentProposalId", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getFirstUnprocessedPriorityTx", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getGovernor", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getL2BootloaderBytecodeHash", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getL2DefaultAccountBytecodeHash", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getPendingGovernor", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getPriorityQueueSize", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getPriorityTxMaxGasLimit", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getProposedUpgradeHash", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getProposedUpgradeTimestamp", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getSecurityCouncil", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getTotalBlocksCommitted", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getTotalBlocksExecuted", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getTotalBlocksVerified", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getTotalPriorityTxs", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getUpgradeProposalState", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getVerifier", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getVerifierParams", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "isApprovedBySecurityCouncil", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "isDiamondStorageFrozen", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "isEthWithdrawalFinalized", + values: [BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "isFacetFreezable", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "isFunctionFreezable", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "isValidator", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "l2LogsRootHash", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "l2TransactionBaseCost", + values: [BigNumberish, BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "priorityQueueFrontOperation", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "proposeShadowUpgrade", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "proposeTransparentUpgrade", + values: [Diamond.DiamondCutDataStruct, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "proveBlocks", + values: [ + IExecutor.StoredBlockInfoStruct, + IExecutor.StoredBlockInfoStruct[], + IExecutor.ProofInputStruct + ] + ): string; + encodeFunctionData( + functionFragment: "proveL1ToL2TransactionStatus", + values: [ + BytesLike, + BigNumberish, + BigNumberish, + BigNumberish, + BytesLike[], + BigNumberish + ] + ): string; + encodeFunctionData( + functionFragment: "proveL2LogInclusion", + values: [BigNumberish, BigNumberish, L2LogStruct, BytesLike[]] + ): string; + encodeFunctionData( + functionFragment: "proveL2MessageInclusion", + values: [BigNumberish, BigNumberish, L2MessageStruct, BytesLike[]] + ): string; + encodeFunctionData( + functionFragment: "requestL2Transaction", + values: [ + AddressLike, + BigNumberish, + BytesLike, + BigNumberish, + BigNumberish, + BytesLike[], + AddressLike + ] + ): string; + encodeFunctionData( + functionFragment: "revertBlocks", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "securityCouncilUpgradeApprove", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setAllowList", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setL2BootloaderBytecodeHash", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setL2DefaultAccountBytecodeHash", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "setPendingGovernor", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setPorterAvailability", + values: [boolean] + ): string; + encodeFunctionData( + functionFragment: "setPriorityTxMaxGasLimit", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setValidator", + values: [AddressLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "setVerifier", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "setVerifierParams", + values: [VerifierParamsStruct] + ): string; + encodeFunctionData( + functionFragment: "storedBlockHash", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "unfreezeDiamond", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "upgradeProposalHash", + values: [Diamond.DiamondCutDataStruct, BigNumberish, BytesLike] + ): string; + + decodeFunctionResult( + functionFragment: "acceptGovernor", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "cancelUpgradeProposal", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "commitBlocks", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "executeBlocks", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "executeUpgrade", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "facetAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "facetAddresses", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "facetFunctionSelectors", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "facets", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "finalizeEthWithdrawal", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "freezeDiamond", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getAllowList", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getCurrentProposalId", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getFirstUnprocessedPriorityTx", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getGovernor", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getL2BootloaderBytecodeHash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getL2DefaultAccountBytecodeHash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getPendingGovernor", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getPriorityQueueSize", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getPriorityTxMaxGasLimit", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getProposedUpgradeHash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getProposedUpgradeTimestamp", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getSecurityCouncil", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTotalBlocksCommitted", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTotalBlocksExecuted", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTotalBlocksVerified", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTotalPriorityTxs", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getUpgradeProposalState", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getVerifier", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getVerifierParams", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isApprovedBySecurityCouncil", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isDiamondStorageFrozen", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isEthWithdrawalFinalized", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isFacetFreezable", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isFunctionFreezable", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isValidator", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "l2LogsRootHash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "l2TransactionBaseCost", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "priorityQueueFrontOperation", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "proposeShadowUpgrade", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "proposeTransparentUpgrade", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "proveBlocks", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "proveL1ToL2TransactionStatus", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "proveL2LogInclusion", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "proveL2MessageInclusion", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "requestL2Transaction", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "revertBlocks", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "securityCouncilUpgradeApprove", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setAllowList", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setL2BootloaderBytecodeHash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setL2DefaultAccountBytecodeHash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setPendingGovernor", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setPorterAvailability", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setPriorityTxMaxGasLimit", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setValidator", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setVerifier", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setVerifierParams", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "storedBlockHash", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "unfreezeDiamond", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "upgradeProposalHash", + data: BytesLike + ): Result; +} + +export namespace BlockCommitEvent { + export type InputTuple = [ + blockNumber: BigNumberish, + blockHash: BytesLike, + commitment: BytesLike + ]; + export type OutputTuple = [ + blockNumber: bigint, + blockHash: string, + commitment: string + ]; + export interface OutputObject { + blockNumber: bigint; + blockHash: string; + commitment: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace BlockExecutionEvent { + export type InputTuple = [ + blockNumber: BigNumberish, + blockHash: BytesLike, + commitment: BytesLike + ]; + export type OutputTuple = [ + blockNumber: bigint, + blockHash: string, + commitment: string + ]; + export interface OutputObject { + blockNumber: bigint; + blockHash: string; + commitment: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace BlocksRevertEvent { + export type InputTuple = [ + totalBlocksCommitted: BigNumberish, + totalBlocksVerified: BigNumberish, + totalBlocksExecuted: BigNumberish + ]; + export type OutputTuple = [ + totalBlocksCommitted: bigint, + totalBlocksVerified: bigint, + totalBlocksExecuted: bigint + ]; + export interface OutputObject { + totalBlocksCommitted: bigint; + totalBlocksVerified: bigint; + totalBlocksExecuted: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace BlocksVerificationEvent { + export type InputTuple = [ + previousLastVerifiedBlock: BigNumberish, + currentLastVerifiedBlock: BigNumberish + ]; + export type OutputTuple = [ + previousLastVerifiedBlock: bigint, + currentLastVerifiedBlock: bigint + ]; + export interface OutputObject { + previousLastVerifiedBlock: bigint; + currentLastVerifiedBlock: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace CancelUpgradeProposalEvent { + export type InputTuple = [proposalId: BigNumberish, proposalHash: BytesLike]; + export type OutputTuple = [proposalId: bigint, proposalHash: string]; + export interface OutputObject { + proposalId: bigint; + proposalHash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace EthWithdrawalFinalizedEvent { + export type InputTuple = [to: AddressLike, amount: BigNumberish]; + export type OutputTuple = [to: string, amount: bigint]; + export interface OutputObject { + to: string; + amount: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ExecuteUpgradeEvent { + export type InputTuple = [ + proposalId: BigNumberish, + proposalHash: BytesLike, + proposalSalt: BytesLike + ]; + export type OutputTuple = [ + proposalId: bigint, + proposalHash: string, + proposalSalt: string + ]; + export interface OutputObject { + proposalId: bigint; + proposalHash: string; + proposalSalt: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace FreezeEvent { + export type InputTuple = []; + export type OutputTuple = []; + export interface OutputObject {} + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace IsPorterAvailableStatusUpdateEvent { + export type InputTuple = [isPorterAvailable: boolean]; + export type OutputTuple = [isPorterAvailable: boolean]; + export interface OutputObject { + isPorterAvailable: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewAllowListEvent { + export type InputTuple = [ + oldAllowList: AddressLike, + newAllowList: AddressLike + ]; + export type OutputTuple = [oldAllowList: string, newAllowList: string]; + export interface OutputObject { + oldAllowList: string; + newAllowList: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewGovernorEvent { + export type InputTuple = [oldGovernor: AddressLike, newGovernor: AddressLike]; + export type OutputTuple = [oldGovernor: string, newGovernor: string]; + export interface OutputObject { + oldGovernor: string; + newGovernor: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewL2BootloaderBytecodeHashEvent { + export type InputTuple = [ + previousBytecodeHash: BytesLike, + newBytecodeHash: BytesLike + ]; + export type OutputTuple = [ + previousBytecodeHash: string, + newBytecodeHash: string + ]; + export interface OutputObject { + previousBytecodeHash: string; + newBytecodeHash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewL2DefaultAccountBytecodeHashEvent { + export type InputTuple = [ + previousBytecodeHash: BytesLike, + newBytecodeHash: BytesLike + ]; + export type OutputTuple = [ + previousBytecodeHash: string, + newBytecodeHash: string + ]; + export interface OutputObject { + previousBytecodeHash: string; + newBytecodeHash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewPendingGovernorEvent { + export type InputTuple = [ + oldPendingGovernor: AddressLike, + newPendingGovernor: AddressLike + ]; + export type OutputTuple = [ + oldPendingGovernor: string, + newPendingGovernor: string + ]; + export interface OutputObject { + oldPendingGovernor: string; + newPendingGovernor: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewPriorityRequestEvent { + export type InputTuple = [ + txId: BigNumberish, + txHash: BytesLike, + expirationTimestamp: BigNumberish, + transaction: IMailbox.L2CanonicalTransactionStruct, + factoryDeps: BytesLike[] + ]; + export type OutputTuple = [ + txId: bigint, + txHash: string, + expirationTimestamp: bigint, + transaction: IMailbox.L2CanonicalTransactionStructOutput, + factoryDeps: string[] + ]; + export interface OutputObject { + txId: bigint; + txHash: string; + expirationTimestamp: bigint; + transaction: IMailbox.L2CanonicalTransactionStructOutput; + factoryDeps: string[]; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewPriorityTxMaxGasLimitEvent { + export type InputTuple = [ + oldPriorityTxMaxGasLimit: BigNumberish, + newPriorityTxMaxGasLimit: BigNumberish + ]; + export type OutputTuple = [ + oldPriorityTxMaxGasLimit: bigint, + newPriorityTxMaxGasLimit: bigint + ]; + export interface OutputObject { + oldPriorityTxMaxGasLimit: bigint; + newPriorityTxMaxGasLimit: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewVerifierEvent { + export type InputTuple = [oldVerifier: AddressLike, newVerifier: AddressLike]; + export type OutputTuple = [oldVerifier: string, newVerifier: string]; + export interface OutputObject { + oldVerifier: string; + newVerifier: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace NewVerifierParamsEvent { + export type InputTuple = [ + oldVerifierParams: VerifierParamsStruct, + newVerifierParams: VerifierParamsStruct + ]; + export type OutputTuple = [ + oldVerifierParams: VerifierParamsStructOutput, + newVerifierParams: VerifierParamsStructOutput + ]; + export interface OutputObject { + oldVerifierParams: VerifierParamsStructOutput; + newVerifierParams: VerifierParamsStructOutput; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ProposeShadowUpgradeEvent { + export type InputTuple = [proposalId: BigNumberish, proposalHash: BytesLike]; + export type OutputTuple = [proposalId: bigint, proposalHash: string]; + export interface OutputObject { + proposalId: bigint; + proposalHash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ProposeTransparentUpgradeEvent { + export type InputTuple = [ + diamondCut: Diamond.DiamondCutDataStruct, + proposalId: BigNumberish, + proposalSalt: BytesLike + ]; + export type OutputTuple = [ + diamondCut: Diamond.DiamondCutDataStructOutput, + proposalId: bigint, + proposalSalt: string + ]; + export interface OutputObject { + diamondCut: Diamond.DiamondCutDataStructOutput; + proposalId: bigint; + proposalSalt: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace SecurityCouncilUpgradeApproveEvent { + export type InputTuple = [proposalId: BigNumberish, proposalHash: BytesLike]; + export type OutputTuple = [proposalId: bigint, proposalHash: string]; + export interface OutputObject { + proposalId: bigint; + proposalHash: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace UnfreezeEvent { + export type InputTuple = []; + export type OutputTuple = []; + export interface OutputObject {} + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace ValidatorStatusUpdateEvent { + export type InputTuple = [validatorAddress: AddressLike, isActive: boolean]; + export type OutputTuple = [validatorAddress: string, isActive: boolean]; + export interface OutputObject { + validatorAddress: string; + isActive: boolean; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface IZkSync extends BaseContract { + connect(runner?: ContractRunner | null): IZkSync; + waitForDeployment(): Promise; + + interface: IZkSyncInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + acceptGovernor: TypedContractMethod<[], [void], "nonpayable">; + + cancelUpgradeProposal: TypedContractMethod< + [_proposedUpgradeHash: BytesLike], + [void], + "nonpayable" + >; + + commitBlocks: TypedContractMethod< + [ + _lastCommittedBlockData: IExecutor.StoredBlockInfoStruct, + _newBlocksData: IExecutor.CommitBlockInfoStruct[] + ], + [void], + "nonpayable" + >; + + executeBlocks: TypedContractMethod< + [_blocksData: IExecutor.StoredBlockInfoStruct[]], + [void], + "nonpayable" + >; + + executeUpgrade: TypedContractMethod< + [_diamondCut: Diamond.DiamondCutDataStruct, _proposalSalt: BytesLike], + [void], + "nonpayable" + >; + + facetAddress: TypedContractMethod<[_selector: BytesLike], [string], "view">; + + facetAddresses: TypedContractMethod<[], [string[]], "view">; + + facetFunctionSelectors: TypedContractMethod< + [_facet: AddressLike], + [string[]], + "view" + >; + + facets: TypedContractMethod<[], [IGetters.FacetStructOutput[]], "view">; + + finalizeEthWithdrawal: TypedContractMethod< + [ + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _message: BytesLike, + _merkleProof: BytesLike[] + ], + [void], + "nonpayable" + >; + + freezeDiamond: TypedContractMethod<[], [void], "nonpayable">; + + getAllowList: TypedContractMethod<[], [string], "view">; + + getCurrentProposalId: TypedContractMethod<[], [bigint], "view">; + + getFirstUnprocessedPriorityTx: TypedContractMethod<[], [bigint], "view">; + + getGovernor: TypedContractMethod<[], [string], "view">; + + getL2BootloaderBytecodeHash: TypedContractMethod<[], [string], "view">; + + getL2DefaultAccountBytecodeHash: TypedContractMethod<[], [string], "view">; + + getPendingGovernor: TypedContractMethod<[], [string], "view">; + + getPriorityQueueSize: TypedContractMethod<[], [bigint], "view">; + + getPriorityTxMaxGasLimit: TypedContractMethod<[], [bigint], "view">; + + getProposedUpgradeHash: TypedContractMethod<[], [string], "view">; + + getProposedUpgradeTimestamp: TypedContractMethod<[], [bigint], "view">; + + getSecurityCouncil: TypedContractMethod<[], [string], "view">; + + getTotalBlocksCommitted: TypedContractMethod<[], [bigint], "view">; + + getTotalBlocksExecuted: TypedContractMethod<[], [bigint], "view">; + + getTotalBlocksVerified: TypedContractMethod<[], [bigint], "view">; + + getTotalPriorityTxs: TypedContractMethod<[], [bigint], "view">; + + getUpgradeProposalState: TypedContractMethod<[], [bigint], "view">; + + getVerifier: TypedContractMethod<[], [string], "view">; + + getVerifierParams: TypedContractMethod< + [], + [VerifierParamsStructOutput], + "view" + >; + + isApprovedBySecurityCouncil: TypedContractMethod<[], [boolean], "view">; + + isDiamondStorageFrozen: TypedContractMethod<[], [boolean], "view">; + + isEthWithdrawalFinalized: TypedContractMethod< + [_l2BlockNumber: BigNumberish, _l2MessageIndex: BigNumberish], + [boolean], + "view" + >; + + isFacetFreezable: TypedContractMethod< + [_facet: AddressLike], + [boolean], + "view" + >; + + isFunctionFreezable: TypedContractMethod< + [_selector: BytesLike], + [boolean], + "view" + >; + + isValidator: TypedContractMethod<[_address: AddressLike], [boolean], "view">; + + l2LogsRootHash: TypedContractMethod< + [_blockNumber: BigNumberish], + [string], + "view" + >; + + l2TransactionBaseCost: TypedContractMethod< + [ + _gasPrice: BigNumberish, + _l2GasLimit: BigNumberish, + _l2GasPerPubdataByteLimit: BigNumberish + ], + [bigint], + "view" + >; + + priorityQueueFrontOperation: TypedContractMethod< + [], + [PriorityOperationStructOutput], + "view" + >; + + proposeShadowUpgrade: TypedContractMethod< + [_proposalHash: BytesLike, _proposalId: BigNumberish], + [void], + "nonpayable" + >; + + proposeTransparentUpgrade: TypedContractMethod< + [_diamondCut: Diamond.DiamondCutDataStruct, _proposalId: BigNumberish], + [void], + "nonpayable" + >; + + proveBlocks: TypedContractMethod< + [ + _prevBlock: IExecutor.StoredBlockInfoStruct, + _committedBlocks: IExecutor.StoredBlockInfoStruct[], + _proof: IExecutor.ProofInputStruct + ], + [void], + "nonpayable" + >; + + proveL1ToL2TransactionStatus: TypedContractMethod< + [ + _l2TxHash: BytesLike, + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _merkleProof: BytesLike[], + _status: BigNumberish + ], + [boolean], + "view" + >; + + proveL2LogInclusion: TypedContractMethod< + [ + _blockNumber: BigNumberish, + _index: BigNumberish, + _log: L2LogStruct, + _proof: BytesLike[] + ], + [boolean], + "view" + >; + + proveL2MessageInclusion: TypedContractMethod< + [ + _blockNumber: BigNumberish, + _index: BigNumberish, + _message: L2MessageStruct, + _proof: BytesLike[] + ], + [boolean], + "view" + >; + + requestL2Transaction: TypedContractMethod< + [ + _contractL2: AddressLike, + _l2Value: BigNumberish, + _calldata: BytesLike, + _l2GasLimit: BigNumberish, + _l2GasPerPubdataByteLimit: BigNumberish, + _factoryDeps: BytesLike[], + _refundRecipient: AddressLike + ], + [string], + "payable" + >; + + revertBlocks: TypedContractMethod< + [_newLastBlock: BigNumberish], + [void], + "nonpayable" + >; + + securityCouncilUpgradeApprove: TypedContractMethod< + [_upgradeProposalHash: BytesLike], + [void], + "nonpayable" + >; + + setAllowList: TypedContractMethod< + [_newAllowList: AddressLike], + [void], + "nonpayable" + >; + + setL2BootloaderBytecodeHash: TypedContractMethod< + [_l2BootloaderBytecodeHash: BytesLike], + [void], + "nonpayable" + >; + + setL2DefaultAccountBytecodeHash: TypedContractMethod< + [_l2DefaultAccountBytecodeHash: BytesLike], + [void], + "nonpayable" + >; + + setPendingGovernor: TypedContractMethod< + [_newPendingGovernor: AddressLike], + [void], + "nonpayable" + >; + + setPorterAvailability: TypedContractMethod< + [_zkPorterIsAvailable: boolean], + [void], + "nonpayable" + >; + + setPriorityTxMaxGasLimit: TypedContractMethod< + [_newPriorityTxMaxGasLimit: BigNumberish], + [void], + "nonpayable" + >; + + setValidator: TypedContractMethod< + [_validator: AddressLike, _active: boolean], + [void], + "nonpayable" + >; + + setVerifier: TypedContractMethod< + [_newVerifier: AddressLike], + [void], + "nonpayable" + >; + + setVerifierParams: TypedContractMethod< + [_newVerifierParams: VerifierParamsStruct], + [void], + "nonpayable" + >; + + storedBlockHash: TypedContractMethod< + [_blockNumber: BigNumberish], + [string], + "view" + >; + + unfreezeDiamond: TypedContractMethod<[], [void], "nonpayable">; + + upgradeProposalHash: TypedContractMethod< + [ + _diamondCut: Diamond.DiamondCutDataStruct, + _proposalId: BigNumberish, + _salt: BytesLike + ], + [string], + "view" + >; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "acceptGovernor" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "cancelUpgradeProposal" + ): TypedContractMethod< + [_proposedUpgradeHash: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "commitBlocks" + ): TypedContractMethod< + [ + _lastCommittedBlockData: IExecutor.StoredBlockInfoStruct, + _newBlocksData: IExecutor.CommitBlockInfoStruct[] + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "executeBlocks" + ): TypedContractMethod< + [_blocksData: IExecutor.StoredBlockInfoStruct[]], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "executeUpgrade" + ): TypedContractMethod< + [_diamondCut: Diamond.DiamondCutDataStruct, _proposalSalt: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "facetAddress" + ): TypedContractMethod<[_selector: BytesLike], [string], "view">; + getFunction( + nameOrSignature: "facetAddresses" + ): TypedContractMethod<[], [string[]], "view">; + getFunction( + nameOrSignature: "facetFunctionSelectors" + ): TypedContractMethod<[_facet: AddressLike], [string[]], "view">; + getFunction( + nameOrSignature: "facets" + ): TypedContractMethod<[], [IGetters.FacetStructOutput[]], "view">; + getFunction( + nameOrSignature: "finalizeEthWithdrawal" + ): TypedContractMethod< + [ + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _message: BytesLike, + _merkleProof: BytesLike[] + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "freezeDiamond" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "getAllowList" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getCurrentProposalId" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getFirstUnprocessedPriorityTx" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getGovernor" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getL2BootloaderBytecodeHash" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getL2DefaultAccountBytecodeHash" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getPendingGovernor" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getPriorityQueueSize" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getPriorityTxMaxGasLimit" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getProposedUpgradeHash" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getProposedUpgradeTimestamp" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getSecurityCouncil" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getTotalBlocksCommitted" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getTotalBlocksExecuted" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getTotalBlocksVerified" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getTotalPriorityTxs" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getUpgradeProposalState" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "getVerifier" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "getVerifierParams" + ): TypedContractMethod<[], [VerifierParamsStructOutput], "view">; + getFunction( + nameOrSignature: "isApprovedBySecurityCouncil" + ): TypedContractMethod<[], [boolean], "view">; + getFunction( + nameOrSignature: "isDiamondStorageFrozen" + ): TypedContractMethod<[], [boolean], "view">; + getFunction( + nameOrSignature: "isEthWithdrawalFinalized" + ): TypedContractMethod< + [_l2BlockNumber: BigNumberish, _l2MessageIndex: BigNumberish], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "isFacetFreezable" + ): TypedContractMethod<[_facet: AddressLike], [boolean], "view">; + getFunction( + nameOrSignature: "isFunctionFreezable" + ): TypedContractMethod<[_selector: BytesLike], [boolean], "view">; + getFunction( + nameOrSignature: "isValidator" + ): TypedContractMethod<[_address: AddressLike], [boolean], "view">; + getFunction( + nameOrSignature: "l2LogsRootHash" + ): TypedContractMethod<[_blockNumber: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "l2TransactionBaseCost" + ): TypedContractMethod< + [ + _gasPrice: BigNumberish, + _l2GasLimit: BigNumberish, + _l2GasPerPubdataByteLimit: BigNumberish + ], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "priorityQueueFrontOperation" + ): TypedContractMethod<[], [PriorityOperationStructOutput], "view">; + getFunction( + nameOrSignature: "proposeShadowUpgrade" + ): TypedContractMethod< + [_proposalHash: BytesLike, _proposalId: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "proposeTransparentUpgrade" + ): TypedContractMethod< + [_diamondCut: Diamond.DiamondCutDataStruct, _proposalId: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "proveBlocks" + ): TypedContractMethod< + [ + _prevBlock: IExecutor.StoredBlockInfoStruct, + _committedBlocks: IExecutor.StoredBlockInfoStruct[], + _proof: IExecutor.ProofInputStruct + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "proveL1ToL2TransactionStatus" + ): TypedContractMethod< + [ + _l2TxHash: BytesLike, + _l2BlockNumber: BigNumberish, + _l2MessageIndex: BigNumberish, + _l2TxNumberInBlock: BigNumberish, + _merkleProof: BytesLike[], + _status: BigNumberish + ], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "proveL2LogInclusion" + ): TypedContractMethod< + [ + _blockNumber: BigNumberish, + _index: BigNumberish, + _log: L2LogStruct, + _proof: BytesLike[] + ], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "proveL2MessageInclusion" + ): TypedContractMethod< + [ + _blockNumber: BigNumberish, + _index: BigNumberish, + _message: L2MessageStruct, + _proof: BytesLike[] + ], + [boolean], + "view" + >; + getFunction( + nameOrSignature: "requestL2Transaction" + ): TypedContractMethod< + [ + _contractL2: AddressLike, + _l2Value: BigNumberish, + _calldata: BytesLike, + _l2GasLimit: BigNumberish, + _l2GasPerPubdataByteLimit: BigNumberish, + _factoryDeps: BytesLike[], + _refundRecipient: AddressLike + ], + [string], + "payable" + >; + getFunction( + nameOrSignature: "revertBlocks" + ): TypedContractMethod<[_newLastBlock: BigNumberish], [void], "nonpayable">; + getFunction( + nameOrSignature: "securityCouncilUpgradeApprove" + ): TypedContractMethod< + [_upgradeProposalHash: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setAllowList" + ): TypedContractMethod<[_newAllowList: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "setL2BootloaderBytecodeHash" + ): TypedContractMethod< + [_l2BootloaderBytecodeHash: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setL2DefaultAccountBytecodeHash" + ): TypedContractMethod< + [_l2DefaultAccountBytecodeHash: BytesLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setPendingGovernor" + ): TypedContractMethod< + [_newPendingGovernor: AddressLike], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setPorterAvailability" + ): TypedContractMethod<[_zkPorterIsAvailable: boolean], [void], "nonpayable">; + getFunction( + nameOrSignature: "setPriorityTxMaxGasLimit" + ): TypedContractMethod< + [_newPriorityTxMaxGasLimit: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setValidator" + ): TypedContractMethod< + [_validator: AddressLike, _active: boolean], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "setVerifier" + ): TypedContractMethod<[_newVerifier: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "setVerifierParams" + ): TypedContractMethod< + [_newVerifierParams: VerifierParamsStruct], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "storedBlockHash" + ): TypedContractMethod<[_blockNumber: BigNumberish], [string], "view">; + getFunction( + nameOrSignature: "unfreezeDiamond" + ): TypedContractMethod<[], [void], "nonpayable">; + getFunction( + nameOrSignature: "upgradeProposalHash" + ): TypedContractMethod< + [ + _diamondCut: Diamond.DiamondCutDataStruct, + _proposalId: BigNumberish, + _salt: BytesLike + ], + [string], + "view" + >; + + getEvent( + key: "BlockCommit" + ): TypedContractEvent< + BlockCommitEvent.InputTuple, + BlockCommitEvent.OutputTuple, + BlockCommitEvent.OutputObject + >; + getEvent( + key: "BlockExecution" + ): TypedContractEvent< + BlockExecutionEvent.InputTuple, + BlockExecutionEvent.OutputTuple, + BlockExecutionEvent.OutputObject + >; + getEvent( + key: "BlocksRevert" + ): TypedContractEvent< + BlocksRevertEvent.InputTuple, + BlocksRevertEvent.OutputTuple, + BlocksRevertEvent.OutputObject + >; + getEvent( + key: "BlocksVerification" + ): TypedContractEvent< + BlocksVerificationEvent.InputTuple, + BlocksVerificationEvent.OutputTuple, + BlocksVerificationEvent.OutputObject + >; + getEvent( + key: "CancelUpgradeProposal" + ): TypedContractEvent< + CancelUpgradeProposalEvent.InputTuple, + CancelUpgradeProposalEvent.OutputTuple, + CancelUpgradeProposalEvent.OutputObject + >; + getEvent( + key: "EthWithdrawalFinalized" + ): TypedContractEvent< + EthWithdrawalFinalizedEvent.InputTuple, + EthWithdrawalFinalizedEvent.OutputTuple, + EthWithdrawalFinalizedEvent.OutputObject + >; + getEvent( + key: "ExecuteUpgrade" + ): TypedContractEvent< + ExecuteUpgradeEvent.InputTuple, + ExecuteUpgradeEvent.OutputTuple, + ExecuteUpgradeEvent.OutputObject + >; + getEvent( + key: "Freeze" + ): TypedContractEvent< + FreezeEvent.InputTuple, + FreezeEvent.OutputTuple, + FreezeEvent.OutputObject + >; + getEvent( + key: "IsPorterAvailableStatusUpdate" + ): TypedContractEvent< + IsPorterAvailableStatusUpdateEvent.InputTuple, + IsPorterAvailableStatusUpdateEvent.OutputTuple, + IsPorterAvailableStatusUpdateEvent.OutputObject + >; + getEvent( + key: "NewAllowList" + ): TypedContractEvent< + NewAllowListEvent.InputTuple, + NewAllowListEvent.OutputTuple, + NewAllowListEvent.OutputObject + >; + getEvent( + key: "NewGovernor" + ): TypedContractEvent< + NewGovernorEvent.InputTuple, + NewGovernorEvent.OutputTuple, + NewGovernorEvent.OutputObject + >; + getEvent( + key: "NewL2BootloaderBytecodeHash" + ): TypedContractEvent< + NewL2BootloaderBytecodeHashEvent.InputTuple, + NewL2BootloaderBytecodeHashEvent.OutputTuple, + NewL2BootloaderBytecodeHashEvent.OutputObject + >; + getEvent( + key: "NewL2DefaultAccountBytecodeHash" + ): TypedContractEvent< + NewL2DefaultAccountBytecodeHashEvent.InputTuple, + NewL2DefaultAccountBytecodeHashEvent.OutputTuple, + NewL2DefaultAccountBytecodeHashEvent.OutputObject + >; + getEvent( + key: "NewPendingGovernor" + ): TypedContractEvent< + NewPendingGovernorEvent.InputTuple, + NewPendingGovernorEvent.OutputTuple, + NewPendingGovernorEvent.OutputObject + >; + getEvent( + key: "NewPriorityRequest" + ): TypedContractEvent< + NewPriorityRequestEvent.InputTuple, + NewPriorityRequestEvent.OutputTuple, + NewPriorityRequestEvent.OutputObject + >; + getEvent( + key: "NewPriorityTxMaxGasLimit" + ): TypedContractEvent< + NewPriorityTxMaxGasLimitEvent.InputTuple, + NewPriorityTxMaxGasLimitEvent.OutputTuple, + NewPriorityTxMaxGasLimitEvent.OutputObject + >; + getEvent( + key: "NewVerifier" + ): TypedContractEvent< + NewVerifierEvent.InputTuple, + NewVerifierEvent.OutputTuple, + NewVerifierEvent.OutputObject + >; + getEvent( + key: "NewVerifierParams" + ): TypedContractEvent< + NewVerifierParamsEvent.InputTuple, + NewVerifierParamsEvent.OutputTuple, + NewVerifierParamsEvent.OutputObject + >; + getEvent( + key: "ProposeShadowUpgrade" + ): TypedContractEvent< + ProposeShadowUpgradeEvent.InputTuple, + ProposeShadowUpgradeEvent.OutputTuple, + ProposeShadowUpgradeEvent.OutputObject + >; + getEvent( + key: "ProposeTransparentUpgrade" + ): TypedContractEvent< + ProposeTransparentUpgradeEvent.InputTuple, + ProposeTransparentUpgradeEvent.OutputTuple, + ProposeTransparentUpgradeEvent.OutputObject + >; + getEvent( + key: "SecurityCouncilUpgradeApprove" + ): TypedContractEvent< + SecurityCouncilUpgradeApproveEvent.InputTuple, + SecurityCouncilUpgradeApproveEvent.OutputTuple, + SecurityCouncilUpgradeApproveEvent.OutputObject + >; + getEvent( + key: "Unfreeze" + ): TypedContractEvent< + UnfreezeEvent.InputTuple, + UnfreezeEvent.OutputTuple, + UnfreezeEvent.OutputObject + >; + getEvent( + key: "ValidatorStatusUpdate" + ): TypedContractEvent< + ValidatorStatusUpdateEvent.InputTuple, + ValidatorStatusUpdateEvent.OutputTuple, + ValidatorStatusUpdateEvent.OutputObject + >; + + filters: { + "BlockCommit(uint256,bytes32,bytes32)": TypedContractEvent< + BlockCommitEvent.InputTuple, + BlockCommitEvent.OutputTuple, + BlockCommitEvent.OutputObject + >; + BlockCommit: TypedContractEvent< + BlockCommitEvent.InputTuple, + BlockCommitEvent.OutputTuple, + BlockCommitEvent.OutputObject + >; + + "BlockExecution(uint256,bytes32,bytes32)": TypedContractEvent< + BlockExecutionEvent.InputTuple, + BlockExecutionEvent.OutputTuple, + BlockExecutionEvent.OutputObject + >; + BlockExecution: TypedContractEvent< + BlockExecutionEvent.InputTuple, + BlockExecutionEvent.OutputTuple, + BlockExecutionEvent.OutputObject + >; + + "BlocksRevert(uint256,uint256,uint256)": TypedContractEvent< + BlocksRevertEvent.InputTuple, + BlocksRevertEvent.OutputTuple, + BlocksRevertEvent.OutputObject + >; + BlocksRevert: TypedContractEvent< + BlocksRevertEvent.InputTuple, + BlocksRevertEvent.OutputTuple, + BlocksRevertEvent.OutputObject + >; + + "BlocksVerification(uint256,uint256)": TypedContractEvent< + BlocksVerificationEvent.InputTuple, + BlocksVerificationEvent.OutputTuple, + BlocksVerificationEvent.OutputObject + >; + BlocksVerification: TypedContractEvent< + BlocksVerificationEvent.InputTuple, + BlocksVerificationEvent.OutputTuple, + BlocksVerificationEvent.OutputObject + >; + + "CancelUpgradeProposal(uint256,bytes32)": TypedContractEvent< + CancelUpgradeProposalEvent.InputTuple, + CancelUpgradeProposalEvent.OutputTuple, + CancelUpgradeProposalEvent.OutputObject + >; + CancelUpgradeProposal: TypedContractEvent< + CancelUpgradeProposalEvent.InputTuple, + CancelUpgradeProposalEvent.OutputTuple, + CancelUpgradeProposalEvent.OutputObject + >; + + "EthWithdrawalFinalized(address,uint256)": TypedContractEvent< + EthWithdrawalFinalizedEvent.InputTuple, + EthWithdrawalFinalizedEvent.OutputTuple, + EthWithdrawalFinalizedEvent.OutputObject + >; + EthWithdrawalFinalized: TypedContractEvent< + EthWithdrawalFinalizedEvent.InputTuple, + EthWithdrawalFinalizedEvent.OutputTuple, + EthWithdrawalFinalizedEvent.OutputObject + >; + + "ExecuteUpgrade(uint256,bytes32,bytes32)": TypedContractEvent< + ExecuteUpgradeEvent.InputTuple, + ExecuteUpgradeEvent.OutputTuple, + ExecuteUpgradeEvent.OutputObject + >; + ExecuteUpgrade: TypedContractEvent< + ExecuteUpgradeEvent.InputTuple, + ExecuteUpgradeEvent.OutputTuple, + ExecuteUpgradeEvent.OutputObject + >; + + "Freeze()": TypedContractEvent< + FreezeEvent.InputTuple, + FreezeEvent.OutputTuple, + FreezeEvent.OutputObject + >; + Freeze: TypedContractEvent< + FreezeEvent.InputTuple, + FreezeEvent.OutputTuple, + FreezeEvent.OutputObject + >; + + "IsPorterAvailableStatusUpdate(bool)": TypedContractEvent< + IsPorterAvailableStatusUpdateEvent.InputTuple, + IsPorterAvailableStatusUpdateEvent.OutputTuple, + IsPorterAvailableStatusUpdateEvent.OutputObject + >; + IsPorterAvailableStatusUpdate: TypedContractEvent< + IsPorterAvailableStatusUpdateEvent.InputTuple, + IsPorterAvailableStatusUpdateEvent.OutputTuple, + IsPorterAvailableStatusUpdateEvent.OutputObject + >; + + "NewAllowList(address,address)": TypedContractEvent< + NewAllowListEvent.InputTuple, + NewAllowListEvent.OutputTuple, + NewAllowListEvent.OutputObject + >; + NewAllowList: TypedContractEvent< + NewAllowListEvent.InputTuple, + NewAllowListEvent.OutputTuple, + NewAllowListEvent.OutputObject + >; + + "NewGovernor(address,address)": TypedContractEvent< + NewGovernorEvent.InputTuple, + NewGovernorEvent.OutputTuple, + NewGovernorEvent.OutputObject + >; + NewGovernor: TypedContractEvent< + NewGovernorEvent.InputTuple, + NewGovernorEvent.OutputTuple, + NewGovernorEvent.OutputObject + >; + + "NewL2BootloaderBytecodeHash(bytes32,bytes32)": TypedContractEvent< + NewL2BootloaderBytecodeHashEvent.InputTuple, + NewL2BootloaderBytecodeHashEvent.OutputTuple, + NewL2BootloaderBytecodeHashEvent.OutputObject + >; + NewL2BootloaderBytecodeHash: TypedContractEvent< + NewL2BootloaderBytecodeHashEvent.InputTuple, + NewL2BootloaderBytecodeHashEvent.OutputTuple, + NewL2BootloaderBytecodeHashEvent.OutputObject + >; + + "NewL2DefaultAccountBytecodeHash(bytes32,bytes32)": TypedContractEvent< + NewL2DefaultAccountBytecodeHashEvent.InputTuple, + NewL2DefaultAccountBytecodeHashEvent.OutputTuple, + NewL2DefaultAccountBytecodeHashEvent.OutputObject + >; + NewL2DefaultAccountBytecodeHash: TypedContractEvent< + NewL2DefaultAccountBytecodeHashEvent.InputTuple, + NewL2DefaultAccountBytecodeHashEvent.OutputTuple, + NewL2DefaultAccountBytecodeHashEvent.OutputObject + >; + + "NewPendingGovernor(address,address)": TypedContractEvent< + NewPendingGovernorEvent.InputTuple, + NewPendingGovernorEvent.OutputTuple, + NewPendingGovernorEvent.OutputObject + >; + NewPendingGovernor: TypedContractEvent< + NewPendingGovernorEvent.InputTuple, + NewPendingGovernorEvent.OutputTuple, + NewPendingGovernorEvent.OutputObject + >; + + "NewPriorityRequest(uint256,bytes32,uint64,tuple,bytes[])": TypedContractEvent< + NewPriorityRequestEvent.InputTuple, + NewPriorityRequestEvent.OutputTuple, + NewPriorityRequestEvent.OutputObject + >; + NewPriorityRequest: TypedContractEvent< + NewPriorityRequestEvent.InputTuple, + NewPriorityRequestEvent.OutputTuple, + NewPriorityRequestEvent.OutputObject + >; + + "NewPriorityTxMaxGasLimit(uint256,uint256)": TypedContractEvent< + NewPriorityTxMaxGasLimitEvent.InputTuple, + NewPriorityTxMaxGasLimitEvent.OutputTuple, + NewPriorityTxMaxGasLimitEvent.OutputObject + >; + NewPriorityTxMaxGasLimit: TypedContractEvent< + NewPriorityTxMaxGasLimitEvent.InputTuple, + NewPriorityTxMaxGasLimitEvent.OutputTuple, + NewPriorityTxMaxGasLimitEvent.OutputObject + >; + + "NewVerifier(address,address)": TypedContractEvent< + NewVerifierEvent.InputTuple, + NewVerifierEvent.OutputTuple, + NewVerifierEvent.OutputObject + >; + NewVerifier: TypedContractEvent< + NewVerifierEvent.InputTuple, + NewVerifierEvent.OutputTuple, + NewVerifierEvent.OutputObject + >; + + "NewVerifierParams(tuple,tuple)": TypedContractEvent< + NewVerifierParamsEvent.InputTuple, + NewVerifierParamsEvent.OutputTuple, + NewVerifierParamsEvent.OutputObject + >; + NewVerifierParams: TypedContractEvent< + NewVerifierParamsEvent.InputTuple, + NewVerifierParamsEvent.OutputTuple, + NewVerifierParamsEvent.OutputObject + >; + + "ProposeShadowUpgrade(uint256,bytes32)": TypedContractEvent< + ProposeShadowUpgradeEvent.InputTuple, + ProposeShadowUpgradeEvent.OutputTuple, + ProposeShadowUpgradeEvent.OutputObject + >; + ProposeShadowUpgrade: TypedContractEvent< + ProposeShadowUpgradeEvent.InputTuple, + ProposeShadowUpgradeEvent.OutputTuple, + ProposeShadowUpgradeEvent.OutputObject + >; + + "ProposeTransparentUpgrade(tuple,uint256,bytes32)": TypedContractEvent< + ProposeTransparentUpgradeEvent.InputTuple, + ProposeTransparentUpgradeEvent.OutputTuple, + ProposeTransparentUpgradeEvent.OutputObject + >; + ProposeTransparentUpgrade: TypedContractEvent< + ProposeTransparentUpgradeEvent.InputTuple, + ProposeTransparentUpgradeEvent.OutputTuple, + ProposeTransparentUpgradeEvent.OutputObject + >; + + "SecurityCouncilUpgradeApprove(uint256,bytes32)": TypedContractEvent< + SecurityCouncilUpgradeApproveEvent.InputTuple, + SecurityCouncilUpgradeApproveEvent.OutputTuple, + SecurityCouncilUpgradeApproveEvent.OutputObject + >; + SecurityCouncilUpgradeApprove: TypedContractEvent< + SecurityCouncilUpgradeApproveEvent.InputTuple, + SecurityCouncilUpgradeApproveEvent.OutputTuple, + SecurityCouncilUpgradeApproveEvent.OutputObject + >; + + "Unfreeze()": TypedContractEvent< + UnfreezeEvent.InputTuple, + UnfreezeEvent.OutputTuple, + UnfreezeEvent.OutputObject + >; + Unfreeze: TypedContractEvent< + UnfreezeEvent.InputTuple, + UnfreezeEvent.OutputTuple, + UnfreezeEvent.OutputObject + >; + + "ValidatorStatusUpdate(address,bool)": TypedContractEvent< + ValidatorStatusUpdateEvent.InputTuple, + ValidatorStatusUpdateEvent.OutputTuple, + ValidatorStatusUpdateEvent.OutputObject + >; + ValidatorStatusUpdate: TypedContractEvent< + ValidatorStatusUpdateEvent.InputTuple, + ValidatorStatusUpdateEvent.OutputTuple, + ValidatorStatusUpdateEvent.OutputObject + >; + }; +} diff --git a/typechain/common.ts b/typechain/common.ts new file mode 100644 index 0000000..56b5f21 --- /dev/null +++ b/typechain/common.ts @@ -0,0 +1,131 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + FunctionFragment, + Typed, + EventFragment, + ContractTransaction, + ContractTransactionResponse, + DeferredTopicFilter, + EventLog, + TransactionRequest, + LogDescription, +} from "ethers"; + +export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> + extends DeferredTopicFilter {} + +export interface TypedContractEvent< + InputTuple extends Array = any, + OutputTuple extends Array = any, + OutputObject = any +> { + (...args: Partial): TypedDeferredTopicFilter< + TypedContractEvent + >; + name: string; + fragment: EventFragment; + getFragment(...args: Partial): EventFragment; +} + +type __TypechainAOutputTuple = T extends TypedContractEvent< + infer _U, + infer W +> + ? W + : never; +type __TypechainOutputObject = T extends TypedContractEvent< + infer _U, + infer _W, + infer V +> + ? V + : never; + +export interface TypedEventLog + extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} + +export interface TypedLogDescription + extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} + +export type TypedListener = ( + ...listenerArg: [ + ...__TypechainAOutputTuple, + TypedEventLog, + ...undefined[] + ] +) => void; + +export type MinEthersFactory = { + deploy(...a: ARGS[]): Promise; +}; + +export type GetContractTypeFromFactory = F extends MinEthersFactory< + infer C, + any +> + ? C + : never; +export type GetARGsTypeFromFactory = F extends MinEthersFactory + ? Parameters + : never; + +export type StateMutability = "nonpayable" | "payable" | "view"; + +export type BaseOverrides = Omit; +export type NonPayableOverrides = Omit< + BaseOverrides, + "value" | "blockTag" | "enableCcipRead" +>; +export type PayableOverrides = Omit< + BaseOverrides, + "blockTag" | "enableCcipRead" +>; +export type ViewOverrides = Omit; +export type Overrides = S extends "nonpayable" + ? NonPayableOverrides + : S extends "payable" + ? PayableOverrides + : ViewOverrides; + +export type PostfixOverrides, S extends StateMutability> = + | A + | [...A, Overrides]; +export type ContractMethodArgs< + A extends Array, + S extends StateMutability +> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>; + +export type DefaultReturnType = R extends Array ? R[0] : R; + +// export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { +export interface TypedContractMethod< + A extends Array = Array, + R = any, + S extends StateMutability = "payable" +> { + (...args: ContractMethodArgs): S extends "view" + ? Promise> + : Promise; + + name: string; + + fragment: FunctionFragment; + + getFragment(...args: ContractMethodArgs): FunctionFragment; + + populateTransaction( + ...args: ContractMethodArgs + ): Promise; + staticCall( + ...args: ContractMethodArgs + ): Promise>; + send(...args: ContractMethodArgs): Promise; + estimateGas(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; +} diff --git a/typechain/factories/ContractDeployer__factory.ts b/typechain/factories/ContractDeployer__factory.ts new file mode 100644 index 0000000..636901d --- /dev/null +++ b/typechain/factories/ContractDeployer__factory.ts @@ -0,0 +1,433 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { + ContractDeployer, + ContractDeployerInterface, +} from "../ContractDeployer"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "accountAddress", + type: "address", + }, + { + indexed: false, + internalType: "enum IContractDeployer.AccountNonceOrdering", + name: "nonceOrdering", + type: "uint8", + }, + ], + name: "AccountNonceOrderingUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "accountAddress", + type: "address", + }, + { + indexed: false, + internalType: "enum IContractDeployer.AccountAbstractionVersion", + name: "aaVersion", + type: "uint8", + }, + ], + name: "AccountVersionUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "deployerAddress", + type: "address", + }, + { + indexed: true, + internalType: "bytes32", + name: "bytecodeHash", + type: "bytes32", + }, + { + indexed: true, + internalType: "address", + name: "contractAddress", + type: "address", + }, + ], + name: "ContractDeployed", + type: "event", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_salt", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "_bytecodeHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "_input", + type: "bytes", + }, + ], + name: "create", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_salt", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "_bytecodeHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "_input", + type: "bytes", + }, + ], + name: "create2", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_salt", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "_bytecodeHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "_input", + type: "bytes", + }, + { + internalType: "enum IContractDeployer.AccountAbstractionVersion", + name: "_aaVersion", + type: "uint8", + }, + ], + name: "create2Account", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "_bytecodeHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "_input", + type: "bytes", + }, + { + internalType: "enum IContractDeployer.AccountAbstractionVersion", + name: "_aaVersion", + type: "uint8", + }, + ], + name: "createAccount", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_address", + type: "address", + }, + ], + name: "extendedAccountVersion", + outputs: [ + { + internalType: "enum IContractDeployer.AccountAbstractionVersion", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "bytes32", + name: "bytecodeHash", + type: "bytes32", + }, + { + internalType: "address", + name: "newAddress", + type: "address", + }, + { + internalType: "bool", + name: "callConstructor", + type: "bool", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "input", + type: "bytes", + }, + ], + internalType: "struct ContractDeployer.ForceDeployment", + name: "_deployment", + type: "tuple", + }, + { + internalType: "address", + name: "_sender", + type: "address", + }, + ], + name: "forceDeployOnAddress", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "bytes32", + name: "bytecodeHash", + type: "bytes32", + }, + { + internalType: "address", + name: "newAddress", + type: "address", + }, + { + internalType: "bool", + name: "callConstructor", + type: "bool", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "input", + type: "bytes", + }, + ], + internalType: "struct ContractDeployer.ForceDeployment[]", + name: "_deployments", + type: "tuple[]", + }, + ], + name: "forceDeployOnAddresses", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_address", + type: "address", + }, + ], + name: "getAccountInfo", + outputs: [ + { + components: [ + { + internalType: "enum IContractDeployer.AccountAbstractionVersion", + name: "supportedAAVersion", + type: "uint8", + }, + { + internalType: "enum IContractDeployer.AccountNonceOrdering", + name: "nonceOrdering", + type: "uint8", + }, + ], + internalType: "struct IContractDeployer.AccountInfo", + name: "info", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_sender", + type: "address", + }, + { + internalType: "uint256", + name: "_senderNonce", + type: "uint256", + }, + ], + name: "getNewAddressCreate", + outputs: [ + { + internalType: "address", + name: "newAddress", + type: "address", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_sender", + type: "address", + }, + { + internalType: "bytes32", + name: "_bytecodeHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32", + }, + { + internalType: "bytes", + name: "_input", + type: "bytes", + }, + ], + name: "getNewAddressCreate2", + outputs: [ + { + internalType: "address", + name: "newAddress", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "enum IContractDeployer.AccountAbstractionVersion", + name: "_version", + type: "uint8", + }, + ], + name: "updateAccountVersion", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "enum IContractDeployer.AccountNonceOrdering", + name: "_nonceOrdering", + type: "uint8", + }, + ], + name: "updateNonceOrdering", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class ContractDeployer__factory { + static readonly abi = _abi; + static createInterface(): ContractDeployerInterface { + return new Interface(_abi) as ContractDeployerInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): ContractDeployer { + return new Contract(address, _abi, runner) as unknown as ContractDeployer; + } +} diff --git a/typechain/factories/IAllowList__factory.ts b/typechain/factories/IAllowList__factory.ts new file mode 100644 index 0000000..3f8218c --- /dev/null +++ b/typechain/factories/IAllowList__factory.ts @@ -0,0 +1,298 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IAllowList, IAllowListInterface } from "../IAllowList"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "target", + type: "address", + }, + { + indexed: false, + internalType: "enum IAllowList.AccessMode", + name: "previousMode", + type: "uint8", + }, + { + indexed: false, + internalType: "enum IAllowList.AccessMode", + name: "newMode", + type: "uint8", + }, + ], + name: "UpdateAccessMode", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "caller", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "target", + type: "address", + }, + { + indexed: true, + internalType: "bytes4", + name: "functionSig", + type: "bytes4", + }, + { + indexed: false, + internalType: "bool", + name: "status", + type: "bool", + }, + ], + name: "UpdateCallPermission", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "_caller", + type: "address", + }, + { + internalType: "address", + name: "_target", + type: "address", + }, + { + internalType: "bytes4", + name: "_functionSig", + type: "bytes4", + }, + ], + name: "canCall", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_target", + type: "address", + }, + ], + name: "getAccessMode", + outputs: [ + { + internalType: "enum IAllowList.AccessMode", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l1Token", + type: "address", + }, + ], + name: "getTokenDepositLimitData", + outputs: [ + { + components: [ + { + internalType: "bool", + name: "depositLimitation", + type: "bool", + }, + { + internalType: "uint256", + name: "depositCap", + type: "uint256", + }, + ], + internalType: "struct IAllowList.Deposit", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_caller", + type: "address", + }, + { + internalType: "address", + name: "_target", + type: "address", + }, + { + internalType: "bytes4", + name: "_functionSig", + type: "bytes4", + }, + ], + name: "hasSpecialAccessToCall", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_target", + type: "address", + }, + { + internalType: "enum IAllowList.AccessMode", + name: "_accessMode", + type: "uint8", + }, + ], + name: "setAccessMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "_targets", + type: "address[]", + }, + { + internalType: "enum IAllowList.AccessMode[]", + name: "_accessMode", + type: "uint8[]", + }, + ], + name: "setBatchAccessMode", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "_callers", + type: "address[]", + }, + { + internalType: "address[]", + name: "_targets", + type: "address[]", + }, + { + internalType: "bytes4[]", + name: "_functionSigs", + type: "bytes4[]", + }, + { + internalType: "bool[]", + name: "_enables", + type: "bool[]", + }, + ], + name: "setBatchPermissionToCall", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l1Token", + type: "address", + }, + { + internalType: "bool", + name: "_depositLimitation", + type: "bool", + }, + { + internalType: "uint256", + name: "_depositCap", + type: "uint256", + }, + ], + name: "setDepositLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_caller", + type: "address", + }, + { + internalType: "address", + name: "_target", + type: "address", + }, + { + internalType: "bytes4", + name: "_functionSig", + type: "bytes4", + }, + { + internalType: "bool", + name: "_enable", + type: "bool", + }, + ], + name: "setPermissionToCall", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class IAllowList__factory { + static readonly abi = _abi; + static createInterface(): IAllowListInterface { + return new Interface(_abi) as IAllowListInterface; + } + static connect(address: string, runner?: ContractRunner | null): IAllowList { + return new Contract(address, _abi, runner) as unknown as IAllowList; + } +} diff --git a/typechain/factories/IERC1271__factory.ts b/typechain/factories/IERC1271__factory.ts new file mode 100644 index 0000000..dc5bdef --- /dev/null +++ b/typechain/factories/IERC1271__factory.ts @@ -0,0 +1,43 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IERC1271, IERC1271Interface } from "../IERC1271"; + +const _abi = [ + { + inputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "isValidSignature", + outputs: [ + { + internalType: "bytes4", + name: "magicValue", + type: "bytes4", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +export class IERC1271__factory { + static readonly abi = _abi; + static createInterface(): IERC1271Interface { + return new Interface(_abi) as IERC1271Interface; + } + static connect(address: string, runner?: ContractRunner | null): IERC1271 { + return new Contract(address, _abi, runner) as unknown as IERC1271; + } +} diff --git a/typechain/factories/IERC20Metadata__factory.ts b/typechain/factories/IERC20Metadata__factory.ts new file mode 100644 index 0000000..3ed1fbc --- /dev/null +++ b/typechain/factories/IERC20Metadata__factory.ts @@ -0,0 +1,247 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { + IERC20Metadata, + IERC20MetadataInterface, +} from "../IERC20Metadata"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "spender", + type: "address", + }, + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class IERC20Metadata__factory { + static readonly abi = _abi; + static createInterface(): IERC20MetadataInterface { + return new Interface(_abi) as IERC20MetadataInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): IERC20Metadata { + return new Contract(address, _abi, runner) as unknown as IERC20Metadata; + } +} diff --git a/typechain/factories/IERC20__factory.ts b/typechain/factories/IERC20__factory.ts new file mode 100644 index 0000000..c078496 --- /dev/null +++ b/typechain/factories/IERC20__factory.ts @@ -0,0 +1,241 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IERC20, IERC20Interface } from "../IERC20"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "spender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + { + internalType: "address", + name: "spender", + type: "address", + }, + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address", + }, + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class IERC20__factory { + static readonly abi = _abi; + static createInterface(): IERC20Interface { + return new Interface(_abi) as IERC20Interface; + } + static connect(address: string, runner?: ContractRunner | null): IERC20 { + return new Contract(address, _abi, runner) as unknown as IERC20; + } +} diff --git a/typechain/factories/IEthToken__factory.ts b/typechain/factories/IEthToken__factory.ts new file mode 100644 index 0000000..01608b2 --- /dev/null +++ b/typechain/factories/IEthToken__factory.ts @@ -0,0 +1,213 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IEthToken, IEthTokenInterface } from "../IEthToken"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "Mint", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "_l2Sender", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "_l1Receiver", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "Withdrawal", + type: "event", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_account", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "mint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_from", + type: "address", + }, + { + internalType: "address", + name: "_to", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "transferFromTo", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l1Receiver", + type: "address", + }, + ], + name: "withdraw", + outputs: [], + stateMutability: "payable", + type: "function", + }, +] as const; + +export class IEthToken__factory { + static readonly abi = _abi; + static createInterface(): IEthTokenInterface { + return new Interface(_abi) as IEthTokenInterface; + } + static connect(address: string, runner?: ContractRunner | null): IEthToken { + return new Contract(address, _abi, runner) as unknown as IEthToken; + } +} diff --git a/typechain/factories/IL1Bridge__factory.ts b/typechain/factories/IL1Bridge__factory.ts new file mode 100644 index 0000000..6d12c9f --- /dev/null +++ b/typechain/factories/IL1Bridge__factory.ts @@ -0,0 +1,282 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IL1Bridge, IL1BridgeInterface } from "../IL1Bridge"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "l1Token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "ClaimedFailedDeposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "l2DepositTxHash", + type: "bytes32", + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "l1Token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "DepositInitiated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "l1Token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "WithdrawalFinalized", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "_depositSender", + type: "address", + }, + { + internalType: "address", + name: "_l1Token", + type: "address", + }, + { + internalType: "bytes32", + name: "_l2TxHash", + type: "bytes32", + }, + { + internalType: "uint256", + name: "_l2BlockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2MessageIndex", + type: "uint256", + }, + { + internalType: "uint16", + name: "_l2TxNumberInBlock", + type: "uint16", + }, + { + internalType: "bytes32[]", + name: "_merkleProof", + type: "bytes32[]", + }, + ], + name: "claimFailedDeposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l2Receiver", + type: "address", + }, + { + internalType: "address", + name: "_l1Token", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2TxGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2TxGasPerPubdataByte", + type: "uint256", + }, + { + internalType: "address", + name: "_refundRecipient", + type: "address", + }, + ], + name: "deposit", + outputs: [ + { + internalType: "bytes32", + name: "txHash", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_l2BlockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2MessageIndex", + type: "uint256", + }, + { + internalType: "uint16", + name: "_l2TxNumberInBlock", + type: "uint16", + }, + { + internalType: "bytes", + name: "_message", + type: "bytes", + }, + { + internalType: "bytes32[]", + name: "_merkleProof", + type: "bytes32[]", + }, + ], + name: "finalizeWithdrawal", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_l2BlockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2MessageIndex", + type: "uint256", + }, + ], + name: "isWithdrawalFinalized", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "l2Bridge", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l1Token", + type: "address", + }, + ], + name: "l2TokenAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +export class IL1Bridge__factory { + static readonly abi = _abi; + static createInterface(): IL1BridgeInterface { + return new Interface(_abi) as IL1BridgeInterface; + } + static connect(address: string, runner?: ContractRunner | null): IL1Bridge { + return new Contract(address, _abi, runner) as unknown as IL1Bridge; + } +} diff --git a/typechain/factories/IL1Messenger__factory.ts b/typechain/factories/IL1Messenger__factory.ts new file mode 100644 index 0000000..fb0142c --- /dev/null +++ b/typechain/factories/IL1Messenger__factory.ts @@ -0,0 +1,66 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IL1Messenger, IL1MessengerInterface } from "../IL1Messenger"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "_sender", + type: "address", + }, + { + indexed: true, + internalType: "bytes32", + name: "_hash", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes", + name: "_message", + type: "bytes", + }, + ], + name: "L1MessageSent", + type: "event", + }, + { + inputs: [ + { + internalType: "bytes", + name: "_message", + type: "bytes", + }, + ], + name: "sendToL1", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class IL1Messenger__factory { + static readonly abi = _abi; + static createInterface(): IL1MessengerInterface { + return new Interface(_abi) as IL1MessengerInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): IL1Messenger { + return new Contract(address, _abi, runner) as unknown as IL1Messenger; + } +} diff --git a/typechain/factories/IL2Bridge__factory.ts b/typechain/factories/IL2Bridge__factory.ts new file mode 100644 index 0000000..cebf56f --- /dev/null +++ b/typechain/factories/IL2Bridge__factory.ts @@ -0,0 +1,188 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IL2Bridge, IL2BridgeInterface } from "../IL2Bridge"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "l1Sender", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "l2Receiver", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "l2Token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "FinalizeDeposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "l2Sender", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "l1Receiver", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "l2Token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "WithdrawalInitiated", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "_l1Sender", + type: "address", + }, + { + internalType: "address", + name: "_l2Receiver", + type: "address", + }, + { + internalType: "address", + name: "_l1Token", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + { + internalType: "bytes", + name: "_data", + type: "bytes", + }, + ], + name: "finalizeDeposit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "l1Bridge", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l2Token", + type: "address", + }, + ], + name: "l1TokenAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l1Token", + type: "address", + }, + ], + name: "l2TokenAddress", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_l1Receiver", + type: "address", + }, + { + internalType: "address", + name: "_l2Token", + type: "address", + }, + { + internalType: "uint256", + name: "_amount", + type: "uint256", + }, + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class IL2Bridge__factory { + static readonly abi = _abi; + static createInterface(): IL2BridgeInterface { + return new Interface(_abi) as IL2BridgeInterface; + } + static connect(address: string, runner?: ContractRunner | null): IL2Bridge { + return new Contract(address, _abi, runner) as unknown as IL2Bridge; + } +} diff --git a/typechain/factories/IPaymasterFlow__factory.ts b/typechain/factories/IPaymasterFlow__factory.ts new file mode 100644 index 0000000..4abbb9d --- /dev/null +++ b/typechain/factories/IPaymasterFlow__factory.ts @@ -0,0 +1,61 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { + IPaymasterFlow, + IPaymasterFlowInterface, +} from "../IPaymasterFlow"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "_token", + type: "address", + }, + { + internalType: "uint256", + name: "_minAllowance", + type: "uint256", + }, + { + internalType: "bytes", + name: "_innerInput", + type: "bytes", + }, + ], + name: "approvalBased", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "input", + type: "bytes", + }, + ], + name: "general", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class IPaymasterFlow__factory { + static readonly abi = _abi; + static createInterface(): IPaymasterFlowInterface { + return new Interface(_abi) as IPaymasterFlowInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): IPaymasterFlow { + return new Contract(address, _abi, runner) as unknown as IPaymasterFlow; + } +} diff --git a/typechain/factories/IZkSync__factory.ts b/typechain/factories/IZkSync__factory.ts new file mode 100644 index 0000000..54da8ef --- /dev/null +++ b/typechain/factories/IZkSync__factory.ts @@ -0,0 +1,2109 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { IZkSync, IZkSyncInterface } from "../IZkSync"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "blockNumber", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32", + }, + ], + name: "BlockCommit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "blockNumber", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "commitment", + type: "bytes32", + }, + ], + name: "BlockExecution", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "totalBlocksCommitted", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "totalBlocksVerified", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "totalBlocksExecuted", + type: "uint256", + }, + ], + name: "BlocksRevert", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "previousLastVerifiedBlock", + type: "uint256", + }, + { + indexed: true, + internalType: "uint256", + name: "currentLastVerifiedBlock", + type: "uint256", + }, + ], + name: "BlocksVerification", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes32", + name: "proposalHash", + type: "bytes32", + }, + ], + name: "CancelUpgradeProposal", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "EthWithdrawalFinalized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes32", + name: "proposalHash", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes32", + name: "proposalSalt", + type: "bytes32", + }, + ], + name: "ExecuteUpgrade", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "Freeze", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bool", + name: "isPorterAvailable", + type: "bool", + }, + ], + name: "IsPorterAvailableStatusUpdate", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldAllowList", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newAllowList", + type: "address", + }, + ], + name: "NewAllowList", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldGovernor", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newGovernor", + type: "address", + }, + ], + name: "NewGovernor", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "previousBytecodeHash", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "newBytecodeHash", + type: "bytes32", + }, + ], + name: "NewL2BootloaderBytecodeHash", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "previousBytecodeHash", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "newBytecodeHash", + type: "bytes32", + }, + ], + name: "NewL2DefaultAccountBytecodeHash", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldPendingGovernor", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newPendingGovernor", + type: "address", + }, + ], + name: "NewPendingGovernor", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "txId", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "txHash", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint64", + name: "expirationTimestamp", + type: "uint64", + }, + { + components: [ + { + internalType: "uint256", + name: "txType", + type: "uint256", + }, + { + internalType: "uint256", + name: "from", + type: "uint256", + }, + { + internalType: "uint256", + name: "to", + type: "uint256", + }, + { + internalType: "uint256", + name: "gasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "gasPerPubdataByteLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxFeePerGas", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxPriorityFeePerGas", + type: "uint256", + }, + { + internalType: "uint256", + name: "paymaster", + type: "uint256", + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "uint256[4]", + name: "reserved", + type: "uint256[4]", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + { + internalType: "uint256[]", + name: "factoryDeps", + type: "uint256[]", + }, + { + internalType: "bytes", + name: "paymasterInput", + type: "bytes", + }, + { + internalType: "bytes", + name: "reservedDynamic", + type: "bytes", + }, + ], + indexed: false, + internalType: "struct IMailbox.L2CanonicalTransaction", + name: "transaction", + type: "tuple", + }, + { + indexed: false, + internalType: "bytes[]", + name: "factoryDeps", + type: "bytes[]", + }, + ], + name: "NewPriorityRequest", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "oldPriorityTxMaxGasLimit", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "newPriorityTxMaxGasLimit", + type: "uint256", + }, + ], + name: "NewPriorityTxMaxGasLimit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldVerifier", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newVerifier", + type: "address", + }, + ], + name: "NewVerifier", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + internalType: "bytes32", + name: "recursionNodeLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionLeafLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionCircuitsSetVksHash", + type: "bytes32", + }, + ], + indexed: false, + internalType: "struct VerifierParams", + name: "oldVerifierParams", + type: "tuple", + }, + { + components: [ + { + internalType: "bytes32", + name: "recursionNodeLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionLeafLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionCircuitsSetVksHash", + type: "bytes32", + }, + ], + indexed: false, + internalType: "struct VerifierParams", + name: "newVerifierParams", + type: "tuple", + }, + ], + name: "NewVerifierParams", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes32", + name: "proposalHash", + type: "bytes32", + }, + ], + name: "ProposeShadowUpgrade", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "facet", + type: "address", + }, + { + internalType: "enum Diamond.Action", + name: "action", + type: "uint8", + }, + { + internalType: "bool", + name: "isFreezable", + type: "bool", + }, + { + internalType: "bytes4[]", + name: "selectors", + type: "bytes4[]", + }, + ], + internalType: "struct Diamond.FacetCut[]", + name: "facetCuts", + type: "tuple[]", + }, + { + internalType: "address", + name: "initAddress", + type: "address", + }, + { + internalType: "bytes", + name: "initCalldata", + type: "bytes", + }, + ], + indexed: false, + internalType: "struct Diamond.DiamondCutData", + name: "diamondCut", + type: "tuple", + }, + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "proposalSalt", + type: "bytes32", + }, + ], + name: "ProposeTransparentUpgrade", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "proposalId", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes32", + name: "proposalHash", + type: "bytes32", + }, + ], + name: "SecurityCouncilUpgradeApprove", + type: "event", + }, + { + anonymous: false, + inputs: [], + name: "Unfreeze", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "validatorAddress", + type: "address", + }, + { + indexed: false, + internalType: "bool", + name: "isActive", + type: "bool", + }, + ], + name: "ValidatorStatusUpdate", + type: "event", + }, + { + inputs: [], + name: "acceptGovernor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_proposedUpgradeHash", + type: "bytes32", + }, + ], + name: "cancelUpgradeProposal", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint64", + name: "blockNumber", + type: "uint64", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + internalType: "uint64", + name: "indexRepeatedStorageChanges", + type: "uint64", + }, + { + internalType: "uint256", + name: "numberOfLayer1Txs", + type: "uint256", + }, + { + internalType: "bytes32", + name: "priorityOperationsHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "l2LogsTreeRoot", + type: "bytes32", + }, + { + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + { + internalType: "bytes32", + name: "commitment", + type: "bytes32", + }, + ], + internalType: "struct IExecutor.StoredBlockInfo", + name: "_lastCommittedBlockData", + type: "tuple", + }, + { + components: [ + { + internalType: "uint64", + name: "blockNumber", + type: "uint64", + }, + { + internalType: "uint64", + name: "timestamp", + type: "uint64", + }, + { + internalType: "uint64", + name: "indexRepeatedStorageChanges", + type: "uint64", + }, + { + internalType: "bytes32", + name: "newStateRoot", + type: "bytes32", + }, + { + internalType: "uint256", + name: "numberOfLayer1Txs", + type: "uint256", + }, + { + internalType: "bytes32", + name: "l2LogsTreeRoot", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "priorityOperationsHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "initialStorageChanges", + type: "bytes", + }, + { + internalType: "bytes", + name: "repeatedStorageChanges", + type: "bytes", + }, + { + internalType: "bytes", + name: "l2Logs", + type: "bytes", + }, + { + internalType: "bytes[]", + name: "l2ArbitraryLengthMessages", + type: "bytes[]", + }, + { + internalType: "bytes[]", + name: "factoryDeps", + type: "bytes[]", + }, + ], + internalType: "struct IExecutor.CommitBlockInfo[]", + name: "_newBlocksData", + type: "tuple[]", + }, + ], + name: "commitBlocks", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint64", + name: "blockNumber", + type: "uint64", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + internalType: "uint64", + name: "indexRepeatedStorageChanges", + type: "uint64", + }, + { + internalType: "uint256", + name: "numberOfLayer1Txs", + type: "uint256", + }, + { + internalType: "bytes32", + name: "priorityOperationsHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "l2LogsTreeRoot", + type: "bytes32", + }, + { + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + { + internalType: "bytes32", + name: "commitment", + type: "bytes32", + }, + ], + internalType: "struct IExecutor.StoredBlockInfo[]", + name: "_blocksData", + type: "tuple[]", + }, + ], + name: "executeBlocks", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "facet", + type: "address", + }, + { + internalType: "enum Diamond.Action", + name: "action", + type: "uint8", + }, + { + internalType: "bool", + name: "isFreezable", + type: "bool", + }, + { + internalType: "bytes4[]", + name: "selectors", + type: "bytes4[]", + }, + ], + internalType: "struct Diamond.FacetCut[]", + name: "facetCuts", + type: "tuple[]", + }, + { + internalType: "address", + name: "initAddress", + type: "address", + }, + { + internalType: "bytes", + name: "initCalldata", + type: "bytes", + }, + ], + internalType: "struct Diamond.DiamondCutData", + name: "_diamondCut", + type: "tuple", + }, + { + internalType: "bytes32", + name: "_proposalSalt", + type: "bytes32", + }, + ], + name: "executeUpgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4", + }, + ], + name: "facetAddress", + outputs: [ + { + internalType: "address", + name: "facet", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "facetAddresses", + outputs: [ + { + internalType: "address[]", + name: "facets", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address", + }, + ], + name: "facetFunctionSelectors", + outputs: [ + { + internalType: "bytes4[]", + name: "", + type: "bytes4[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "facets", + outputs: [ + { + components: [ + { + internalType: "address", + name: "addr", + type: "address", + }, + { + internalType: "bytes4[]", + name: "selectors", + type: "bytes4[]", + }, + ], + internalType: "struct IGetters.Facet[]", + name: "", + type: "tuple[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_l2BlockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2MessageIndex", + type: "uint256", + }, + { + internalType: "uint16", + name: "_l2TxNumberInBlock", + type: "uint16", + }, + { + internalType: "bytes", + name: "_message", + type: "bytes", + }, + { + internalType: "bytes32[]", + name: "_merkleProof", + type: "bytes32[]", + }, + ], + name: "finalizeEthWithdrawal", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "freezeDiamond", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "getAllowList", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getCurrentProposalId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getFirstUnprocessedPriorityTx", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getGovernor", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getL2BootloaderBytecodeHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getL2DefaultAccountBytecodeHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getPendingGovernor", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getPriorityQueueSize", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getPriorityTxMaxGasLimit", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getProposedUpgradeHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getProposedUpgradeTimestamp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getSecurityCouncil", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getTotalBlocksCommitted", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getTotalBlocksExecuted", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getTotalBlocksVerified", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getTotalPriorityTxs", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getUpgradeProposalState", + outputs: [ + { + internalType: "enum UpgradeState", + name: "", + type: "uint8", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getVerifier", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getVerifierParams", + outputs: [ + { + components: [ + { + internalType: "bytes32", + name: "recursionNodeLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionLeafLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionCircuitsSetVksHash", + type: "bytes32", + }, + ], + internalType: "struct VerifierParams", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isApprovedBySecurityCouncil", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "isDiamondStorageFrozen", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_l2BlockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2MessageIndex", + type: "uint256", + }, + ], + name: "isEthWithdrawalFinalized", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_facet", + type: "address", + }, + ], + name: "isFacetFreezable", + outputs: [ + { + internalType: "bool", + name: "isFreezable", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_selector", + type: "bytes4", + }, + ], + name: "isFunctionFreezable", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_address", + type: "address", + }, + ], + name: "isValidator", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_blockNumber", + type: "uint256", + }, + ], + name: "l2LogsRootHash", + outputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_gasPrice", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2GasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2GasPerPubdataByteLimit", + type: "uint256", + }, + ], + name: "l2TransactionBaseCost", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "priorityQueueFrontOperation", + outputs: [ + { + components: [ + { + internalType: "bytes32", + name: "canonicalTxHash", + type: "bytes32", + }, + { + internalType: "uint64", + name: "expirationTimestamp", + type: "uint64", + }, + { + internalType: "uint192", + name: "layer2Tip", + type: "uint192", + }, + ], + internalType: "struct PriorityOperation", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_proposalHash", + type: "bytes32", + }, + { + internalType: "uint40", + name: "_proposalId", + type: "uint40", + }, + ], + name: "proposeShadowUpgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "facet", + type: "address", + }, + { + internalType: "enum Diamond.Action", + name: "action", + type: "uint8", + }, + { + internalType: "bool", + name: "isFreezable", + type: "bool", + }, + { + internalType: "bytes4[]", + name: "selectors", + type: "bytes4[]", + }, + ], + internalType: "struct Diamond.FacetCut[]", + name: "facetCuts", + type: "tuple[]", + }, + { + internalType: "address", + name: "initAddress", + type: "address", + }, + { + internalType: "bytes", + name: "initCalldata", + type: "bytes", + }, + ], + internalType: "struct Diamond.DiamondCutData", + name: "_diamondCut", + type: "tuple", + }, + { + internalType: "uint40", + name: "_proposalId", + type: "uint40", + }, + ], + name: "proposeTransparentUpgrade", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint64", + name: "blockNumber", + type: "uint64", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + internalType: "uint64", + name: "indexRepeatedStorageChanges", + type: "uint64", + }, + { + internalType: "uint256", + name: "numberOfLayer1Txs", + type: "uint256", + }, + { + internalType: "bytes32", + name: "priorityOperationsHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "l2LogsTreeRoot", + type: "bytes32", + }, + { + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + { + internalType: "bytes32", + name: "commitment", + type: "bytes32", + }, + ], + internalType: "struct IExecutor.StoredBlockInfo", + name: "_prevBlock", + type: "tuple", + }, + { + components: [ + { + internalType: "uint64", + name: "blockNumber", + type: "uint64", + }, + { + internalType: "bytes32", + name: "blockHash", + type: "bytes32", + }, + { + internalType: "uint64", + name: "indexRepeatedStorageChanges", + type: "uint64", + }, + { + internalType: "uint256", + name: "numberOfLayer1Txs", + type: "uint256", + }, + { + internalType: "bytes32", + name: "priorityOperationsHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "l2LogsTreeRoot", + type: "bytes32", + }, + { + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + { + internalType: "bytes32", + name: "commitment", + type: "bytes32", + }, + ], + internalType: "struct IExecutor.StoredBlockInfo[]", + name: "_committedBlocks", + type: "tuple[]", + }, + { + components: [ + { + internalType: "uint256[]", + name: "recursiveAggregationInput", + type: "uint256[]", + }, + { + internalType: "uint256[]", + name: "serializedProof", + type: "uint256[]", + }, + ], + internalType: "struct IExecutor.ProofInput", + name: "_proof", + type: "tuple", + }, + ], + name: "proveBlocks", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_l2TxHash", + type: "bytes32", + }, + { + internalType: "uint256", + name: "_l2BlockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2MessageIndex", + type: "uint256", + }, + { + internalType: "uint16", + name: "_l2TxNumberInBlock", + type: "uint16", + }, + { + internalType: "bytes32[]", + name: "_merkleProof", + type: "bytes32[]", + }, + { + internalType: "enum TxStatus", + name: "_status", + type: "uint8", + }, + ], + name: "proveL1ToL2TransactionStatus", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_blockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_index", + type: "uint256", + }, + { + components: [ + { + internalType: "uint8", + name: "l2ShardId", + type: "uint8", + }, + { + internalType: "bool", + name: "isService", + type: "bool", + }, + { + internalType: "uint16", + name: "txNumberInBlock", + type: "uint16", + }, + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "bytes32", + name: "key", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "value", + type: "bytes32", + }, + ], + internalType: "struct L2Log", + name: "_log", + type: "tuple", + }, + { + internalType: "bytes32[]", + name: "_proof", + type: "bytes32[]", + }, + ], + name: "proveL2LogInclusion", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_blockNumber", + type: "uint256", + }, + { + internalType: "uint256", + name: "_index", + type: "uint256", + }, + { + components: [ + { + internalType: "uint16", + name: "txNumberInBlock", + type: "uint16", + }, + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + internalType: "struct L2Message", + name: "_message", + type: "tuple", + }, + { + internalType: "bytes32[]", + name: "_proof", + type: "bytes32[]", + }, + ], + name: "proveL2MessageInclusion", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_contractL2", + type: "address", + }, + { + internalType: "uint256", + name: "_l2Value", + type: "uint256", + }, + { + internalType: "bytes", + name: "_calldata", + type: "bytes", + }, + { + internalType: "uint256", + name: "_l2GasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "_l2GasPerPubdataByteLimit", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "_factoryDeps", + type: "bytes[]", + }, + { + internalType: "address", + name: "_refundRecipient", + type: "address", + }, + ], + name: "requestL2Transaction", + outputs: [ + { + internalType: "bytes32", + name: "canonicalTxHash", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_newLastBlock", + type: "uint256", + }, + ], + name: "revertBlocks", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_upgradeProposalHash", + type: "bytes32", + }, + ], + name: "securityCouncilUpgradeApprove", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract IAllowList", + name: "_newAllowList", + type: "address", + }, + ], + name: "setAllowList", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_l2BootloaderBytecodeHash", + type: "bytes32", + }, + ], + name: "setL2BootloaderBytecodeHash", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "_l2DefaultAccountBytecodeHash", + type: "bytes32", + }, + ], + name: "setL2DefaultAccountBytecodeHash", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_newPendingGovernor", + type: "address", + }, + ], + name: "setPendingGovernor", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bool", + name: "_zkPorterIsAvailable", + type: "bool", + }, + ], + name: "setPorterAvailability", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_newPriorityTxMaxGasLimit", + type: "uint256", + }, + ], + name: "setPriorityTxMaxGasLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_validator", + type: "address", + }, + { + internalType: "bool", + name: "_active", + type: "bool", + }, + ], + name: "setValidator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "contract Verifier", + name: "_newVerifier", + type: "address", + }, + ], + name: "setVerifier", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "bytes32", + name: "recursionNodeLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionLeafLevelVkHash", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "recursionCircuitsSetVksHash", + type: "bytes32", + }, + ], + internalType: "struct VerifierParams", + name: "_newVerifierParams", + type: "tuple", + }, + ], + name: "setVerifierParams", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_blockNumber", + type: "uint256", + }, + ], + name: "storedBlockHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "unfreezeDiamond", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: "address", + name: "facet", + type: "address", + }, + { + internalType: "enum Diamond.Action", + name: "action", + type: "uint8", + }, + { + internalType: "bool", + name: "isFreezable", + type: "bool", + }, + { + internalType: "bytes4[]", + name: "selectors", + type: "bytes4[]", + }, + ], + internalType: "struct Diamond.FacetCut[]", + name: "facetCuts", + type: "tuple[]", + }, + { + internalType: "address", + name: "initAddress", + type: "address", + }, + { + internalType: "bytes", + name: "initCalldata", + type: "bytes", + }, + ], + internalType: "struct Diamond.DiamondCutData", + name: "_diamondCut", + type: "tuple", + }, + { + internalType: "uint256", + name: "_proposalId", + type: "uint256", + }, + { + internalType: "bytes32", + name: "_salt", + type: "bytes32", + }, + ], + name: "upgradeProposalHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, +] as const; + +export class IZkSync__factory { + static readonly abi = _abi; + static createInterface(): IZkSyncInterface { + return new Interface(_abi) as IZkSyncInterface; + } + static connect(address: string, runner?: ContractRunner | null): IZkSync { + return new Contract(address, _abi, runner) as unknown as IZkSync; + } +} diff --git a/typechain/factories/index.ts b/typechain/factories/index.ts new file mode 100644 index 0000000..0d909a8 --- /dev/null +++ b/typechain/factories/index.ts @@ -0,0 +1,13 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { ContractDeployer__factory } from "./ContractDeployer__factory"; +export { IAllowList__factory } from "./IAllowList__factory"; +export { IERC1271__factory } from "./IERC1271__factory"; +export { IERC20__factory } from "./IERC20__factory"; +export { IEthToken__factory } from "./IEthToken__factory"; +export { IL1Bridge__factory } from "./IL1Bridge__factory"; +export { IL1Messenger__factory } from "./IL1Messenger__factory"; +export { IL2Bridge__factory } from "./IL2Bridge__factory"; +export { IPaymasterFlow__factory } from "./IPaymasterFlow__factory"; +export { IZkSync__factory } from "./IZkSync__factory"; diff --git a/typechain/index.ts b/typechain/index.ts new file mode 100644 index 0000000..686f6ec --- /dev/null +++ b/typechain/index.ts @@ -0,0 +1,24 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { ContractDeployer } from "./ContractDeployer"; +export type { IAllowList } from "./IAllowList"; +export type { IERC1271 } from "./IERC1271"; +export type { IERC20 } from "./IERC20"; +export type { IEthToken } from "./IEthToken"; +export type { IL1Bridge } from "./IL1Bridge"; +export type { IL1Messenger } from "./IL1Messenger"; +export type { IL2Bridge } from "./IL2Bridge"; +export type { IPaymasterFlow } from "./IPaymasterFlow"; +export type { IZkSync } from "./IZkSync"; +export * as factories from "./factories"; +export { ContractDeployer__factory } from "./factories/ContractDeployer__factory"; +export { IAllowList__factory } from "./factories/IAllowList__factory"; +export { IERC1271__factory } from "./factories/IERC1271__factory"; +export { IERC20__factory } from "./factories/IERC20__factory"; +export { IEthToken__factory } from "./factories/IEthToken__factory"; +export { IL1Bridge__factory } from "./factories/IL1Bridge__factory"; +export { IL1Messenger__factory } from "./factories/IL1Messenger__factory"; +export { IL2Bridge__factory } from "./factories/IL2Bridge__factory"; +export { IPaymasterFlow__factory } from "./factories/IPaymasterFlow__factory"; +export { IZkSync__factory } from "./factories/IZkSync__factory"; diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..dc53dc4 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,987 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@adraffy/ens-normalize@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz#60111a5d9db45b2e5cbb6231b0bb8d97e8659316" + integrity sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg== + +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@noble/hashes@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" + integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== + +"@noble/secp256k1@1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" + integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw== + +"@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== + +"@typechain/ethers-v6@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@typechain/ethers-v6/-/ethers-v6-0.5.0.tgz#841a63a61272448b72dfc8f53d32d7813709ef62" + integrity sha512-wsz7AvbY5n2uVwpS2RHDYsW6wYOrhWxeTLFpxuzhO62w/ZDQEVIipArX731KA/hdqygP2zJ2RTkVXgzU1WrU1g== + dependencies: + lodash "^4.17.15" + ts-essentials "^7.0.1" + +"@types/chai@^4.3.5": + version "4.3.5" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.5.tgz#ae69bcbb1bebb68c4ac0b11e9d8ed04526b3562b" + integrity sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng== + +"@types/mocha@^10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.1.tgz#2f4f65bb08bc368ac39c96da7b2f09140b26851b" + integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q== + +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + +"@types/node@^20.5.2": + version "20.5.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.2.tgz#02850ed821c8113fd6ed9ae5c744b7f7cd6d6f51" + integrity sha512-5j/lXt7unfPOUlrKC34HIaedONleyLtwkKggiD/0uuMfT8gg2EOpg0dz4lCD15Ga7muC+1WzJZAjIB9simWd6Q== + +"@types/prettier@^2.1.1": + version "2.7.3" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" + integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== + +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + +acorn@^8.4.1: + version "8.10.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" + integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== + +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== + +ansi-colors@4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" + integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +array-back@^3.0.1, array-back@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0" + integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q== + +array-back@^4.0.1, array-back@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e" + integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg== + +assertion-error@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" + integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +binary-extensions@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" + integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +camelcase@^6.0.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +chai@^4.3.7: + version "4.3.7" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" + integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== + dependencies: + assertion-error "^1.1.0" + check-error "^1.0.2" + deep-eql "^4.1.2" + get-func-name "^2.0.0" + loupe "^2.3.1" + pathval "^1.1.1" + type-detect "^4.0.5" + +chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +check-error@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" + integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== + +chokidar@3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +command-line-args@^5.1.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e" + integrity sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg== + dependencies: + array-back "^3.1.0" + find-replace "^3.0.0" + lodash.camelcase "^4.3.0" + typical "^4.0.0" + +command-line-usage@^6.1.0: + version "6.1.3" + resolved "https://registry.yarnpkg.com/command-line-usage/-/command-line-usage-6.1.3.tgz#428fa5acde6a838779dfa30e44686f4b6761d957" + integrity sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw== + dependencies: + array-back "^4.0.2" + chalk "^2.4.2" + table-layout "^1.0.2" + typical "^5.2.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +debug@4.3.4, debug@^4.3.1: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + +deep-eql@^4.1.2: + version "4.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" + integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== + dependencies: + type-detect "^4.0.0" + +deep-extend@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +diff@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" + integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escape-string-regexp@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +ethers@^6.7.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.7.1.tgz#9c65e8b5d8e9ad77b7e8cf1c46099892cfafad49" + integrity sha512-qX5kxIFMfg1i+epfgb0xF4WM7IqapIIu50pOJ17aebkxxa4BacW5jFrQRmCJpDEg2ZK2oNtR5QjrQ1WDBF29dA== + dependencies: + "@adraffy/ens-normalize" "1.9.2" + "@noble/hashes" "1.1.2" + "@noble/secp256k1" "1.7.1" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.5.0" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-replace@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38" + integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ== + dependencies: + array-back "^3.0.1" + +find-up@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + +fs-extra@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-func-name@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" + integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig== + +glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob@7.1.7: + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +he@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== + +js-sha3@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + +js-yaml@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== + optionalDependencies: + graceful-fs "^4.1.6" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== + +lodash@^4.17.15: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +log-symbols@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== + dependencies: + chalk "^4.1.0" + is-unicode-supported "^0.1.0" + +loupe@^2.3.1: + version "2.3.6" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53" + integrity sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA== + dependencies: + get-func-name "^2.0.0" + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +minimatch@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" + integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== + dependencies: + brace-expansion "^2.0.1" + +minimatch@^3.0.4: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + +mocha@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" + integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== + dependencies: + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.5.3" + debug "4.3.4" + diff "5.0.0" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.2.0" + he "1.2.0" + js-yaml "4.1.0" + log-symbols "4.1.0" + minimatch "5.0.1" + ms "2.1.3" + nanoid "3.3.3" + serialize-javascript "6.0.0" + strip-json-comments "3.1.1" + supports-color "8.1.1" + workerpool "6.2.1" + yargs "16.2.0" + yargs-parser "20.2.4" + yargs-unparser "2.0.0" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +nanoid@3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" + integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== + +ncp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" + integrity sha512-zIdGUrPRFTUELUvr3Gmc7KZ2Sw/h1PiVM0Af/oHB6zgnV1ikqSfRk+TOufi79aHYCW3NiOXmr1BP5nWbzojLaA== + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +pathval@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" + integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== + +picomatch@^2.0.4, picomatch@^2.2.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +prettier@^2.3.1: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +reduce-flatten@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" + integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w== + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +safe-buffer@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +serialize-javascript@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" + integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== + dependencies: + randombytes "^2.1.0" + +string-format@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b" + integrity sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA== + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-json-comments@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +table-layout@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04" + integrity sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A== + dependencies: + array-back "^4.0.1" + deep-extend "~0.6.0" + typical "^5.2.0" + wordwrapjs "^4.0.0" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +ts-command-line-args@^2.2.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz#e64456b580d1d4f6d948824c274cf6fa5f45f7f0" + integrity sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw== + dependencies: + chalk "^4.1.0" + command-line-args "^5.1.1" + command-line-usage "^6.1.0" + string-format "^2.0.0" + +ts-essentials@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38" + integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ== + +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + +type-detect@^4.0.0, type-detect@^4.0.5: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +typechain@^8.3.1: + version "8.3.1" + resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.1.tgz#dccbc839b94877997536c356380eff7325395cfb" + integrity sha512-fA7clol2IP/56yq6vkMTR+4URF1nGjV82Wx6Rf09EsqD4tkzMAvEaqYxVFCavJm/1xaRga/oD55K+4FtuXwQOQ== + dependencies: + "@types/prettier" "^2.1.1" + debug "^4.3.1" + fs-extra "^7.0.0" + glob "7.1.7" + js-sha3 "^0.8.0" + lodash "^4.17.15" + mkdirp "^1.0.4" + prettier "^2.3.1" + ts-command-line-args "^2.2.0" + ts-essentials "^7.0.1" + +typescript@^5.1.6: + version "5.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" + integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== + +typical@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4" + integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw== + +typical@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" + integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== + +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + +wordwrapjs@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f" + integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA== + dependencies: + reduce-flatten "^2.0.0" + typical "^5.2.0" + +workerpool@6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" + integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yargs-parser@20.2.4: + version "20.2.4" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" + integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== + +yargs-parser@^20.2.2: + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==