From ae82e1bb10b8e3d7872e6fdae797972037cf888b Mon Sep 17 00:00:00 2001 From: Alexander Belokon Date: Tue, 8 Oct 2024 10:47:16 +0200 Subject: [PATCH 1/2] fix: remove console.log --- modules/shared/hooks/useEnsNames.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/shared/hooks/useEnsNames.ts b/modules/shared/hooks/useEnsNames.ts index 929cec5b..374b9615 100644 --- a/modules/shared/hooks/useEnsNames.ts +++ b/modules/shared/hooks/useEnsNames.ts @@ -21,7 +21,6 @@ export function useEnsNames(addresses: string[]) { const res = await Promise.all( addresses.map(address => provider.lookupAddress(address)), ) - console.info(res) return res }, ) From fe0d494091e86264ce235909e23cc8de8fd67a06 Mon Sep 17 00:00:00 2001 From: Alexander Belokon Date: Tue, 8 Oct 2024 10:47:48 +0200 Subject: [PATCH 2/2] feat: add `L1ERC20TokenBridge` to EVM script decoder --- abi/L1ERC20TokenBridge.abi.json | 756 +++++++++++++++++++++ modules/blockChain/contractAddresses.ts | 4 + modules/votes/hooks/useEvmScriptDecoder.ts | 1 + 3 files changed, 761 insertions(+) create mode 100644 abi/L1ERC20TokenBridge.abi.json diff --git a/abi/L1ERC20TokenBridge.abi.json b/abi/L1ERC20TokenBridge.abi.json new file mode 100644 index 00000000..91c6fae8 --- /dev/null +++ b/abi/L1ERC20TokenBridge.abi.json @@ -0,0 +1,756 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + }, + { "internalType": "address", "name": "admin_", "type": "address" }, + { "internalType": "bytes", "name": "data_", "type": "bytes" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "ErrorNotAdmin", "type": "error" }, + { "inputs": [], "name": "ErrorProxyIsOssified", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "ProxyOssified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { "stateMutability": "payable", "type": "fallback" }, + { + "inputs": [ + { "internalType": "address", "name": "newAdmin_", "type": "address" } + ], + "name": "proxy__changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxy__getAdmin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxy__getImplementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxy__getIsOssified", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxy__ossify", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation_", + "type": "address" + } + ], + "name": "proxy__upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation_", + "type": "address" + }, + { "internalType": "bytes", "name": "setupCalldata_", "type": "bytes" }, + { "internalType": "bool", "name": "forceCall_", "type": "bool" } + ], + "name": "proxy__upgradeToAndCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "stateMutability": "payable", "type": "receive" }, + { + "inputs": [ + { "internalType": "address", "name": "messenger_", "type": "address" }, + { + "internalType": "address", + "name": "l2TokenBridge_", + "type": "address" + }, + { + "internalType": "address", + "name": "l1TokenNonRebasable_", + "type": "address" + }, + { + "internalType": "address", + "name": "l1TokenRebasable_", + "type": "address" + }, + { + "internalType": "address", + "name": "l2TokenNonRebasable_", + "type": "address" + }, + { + "internalType": "address", + "name": "l2TokenRebasable_", + "type": "address" + }, + { + "internalType": "address", + "name": "accountingOracle_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "ErrorAccountIsZeroAddress", "type": "error" }, + { "inputs": [], "name": "ErrorAlreadyInitialized", "type": "error" }, + { + "inputs": [], + "name": "ErrorBridgingManagerIsNotInitialized", + "type": "error" + }, + { "inputs": [], "name": "ErrorDepositsDisabled", "type": "error" }, + { "inputs": [], "name": "ErrorDepositsEnabled", "type": "error" }, + { "inputs": [], "name": "ErrorSenderNotEOA", "type": "error" }, + { "inputs": [], "name": "ErrorUnauthorizedMessenger", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "l1Token", "type": "address" }, + { "internalType": "address", "name": "l2Token", "type": "address" } + ], + "name": "ErrorUnsupportedL1L2TokensPair", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "l2Token", "type": "address" } + ], + "name": "ErrorUnsupportedL2Token", + "type": "error" + }, + { "inputs": [], "name": "ErrorWithdrawalsDisabled", "type": "error" }, + { "inputs": [], "name": "ErrorWithdrawalsEnabled", "type": "error" }, + { "inputs": [], "name": "ErrorWrongCrossDomainSender", "type": "error" }, + { "inputs": [], "name": "ErrorZeroAddressAccountingOracle", "type": "error" }, + { "inputs": [], "name": "ErrorZeroAddressAdmin", "type": "error" }, + { + "inputs": [], + "name": "ErrorZeroAddressL1TokenNonRebasable", + "type": "error" + }, + { "inputs": [], "name": "ErrorZeroAddressL1TokenRebasable", "type": "error" }, + { "inputs": [], "name": "ErrorZeroAddressL2Bridge", "type": "error" }, + { + "inputs": [], + "name": "ErrorZeroAddressL2TokenNonRebasable", + "type": "error" + }, + { "inputs": [], "name": "ErrorZeroAddressL2TokenRebasable", "type": "error" }, + { "inputs": [], "name": "ErrorZeroAddressMessenger", "type": "error" }, + { "inputs": [], "name": "ErrorZeroAddressWstETH", "type": "error" }, + { "inputs": [], "name": "InvalidContractVersionIncrement", "type": "error" }, + { "inputs": [], "name": "NonZeroContractVersionOnInit", "type": "error" }, + { + "inputs": [ + { "internalType": "uint256", "name": "expected", "type": "uint256" }, + { "internalType": "uint256", "name": "received", "type": "uint256" } + ], + "name": "UnexpectedContractVersion", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "version", + "type": "uint256" + } + ], + "name": "ContractVersionSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "disabler", + "type": "address" + } + ], + "name": "DepositsDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "enabler", + "type": "address" + } + ], + "name": "DepositsEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_l2Token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "ERC20DepositInitiated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_l2Token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "ERC20WithdrawalFinalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "disabler", + "type": "address" + } + ], + "name": "WithdrawalsDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "enabler", + "type": "address" + } + ], + "name": "WithdrawalsEnabled", + "type": "event" + }, + { + "inputs": [], + "name": "ACCOUNTING_ORACLE", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEPOSITS_DISABLER_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEPOSITS_ENABLER_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GENESIS_TIME", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "L1_TOKEN_NON_REBASABLE", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "L1_TOKEN_REBASABLE", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "L2_TOKEN_NON_REBASABLE", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "L2_TOKEN_REBASABLE", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MESSENGER", + "outputs": [ + { + "internalType": "contract ICrossDomainMessenger", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SECONDS_PER_SLOT", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "TOKEN_RATE_DECIMALS", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WITHDRAWALS_DISABLER_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WITHDRAWALS_ENABLER_ROLE", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WSTETH", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "l1Token_", "type": "address" }, + { "internalType": "address", "name": "l2Token_", "type": "address" }, + { "internalType": "uint256", "name": "amount_", "type": "uint256" }, + { "internalType": "uint32", "name": "l2Gas_", "type": "uint32" }, + { "internalType": "bytes", "name": "data_", "type": "bytes" } + ], + "name": "depositERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "l1Token_", "type": "address" }, + { "internalType": "address", "name": "l2Token_", "type": "address" }, + { "internalType": "address", "name": "to_", "type": "address" }, + { "internalType": "uint256", "name": "amount_", "type": "uint256" }, + { "internalType": "uint32", "name": "l2Gas_", "type": "uint32" }, + { "internalType": "bytes", "name": "data_", "type": "bytes" } + ], + "name": "depositERC20To", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableDeposits", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableWithdrawals", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableDeposits", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableWithdrawals", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "l1Token_", "type": "address" }, + { "internalType": "address", "name": "l2Token_", "type": "address" }, + { "internalType": "address", "name": "from_", "type": "address" }, + { "internalType": "address", "name": "to_", "type": "address" }, + { "internalType": "uint256", "name": "amount_", "type": "uint256" }, + { "internalType": "bytes", "name": "data_", "type": "bytes" } + ], + "name": "finalizeERC20Withdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "finalizeUpgrade_v2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getContractVersion", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" } + ], + "name": "getRoleAdmin", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "hasRole", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "admin_", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isDepositsEnabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isInitialized", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isWithdrawalsEnabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2TokenBridge", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + ], + "name": "supportsInterface", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/modules/blockChain/contractAddresses.ts b/modules/blockChain/contractAddresses.ts index dc7917e7..c4b0e75a 100644 --- a/modules/blockChain/contractAddresses.ts +++ b/modules/blockChain/contractAddresses.ts @@ -217,3 +217,7 @@ export const Snapshot: ChainAddressMap = { [CHAINS.Mainnet]: '0x469788fE6E9E9681C6ebF3bF78e7Fd26Fc015446', [CHAINS.Holesky]: '0x575e8c7DD6422e574A0E3e8cf6B23db1F01584CD', } + +export const L1ERC20TokenBridge: ChainAddressMap = { + [CHAINS.Mainnet]: '0x76943C0D61395d8F2edF9060e1533529cAe05dE6', +} diff --git a/modules/votes/hooks/useEvmScriptDecoder.ts b/modules/votes/hooks/useEvmScriptDecoder.ts index e7a4eaeb..3143c350 100644 --- a/modules/votes/hooks/useEvmScriptDecoder.ts +++ b/modules/votes/hooks/useEvmScriptDecoder.ts @@ -71,6 +71,7 @@ export function useEVMScriptDecoder(): EVMScriptDecoder { abis.ExecutionLayerRewardsVaultAbi__factory.abi, [KEYS.Burner]: abis.BurnerAbi__factory.abi, [KEYS.SimpleDVT]: abis.NodeOperatorsRegistryAbi__factory.abi, + [KEYS.L1ERC20TokenBridge]: abis.L1ERC20TokenBridgeAbi__factory.abi, }) const etherscanDecoder = new abiProviders.Base({