From d76ee7decdecaec79c799ef90e7bfaca904c5f34 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 30 Oct 2023 17:57:47 +0800 Subject: [PATCH] Max transferable (#549) * interface TransferOptions * change abi to ts files * base bridge getSigner * support estimate transfer gas * decimals limit for balance-input * support estimate transfer fee * subscribe estimate transfer gas fee * max option for balance-input * trasferable value * improve the calculation of transferable * improve balance-input exceeded message * improve transfer disabled status --- packages/apps/src/abi/backing-dvmdvm.json | 1195 ---------------- packages/apps/src/abi/backing-dvmdvm.ts | 1197 ++++++++++++++++ packages/apps/src/abi/backing-dvmevm.json | 1027 ------------- packages/apps/src/abi/backing-dvmevm.ts | 1029 +++++++++++++ packages/apps/src/abi/erc20.json | 129 -- packages/apps/src/abi/erc20.ts | 131 ++ packages/apps/src/abi/faucet.json | 199 --- packages/apps/src/abi/faucet.ts | 201 +++ packages/apps/src/abi/guard.json | 580 -------- packages/apps/src/abi/guard.ts | 582 ++++++++ packages/apps/src/abi/inbox.json | 375 ----- packages/apps/src/abi/inbox.ts | 377 +++++ packages/apps/src/abi/l1-gateway-router.json | 248 ---- packages/apps/src/abi/l1-gateway-router.ts | 250 ++++ .../apps/src/abi/lnbridgev20-default.json | 541 ------- packages/apps/src/abi/lnbridgev20-default.ts | 543 +++++++ .../apps/src/abi/lnbridgev20-opposite.json | 445 ------ packages/apps/src/abi/lnbridgev20-opposite.ts | 447 ++++++ packages/apps/src/abi/lpbridge-sub2eth.json | 1063 -------------- packages/apps/src/abi/lpbridge-sub2eth.ts | 1065 ++++++++++++++ packages/apps/src/abi/lpbridge.json | 992 ------------- packages/apps/src/abi/lpbridge.ts | 994 +++++++++++++ .../apps/src/abi/mappingtoken-dvmdvm.json | 1269 ---------------- packages/apps/src/abi/mappingtoken-dvmdvm.ts | 1271 +++++++++++++++++ .../apps/src/abi/mappingtoken-dvmevm.json | 1095 -------------- packages/apps/src/abi/mappingtoken-dvmevm.ts | 1097 ++++++++++++++ packages/apps/src/bridges/base.ts | 41 +- packages/apps/src/bridges/helix-lpbridge.ts | 149 +- .../apps/src/bridges/helixbridge-dvmdvm.ts | 277 ++-- .../apps/src/bridges/helixbridge-dvmevm.ts | 271 ++-- packages/apps/src/bridges/l2bridge.ts | 53 +- packages/apps/src/bridges/lnbridge-base.ts | 14 +- packages/apps/src/bridges/lnbridge-default.ts | 79 +- .../apps/src/bridges/lnbridge-opposite.ts | 77 +- .../apps/src/components/balance-input.tsx | 106 +- packages/apps/src/components/faucet.tsx | 4 +- .../src/components/relayer-manage-modal.tsx | 4 +- .../apps/src/components/relayer-register.tsx | 4 +- .../apps/src/components/transfer-action.tsx | 6 +- .../apps/src/components/transfer-modal.tsx | 23 +- packages/apps/src/components/transfer.tsx | 65 +- packages/apps/src/config/gql.ts | 19 +- .../apps/src/providers/transfer-provider.tsx | 6 +- packages/apps/src/types/bridge.ts | 8 + packages/apps/src/types/graphql.ts | 24 +- 45 files changed, 9930 insertions(+), 9642 deletions(-) delete mode 100644 packages/apps/src/abi/backing-dvmdvm.json create mode 100644 packages/apps/src/abi/backing-dvmdvm.ts delete mode 100644 packages/apps/src/abi/backing-dvmevm.json create mode 100644 packages/apps/src/abi/backing-dvmevm.ts delete mode 100644 packages/apps/src/abi/erc20.json create mode 100644 packages/apps/src/abi/erc20.ts delete mode 100644 packages/apps/src/abi/faucet.json create mode 100644 packages/apps/src/abi/faucet.ts delete mode 100644 packages/apps/src/abi/guard.json create mode 100644 packages/apps/src/abi/guard.ts delete mode 100644 packages/apps/src/abi/inbox.json create mode 100644 packages/apps/src/abi/inbox.ts delete mode 100644 packages/apps/src/abi/l1-gateway-router.json create mode 100644 packages/apps/src/abi/l1-gateway-router.ts delete mode 100644 packages/apps/src/abi/lnbridgev20-default.json create mode 100644 packages/apps/src/abi/lnbridgev20-default.ts delete mode 100644 packages/apps/src/abi/lnbridgev20-opposite.json create mode 100644 packages/apps/src/abi/lnbridgev20-opposite.ts delete mode 100644 packages/apps/src/abi/lpbridge-sub2eth.json create mode 100644 packages/apps/src/abi/lpbridge-sub2eth.ts delete mode 100644 packages/apps/src/abi/lpbridge.json create mode 100644 packages/apps/src/abi/lpbridge.ts delete mode 100644 packages/apps/src/abi/mappingtoken-dvmdvm.json create mode 100644 packages/apps/src/abi/mappingtoken-dvmdvm.ts delete mode 100644 packages/apps/src/abi/mappingtoken-dvmevm.json create mode 100644 packages/apps/src/abi/mappingtoken-dvmevm.ts diff --git a/packages/apps/src/abi/backing-dvmdvm.json b/packages/apps/src/abi/backing-dvmdvm.json deleted file mode 100644 index c88a976ae..000000000 --- a/packages/apps/src/abi/backing-dvmdvm.json +++ /dev/null @@ -1,1195 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "DailyLimitChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "NewErc20TokenRegistered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "refundId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "RemoteIssuingFailure", - "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": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "TokenLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenUnlocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenUnlockedForFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "CALLEE_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CALLER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DAO_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LASTDAY_BIT_LENGTH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SPEND_BIT_LENGTH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "_slotReserved", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "calcMaxWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "chainName", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "changeDailyLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "dailyLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "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": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": [], - "name": "guard", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "originSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "handleUnlockFailureFromRemote", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "handleUnlockFailureFromRemoteNative", - "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": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "hash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "helixFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "lockAndRemoteIssuing", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "lockAndRemoteIssuingNative", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lockedMessages", - "outputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - }, - { - "internalType": "bool", - "name": "hasRefundForFailed", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "messageEndpoint", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "register", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "remoteIssuingFailure", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "remoteMappingTokenFactory", - "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": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "rescueFunds", - "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": "string", - "name": "_chainName", - "type": "string" - } - ], - "name": "setChainName", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_helixFee", - "type": "uint256" - } - ], - "name": "setHelixFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "setMessageEndpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_remoteMappingTokenFactory", - "type": "address" - } - ], - "name": "setRemoteMappingTokenFactory", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_wToken", - "type": "address" - } - ], - "name": "setWToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "spentToday", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "unlockFromRemote", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "unlockFromRemoteNative", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newGuard", - "type": "address" - } - ], - "name": "updateGuard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "wToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/packages/apps/src/abi/backing-dvmdvm.ts b/packages/apps/src/abi/backing-dvmdvm.ts new file mode 100644 index 000000000..efc1cd590 --- /dev/null +++ b/packages/apps/src/abi/backing-dvmdvm.ts @@ -0,0 +1,1197 @@ +const abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "DailyLimitChange", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + ], + name: "NewErc20TokenRegistered", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "refundId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "originalSender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "RemoteIssuingFailure", + 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: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "bool", + name: "isNative", + type: "bool", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "TokenLocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "bool", + name: "isNative", + type: "bool", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenUnlocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "bool", + name: "isNative", + type: "bool", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenUnlockedForFailed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Unpaused", + type: "event", + }, + { + inputs: [], + name: "CALLEE_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "CALLER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DAO_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "LASTDAY_BIT_LENGTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "OPERATOR_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "SPEND_BIT_LENGTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "_slotReserved", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + ], + name: "calcMaxWithdraw", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "chainName", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "changeDailyLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "dailyLimit", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fee", + 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: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getRoleMember", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleMemberCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + 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: [], + name: "guard", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "originSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "handleUnlockFailureFromRemote", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "originSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "handleUnlockFailureFromRemoteNative", + 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: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "hash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "helixFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "lockAndRemoteIssuing", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "lockAndRemoteIssuingNative", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "lockedMessages", + outputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "bool", + name: "hasRefundForFailed", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "messageEndpoint", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "string", + name: "name", + type: "string", + }, + { + internalType: "string", + name: "symbol", + type: "string", + }, + { + internalType: "uint8", + name: "decimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "register", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "address", + name: "originalSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "remoteIssuingFailure", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "remoteMappingTokenFactory", + 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: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "rescueFunds", + 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: "string", + name: "_chainName", + type: "string", + }, + ], + name: "setChainName", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_helixFee", + type: "uint256", + }, + ], + name: "setHelixFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "setMessageEndpoint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_remoteMappingTokenFactory", + type: "address", + }, + ], + name: "setRemoteMappingTokenFactory", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_wToken", + type: "address", + }, + ], + name: "setWToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "spentToday", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "unlockFromRemote", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address payable", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "unlockFromRemoteNative", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newGuard", + type: "address", + }, + ], + name: "updateGuard", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "wToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address payable", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "withdrawFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/backing-dvmevm.json b/packages/apps/src/abi/backing-dvmevm.json deleted file mode 100644 index 25a7d2d71..000000000 --- a/packages/apps/src/abi/backing-dvmevm.json +++ /dev/null @@ -1,1027 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "DailyLimitChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "NativeTokenUnlockedForFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "RemoteIssuingFailure", - "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": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "TokenLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenUnlocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenUnlockedForFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "CALLEE_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CALLER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DAO_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "calcMaxWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "changeDailyLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "currentFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "dailyLimit", - "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": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": [], - "name": "guard", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "originSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "handleUnlockFailureFromRemote", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "handleUnlockFailureFromRemoteNative", - "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": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "hash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "helixFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastDay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "lockAndRemoteIssuing", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "lockAndRemoteIssuingNative", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "lockedMessages", - "outputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - }, - { - "internalType": "bool", - "name": "hasRefundForFailed", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "messageEndpoint", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "remoteIssuingFailure", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "remoteMappingTokenFactory", - "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": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "rescueFunds", - "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": "uint256", - "name": "_helixFee", - "type": "uint256" - } - ], - "name": "setHelixFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "setMessageEndpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_remoteMappingTokenFactory", - "type": "address" - } - ], - "name": "setRemoteMappingTokenFactory", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_wToken", - "type": "address" - } - ], - "name": "setwToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "spentToday", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "unlockFromRemote", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "unlockFromRemoteNative", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newGuard", - "type": "address" - } - ], - "name": "updateGuard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "wToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/packages/apps/src/abi/backing-dvmevm.ts b/packages/apps/src/abi/backing-dvmevm.ts new file mode 100644 index 000000000..acfd6eb0d --- /dev/null +++ b/packages/apps/src/abi/backing-dvmevm.ts @@ -0,0 +1,1029 @@ +const abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "DailyLimitChange", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "NativeTokenUnlockedForFailed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "originalSender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "RemoteIssuingFailure", + 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: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "TokenLocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenUnlocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenUnlockedForFailed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Unpaused", + type: "event", + }, + { + inputs: [], + name: "CALLEE_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "CALLER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DAO_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "OPERATOR_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + ], + name: "calcMaxWithdraw", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "changeDailyLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "currentFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "dailyLimit", + 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: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getRoleMember", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleMemberCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + 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: [], + name: "guard", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "originSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "handleUnlockFailureFromRemote", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "originSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "handleUnlockFailureFromRemoteNative", + 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: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "hash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "helixFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "lastDay", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "lockAndRemoteIssuing", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "lockAndRemoteIssuingNative", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "lockedMessages", + outputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "bool", + name: "hasRefundForFailed", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "messageEndpoint", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "address", + name: "originalSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "remoteIssuingFailure", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "remoteMappingTokenFactory", + 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: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "rescueFunds", + 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: "uint256", + name: "_helixFee", + type: "uint256", + }, + ], + name: "setHelixFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "setMessageEndpoint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_remoteMappingTokenFactory", + type: "address", + }, + ], + name: "setRemoteMappingTokenFactory", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_wToken", + type: "address", + }, + ], + name: "setwToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "spentToday", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "unlockFromRemote", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address payable", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "unlockFromRemoteNative", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newGuard", + type: "address", + }, + ], + name: "updateGuard", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "wToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/erc20.json b/packages/apps/src/abi/erc20.json deleted file mode 100644 index f5195cf64..000000000 --- a/packages/apps/src/abi/erc20.json +++ /dev/null @@ -1,129 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "string", "name": "name_", "type": "string" }, - { "internalType": "string", "name": "symbol_", "type": "string" }, - { "internalType": "uint8", "name": "decimals_", "type": "uint8" }, - { "internalType": "uint256", "name": "initialBalance_", "type": "uint256" }, - { "internalType": "address payable", "name": "feeReceiver_", "type": "address" } - ], - "stateMutability": "payable", - "type": "constructor" - }, - { - "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": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "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": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/packages/apps/src/abi/erc20.ts b/packages/apps/src/abi/erc20.ts new file mode 100644 index 000000000..4fa744867 --- /dev/null +++ b/packages/apps/src/abi/erc20.ts @@ -0,0 +1,131 @@ +const abi = [ + { + inputs: [ + { internalType: "string", name: "name_", type: "string" }, + { internalType: "string", name: "symbol_", type: "string" }, + { internalType: "uint8", name: "decimals_", type: "uint8" }, + { internalType: "uint256", name: "initialBalance_", type: "uint256" }, + { internalType: "address payable", name: "feeReceiver_", type: "address" }, + ], + stateMutability: "payable", + type: "constructor", + }, + { + 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: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "subtractedValue", type: "uint256" }, + ], + name: "decreaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "addedValue", type: "uint256" }, + ], + name: "increaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + 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: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "address", name: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/faucet.json b/packages/apps/src/abi/faucet.json deleted file mode 100644 index 6fa7e03f1..000000000 --- a/packages/apps/src/abi/faucet.json +++ /dev/null @@ -1,199 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "string", "name": "_name", "type": "string" }, - { "internalType": "string", "name": "_symbol", "type": "string" }, - { "internalType": "uint8", "name": "_decimals", "type": "uint8" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "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": "previousOwner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } - ], - "name": "OwnershipTransferred", - "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": "", "type": "address" }], - "name": "allowFaucet", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "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": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "faucet", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "maxFaucetAllowed", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "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": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "allowed", "type": "uint256" }], - "name": "setMaxFaucetAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "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": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/packages/apps/src/abi/faucet.ts b/packages/apps/src/abi/faucet.ts new file mode 100644 index 000000000..3662e7987 --- /dev/null +++ b/packages/apps/src/abi/faucet.ts @@ -0,0 +1,201 @@ +const abi = [ + { + inputs: [ + { internalType: "string", name: "_name", type: "string" }, + { internalType: "string", name: "_symbol", type: "string" }, + { internalType: "uint8", name: "_decimals", type: "uint8" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + 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: "previousOwner", type: "address" }, + { indexed: true, internalType: "address", name: "newOwner", type: "address" }, + ], + name: "OwnershipTransferred", + 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: "", type: "address" }], + name: "allowFaucet", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + 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: [ + { internalType: "address", name: "account", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "burn", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "decimals", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "subtractedValue", type: "uint256" }, + ], + name: "decreaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }], + name: "faucet", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "spender", type: "address" }, + { internalType: "uint256", name: "addedValue", type: "uint256" }, + ], + name: "increaseAllowance", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "maxFaucetAllowed", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + 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: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "uint256", name: "allowed", type: "uint256" }], + name: "setMaxFaucetAllowed", + outputs: [], + stateMutability: "nonpayable", + 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: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "address", name: "recipient", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "newOwner", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/guard.json b/packages/apps/src/abi/guard.json deleted file mode 100644 index 293fd3e72..000000000 --- a/packages/apps/src/abi/guard.json +++ /dev/null @@ -1,580 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address[]", - "name": "_guards", - "type": "address[]" - }, - { - "internalType": "uint256", - "name": "_threshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxUnclaimableTime", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_depositor", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "guard", - "type": "address" - } - ], - "name": "AddedGuard", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "threshold", - "type": "uint256" - } - ], - "name": "ChangedThreshold", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "guard", - "type": "address" - } - ], - "name": "RemovedGuard", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "TokenClaimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "guard", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_threshold", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "name": "addGuardWithThreshold", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_threshold", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "name": "changeThreshold", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "structHash", - "type": "bytes32" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "name": "checkGuardSignatures", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "dataHash", - "type": "bytes32" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - }, - { - "internalType": "uint256", - "name": "requiredSignatures", - "type": "uint256" - } - ], - "name": "checkNSignatures", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "claimByTimeout", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "depositor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "domainSeparator", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "structHash", - "type": "bytes32" - } - ], - "name": "encodeDataHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getChainId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGuards", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "hash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "guard", - "type": "address" - } - ], - "name": "isGuard", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxUnclaimableTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "operator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "prevGuard", - "type": "address" - }, - { - "internalType": "address", - "name": "guard", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_threshold", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "name": "removeGuard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOperator", - "type": "address" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "name": "setOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "prevGuard", - "type": "address" - }, - { - "internalType": "address", - "name": "oldGuard", - "type": "address" - }, - { - "internalType": "address", - "name": "newGuard", - "type": "address" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "name": "swapGuard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/packages/apps/src/abi/guard.ts b/packages/apps/src/abi/guard.ts new file mode 100644 index 000000000..d0bf2f40b --- /dev/null +++ b/packages/apps/src/abi/guard.ts @@ -0,0 +1,582 @@ +const abi = [ + { + inputs: [ + { + internalType: "address[]", + name: "_guards", + type: "address[]", + }, + { + internalType: "uint256", + name: "_threshold", + type: "uint256", + }, + { + internalType: "uint256", + name: "_maxUnclaimableTime", + type: "uint256", + }, + { + internalType: "address", + name: "_depositor", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "guard", + type: "address", + }, + ], + name: "AddedGuard", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "threshold", + type: "uint256", + }, + ], + name: "ChangedThreshold", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "guard", + type: "address", + }, + ], + name: "RemovedGuard", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256", + }, + ], + name: "TokenClaimed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenDeposit", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Unpaused", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "guard", + type: "address", + }, + { + internalType: "uint256", + name: "_threshold", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + ], + name: "addGuardWithThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_threshold", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + ], + name: "changeThreshold", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "structHash", + type: "bytes32", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + ], + name: "checkGuardSignatures", + outputs: [], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "dataHash", + type: "bytes32", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + { + internalType: "uint256", + name: "requiredSignatures", + type: "uint256", + }, + ], + name: "checkNSignatures", + outputs: [], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + ], + name: "claim", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "claimByTimeout", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "id", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "deposit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "depositor", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "domainSeparator", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "structHash", + type: "bytes32", + }, + ], + name: "encodeDataHash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getChainId", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getGuards", + outputs: [ + { + internalType: "address[]", + name: "", + type: "address[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getThreshold", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "hash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "guard", + type: "address", + }, + ], + name: "isGuard", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "maxUnclaimableTime", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "nonce", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "operator", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "prevGuard", + type: "address", + }, + { + internalType: "address", + name: "guard", + type: "address", + }, + { + internalType: "uint256", + name: "_threshold", + type: "uint256", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + ], + name: "removeGuard", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOperator", + type: "address", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + ], + name: "setOperator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "prevGuard", + type: "address", + }, + { + internalType: "address", + name: "oldGuard", + type: "address", + }, + { + internalType: "address", + name: "newGuard", + type: "address", + }, + { + internalType: "bytes[]", + name: "signatures", + type: "bytes[]", + }, + ], + name: "swapGuard", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/inbox.json b/packages/apps/src/abi/inbox.json deleted file mode 100644 index c0e9beb55..000000000 --- a/packages/apps/src/abi/inbox.json +++ /dev/null @@ -1,375 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "uint256", "name": "dataLength", "type": "uint256" }, - { "internalType": "uint256", "name": "maxDataLength", "type": "uint256" } - ], - "name": "DataTooLarge", - "type": "error" - }, - { "inputs": [], "name": "GasLimitTooLarge", "type": "error" }, - { - "inputs": [ - { "internalType": "uint256", "name": "expected", "type": "uint256" }, - { "internalType": "uint256", "name": "actual", "type": "uint256" } - ], - "name": "InsufficientSubmissionCost", - "type": "error" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "expected", "type": "uint256" }, - { "internalType": "uint256", "name": "actual", "type": "uint256" } - ], - "name": "InsufficientValue", - "type": "error" - }, - { "inputs": [], "name": "L1Forked", "type": "error" }, - { - "inputs": [{ "internalType": "address", "name": "origin", "type": "address" }], - "name": "NotAllowedOrigin", - "type": "error" - }, - { "inputs": [], "name": "NotForked", "type": "error" }, - { "inputs": [], "name": "NotOrigin", "type": "error" }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "owner", "type": "address" } - ], - "name": "NotOwner", - "type": "error" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "rollup", "type": "address" }, - { "internalType": "address", "name": "owner", "type": "address" } - ], - "name": "NotRollupOrOwner", - "type": "error" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "l2CallValue", "type": "uint256" }, - { "internalType": "uint256", "name": "deposit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxSubmissionCost", "type": "uint256" }, - { "internalType": "address", "name": "excessFeeRefundAddress", "type": "address" }, - { "internalType": "address", "name": "callValueRefundAddress", "type": "address" }, - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "RetryableData", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "bool", "name": "val", "type": "bool" } - ], - "name": "AllowListAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "bool", "name": "isEnabled", "type": "bool" }], - "name": "AllowListEnabledUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "messageNum", "type": "uint256" }, - { "indexed": false, "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "InboxMessageDelivered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": true, "internalType": "uint256", "name": "messageNum", "type": "uint256" }], - "name": "InboxMessageDeliveredFromOrigin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "allowListEnabled", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bridge", - "outputs": [{ "internalType": "contract IBridge", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "dataLength", "type": "uint256" }, - { "internalType": "uint256", "name": "baseFee", "type": "uint256" } - ], - "name": "calculateRetryableSubmissionFee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "l2CallValue", "type": "uint256" }, - { "internalType": "uint256", "name": "maxSubmissionCost", "type": "uint256" }, - { "internalType": "address", "name": "excessFeeRefundAddress", "type": "address" }, - { "internalType": "address", "name": "callValueRefundAddress", "type": "address" }, - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "createRetryableTicket", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "l2CallValue", "type": "uint256" }, - { "internalType": "uint256", "name": "maxSubmissionCost", "type": "uint256" }, - { "internalType": "address", "name": "excessFeeRefundAddress", "type": "address" }, - { "internalType": "address", "name": "callValueRefundAddress", "type": "address" }, - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "createRetryableTicketNoRefundAliasRewrite", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "depositEth", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "depositEth", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "contract IBridge", "name": "_bridge", "type": "address" }, - { "internalType": "contract ISequencerInbox", "name": "_sequencerInbox", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "isAllowed", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "contract IBridge", "name": "", "type": "address" }], - "name": "postUpgradeInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "sendContractTransaction", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "sendL1FundedContractTransaction", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "sendL1FundedUnsignedTransaction", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "sendL1FundedUnsignedTransactionToFork", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes", "name": "messageData", "type": "bytes" }], - "name": "sendL2Message", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes", "name": "messageData", "type": "bytes" }], - "name": "sendL2MessageFromOrigin", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "sendUnsignedTransaction", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "sendUnsignedTransactionToFork", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "address", "name": "withdrawTo", "type": "address" } - ], - "name": "sendWithdrawEthToFork", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "sequencerInbox", - "outputs": [{ "internalType": "contract ISequencerInbox", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address[]", "name": "user", "type": "address[]" }, - { "internalType": "bool[]", "name": "val", "type": "bool[]" } - ], - "name": "setAllowList", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bool", "name": "_allowListEnabled", "type": "bool" }], - "name": "setAllowListEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "l2CallValue", "type": "uint256" }, - { "internalType": "uint256", "name": "maxSubmissionCost", "type": "uint256" }, - { "internalType": "address", "name": "excessFeeRefundAddress", "type": "address" }, - { "internalType": "address", "name": "callValueRefundAddress", "type": "address" }, - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "uniswapCreateRetryableTicket", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "l2CallValue", "type": "uint256" }, - { "internalType": "uint256", "name": "maxSubmissionCost", "type": "uint256" }, - { "internalType": "address", "name": "excessFeeRefundAddress", "type": "address" }, - { "internalType": "address", "name": "callValueRefundAddress", "type": "address" }, - { "internalType": "uint256", "name": "gasLimit", "type": "uint256" }, - { "internalType": "uint256", "name": "maxFeePerGas", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "unsafeCreateRetryableTicket", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - } -] diff --git a/packages/apps/src/abi/inbox.ts b/packages/apps/src/abi/inbox.ts new file mode 100644 index 000000000..f50225388 --- /dev/null +++ b/packages/apps/src/abi/inbox.ts @@ -0,0 +1,377 @@ +const abi = [ + { + inputs: [ + { internalType: "uint256", name: "dataLength", type: "uint256" }, + { internalType: "uint256", name: "maxDataLength", type: "uint256" }, + ], + name: "DataTooLarge", + type: "error", + }, + { inputs: [], name: "GasLimitTooLarge", type: "error" }, + { + inputs: [ + { internalType: "uint256", name: "expected", type: "uint256" }, + { internalType: "uint256", name: "actual", type: "uint256" }, + ], + name: "InsufficientSubmissionCost", + type: "error", + }, + { + inputs: [ + { internalType: "uint256", name: "expected", type: "uint256" }, + { internalType: "uint256", name: "actual", type: "uint256" }, + ], + name: "InsufficientValue", + type: "error", + }, + { inputs: [], name: "L1Forked", type: "error" }, + { + inputs: [{ internalType: "address", name: "origin", type: "address" }], + name: "NotAllowedOrigin", + type: "error", + }, + { inputs: [], name: "NotForked", type: "error" }, + { inputs: [], name: "NotOrigin", type: "error" }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "address", name: "owner", type: "address" }, + ], + name: "NotOwner", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "sender", type: "address" }, + { internalType: "address", name: "rollup", type: "address" }, + { internalType: "address", name: "owner", type: "address" }, + ], + name: "NotRollupOrOwner", + type: "error", + }, + { + inputs: [ + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "l2CallValue", type: "uint256" }, + { internalType: "uint256", name: "deposit", type: "uint256" }, + { internalType: "uint256", name: "maxSubmissionCost", type: "uint256" }, + { internalType: "address", name: "excessFeeRefundAddress", type: "address" }, + { internalType: "address", name: "callValueRefundAddress", type: "address" }, + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "RetryableData", + type: "error", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "user", type: "address" }, + { indexed: false, internalType: "bool", name: "val", type: "bool" }, + ], + name: "AllowListAddressSet", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "bool", name: "isEnabled", type: "bool" }], + name: "AllowListEnabledUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "uint256", name: "messageNum", type: "uint256" }, + { indexed: false, internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "InboxMessageDelivered", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: true, internalType: "uint256", name: "messageNum", type: "uint256" }], + name: "InboxMessageDeliveredFromOrigin", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Unpaused", + type: "event", + }, + { + inputs: [], + name: "allowListEnabled", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "bridge", + outputs: [{ internalType: "contract IBridge", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "dataLength", type: "uint256" }, + { internalType: "uint256", name: "baseFee", type: "uint256" }, + ], + name: "calculateRetryableSubmissionFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "l2CallValue", type: "uint256" }, + { internalType: "uint256", name: "maxSubmissionCost", type: "uint256" }, + { internalType: "address", name: "excessFeeRefundAddress", type: "address" }, + { internalType: "address", name: "callValueRefundAddress", type: "address" }, + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "createRetryableTicket", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "l2CallValue", type: "uint256" }, + { internalType: "uint256", name: "maxSubmissionCost", type: "uint256" }, + { internalType: "address", name: "excessFeeRefundAddress", type: "address" }, + { internalType: "address", name: "callValueRefundAddress", type: "address" }, + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "createRetryableTicketNoRefundAliasRewrite", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "depositEth", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "depositEth", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "contract IBridge", name: "_bridge", type: "address" }, + { internalType: "contract ISequencerInbox", name: "_sequencerInbox", type: "address" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "isAllowed", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "paused", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "contract IBridge", name: "", type: "address" }], + name: "postUpgradeInit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "sendContractTransaction", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "sendL1FundedContractTransaction", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "sendL1FundedUnsignedTransaction", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "sendL1FundedUnsignedTransactionToFork", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "bytes", name: "messageData", type: "bytes" }], + name: "sendL2Message", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes", name: "messageData", type: "bytes" }], + name: "sendL2MessageFromOrigin", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "sendUnsignedTransaction", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "sendUnsignedTransactionToFork", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "uint256", name: "nonce", type: "uint256" }, + { internalType: "uint256", name: "value", type: "uint256" }, + { internalType: "address", name: "withdrawTo", type: "address" }, + ], + name: "sendWithdrawEthToFork", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "sequencerInbox", + outputs: [{ internalType: "contract ISequencerInbox", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "user", type: "address[]" }, + { internalType: "bool[]", name: "val", type: "bool[]" }, + ], + name: "setAllowList", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bool", name: "_allowListEnabled", type: "bool" }], + name: "setAllowListEnabled", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "l2CallValue", type: "uint256" }, + { internalType: "uint256", name: "maxSubmissionCost", type: "uint256" }, + { internalType: "address", name: "excessFeeRefundAddress", type: "address" }, + { internalType: "address", name: "callValueRefundAddress", type: "address" }, + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "uniswapCreateRetryableTicket", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "l2CallValue", type: "uint256" }, + { internalType: "uint256", name: "maxSubmissionCost", type: "uint256" }, + { internalType: "address", name: "excessFeeRefundAddress", type: "address" }, + { internalType: "address", name: "callValueRefundAddress", type: "address" }, + { internalType: "uint256", name: "gasLimit", type: "uint256" }, + { internalType: "uint256", name: "maxFeePerGas", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, + ], + name: "unsafeCreateRetryableTicket", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/l1-gateway-router.json b/packages/apps/src/abi/l1-gateway-router.json deleted file mode 100644 index 3d8c5d296..000000000 --- a/packages/apps/src/abi/l1-gateway-router.json +++ /dev/null @@ -1,248 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "newDefaultGateway", "type": "address" }], - "name": "DefaultGatewayUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "l1Token", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "gateway", "type": "address" } - ], - "name": "GatewaySet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "token", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "_userFrom", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "_userTo", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "gateway", "type": "address" } - ], - "name": "TransferRouted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "_from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "_to", "type": "address" }, - { "indexed": true, "internalType": "uint256", "name": "_seqNum", "type": "uint256" }, - { "indexed": false, "internalType": "bytes", "name": "_data", "type": "bytes" } - ], - "name": "TxToL2", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "newSource", "type": "address" }], - "name": "WhitelistSourceUpdated", - "type": "event" - }, - { - "inputs": [{ "internalType": "address", "name": "l1ERC20", "type": "address" }], - "name": "calculateL2TokenAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "counterpartGateway", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "defaultGateway", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "bytes", "name": "", "type": "bytes" } - ], - "name": "finalizeInboundTransfer", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_token", "type": "address" }], - "name": "getGateway", - "outputs": [{ "internalType": "address", "name": "gateway", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token", "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": "getOutboundCalldata", - "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "inbox", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_owner", "type": "address" }, - { "internalType": "address", "name": "_defaultGateway", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "_counterpartGateway", "type": "address" }, - { "internalType": "address", "name": "_inbox", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "l1TokenToGateway", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token", "type": "address" }, - { "internalType": "address", "name": "_to", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "_maxGas", "type": "uint256" }, - { "internalType": "uint256", "name": "_gasPriceBid", "type": "uint256" }, - { "internalType": "bytes", "name": "_data", "type": "bytes" } - ], - "name": "outboundTransfer", - "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token", "type": "address" }, - { "internalType": "address", "name": "_refundTo", "type": "address" }, - { "internalType": "address", "name": "_to", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "_maxGas", "type": "uint256" }, - { "internalType": "uint256", "name": "_gasPriceBid", "type": "uint256" }, - { "internalType": "bytes", "name": "_data", "type": "bytes" } - ], - "name": "outboundTransferCustomRefund", - "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "postUpgradeInit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "router", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "newL1DefaultGateway", "type": "address" }, - { "internalType": "uint256", "name": "_maxGas", "type": "uint256" }, - { "internalType": "uint256", "name": "_gasPriceBid", "type": "uint256" }, - { "internalType": "uint256", "name": "_maxSubmissionCost", "type": "uint256" } - ], - "name": "setDefaultGateway", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_gateway", "type": "address" }, - { "internalType": "uint256", "name": "_maxGas", "type": "uint256" }, - { "internalType": "uint256", "name": "_gasPriceBid", "type": "uint256" }, - { "internalType": "uint256", "name": "_maxSubmissionCost", "type": "uint256" }, - { "internalType": "address", "name": "_creditBackAddress", "type": "address" } - ], - "name": "setGateway", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_gateway", "type": "address" }, - { "internalType": "uint256", "name": "_maxGas", "type": "uint256" }, - { "internalType": "uint256", "name": "_gasPriceBid", "type": "uint256" }, - { "internalType": "uint256", "name": "_maxSubmissionCost", "type": "uint256" } - ], - "name": "setGateway", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address[]", "name": "_token", "type": "address[]" }, - { "internalType": "address[]", "name": "_gateway", "type": "address[]" }, - { "internalType": "uint256", "name": "_maxGas", "type": "uint256" }, - { "internalType": "uint256", "name": "_gasPriceBid", "type": "uint256" }, - { "internalType": "uint256", "name": "_maxSubmissionCost", "type": "uint256" } - ], - "name": "setGateways", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "setOwner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }], - "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "newSource", "type": "address" }], - "name": "updateWhitelistSource", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "whitelist", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - } -] diff --git a/packages/apps/src/abi/l1-gateway-router.ts b/packages/apps/src/abi/l1-gateway-router.ts new file mode 100644 index 000000000..2069c5057 --- /dev/null +++ b/packages/apps/src/abi/l1-gateway-router.ts @@ -0,0 +1,250 @@ +const abi = [ + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "newDefaultGateway", type: "address" }], + name: "DefaultGatewayUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "l1Token", type: "address" }, + { indexed: true, internalType: "address", name: "gateway", type: "address" }, + ], + name: "GatewaySet", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "token", type: "address" }, + { indexed: true, internalType: "address", name: "_userFrom", type: "address" }, + { indexed: true, internalType: "address", name: "_userTo", type: "address" }, + { indexed: false, internalType: "address", name: "gateway", type: "address" }, + ], + name: "TransferRouted", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "_from", type: "address" }, + { indexed: true, internalType: "address", name: "_to", type: "address" }, + { indexed: true, internalType: "uint256", name: "_seqNum", type: "uint256" }, + { indexed: false, internalType: "bytes", name: "_data", type: "bytes" }, + ], + name: "TxToL2", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "newSource", type: "address" }], + name: "WhitelistSourceUpdated", + type: "event", + }, + { + inputs: [{ internalType: "address", name: "l1ERC20", type: "address" }], + name: "calculateL2TokenAddress", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "counterpartGateway", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "defaultGateway", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "", type: "address" }, + { internalType: "uint256", name: "", type: "uint256" }, + { internalType: "bytes", name: "", type: "bytes" }, + ], + name: "finalizeInboundTransfer", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_token", type: "address" }], + name: "getGateway", + outputs: [{ internalType: "address", name: "gateway", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", 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: "getOutboundCalldata", + outputs: [{ internalType: "bytes", name: "", type: "bytes" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "inbox", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_owner", type: "address" }, + { internalType: "address", name: "_defaultGateway", type: "address" }, + { internalType: "address", name: "", type: "address" }, + { internalType: "address", name: "_counterpartGateway", type: "address" }, + { internalType: "address", name: "_inbox", type: "address" }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "l1TokenToGateway", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_to", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "uint256", name: "_maxGas", type: "uint256" }, + { internalType: "uint256", name: "_gasPriceBid", type: "uint256" }, + { internalType: "bytes", name: "_data", type: "bytes" }, + ], + name: "outboundTransfer", + outputs: [{ internalType: "bytes", name: "", type: "bytes" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_token", type: "address" }, + { internalType: "address", name: "_refundTo", type: "address" }, + { internalType: "address", name: "_to", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + { internalType: "uint256", name: "_maxGas", type: "uint256" }, + { internalType: "uint256", name: "_gasPriceBid", type: "uint256" }, + { internalType: "bytes", name: "_data", type: "bytes" }, + ], + name: "outboundTransferCustomRefund", + outputs: [{ internalType: "bytes", name: "", type: "bytes" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "postUpgradeInit", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "router", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "newL1DefaultGateway", type: "address" }, + { internalType: "uint256", name: "_maxGas", type: "uint256" }, + { internalType: "uint256", name: "_gasPriceBid", type: "uint256" }, + { internalType: "uint256", name: "_maxSubmissionCost", type: "uint256" }, + ], + name: "setDefaultGateway", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_gateway", type: "address" }, + { internalType: "uint256", name: "_maxGas", type: "uint256" }, + { internalType: "uint256", name: "_gasPriceBid", type: "uint256" }, + { internalType: "uint256", name: "_maxSubmissionCost", type: "uint256" }, + { internalType: "address", name: "_creditBackAddress", type: "address" }, + ], + name: "setGateway", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "_gateway", type: "address" }, + { internalType: "uint256", name: "_maxGas", type: "uint256" }, + { internalType: "uint256", name: "_gasPriceBid", type: "uint256" }, + { internalType: "uint256", name: "_maxSubmissionCost", type: "uint256" }, + ], + name: "setGateway", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "address[]", name: "_token", type: "address[]" }, + { internalType: "address[]", name: "_gateway", type: "address[]" }, + { internalType: "uint256", name: "_maxGas", type: "uint256" }, + { internalType: "uint256", name: "_gasPriceBid", type: "uint256" }, + { internalType: "uint256", name: "_maxSubmissionCost", type: "uint256" }, + ], + name: "setGateways", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "newOwner", type: "address" }], + name: "setOwner", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }], + name: "supportsInterface", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "newSource", type: "address" }], + name: "updateWhitelistSource", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "whitelist", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/lnbridgev20-default.json b/packages/apps/src/abi/lnbridgev20-default.json deleted file mode 100644 index 29fc52217..000000000 --- a/packages/apps/src/abi/lnbridgev20-default.json +++ /dev/null @@ -1,541 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "baseFee", "type": "uint112" }, - { "indexed": false, "internalType": "uint8", "name": "liquidityfeeRate", "type": "uint8" } - ], - "name": "LnProviderUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "indexed": false, "internalType": "uint64", "name": "withdrawNonce", "type": "uint64" } - ], - "name": "MarginUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "margin", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "slasher", "type": "address" } - ], - "name": "Slash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "bytes32", "name": "expectedTransferId", "type": "bytes32" } - ], - "name": "SlashRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "SlashReserveUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "fee", "type": "uint112" }, - { "indexed": false, "internalType": "uint64", "name": "timestamp", "type": "uint64" }, - { "indexed": false, "internalType": "address", "name": "receiver", "type": "address" } - ], - "name": "TokenLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" } - ], - "name": "TransferFilled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "amount", "type": "uint112" } - ], - "name": "WithdrawMarginRequest", - "type": "event" - }, - { - "inputs": [], - "name": "dao", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint256", "name": "_margin", "type": "uint256" } - ], - "name": "depositProviderMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" } - ], - "name": "depositSlashFundReserve", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes32", "name": "previousTransferId", "type": "bytes32" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, - { "internalType": "address", "name": "receiver", "type": "address" } - ], - "internalType": "struct LnBridgeHelper.TransferParameter", - "name": "_params", - "type": "tuple" - }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_slasher", "type": "address" }, - { "internalType": "uint112", "name": "_fee", "type": "uint112" }, - { "internalType": "uint112", "name": "_penalty", "type": "uint112" } - ], - "name": "encodeSlashCall", - "outputs": [{ "internalType": "bytes", "name": "message", "type": "bytes" }], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "_lastTransferId", "type": "bytes32" }, - { "internalType": "uint64", "name": "_withdrawNonce", "type": "uint64" }, - { "internalType": "address", "name": "_provider", "type": "address" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" } - ], - "name": "encodeWithdrawCall", - "outputs": [{ "internalType": "bytes", "name": "message", "type": "bytes" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "fillTransfers", - "outputs": [ - { "internalType": "uint64", "name": "timestamp", "type": "uint64" }, - { "internalType": "address", "name": "slasher", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "dao", "type": "address" }], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "lockInfos", - "outputs": [ - { "internalType": "uint112", "name": "fee", "type": "uint112" }, - { "internalType": "uint112", "name": "penalty", "type": "uint112" }, - { "internalType": "uint32", "name": "timestamp", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "messagers", - "outputs": [ - { "internalType": "address", "name": "sendService", "type": "address" }, - { "internalType": "address", "name": "receiveService", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "operator", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "protocolFeeReceiver", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" } - ], - "name": "providerPause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" } - ], - "name": "providerUnpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes32", "name": "previousTransferId", "type": "bytes32" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, - { "internalType": "address", "name": "receiver", "type": "address" } - ], - "internalType": "struct LnBridgeHelper.TransferParameter", - "name": "_params", - "type": "tuple" - }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "bytes32", "name": "_expectedTransferId", "type": "bytes32" }, - { "internalType": "bytes", "name": "_extParams", "type": "bytes" } - ], - "name": "requestSlashAndRemoteRelease", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" }, - { "internalType": "bytes", "name": "_extParams", "type": "bytes" } - ], - "name": "requestWithdrawMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_operator", "type": "address" }], - "name": "setOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_baseFee", "type": "uint112" }, - { "internalType": "uint8", "name": "_liquidityFeeRate", "type": "uint8" } - ], - "name": "setProviderFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_remoteBridge", "type": "address" }, - { "internalType": "address", "name": "_service", "type": "address" } - ], - "name": "setReceiveService", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_remoteBridge", "type": "address" }, - { "internalType": "address", "name": "_service", "type": "address" } - ], - "name": "setSendService", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_protocolFee", "type": "uint112" }, - { "internalType": "uint112", "name": "_penaltyLnCollateral", "type": "uint112" }, - { "internalType": "uint8", "name": "_sourceDecimals", "type": "uint8" }, - { "internalType": "uint8", "name": "_targetDecimals", "type": "uint8" } - ], - "name": "setTokenInfo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes32", "name": "previousTransferId", "type": "bytes32" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, - { "internalType": "address", "name": "receiver", "type": "address" } - ], - "internalType": "struct LnBridgeHelper.TransferParameter", - "name": "_params", - "type": "tuple" - }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_slasher", "type": "address" }, - { "internalType": "uint112", "name": "_fee", "type": "uint112" }, - { "internalType": "uint112", "name": "_penalty", "type": "uint112" } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "srcProviders", - "outputs": [ - { - "components": [ - { "internalType": "uint112", "name": "baseFee", "type": "uint112" }, - { "internalType": "uint16", "name": "liquidityFeeRate", "type": "uint16" }, - { "internalType": "uint64", "name": "withdrawNonce", "type": "uint64" }, - { "internalType": "bool", "name": "pause", "type": "bool" } - ], - "internalType": "struct LnDefaultBridgeSource.SourceProviderConfigure", - "name": "config", - "type": "tuple" - }, - { "internalType": "bytes32", "name": "lastTransferId", "type": "bytes32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "tgtProviders", - "outputs": [ - { "internalType": "uint256", "name": "margin", "type": "uint256" }, - { "internalType": "uint256", "name": "slashReserveFund", "type": "uint256" }, - { "internalType": "uint64", "name": "lastExpireFillTime", "type": "uint64" }, - { "internalType": "uint64", "name": "withdrawNonce", "type": "uint64" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "tokenInfos", - "outputs": [ - { "internalType": "uint112", "name": "protocolFee", "type": "uint112" }, - { "internalType": "uint112", "name": "penaltyLnCollateral", "type": "uint112" }, - { "internalType": "uint8", "name": "sourceDecimals", "type": "uint8" }, - { "internalType": "uint8", "name": "targetDecimals", "type": "uint8" }, - { "internalType": "bool", "name": "isRegistered", "type": "bool" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_provider", "type": "address" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" } - ], - "name": "totalFee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "internalType": "uint112", "name": "totalFee", "type": "uint112" }, - { "internalType": "uint64", "name": "withdrawNonce", "type": "uint64" } - ], - "internalType": "struct LnDefaultBridgeSource.Snapshot", - "name": "_snapshot", - "type": "tuple" - }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" }, - { "internalType": "address", "name": "_receiver", "type": "address" } - ], - "name": "transferAndLockMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes32", "name": "previousTransferId", "type": "bytes32" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, - { "internalType": "address", "name": "receiver", "type": "address" } - ], - "internalType": "struct LnBridgeHelper.TransferParameter", - "name": "_params", - "type": "tuple" - }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "bytes32", "name": "_expectedTransferId", "type": "bytes32" } - ], - "name": "transferAndReleaseMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_dao", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_receiver", "type": "address" }], - "name": "updateFeeReceiver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "bytes32", "name": "_lastTransferId", "type": "bytes32" }, - { "internalType": "uint64", "name": "_withdrawNonce", "type": "uint64" }, - { "internalType": "address", "name": "_provider", "type": "address" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint256", "name": "_amount", "type": "uint256" } - ], - "name": "withdrawSlashFundReserve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "stateMutability": "payable", "type": "receive" } -] diff --git a/packages/apps/src/abi/lnbridgev20-default.ts b/packages/apps/src/abi/lnbridgev20-default.ts new file mode 100644 index 000000000..4f6242f59 --- /dev/null +++ b/packages/apps/src/abi/lnbridgev20-default.ts @@ -0,0 +1,543 @@ +const abi = [ + { + anonymous: false, + inputs: [{ indexed: false, internalType: "uint8", name: "version", type: "uint8" }], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "baseFee", type: "uint112" }, + { indexed: false, internalType: "uint8", name: "liquidityfeeRate", type: "uint8" }, + ], + name: "LnProviderUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + { indexed: false, internalType: "uint64", name: "withdrawNonce", type: "uint64" }, + ], + name: "MarginUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "transferId", type: "bytes32" }, + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "margin", type: "uint256" }, + { indexed: false, internalType: "address", name: "slasher", type: "address" }, + ], + name: "Slash", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "bytes32", name: "expectedTransferId", type: "bytes32" }, + ], + name: "SlashRequest", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "SlashReserveUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "bytes32", name: "transferId", type: "bytes32" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "amount", type: "uint112" }, + { indexed: false, internalType: "uint112", name: "fee", type: "uint112" }, + { indexed: false, internalType: "uint64", name: "timestamp", type: "uint64" }, + { indexed: false, internalType: "address", name: "receiver", type: "address" }, + ], + name: "TokenLocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "transferId", type: "bytes32" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + ], + name: "TransferFilled", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Unpaused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "amount", type: "uint112" }, + ], + name: "WithdrawMarginRequest", + type: "event", + }, + { + inputs: [], + name: "dao", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint256", name: "_margin", type: "uint256" }, + ], + name: "depositProviderMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "depositSlashFundReserve", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "bytes32", name: "previousTransferId", type: "bytes32" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "uint112", name: "amount", type: "uint112" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + internalType: "struct LnBridgeHelper.TransferParameter", + name: "_params", + type: "tuple", + }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_slasher", type: "address" }, + { internalType: "uint112", name: "_fee", type: "uint112" }, + { internalType: "uint112", name: "_penalty", type: "uint112" }, + ], + name: "encodeSlashCall", + outputs: [{ internalType: "bytes", name: "message", type: "bytes" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "_lastTransferId", type: "bytes32" }, + { internalType: "uint64", name: "_withdrawNonce", type: "uint64" }, + { internalType: "address", name: "_provider", type: "address" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + ], + name: "encodeWithdrawCall", + outputs: [{ internalType: "bytes", name: "message", type: "bytes" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "fillTransfers", + outputs: [ + { internalType: "uint64", name: "timestamp", type: "uint64" }, + { internalType: "address", name: "slasher", type: "address" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "dao", type: "address" }], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "lockInfos", + outputs: [ + { internalType: "uint112", name: "fee", type: "uint112" }, + { internalType: "uint112", name: "penalty", type: "uint112" }, + { internalType: "uint32", name: "timestamp", type: "uint32" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], + name: "messagers", + outputs: [ + { internalType: "address", name: "sendService", type: "address" }, + { internalType: "address", name: "receiveService", type: "address" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "operator", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "paused", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "protocolFeeReceiver", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + ], + name: "providerPause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + ], + name: "providerUnpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "bytes32", name: "previousTransferId", type: "bytes32" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "uint112", name: "amount", type: "uint112" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + internalType: "struct LnBridgeHelper.TransferParameter", + name: "_params", + type: "tuple", + }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "bytes32", name: "_expectedTransferId", type: "bytes32" }, + { internalType: "bytes", name: "_extParams", type: "bytes" }, + ], + name: "requestSlashAndRemoteRelease", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + { internalType: "bytes", name: "_extParams", type: "bytes" }, + ], + name: "requestWithdrawMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_operator", type: "address" }], + name: "setOperator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_baseFee", type: "uint112" }, + { internalType: "uint8", name: "_liquidityFeeRate", type: "uint8" }, + ], + name: "setProviderFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_remoteBridge", type: "address" }, + { internalType: "address", name: "_service", type: "address" }, + ], + name: "setReceiveService", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_remoteBridge", type: "address" }, + { internalType: "address", name: "_service", type: "address" }, + ], + name: "setSendService", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_protocolFee", type: "uint112" }, + { internalType: "uint112", name: "_penaltyLnCollateral", type: "uint112" }, + { internalType: "uint8", name: "_sourceDecimals", type: "uint8" }, + { internalType: "uint8", name: "_targetDecimals", type: "uint8" }, + ], + name: "setTokenInfo", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "bytes32", name: "previousTransferId", type: "bytes32" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "uint112", name: "amount", type: "uint112" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + internalType: "struct LnBridgeHelper.TransferParameter", + name: "_params", + type: "tuple", + }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_slasher", type: "address" }, + { internalType: "uint112", name: "_fee", type: "uint112" }, + { internalType: "uint112", name: "_penalty", type: "uint112" }, + ], + name: "slash", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "srcProviders", + outputs: [ + { + components: [ + { internalType: "uint112", name: "baseFee", type: "uint112" }, + { internalType: "uint16", name: "liquidityFeeRate", type: "uint16" }, + { internalType: "uint64", name: "withdrawNonce", type: "uint64" }, + { internalType: "bool", name: "pause", type: "bool" }, + ], + internalType: "struct LnDefaultBridgeSource.SourceProviderConfigure", + name: "config", + type: "tuple", + }, + { internalType: "bytes32", name: "lastTransferId", type: "bytes32" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "tgtProviders", + outputs: [ + { internalType: "uint256", name: "margin", type: "uint256" }, + { internalType: "uint256", name: "slashReserveFund", type: "uint256" }, + { internalType: "uint64", name: "lastExpireFillTime", type: "uint64" }, + { internalType: "uint64", name: "withdrawNonce", type: "uint64" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "tokenInfos", + outputs: [ + { internalType: "uint112", name: "protocolFee", type: "uint112" }, + { internalType: "uint112", name: "penaltyLnCollateral", type: "uint112" }, + { internalType: "uint8", name: "sourceDecimals", type: "uint8" }, + { internalType: "uint8", name: "targetDecimals", type: "uint8" }, + { internalType: "bool", name: "isRegistered", type: "bool" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_provider", type: "address" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + ], + name: "totalFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "bytes32", name: "transferId", type: "bytes32" }, + { internalType: "uint112", name: "totalFee", type: "uint112" }, + { internalType: "uint64", name: "withdrawNonce", type: "uint64" }, + ], + internalType: "struct LnDefaultBridgeSource.Snapshot", + name: "_snapshot", + type: "tuple", + }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "transferAndLockMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "bytes32", name: "previousTransferId", type: "bytes32" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "uint112", name: "amount", type: "uint112" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + internalType: "struct LnBridgeHelper.TransferParameter", + name: "_params", + type: "tuple", + }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "bytes32", name: "_expectedTransferId", type: "bytes32" }, + ], + name: "transferAndReleaseMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_dao", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "address", name: "_receiver", type: "address" }], + name: "updateFeeReceiver", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "bytes32", name: "_lastTransferId", type: "bytes32" }, + { internalType: "uint64", name: "_withdrawNonce", type: "uint64" }, + { internalType: "address", name: "_provider", type: "address" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + ], + name: "withdraw", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint256", name: "_amount", type: "uint256" }, + ], + name: "withdrawSlashFundReserve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { stateMutability: "payable", type: "receive" }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/lnbridgev20-opposite.json b/packages/apps/src/abi/lnbridgev20-opposite.json deleted file mode 100644 index b0fb14a92..000000000 --- a/packages/apps/src/abi/lnbridgev20-opposite.json +++ /dev/null @@ -1,445 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint8", "name": "version", "type": "uint8" }], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "amount", "type": "uint112" } - ], - "name": "LiquidityWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "margin", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "baseFee", "type": "uint112" }, - { "indexed": false, "internalType": "uint16", "name": "liquidityfeeRate", "type": "uint16" } - ], - "name": "LnProviderUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "margin", "type": "uint112" }, - { "indexed": false, "internalType": "address", "name": "slasher", "type": "address" } - ], - "name": "Slash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "bytes32", "name": "transferId", "type": "bytes32" } - ], - "name": "SlashRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "indexed": false, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "fee", "type": "uint112" }, - { "indexed": false, "internalType": "uint64", "name": "timestamp", "type": "uint64" }, - { "indexed": false, "internalType": "address", "name": "receiver", "type": "address" } - ], - "name": "TokenLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "indexed": false, "internalType": "address", "name": "slasher", "type": "address" } - ], - "name": "TransferFilled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "indexed": false, "internalType": "address", "name": "sourceToken", "type": "address" }, - { "indexed": false, "internalType": "address", "name": "targetToken", "type": "address" }, - { "indexed": false, "internalType": "uint112", "name": "amount", "type": "uint112" } - ], - "name": "WithdrawMarginRequest", - "type": "event" - }, - { - "inputs": [], - "name": "dao", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "fillTransfers", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_dao", "type": "address" }], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "lockInfos", - "outputs": [ - { "internalType": "uint112", "name": "amountWithFeeAndPenalty", "type": "uint112" }, - { "internalType": "uint32", "name": "timestamp", "type": "uint32" }, - { "internalType": "bool", "name": "hasSlashed", "type": "bool" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "operator", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "protocolFeeReceiver", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" } - ], - "name": "providerPause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" } - ], - "name": "providerUnpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "internalType": "bytes32", "name": "_transferId", "type": "bytes32" }, - { "internalType": "bytes", "name": "_extParams", "type": "bytes" } - ], - "name": "requestRetrySlashAndRemoteRelease", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes32", "name": "previousTransferId", "type": "bytes32" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, - { "internalType": "address", "name": "receiver", "type": "address" } - ], - "internalType": "struct LnBridgeHelper.TransferParameter", - "name": "_params", - "type": "tuple" - }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "bytes32", "name": "_expectedTransferId", "type": "bytes32" }, - { "internalType": "bytes", "name": "_extParams", "type": "bytes" } - ], - "name": "requestSlashAndRemoteRelease", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "bytes32", "name": "_lastTransferId", "type": "bytes32" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" }, - { "internalType": "bytes", "name": "_extParams", "type": "bytes" } - ], - "name": "requestWithdrawMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_operator", "type": "address" }], - "name": "setOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_remoteBridge", "type": "address" }, - { "internalType": "address", "name": "_service", "type": "address" } - ], - "name": "setReceiveService", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_remoteBridge", "type": "address" }, - { "internalType": "address", "name": "_service", "type": "address" } - ], - "name": "setSendService", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_protocolFee", "type": "uint112" }, - { "internalType": "uint112", "name": "_penaltyLnCollateral", "type": "uint112" }, - { "internalType": "uint8", "name": "_sourceDecimals", "type": "uint8" }, - { "internalType": "uint8", "name": "_targetDecimals", "type": "uint8" } - ], - "name": "setTokenInfo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "_latestSlashTransferId", "type": "bytes32" }, - { "internalType": "bytes32", "name": "_transferId", "type": "bytes32" }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "uint256", "name": "_timestamp", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "address", "name": "_provider", "type": "address" }, - { "internalType": "address", "name": "_slasher", "type": "address" } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "slashInfos", - "outputs": [ - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "address", "name": "slasher", "type": "address" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "srcProviders", - "outputs": [ - { - "components": [ - { "internalType": "uint112", "name": "margin", "type": "uint112" }, - { "internalType": "uint112", "name": "baseFee", "type": "uint112" }, - { "internalType": "uint16", "name": "liquidityFeeRate", "type": "uint16" }, - { "internalType": "bool", "name": "pause", "type": "bool" } - ], - "internalType": "struct LnOppositeBridgeSource.SourceProviderConfigure", - "name": "config", - "type": "tuple" - }, - { "internalType": "bytes32", "name": "lastTransferId", "type": "bytes32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "name": "tokenInfos", - "outputs": [ - { "internalType": "uint112", "name": "protocolFee", "type": "uint112" }, - { "internalType": "uint112", "name": "penaltyLnCollateral", "type": "uint112" }, - { "internalType": "uint8", "name": "sourceDecimals", "type": "uint8" }, - { "internalType": "uint8", "name": "targetDecimals", "type": "uint8" }, - { "internalType": "bool", "name": "isRegistered", "type": "bool" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_provider", "type": "address" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" } - ], - "name": "totalFee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "uint256", "name": "remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "bytes32", "name": "transferId", "type": "bytes32" }, - { "internalType": "uint112", "name": "totalFee", "type": "uint112" }, - { "internalType": "uint112", "name": "depositedMargin", "type": "uint112" } - ], - "internalType": "struct LnOppositeBridgeSource.Snapshot", - "name": "_snapshot", - "type": "tuple" - }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" }, - { "internalType": "address", "name": "_receiver", "type": "address" } - ], - "name": "transferAndLockMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes32", "name": "previousTransferId", "type": "bytes32" }, - { "internalType": "address", "name": "provider", "type": "address" }, - { "internalType": "address", "name": "sourceToken", "type": "address" }, - { "internalType": "address", "name": "targetToken", "type": "address" }, - { "internalType": "uint112", "name": "amount", "type": "uint112" }, - { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, - { "internalType": "address", "name": "receiver", "type": "address" } - ], - "internalType": "struct LnBridgeHelper.TransferParameter", - "name": "_params", - "type": "tuple" - }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "bytes32", "name": "_expectedTransferId", "type": "bytes32" } - ], - "name": "transferAndReleaseMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_dao", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_receiver", "type": "address" }], - "name": "updateFeeReceiver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_margin", "type": "uint112" }, - { "internalType": "uint112", "name": "_baseFee", "type": "uint112" }, - { "internalType": "uint16", "name": "_liquidityFeeRate", "type": "uint16" } - ], - "name": "updateProviderFeeAndMargin", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "_latestSlashTransferId", "type": "bytes32" }, - { "internalType": "bytes32", "name": "_lastTransferId", "type": "bytes32" }, - { "internalType": "uint256", "name": "_remoteChainId", "type": "uint256" }, - { "internalType": "address", "name": "_provider", "type": "address" }, - { "internalType": "address", "name": "_sourceToken", "type": "address" }, - { "internalType": "address", "name": "_targetToken", "type": "address" }, - { "internalType": "uint112", "name": "_amount", "type": "uint112" } - ], - "name": "withdrawMargin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "stateMutability": "payable", "type": "receive" } -] diff --git a/packages/apps/src/abi/lnbridgev20-opposite.ts b/packages/apps/src/abi/lnbridgev20-opposite.ts new file mode 100644 index 000000000..e31c8f98f --- /dev/null +++ b/packages/apps/src/abi/lnbridgev20-opposite.ts @@ -0,0 +1,447 @@ +const abi = [ + { + anonymous: false, + inputs: [{ indexed: false, internalType: "uint8", name: "version", type: "uint8" }], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "amount", type: "uint112" }, + ], + name: "LiquidityWithdrawn", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "margin", type: "uint112" }, + { indexed: false, internalType: "uint112", name: "baseFee", type: "uint112" }, + { indexed: false, internalType: "uint16", name: "liquidityfeeRate", type: "uint16" }, + ], + name: "LnProviderUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "bytes32", name: "transferId", type: "bytes32" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "margin", type: "uint112" }, + { indexed: false, internalType: "address", name: "slasher", type: "address" }, + ], + name: "Slash", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "bytes32", name: "transferId", type: "bytes32" }, + ], + name: "SlashRequest", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "bytes32", name: "transferId", type: "bytes32" }, + { indexed: false, internalType: "address", name: "provider", type: "address" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "amount", type: "uint112" }, + { indexed: false, internalType: "uint112", name: "fee", type: "uint112" }, + { indexed: false, internalType: "uint64", name: "timestamp", type: "uint64" }, + { indexed: false, internalType: "address", name: "receiver", type: "address" }, + ], + name: "TokenLocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "bytes32", name: "transferId", type: "bytes32" }, + { indexed: false, internalType: "address", name: "slasher", type: "address" }, + ], + name: "TransferFilled", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Unpaused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: false, internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { indexed: false, internalType: "address", name: "sourceToken", type: "address" }, + { indexed: false, internalType: "address", name: "targetToken", type: "address" }, + { indexed: false, internalType: "uint112", name: "amount", type: "uint112" }, + ], + name: "WithdrawMarginRequest", + type: "event", + }, + { + inputs: [], + name: "dao", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "fillTransfers", + outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_dao", type: "address" }], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "lockInfos", + outputs: [ + { internalType: "uint112", name: "amountWithFeeAndPenalty", type: "uint112" }, + { internalType: "uint32", name: "timestamp", type: "uint32" }, + { internalType: "bool", name: "hasSlashed", type: "bool" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "operator", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "paused", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "protocolFeeReceiver", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + ], + name: "providerPause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + ], + name: "providerUnpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { internalType: "bytes32", name: "_transferId", type: "bytes32" }, + { internalType: "bytes", name: "_extParams", type: "bytes" }, + ], + name: "requestRetrySlashAndRemoteRelease", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "bytes32", name: "previousTransferId", type: "bytes32" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "uint112", name: "amount", type: "uint112" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + internalType: "struct LnBridgeHelper.TransferParameter", + name: "_params", + type: "tuple", + }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "bytes32", name: "_expectedTransferId", type: "bytes32" }, + { internalType: "bytes", name: "_extParams", type: "bytes" }, + ], + name: "requestSlashAndRemoteRelease", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "bytes32", name: "_lastTransferId", type: "bytes32" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + { internalType: "bytes", name: "_extParams", type: "bytes" }, + ], + name: "requestWithdrawMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_operator", type: "address" }], + name: "setOperator", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_remoteBridge", type: "address" }, + { internalType: "address", name: "_service", type: "address" }, + ], + name: "setReceiveService", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_remoteBridge", type: "address" }, + { internalType: "address", name: "_service", type: "address" }, + ], + name: "setSendService", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_protocolFee", type: "uint112" }, + { internalType: "uint112", name: "_penaltyLnCollateral", type: "uint112" }, + { internalType: "uint8", name: "_sourceDecimals", type: "uint8" }, + { internalType: "uint8", name: "_targetDecimals", type: "uint8" }, + ], + name: "setTokenInfo", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "_latestSlashTransferId", type: "bytes32" }, + { internalType: "bytes32", name: "_transferId", type: "bytes32" }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "uint256", name: "_timestamp", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "address", name: "_provider", type: "address" }, + { internalType: "address", name: "_slasher", type: "address" }, + ], + name: "slash", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "slashInfos", + outputs: [ + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "address", name: "slasher", type: "address" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "srcProviders", + outputs: [ + { + components: [ + { internalType: "uint112", name: "margin", type: "uint112" }, + { internalType: "uint112", name: "baseFee", type: "uint112" }, + { internalType: "uint16", name: "liquidityFeeRate", type: "uint16" }, + { internalType: "bool", name: "pause", type: "bool" }, + ], + internalType: "struct LnOppositeBridgeSource.SourceProviderConfigure", + name: "config", + type: "tuple", + }, + { internalType: "bytes32", name: "lastTransferId", type: "bytes32" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }], + name: "tokenInfos", + outputs: [ + { internalType: "uint112", name: "protocolFee", type: "uint112" }, + { internalType: "uint112", name: "penaltyLnCollateral", type: "uint112" }, + { internalType: "uint8", name: "sourceDecimals", type: "uint8" }, + { internalType: "uint8", name: "targetDecimals", type: "uint8" }, + { internalType: "bool", name: "isRegistered", type: "bool" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_provider", type: "address" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + ], + name: "totalFee", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "uint256", name: "remoteChainId", type: "uint256" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "bytes32", name: "transferId", type: "bytes32" }, + { internalType: "uint112", name: "totalFee", type: "uint112" }, + { internalType: "uint112", name: "depositedMargin", type: "uint112" }, + ], + internalType: "struct LnOppositeBridgeSource.Snapshot", + name: "_snapshot", + type: "tuple", + }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + { internalType: "address", name: "_receiver", type: "address" }, + ], + name: "transferAndLockMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + components: [ + { internalType: "bytes32", name: "previousTransferId", type: "bytes32" }, + { internalType: "address", name: "provider", type: "address" }, + { internalType: "address", name: "sourceToken", type: "address" }, + { internalType: "address", name: "targetToken", type: "address" }, + { internalType: "uint112", name: "amount", type: "uint112" }, + { internalType: "uint256", name: "timestamp", type: "uint256" }, + { internalType: "address", name: "receiver", type: "address" }, + ], + internalType: "struct LnBridgeHelper.TransferParameter", + name: "_params", + type: "tuple", + }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "bytes32", name: "_expectedTransferId", type: "bytes32" }, + ], + name: "transferAndReleaseMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "_dao", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "address", name: "_receiver", type: "address" }], + name: "updateFeeReceiver", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_margin", type: "uint112" }, + { internalType: "uint112", name: "_baseFee", type: "uint112" }, + { internalType: "uint16", name: "_liquidityFeeRate", type: "uint16" }, + ], + name: "updateProviderFeeAndMargin", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "bytes32", name: "_latestSlashTransferId", type: "bytes32" }, + { internalType: "bytes32", name: "_lastTransferId", type: "bytes32" }, + { internalType: "uint256", name: "_remoteChainId", type: "uint256" }, + { internalType: "address", name: "_provider", type: "address" }, + { internalType: "address", name: "_sourceToken", type: "address" }, + { internalType: "address", name: "_targetToken", type: "address" }, + { internalType: "uint112", name: "_amount", type: "uint112" }, + ], + name: "withdrawMargin", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { stateMutability: "payable", type: "receive" }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/lpbridge-sub2eth.json b/packages/apps/src/abi/lpbridge-sub2eth.json deleted file mode 100644 index 09a0ae83f..000000000 --- a/packages/apps/src/abi/lpbridge-sub2eth.json +++ /dev/null @@ -1,1063 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "FeeUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "LiquidityWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "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": false, - "internalType": "uint64", - "name": "toChainId", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "fee", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "TokenLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "TransferCanceled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "relayer", - "type": "address" - } - ], - "name": "TransferRelayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "DAO_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "INVALID_TOKEN_INDEX", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_TRANSFER_AMOUNT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeReceiver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "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": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "increaseFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - } - ], - "name": "increaseNativeFee", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_localEndpoint", - "type": "address" - }, - { - "internalType": "address", - "name": "_remoteEndpoint", - "type": "address" - }, - { - "internalType": "address", - "name": "dao", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "issuedMessages", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "localEndpoint", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "fee", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "tokenIndex", - "type": "uint32" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - } - ], - "name": "lockAndRemoteIssuing", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "lockInfos", - "outputs": [ - { - "internalType": "uint32", - "name": "tokenIndex", - "type": "uint32" - }, - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "fee", - "type": "uint112" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "fee", - "type": "uint112" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - } - ], - "name": "lockNativeAndRemoteIssuing", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "local", - "type": "address" - }, - { - "internalType": "address", - "name": "remote", - "type": "address" - }, - { - "internalType": "uint112", - "name": "helixFee", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "remoteChainId", - "type": "uint32" - }, - { - "internalType": "uint8", - "name": "localDecimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "remoteDecimals", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "remoteIsNative", - "type": "bool" - } - ], - "name": "registerToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint64", - "name": "sourceChainId", - "type": "uint64" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - } - ], - "name": "relay", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "remoteBridge", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "remoteEndpoint", - "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": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint64", - "name": "sourceChainId", - "type": "uint64" - }, - { - "internalType": "bool", - "name": "withdrawNative", - "type": "bool" - } - ], - "name": "requestCancelIssuing", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "transferIds", - "type": "bytes32[]" - }, - { - "internalType": "bool", - "name": "withdrawNative", - "type": "bool" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "requestWithdrawLiquidity", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_remoteBridge", - "type": "address" - } - ], - "name": "setRemoteBridge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_wTokenIndex", - "type": "uint32" - } - ], - "name": "setwTokenIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tokens", - "outputs": [ - { - "internalType": "address", - "name": "localToken", - "type": "address" - }, - { - "internalType": "address", - "name": "remoteToken", - "type": "address" - }, - { - "internalType": "uint112", - "name": "helixFee", - "type": "uint112" - }, - { - "internalType": "uint64", - "name": "remoteChainId", - "type": "uint64" - }, - { - "internalType": "uint8", - "name": "localDecimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "remoteDecimals", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "remoteIsNative", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "updateFeeReceiver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_tokenIndex", - "type": "uint32" - }, - { - "internalType": "uint112", - "name": "_helixFee", - "type": "uint112" - } - ], - "name": "updateHelixFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_localEndpoint", - "type": "address" - }, - { - "internalType": "address", - "name": "_remoteEndpoint", - "type": "address" - } - ], - "name": "updateMessageEndpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "wTokenIndex", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "transferIds", - "type": "bytes32[]" - }, - { - "internalType": "bool", - "name": "withdrawNative", - "type": "bool" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "withdrawLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/packages/apps/src/abi/lpbridge-sub2eth.ts b/packages/apps/src/abi/lpbridge-sub2eth.ts new file mode 100644 index 000000000..756863d8e --- /dev/null +++ b/packages/apps/src/abi/lpbridge-sub2eth.ts @@ -0,0 +1,1065 @@ +const abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "FeeUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "LiquidityWithdrawn", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Paused", + 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: false, + internalType: "uint64", + name: "toChainId", + type: "uint64", + }, + { + indexed: false, + internalType: "bool", + name: "isNative", + type: "bool", + }, + { + indexed: false, + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + { + indexed: false, + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + indexed: false, + internalType: "uint112", + name: "fee", + type: "uint112", + }, + { + indexed: false, + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "TokenLocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "TransferCanceled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address", + }, + ], + name: "TransferRelayed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Unpaused", + type: "event", + }, + { + inputs: [], + name: "DAO_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "INVALID_TOKEN_INDEX", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_TRANSFER_AMOUNT", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "OPERATOR_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeReceiver", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + 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: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getRoleMember", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleMemberCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + 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: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "increaseFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + ], + name: "increaseNativeFee", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_localEndpoint", + type: "address", + }, + { + internalType: "address", + name: "_remoteEndpoint", + type: "address", + }, + { + internalType: "address", + name: "dao", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + name: "issuedMessages", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "localEndpoint", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint112", + name: "fee", + type: "uint112", + }, + { + internalType: "uint32", + name: "tokenIndex", + type: "uint32", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + ], + name: "lockAndRemoteIssuing", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + name: "lockInfos", + outputs: [ + { + internalType: "uint32", + name: "tokenIndex", + type: "uint32", + }, + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint112", + name: "fee", + type: "uint112", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint112", + name: "fee", + type: "uint112", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + ], + name: "lockNativeAndRemoteIssuing", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "local", + type: "address", + }, + { + internalType: "address", + name: "remote", + type: "address", + }, + { + internalType: "uint112", + name: "helixFee", + type: "uint112", + }, + { + internalType: "uint32", + name: "remoteChainId", + type: "uint32", + }, + { + internalType: "uint8", + name: "localDecimals", + type: "uint8", + }, + { + internalType: "uint8", + name: "remoteDecimals", + type: "uint8", + }, + { + internalType: "bool", + name: "remoteIsNative", + type: "bool", + }, + ], + name: "registerToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint64", + name: "sourceChainId", + type: "uint64", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + ], + name: "relay", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "remoteBridge", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "remoteEndpoint", + 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: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint64", + name: "sourceChainId", + type: "uint64", + }, + { + internalType: "bool", + name: "withdrawNative", + type: "bool", + }, + ], + name: "requestCancelIssuing", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "transferIds", + type: "bytes32[]", + }, + { + internalType: "bool", + name: "withdrawNative", + type: "bool", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "requestWithdrawLiquidity", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_remoteBridge", + type: "address", + }, + ], + name: "setRemoteBridge", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_wTokenIndex", + type: "uint32", + }, + ], + name: "setwTokenIndex", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tokenLength", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "tokens", + outputs: [ + { + internalType: "address", + name: "localToken", + type: "address", + }, + { + internalType: "address", + name: "remoteToken", + type: "address", + }, + { + internalType: "uint112", + name: "helixFee", + type: "uint112", + }, + { + internalType: "uint64", + name: "remoteChainId", + type: "uint64", + }, + { + internalType: "uint8", + name: "localDecimals", + type: "uint8", + }, + { + internalType: "uint8", + name: "remoteDecimals", + type: "uint8", + }, + { + internalType: "bool", + name: "remoteIsNative", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_receiver", + type: "address", + }, + ], + name: "updateFeeReceiver", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_tokenIndex", + type: "uint32", + }, + { + internalType: "uint112", + name: "_helixFee", + type: "uint112", + }, + ], + name: "updateHelixFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_localEndpoint", + type: "address", + }, + { + internalType: "address", + name: "_remoteEndpoint", + type: "address", + }, + ], + name: "updateMessageEndpoint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "wTokenIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "transferIds", + type: "bytes32[]", + }, + { + internalType: "bool", + name: "withdrawNative", + type: "bool", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "withdrawLiquidity", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/lpbridge.json b/packages/apps/src/abi/lpbridge.json deleted file mode 100644 index 6d1e2e45c..000000000 --- a/packages/apps/src/abi/lpbridge.json +++ /dev/null @@ -1,992 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "FeeUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "LiquidityWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "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": false, - "internalType": "uint64", - "name": "toChainId", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "fee", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "TokenLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "TransferCanceled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "relayer", - "type": "address" - } - ], - "name": "TransferRelayed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "DAO_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "INVALID_TOKEN_INDEX", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_TRANSFER_AMOUNT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeReceiver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "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": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": "bytes32", - "name": "transferId", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "increaseFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "transferId", - "type": "bytes32" - } - ], - "name": "increaseNativeFee", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_localEndpoint", - "type": "address" - }, - { - "internalType": "address", - "name": "_remoteEndpoint", - "type": "address" - }, - { - "internalType": "address", - "name": "dao", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "issuedMessages", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "fee", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "tokenIndex", - "type": "uint32" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - } - ], - "name": "lockAndRemoteIssuing", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "fee", - "type": "uint112" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - } - ], - "name": "lockNativeAndRemoteIssuing", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "local", - "type": "address" - }, - { - "internalType": "address", - "name": "remote", - "type": "address" - }, - { - "internalType": "uint112", - "name": "helixFee", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "remoteChainId", - "type": "uint32" - }, - { - "internalType": "uint8", - "name": "localDecimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "remoteDecimals", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "remoteIsNative", - "type": "bool" - } - ], - "name": "registerToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint64", - "name": "sourceChainId", - "type": "uint64" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - } - ], - "name": "relay", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "issuingNative", - "type": "bool" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint64", - "name": "sourceChainId", - "type": "uint64" - }, - { - "internalType": "bool", - "name": "withdrawNative", - "type": "bool" - } - ], - "name": "requestCancelIssuing", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "transferIds", - "type": "bytes32[]" - }, - { - "internalType": "bool", - "name": "withdrawNative", - "type": "bool" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "requestWithdrawLiquidity", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_remoteBridge", - "type": "address" - } - ], - "name": "setRemoteBridge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "_wTokenIndex", - "type": "uint32" - } - ], - "name": "setwTokenIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "tokens", - "outputs": [ - { - "internalType": "address", - "name": "localToken", - "type": "address" - }, - { - "internalType": "address", - "name": "remoteToken", - "type": "address" - }, - { - "internalType": "uint112", - "name": "helixFee", - "type": "uint112" - }, - { - "internalType": "uint64", - "name": "remoteChainId", - "type": "uint64" - }, - { - "internalType": "uint8", - "name": "localDecimals", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "remoteDecimals", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "remoteIsNative", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - } - ], - "name": "updateFeeReceiver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "wTokenIndex", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "transferIds", - "type": "bytes32[]" - }, - { - "internalType": "bool", - "name": "withdrawNative", - "type": "bool" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "withdrawLiquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/packages/apps/src/abi/lpbridge.ts b/packages/apps/src/abi/lpbridge.ts new file mode 100644 index 000000000..5d6f565ea --- /dev/null +++ b/packages/apps/src/abi/lpbridge.ts @@ -0,0 +1,994 @@ +const abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "FeeUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "LiquidityWithdrawn", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Paused", + 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: false, + internalType: "uint64", + name: "toChainId", + type: "uint64", + }, + { + indexed: false, + internalType: "bool", + name: "isNative", + type: "bool", + }, + { + indexed: false, + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + { + indexed: false, + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + indexed: false, + internalType: "uint112", + name: "fee", + type: "uint112", + }, + { + indexed: false, + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "TokenLocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "TransferCanceled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "relayer", + type: "address", + }, + ], + name: "TransferRelayed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Unpaused", + type: "event", + }, + { + inputs: [], + name: "DAO_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "INVALID_TOKEN_INDEX", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "MAX_TRANSFER_AMOUNT", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "OPERATOR_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "feeReceiver", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + 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: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getRoleMember", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleMemberCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + 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: "bytes32", + name: "transferId", + type: "bytes32", + }, + { + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "increaseFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "transferId", + type: "bytes32", + }, + ], + name: "increaseNativeFee", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_localEndpoint", + type: "address", + }, + { + internalType: "address", + name: "_remoteEndpoint", + type: "address", + }, + { + internalType: "address", + name: "dao", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + name: "issuedMessages", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint112", + name: "fee", + type: "uint112", + }, + { + internalType: "uint32", + name: "tokenIndex", + type: "uint32", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + ], + name: "lockAndRemoteIssuing", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint112", + name: "fee", + type: "uint112", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + ], + name: "lockNativeAndRemoteIssuing", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "local", + type: "address", + }, + { + internalType: "address", + name: "remote", + type: "address", + }, + { + internalType: "uint112", + name: "helixFee", + type: "uint112", + }, + { + internalType: "uint32", + name: "remoteChainId", + type: "uint32", + }, + { + internalType: "uint8", + name: "localDecimals", + type: "uint8", + }, + { + internalType: "uint8", + name: "remoteDecimals", + type: "uint8", + }, + { + internalType: "bool", + name: "remoteIsNative", + type: "bool", + }, + ], + name: "registerToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint64", + name: "sourceChainId", + type: "uint64", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + ], + name: "relay", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "bool", + name: "issuingNative", + type: "bool", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + { + internalType: "uint112", + name: "amount", + type: "uint112", + }, + { + internalType: "uint64", + name: "sourceChainId", + type: "uint64", + }, + { + internalType: "bool", + name: "withdrawNative", + type: "bool", + }, + ], + name: "requestCancelIssuing", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "bytes32[]", + name: "transferIds", + type: "bytes32[]", + }, + { + internalType: "bool", + name: "withdrawNative", + type: "bool", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "requestWithdrawLiquidity", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_remoteBridge", + type: "address", + }, + ], + name: "setRemoteBridge", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "_wTokenIndex", + type: "uint32", + }, + ], + name: "setwTokenIndex", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tokenLength", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "tokens", + outputs: [ + { + internalType: "address", + name: "localToken", + type: "address", + }, + { + internalType: "address", + name: "remoteToken", + type: "address", + }, + { + internalType: "uint112", + name: "helixFee", + type: "uint112", + }, + { + internalType: "uint64", + name: "remoteChainId", + type: "uint64", + }, + { + internalType: "uint8", + name: "localDecimals", + type: "uint8", + }, + { + internalType: "uint8", + name: "remoteDecimals", + type: "uint8", + }, + { + internalType: "bool", + name: "remoteIsNative", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_receiver", + type: "address", + }, + ], + name: "updateFeeReceiver", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "wTokenIndex", + outputs: [ + { + internalType: "uint32", + name: "", + type: "uint32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32[]", + name: "transferIds", + type: "bytes32[]", + }, + { + internalType: "bool", + name: "withdrawNative", + type: "bool", + }, + { + internalType: "address", + name: "receiver", + type: "address", + }, + ], + name: "withdrawLiquidity", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/mappingtoken-dvmdvm.json b/packages/apps/src/abi/mappingtoken-dvmdvm.json deleted file mode 100644 index f9a6dc4f9..000000000 --- a/packages/apps/src/abi/mappingtoken-dvmdvm.json +++ /dev/null @@ -1,1269 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isNative", - "type": "bool" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "messageHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "BurnAndRemoteUnlocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "DailyLimitChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "mappingToken", - "type": "address" - } - ], - "name": "IssuingERC20Created", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "tokenType", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "NewLogicSetted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "refundId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "RemoteUnlockFailure", - "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": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenIssued", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenRemintForFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "CALLEE_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CALLER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DAO_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LASTDAY_BIT_LENGTH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "SPEND_BIT_LENGTH", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "_slotReserved", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allMappingTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnAndRemoteUnlock", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnAndRemoteUnlockNative", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "burnMessages", - "outputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - }, - { - "internalType": "bool", - "name": "hasRefundForFailed", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "calcMaxWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "changeDailyLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "dailyLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "backingAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "originalToken", - "type": "address" - } - ], - "name": "getMappingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "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": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": [], - "name": "guard", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "origin_sender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "handleIssuingFailureFromRemote", - "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": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "hash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "helixFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "issueMappingToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "mappingToken2OriginalToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "messageEndpoint", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "internalType": "string", - "name": "bridgedChainName", - "type": "string" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "newErc20Contract", - "outputs": [ - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "remoteBacking", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "remoteUnlockFailure", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "remoteSpecVersion", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "remoteReceiveGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "remoteUnlockFailureNative", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "rescueFunds", - "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": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "salt2MappingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_helixFee", - "type": "uint256" - } - ], - "name": "setHelixFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_xwToken", - "type": "address" - } - ], - "name": "setMappingNativeWrappedToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "setMessageEndpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_remoteBacking", - "type": "address" - } - ], - "name": "setRemoteBacking", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "spentToday", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "new_owner", - "type": "address" - } - ], - "name": "transferMappingTokenOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newGuard", - "type": "address" - } - ], - "name": "updateGuard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "xwToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/packages/apps/src/abi/mappingtoken-dvmdvm.ts b/packages/apps/src/abi/mappingtoken-dvmdvm.ts new file mode 100644 index 000000000..800aa184e --- /dev/null +++ b/packages/apps/src/abi/mappingtoken-dvmdvm.ts @@ -0,0 +1,1271 @@ +const abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "bool", + name: "isNative", + type: "bool", + }, + { + indexed: false, + internalType: "bytes32", + name: "messageHash", + type: "bytes32", + }, + { + indexed: false, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "BurnAndRemoteUnlocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "DailyLimitChange", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint8", + name: "version", + type: "uint8", + }, + ], + name: "Initialized", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "originalToken", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "mappingToken", + type: "address", + }, + ], + name: "IssuingERC20Created", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint32", + name: "tokenType", + type: "uint32", + }, + { + indexed: false, + internalType: "address", + name: "addr", + type: "address", + }, + ], + name: "NewLogicSetted", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "refundId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "RemoteUnlockFailure", + 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: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenIssued", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenRemintForFailed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Unpaused", + type: "event", + }, + { + inputs: [], + name: "CALLEE_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "CALLER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DAO_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "LASTDAY_BIT_LENGTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "OPERATOR_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "SPEND_BIT_LENGTH", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "_slotReserved", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "allMappingTokens", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "burnAndRemoteUnlock", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "burnAndRemoteUnlockNative", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "burnMessages", + outputs: [ + { + internalType: "bytes32", + name: "hash", + type: "bytes32", + }, + { + internalType: "bool", + name: "hasRefundForFailed", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + ], + name: "calcMaxWithdraw", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "changeDailyLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "dailyLimit", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "fee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "backingAddress", + type: "address", + }, + { + internalType: "address", + name: "originalToken", + type: "address", + }, + ], + name: "getMappingToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + 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: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getRoleMember", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleMemberCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + 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: [], + name: "guard", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "origin_sender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "handleIssuingFailureFromRemote", + 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: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "hash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "helixFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "originalToken", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "issueMappingToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "mappingToken2OriginalToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "messageEndpoint", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "originalToken", + type: "address", + }, + { + internalType: "string", + name: "bridgedChainName", + type: "string", + }, + { + internalType: "string", + name: "name", + type: "string", + }, + { + internalType: "string", + name: "symbol", + type: "string", + }, + { + internalType: "uint8", + name: "decimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "newErc20Contract", + outputs: [ + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "remoteBacking", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "originalToken", + type: "address", + }, + { + internalType: "address", + name: "originalSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "remoteUnlockFailure", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint32", + name: "remoteSpecVersion", + type: "uint32", + }, + { + internalType: "uint256", + name: "remoteReceiveGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "originalSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "remoteUnlockFailureNative", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "rescueFunds", + 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: "bytes32", + name: "", + type: "bytes32", + }, + ], + name: "salt2MappingToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "_helixFee", + type: "uint256", + }, + ], + name: "setHelixFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_xwToken", + type: "address", + }, + ], + name: "setMappingNativeWrappedToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "setMessageEndpoint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_remoteBacking", + type: "address", + }, + ], + name: "setRemoteBacking", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "spentToday", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tokenLength", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "address", + name: "new_owner", + type: "address", + }, + ], + name: "transferMappingTokenOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newGuard", + type: "address", + }, + ], + name: "updateGuard", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address payable", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "withdrawFee", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "xwToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/abi/mappingtoken-dvmevm.json b/packages/apps/src/abi/mappingtoken-dvmevm.json deleted file mode 100644 index daecd1017..000000000 --- a/packages/apps/src/abi/mappingtoken-dvmevm.json +++ /dev/null @@ -1,1095 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "BurnAndRemoteUnlocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "DailyLimitChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "mappingToken", - "type": "address" - } - ], - "name": "IssuingERC20Created", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" - } - ], - "name": "RemoteUnlockFailure", - "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": false, - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenRemintForFailed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "CALLEE_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CALLER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DAO_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "OPERATOR_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allMappingTokens", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnAndRemoteUnlock", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnAndRemoteUnlockNative", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "calcMaxWithdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "changeDailyLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "currentFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "dailyLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "backingAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "originalToken", - "type": "address" - } - ], - "name": "getMappingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "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": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": [], - "name": "guard", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "origin_sender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "handleIssuingFailureFromRemote", - "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": "bytes", - "name": "value", - "type": "bytes" - } - ], - "name": "hash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "helixFee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "issueMappingToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastDay", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "mappingToken2OriginalToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "messageEndpoint", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "internalType": "string", - "name": "bridgedChainName", - "type": "string" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "register", - "outputs": [ - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "remoteBacking", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "remoteUnlockFailure", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "transferId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "originalSender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "remoteUnlockFailureNative", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "rescueFunds", - "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": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "salt2MappingToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "originalToken", - "type": "address" - }, - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "dailyLimit", - "type": "uint256" - } - ], - "name": "setMappingToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_messageEndpoint", - "type": "address" - } - ], - "name": "setMessageEndpoint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_remoteBacking", - "type": "address" - } - ], - "name": "setRemoteBacking", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_xwToken", - "type": "address" - } - ], - "name": "setxwToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "spentToday", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "mappingToken", - "type": "address" - }, - { - "internalType": "address", - "name": "new_owner", - "type": "address" - } - ], - "name": "transferMappingTokenOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newGuard", - "type": "address" - } - ], - "name": "updateGuard", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/packages/apps/src/abi/mappingtoken-dvmevm.ts b/packages/apps/src/abi/mappingtoken-dvmevm.ts new file mode 100644 index 000000000..d89813950 --- /dev/null +++ b/packages/apps/src/abi/mappingtoken-dvmevm.ts @@ -0,0 +1,1097 @@ +const abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "BurnAndRemoteUnlocked", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "DailyLimitChange", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "originalToken", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "mappingToken", + type: "address", + }, + ], + name: "IssuingERC20Created", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "originalToken", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "originalSender", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "fee", + type: "uint256", + }, + ], + name: "RemoteUnlockFailure", + 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: false, + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenRemintForFailed", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "Unpaused", + type: "event", + }, + { + inputs: [], + name: "CALLEE_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "CALLER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DAO_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "OPERATOR_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "allMappingTokens", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "burnAndRemoteUnlock", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "burnAndRemoteUnlockNative", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + ], + name: "calcMaxWithdraw", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "changeDailyLimit", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "currentFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "dailyLimit", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "backingAddress", + type: "address", + }, + { + internalType: "address", + name: "originalToken", + type: "address", + }, + ], + name: "getMappingToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + 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: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getRoleMember", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleMemberCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + 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: [], + name: "guard", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "origin_sender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "handleIssuingFailureFromRemote", + 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: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "hash", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "helixFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "originalToken", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "issueMappingToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "lastDay", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "mappingToken2OriginalToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "messageEndpoint", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "paused", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "originalToken", + type: "address", + }, + { + internalType: "string", + name: "bridgedChainName", + type: "string", + }, + { + internalType: "string", + name: "name", + type: "string", + }, + { + internalType: "string", + name: "symbol", + type: "string", + }, + { + internalType: "uint8", + name: "decimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "register", + outputs: [ + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "remoteBacking", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "originalToken", + type: "address", + }, + { + internalType: "address", + name: "originalSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "remoteUnlockFailure", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "transferId", + type: "uint256", + }, + { + internalType: "address", + name: "originalSender", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "remoteUnlockFailureNative", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address", + }, + { + internalType: "address", + name: "recipient", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "rescueFunds", + 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: "bytes32", + name: "", + type: "bytes32", + }, + ], + name: "salt2MappingToken", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "originalToken", + type: "address", + }, + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "uint256", + name: "dailyLimit", + type: "uint256", + }, + ], + name: "setMappingToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_messageEndpoint", + type: "address", + }, + ], + name: "setMessageEndpoint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_remoteBacking", + type: "address", + }, + ], + name: "setRemoteBacking", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_xwToken", + type: "address", + }, + ], + name: "setxwToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "spentToday", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "tokenLength", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "mappingToken", + type: "address", + }, + { + internalType: "address", + name: "new_owner", + type: "address", + }, + ], + name: "transferMappingTokenOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newGuard", + type: "address", + }, + ], + name: "updateGuard", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +export default abi; diff --git a/packages/apps/src/bridges/base.ts b/packages/apps/src/bridges/base.ts index 74102b1ca..222e0d87b 100644 --- a/packages/apps/src/bridges/base.ts +++ b/packages/apps/src/bridges/base.ts @@ -1,4 +1,4 @@ -import { BridgeCategory, BridgeContract, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeContract, BridgeLogo, TransferOptions } from "@/types/bridge"; import { ChainConfig, ChainID } from "@/types/chain"; import { CrossChain } from "@/types/cross-chain"; import { HistoryRecord } from "@/types/graphql"; @@ -108,6 +108,12 @@ export abstract class BaseBridge { : undefined; } + protected async getSigner() { + if (this.walletClient) { + return (await this.walletClient.getAddresses()).at(0); + } + } + protected async validateNetwork(position: "source" | "target") { const chain = position === "source" ? this.sourceChain : this.targetChain; if (chain?.id !== (await this.publicClient?.getChainId())) { @@ -146,7 +152,7 @@ export abstract class BaseBridge { if (token.type === "native") { value = await publicClient.getBalance({ address }); } else { - const abi = (await import("../abi/erc20.json")).default; + const abi = (await import("../abi/erc20")).default; value = (await publicClient.readContract({ address: token.address, abi, @@ -172,7 +178,7 @@ export abstract class BaseBridge { private async getAllowance(owner: Address, spender: Address, token: Token, publicClient: ViemPublicClient) { if (token.type === "erc20") { - const abi = (await import("../abi/erc20.json")).default; + const abi = (await import("../abi/erc20")).default; const value = (await publicClient.readContract({ address: token.address, abi, @@ -197,7 +203,7 @@ export abstract class BaseBridge { private async approve(amount: bigint, owner: Address, spender: Address, token: Token) { if (this.publicClient && this.walletClient) { - const abi = (await import("../abi/erc20.json")).default; + const abi = (await import("../abi/erc20")).default; const { request } = await this.publicClient.simulateContract({ address: token.address, abi, @@ -224,10 +230,27 @@ export abstract class BaseBridge { } } - abstract transfer( - sender: string, - recipient: string, + async transfer(sender: Address, recipient: Address, amount: bigint, options?: TransferOptions) { + await this.validateNetwork("source"); + return this._transfer(sender, recipient, amount, options) as Promise; + } + + async estimateTransferGas(sender: Address, recipient: Address, amount: bigint, options?: TransferOptions) { + return this._transfer(sender, recipient, amount, { ...options, estimateGas: true }) as Promise; + } + + async estimateTransferGasFee(sender: Address, recipient: Address, amount: bigint, options?: TransferOptions) { + const estimateGas = await this.estimateTransferGas(sender, recipient, amount, options); + if (estimateGas && this.sourcePublicClient) { + const { maxFeePerGas } = await this.sourcePublicClient.estimateFeesPerGas(); + return maxFeePerGas && maxFeePerGas * estimateGas; + } + } + + protected abstract _transfer( + sender: Address, + recipient: Address, amount: bigint, - options?: Object, - ): Promise; + options?: TransferOptions & { estimateGas?: boolean }, + ): Promise; } diff --git a/packages/apps/src/bridges/helix-lpbridge.ts b/packages/apps/src/bridges/helix-lpbridge.ts index f701c71c0..a2a08ba34 100644 --- a/packages/apps/src/bridges/helix-lpbridge.ts +++ b/packages/apps/src/bridges/helix-lpbridge.ts @@ -1,9 +1,9 @@ -import { BridgeCategory, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeLogo, TransferOptions } from "@/types/bridge"; import { BaseBridge } from "./base"; import { ChainConfig } from "@/types/chain"; import { Token } from "@/types/token"; import { WalletClient, PublicClient } from "wagmi"; -import { TransactionReceipt } from "viem"; +import { Address, TransactionReceipt } from "viem"; import { HistoryRecord } from "@/types/graphql"; export class HelixLpBridge extends BaseBridge { @@ -39,45 +39,51 @@ export class HelixLpBridge extends BaseBridge { this.initContractFromBackingIssuing(backing, issuing); } - async transfer( - _: string, - recipient: string, + protected async _transfer( + _sender: Address, + recipient: Address, amount: bigint, - options?: { totalFee: bigint }, - ): Promise { - if (options && this.contract && this.crossInfo && this.walletClient && this.publicClient) { + options?: TransferOptions & { estimateGas?: boolean }, + ): Promise { + const account = await this.getSigner(); + if (account && this.contract && this.sourcePublicClient) { const nonce = BigInt(Date.now()) + this.prefix; + const tokenIndex = this.crossInfo?.index ?? 0; + const totalFee = options?.totalFee ?? 0n; + const estimateGas = options?.estimateGas ?? false; - const { args, value, functionName } = - this.sourceToken?.type === "native" - ? { - functionName: "lockNativeAndRemoteIssuing", - args: [amount, options.totalFee, recipient, nonce, this.targetToken?.type === "native"], - value: amount + options.totalFee, - } - : { - functionName: "lockAndRemoteIssuing", - args: [ - nonce, - recipient, - amount, - options.totalFee, - this.crossInfo.index, - this.targetToken?.type === "native", - ], - value: undefined, - }; - const abi = (await import("@/abi/lpbridge.json")).default; + const abi = (await import("@/abi/lpbridge")).default; + const address = this.contract.sourceAddress; + const gas = this.getTxGasLimit(); - const hash = await this.walletClient.writeContract({ - address: this.contract.sourceAddress, + const defaultParams = { + address, abi, - functionName, - args, - value, - gas: this.getTxGasLimit(), - }); - return await this.publicClient.waitForTransactionReceipt({ hash }); + gas, + functionName: "lockAndRemoteIssuing", + args: [nonce, recipient, amount, totalFee, tokenIndex, this.targetToken?.type === "native"], + account, + } as const; + const nativeParams = { + address, + abi, + gas, + functionName: "lockNativeAndRemoteIssuing", + args: [amount, totalFee, recipient, nonce, this.targetToken?.type === "native"], + value: amount + totalFee, + account, + } as const; + + if (estimateGas) { + return this.sourceToken?.type === "native" + ? this.sourcePublicClient.estimateContractGas(nativeParams) + : this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await (this.sourceToken?.type === "native" + ? this.walletClient.writeContract(nativeParams) + : this.walletClient.writeContract(defaultParams)); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } @@ -88,26 +94,27 @@ export class HelixLpBridge extends BaseBridge { await this.validateNetwork("target"); if (this.contract && this.publicClient && this.walletClient) { - const args = [ - record.messageNonce, - this.targetToken?.type === "native", - record.recvTokenAddress, - record.sender, - record.recipient, - record.sendAmount, - record.id.split("-").at(1), - this.sourceToken?.type === "native", - ]; const value = await this.getBridgeFee(); - const abi = (await import("@/abi/lpbridge-sub2eth.json")).default; + const abi = (await import("@/abi/lpbridge-sub2eth")).default; + const address = this.contract.targetAddress; + const gas = this.getTxGasLimit(); const hash = await this.walletClient.writeContract({ - address: this.contract.targetAddress, + address, abi, functionName: "requestCancelIssuing", - args, + args: [ + BigInt(record.messageNonce || 0), + this.targetToken?.type === "native", + record.recvTokenAddress || "0x", + record.sender, + record.recipient, + BigInt(record.sendAmount), + BigInt(record.id.split("-").at(1) || 0), + this.sourceToken?.type === "native", + ], value, - gas: this.getTxGasLimit(), + gas, }); return this.publicClient.waitForTransactionReceipt({ hash }); } @@ -115,7 +122,7 @@ export class HelixLpBridge extends BaseBridge { private async getBridgeFee() { if (this.contract && this.sourcePublicClient) { - const abi = (await import("@/abi/lpbridge.json")).default; + const abi = (await import("@/abi/lpbridge")).default; return this.sourcePublicClient.readContract({ address: this.contract.sourceAddress, abi, @@ -126,30 +133,22 @@ export class HelixLpBridge extends BaseBridge { async speedUp(record: HistoryRecord, fee: bigint) { if (this.contract && this.walletClient && this.publicClient) { - const transferId = record.id.split("-").slice(-1); - - const { args, value, functionName } = - this.sourceToken?.type === "native" - ? { - functionName: "increaseNativeFee", - args: [transferId], - value: fee, - } - : { - functionName: "increaseFee", - args: [transferId, fee], - value: undefined, - }; - const abi = (await import("@/abi/lpbridge.json")).default; - - const hash = await this.walletClient.writeContract({ - address: this.contract.sourceAddress, - abi, - functionName, - args, - value, - gas: this.getTxGasLimit(), - }); + const transferId = record.id.split("-").slice(-1).join("") as Address; + + const abi = (await import("@/abi/lpbridge")).default; + const address = this.contract.sourceAddress; + const gas = this.getTxGasLimit(); + + const hash = await (this.sourceToken?.type === "native" + ? this.walletClient.writeContract({ + address, + abi, + gas, + functionName: "increaseNativeFee", + args: [transferId], + value: fee, + }) + : this.walletClient.writeContract({ address, abi, gas, functionName: "increaseFee", args: [transferId, fee] })); return await this.publicClient.waitForTransactionReceipt({ hash }); } } diff --git a/packages/apps/src/bridges/helixbridge-dvmdvm.ts b/packages/apps/src/bridges/helixbridge-dvmdvm.ts index dc82ce8ac..80f41a948 100644 --- a/packages/apps/src/bridges/helixbridge-dvmdvm.ts +++ b/packages/apps/src/bridges/helixbridge-dvmdvm.ts @@ -1,9 +1,9 @@ -import { BridgeCategory, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeLogo, TransferOptions } from "@/types/bridge"; import { BaseBridge } from "./base"; import { ChainConfig } from "@/types/chain"; import { Token } from "@/types/token"; import { PublicClient, WalletClient } from "wagmi"; -import { TransactionReceipt } from "viem"; +import { Address, TransactionReceipt } from "viem"; import { ApiPromise, WsProvider } from "@polkadot/api"; import { SpecVersion } from "@polkadot/types/interfaces"; import { HistoryRecord } from "@/types/graphql"; @@ -74,81 +74,112 @@ export class HelixBridgeDVMDVM extends BaseBridge { } } - private async lock(_: string, recipient: string, amount: bigint, options?: { totalFee: bigint }) { - if (options && this.contract && this.specVersion && this.sourceToken && this.publicClient && this.walletClient) { - const { args, value, functionName } = - this.sourceToken.type === "native" - ? { - functionName: "lockAndRemoteIssuingNative", - args: [this.specVersion.target, this.gasLimit, recipient, amount], - value: amount + options.totalFee, - } - : { - functionName: "lockAndRemoteIssuing", - args: [this.specVersion.target, this.gasLimit, this.sourceToken.address, recipient, amount], - value: options.totalFee, - }; - const abi = (await import("@/abi/backing-dvmdvm.json")).default; - - const hash = await this.walletClient.writeContract({ - address: this.contract.sourceAddress, + private async lock( + account: Address, + _: Address, + recipient: Address, + amount: bigint, + options?: TransferOptions & { estimateGas?: boolean }, + ) { + if (this.contract && this.specVersion && this.sourceToken && this.sourcePublicClient) { + const totalFee = options?.totalFee ?? 0n; + const estimateGas = options?.estimateGas ?? false; + + const abi = (await import("@/abi/backing-dvmdvm")).default; + const address = this.contract.sourceAddress; + const gas = this.getTxGasLimit(); + + const defaultParams = { + address, abi, - functionName, - args, - value, - gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + gas, + functionName: "lockAndRemoteIssuing", + args: [this.specVersion.target, this.gasLimit, this.sourceToken.address, recipient, amount], + value: totalFee, + account, + } as const; + const nativeParams = { + address, + abi, + gas, + functionName: "lockAndRemoteIssuingNative", + args: [this.specVersion.target, this.gasLimit, recipient, amount], + value: amount + totalFee, + account, + } as const; + + if (estimateGas) { + return this.sourceToken.type === "native" + ? this.sourcePublicClient.estimateContractGas(nativeParams) + : this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await (this.sourceToken.type === "native" + ? this.walletClient.writeContract(nativeParams) + : this.walletClient.writeContract(defaultParams)); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } - private async burn(_: string, recipient: string, amount: bigint, options?: { totalFee: bigint }) { - if ( - options && - this.contract && - this.specVersion && - this.sourceToken && - this.targetToken && - this.publicClient && - this.walletClient - ) { - const { args, functionName } = - this.targetToken.type === "native" - ? { - functionName: "burnAndRemoteUnlockNative", - args: [this.specVersion.target, this.gasLimit, recipient, amount], - } - : { - functionName: "burnAndRemoteUnlock", - args: [this.specVersion.target, this.gasLimit, this.sourceToken.address, recipient, amount], - }; - const abi = (await import("@/abi/mappingtoken-dvmdvm.json")).default; - - const hash = await this.walletClient.writeContract({ - address: this.contract.sourceAddress, + private async burn( + account: Address, + _: Address, + recipient: Address, + amount: bigint, + options?: TransferOptions & { estimateGas?: boolean }, + ) { + if (this.contract && this.specVersion && this.sourceToken && this.sourcePublicClient) { + const abi = (await import("@/abi/mappingtoken-dvmdvm")).default; + const address = this.contract.sourceAddress; + const gas = this.getTxGasLimit(); + const value = options?.totalFee ?? 0n; + const estimateGas = options?.estimateGas ?? false; + + const defaultParams = { + address, abi, - functionName, - args, - value: options.totalFee, - gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + gas, + value, + functionName: "burnAndRemoteUnlock", + args: [this.specVersion.target, this.gasLimit, this.sourceToken.address, recipient, amount], + account, + } as const; + const nativeParams = { + address, + abi, + gas, + value, + functionName: "burnAndRemoteUnlockNative", + args: [this.specVersion.target, this.gasLimit, recipient, amount], + account, + } as const; + + if (estimateGas) { + return this.targetToken?.type === "native" + ? this.sourcePublicClient.estimateContractGas(nativeParams) + : this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await (this.targetToken?.type === "native" + ? this.walletClient.writeContract(nativeParams) + : this.walletClient.writeContract(defaultParams)); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } - async transfer( - sender: string, - recipient: string, + protected async _transfer( + sender: Address, + recipient: Address, amount: bigint, - options?: { totalFee: bigint }, - ): Promise { - await this.validateNetwork("source"); + options?: TransferOptions & { estimateGas?: boolean }, + ): Promise { await this.ensureSpecVersion(); + const account = await this.getSigner(); if (this.crossInfo?.action === "redeem") { - return this.burn(sender, recipient, amount, options); + return account && this.burn(account, sender, recipient, amount, options); } else { - return this.lock(sender, recipient, amount, options); + return account && this.lock(account, sender, recipient, amount, options); } } @@ -157,70 +188,90 @@ export class HelixBridgeDVMDVM extends BaseBridge { await this.ensureSpecVersion(); if (this.contract && this.specVersion && this.publicClient && this.walletClient) { - const { abi, functionName } = - this.crossInfo?.action === "issue" - ? { - abi: (await import("@/abi/mappingtoken-dvmdvm.json")).default, - functionName: "remoteIssuingFailure", - } - : { - abi: (await import("@/abi/backing-dvmdvm.json")).default, - functionName: this.sourceToken?.type === "native" ? "remoteUnlockFailureNative" : "remoteUnlockFailure", - }; - const args = - this.sourceToken?.type === "native" - ? [this.specVersion.source, this.gasLimit, record.messageNonce, record.sender, record.sendAmount] - : [ - this.specVersion.source, - this.gasLimit, - record.messageNonce, - record.sendTokenAddress, - record.sender, - record.sendAmount, - ]; const value = (await this.getFee())?.value; + const address = this.contract.targetAddress; + const gas = this.getTxGasLimit(); + let hash: Address | undefined; - const hash = await this.walletClient.writeContract({ - address: this.contract.targetAddress, - abi, - functionName, - args, - value, - gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + const messageNonce = BigInt(record.messageNonce || 0); + const sendAmount = BigInt(record.sendAmount); + const sendTokenAddress = record.sendTokenAddress || "0x"; + + if (this.crossInfo?.action === "issue") { + const abi = (await import("@/abi/mappingtoken-dvmdvm")).default; + if (this.sourceToken?.type === "native") { + hash = await this.walletClient.writeContract({ + address, + value, + abi, + gas, + functionName: "remoteUnlockFailureNative", + args: [this.specVersion.source, this.gasLimit, messageNonce, record.sender, sendAmount], + }); + } else { + hash = await this.walletClient.writeContract({ + address, + value, + abi, + gas, + functionName: "remoteUnlockFailure", + args: [this.specVersion.source, this.gasLimit, messageNonce, sendTokenAddress, record.sender, sendAmount], + }); + } + } else { + const abi = (await import("@/abi/backing-dvmdvm")).default; + hash = await this.walletClient.writeContract({ + address, + value, + abi, + gas, + functionName: "remoteIssuingFailure", + args: [this.specVersion.source, this.gasLimit, messageNonce, sendTokenAddress, record.sender, sendAmount], + }); + } + return hash && this.publicClient.waitForTransactionReceipt({ hash }); } } async getFee() { if (this.contract && this.sourceNativeToken && this.sourcePublicClient) { - const { abi } = - this.crossInfo?.action === "issue" - ? { abi: (await import("@/abi/backing-dvmdvm.json")).default } - : { abi: (await import("@/abi/mappingtoken-dvmdvm.json")).default }; + const functionName = "fee" as const; + const address = this.contract.sourceAddress; - const value = (await this.sourcePublicClient.readContract({ - address: this.contract.sourceAddress, - abi, - functionName: "fee", - })) as unknown as bigint; + const value = await (this.crossInfo?.action === "issue" + ? this.sourcePublicClient.readContract({ + address, + functionName, + abi: (await import("@/abi/backing-dvmdvm")).default, + }) + : this.sourcePublicClient.readContract({ + address, + functionName, + abi: (await import("@/abi/mappingtoken-dvmdvm")).default, + })); return { value, token: this.sourceNativeToken }; } } async getDailyLimit() { if (this.contract && this.sourceToken && this.targetToken && this.targetPublicClient) { - const { abi } = - this.crossInfo?.action === "redeem" - ? { abi: (await import("@/abi/backing-dvmdvm.json")).default } - : { abi: (await import("@/abi/mappingtoken-dvmdvm.json")).default }; + const address = this.contract.targetAddress; + const functionName = "calcMaxWithdraw" as const; + const args = [this.targetToken.address] as const; - const limit = (await this.targetPublicClient.readContract({ - address: this.contract.targetAddress, - abi, - functionName: "calcMaxWithdraw", - args: [this.targetToken.address], - })) as unknown as bigint; + const limit = await (this.crossInfo?.action === "redeem" + ? this.targetPublicClient.readContract({ + address, + functionName, + args, + abi: (await import("@/abi/backing-dvmdvm")).default, + }) + : this.targetPublicClient.readContract({ + address, + functionName, + args, + abi: (await import("@/abi/mappingtoken-dvmdvm")).default, + })); return { limit, spent: 0n, token: this.sourceToken }; } diff --git a/packages/apps/src/bridges/helixbridge-dvmevm.ts b/packages/apps/src/bridges/helixbridge-dvmevm.ts index d06270dee..e32bed259 100644 --- a/packages/apps/src/bridges/helixbridge-dvmevm.ts +++ b/packages/apps/src/bridges/helixbridge-dvmevm.ts @@ -1,4 +1,4 @@ -import { BridgeCategory, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeLogo, TransferOptions } from "@/types/bridge"; import { BaseBridge } from "./base"; import { ChainConfig } from "@/types/chain"; import { Token } from "@/types/token"; @@ -41,73 +41,111 @@ export class HelixBridgeDVMEVM extends BaseBridge { this.guard = "0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1"; } - private async lock(_: string, recipient: string, amount: bigint, options?: { totalFee: bigint }) { - if (options && this.contract && this.sourceToken && this.publicClient && this.walletClient) { - const { args, value, functionName } = - this.sourceToken.type === "native" - ? { - functionName: "lockAndRemoteIssuingNative", - args: [recipient, amount], - value: amount + options.totalFee, - } - : { - functionName: "lockAndRemoteIssuing", - args: [this.sourceToken.address, recipient, amount], - value: options.totalFee, - }; - const abi = (await import("@/abi/backing-dvmevm.json")).default; + private async lock( + account: Address, + _: Address, + recipient: Address, + amount: bigint, + options?: TransferOptions & { estimateGas?: boolean }, + ) { + if (this.contract && this.sourceToken && this.sourcePublicClient) { + const totalFee = options?.totalFee ?? 0n; + const estimateGas = options?.estimateGas ?? false; - const hash = await this.walletClient.writeContract({ - address: this.contract.sourceAddress, + const abi = (await import("@/abi/backing-dvmevm")).default; + const address = this.contract.sourceAddress; + const gas = this.getTxGasLimit(); + + const defaultParams = { abi, - functionName, - args, - value, - gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + address, + gas, + functionName: "lockAndRemoteIssuing", + args: [this.sourceToken.address, recipient, amount], + value: totalFee, + account, + } as const; + const nativeParams = { + abi, + address, + gas, + functionName: "lockAndRemoteIssuingNative", + args: [recipient, amount], + value: amount + totalFee, + account, + } as const; + + if (estimateGas) { + return this.sourceToken.type === "native" + ? this.sourcePublicClient.estimateContractGas(nativeParams) + : this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await (this.sourceToken.type === "native" + ? this.walletClient.writeContract(nativeParams) + : this.walletClient.writeContract(defaultParams)); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } - private async burn(_: string, recipient: string, amount: bigint, options?: { totalFee: bigint }) { - if (options && this.contract && this.sourceToken && this.targetToken && this.publicClient && this.walletClient) { - const { args, functionName } = - this.targetToken.type === "native" - ? { - functionName: "burnAndRemoteUnlockNative", - args: [recipient, amount], - } - : { - functionName: "burnAndRemoteUnlock", - args: [this.sourceToken.address, recipient, amount], - }; - const abi = (await import("@/abi/mappingtoken-dvmevm.json")).default; - const value = options.totalFee; + private async burn( + account: Address, + _: Address, + recipient: Address, + amount: bigint, + options?: TransferOptions & { estimateGas?: boolean }, + ) { + if (this.contract && this.sourceToken && this.targetToken && this.sourcePublicClient) { + const abi = (await import("@/abi/mappingtoken-dvmevm")).default; + const address = this.contract.sourceAddress; + const gas = this.getTxGasLimit(); + const value = options?.totalFee ?? 0n; + const estimateGas = options?.estimateGas ?? false; - const hash = await this.walletClient.writeContract({ - address: this.contract.sourceAddress, + const defaultParams = { + address, abi, - functionName, - args, value, - gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + gas, + functionName: "burnAndRemoteUnlock", + args: [this.sourceToken.address, recipient, amount], + account, + } as const; + const nativeParams = { + address, + abi, + value, + gas, + functionName: "burnAndRemoteUnlockNative", + args: [recipient, amount], + account, + } as const; + + if (estimateGas) { + return this.targetToken.type === "native" + ? this.sourcePublicClient.estimateContractGas(nativeParams) + : this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await (this.targetToken.type === "native" + ? this.walletClient.writeContract(nativeParams) + : this.walletClient.writeContract(defaultParams)); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } - async transfer( - sender: string, - recipient: string, + protected async _transfer( + sender: Address, + recipient: Address, amount: bigint, - options?: { totalFee: bigint }, - ): Promise { - await this.validateNetwork("source"); + options?: TransferOptions & { estimateGas?: boolean }, + ): Promise { + const account = await this.getSigner(); if (this.crossInfo?.action === "redeem") { - return this.burn(sender, recipient, amount, options); + return account && this.burn(account, sender, recipient, amount, options); } else { - return this.lock(sender, recipient, amount, options); + return account && this.lock(account, sender, recipient, amount, options); } } @@ -115,19 +153,17 @@ export class HelixBridgeDVMEVM extends BaseBridge { await this.validateNetwork("target"); if (this.guard && this.publicClient && this.walletClient) { - const abi = (await import("@/abi/guard.json")).default; - const hash = await this.walletClient.writeContract({ address: this.guard, - abi, + abi: (await import("@/abi/guard")).default, functionName: "claim", args: [ - record.messageNonce, - record.endTime, - record.recvTokenAddress, + BigInt(record.messageNonce || 0), + BigInt(record.endTime), + record.recvTokenAddress || "0x", record.recipient, - record.recvAmount, - record.guardSignatures?.split("-").slice(1), + BigInt(record.recvAmount), + record.guardSignatures?.split("-").slice(1) as Address[], ], gas: this.getTxGasLimit(), }); @@ -139,63 +175,90 @@ export class HelixBridgeDVMEVM extends BaseBridge { await this.validateNetwork("target"); if (this.contract && this.publicClient && this.walletClient) { - const { abi, functionName } = - this.crossInfo?.action === "issue" - ? { - abi: (await import("@/abi/mappingtoken-dvmevm.json")).default, - functionName: this.sourceToken?.type === "native" ? "remoteUnlockFailureNative" : "remoteUnlockFailure", - } - : { - abi: (await import("@/abi/backing-dvmevm.json")).default, - functionName: "remoteIssuingFailure", - }; - const args = - this.sourceToken?.type === "native" - ? [record.id.split("-").slice(-1), record.sender, record.sendAmount] - : [record.id.split("-").slice(-1), record.sendTokenAddress, record.sender, record.sendAmount]; + const sendAmount = BigInt(record.sendAmount); + const sendTokenAddress = record.sendTokenAddress || "0x"; + const transferId = BigInt(record.id.split("-").slice(-1).join("")); + const value = (await this.getFee())?.value; + const address = this.contract.targetAddress; + const gas = this.getTxGasLimit(); + let hash: Address | undefined; - const hash = await this.walletClient.writeContract({ - address: this.contract.targetAddress, - abi, - functionName, - args, - value, - gas: this.getTxGasLimit(), - }); - return await this.publicClient.waitForTransactionReceipt({ hash }); + if (this.crossInfo?.action === "issue") { + const abi = (await import("@/abi/mappingtoken-dvmevm")).default; + if (this.sourceToken?.type === "native") { + hash = await this.walletClient.writeContract({ + address, + value, + gas, + abi, + functionName: "remoteUnlockFailureNative", + args: [transferId, record.sender, sendAmount], + }); + } else { + hash = await this.walletClient.writeContract({ + address, + value, + gas, + abi, + functionName: "remoteUnlockFailure", + args: [transferId, sendTokenAddress, record.sender, sendAmount], + }); + } + } else { + const abi = (await import("@/abi/backing-dvmevm")).default; + hash = await this.walletClient.writeContract({ + address, + value, + gas, + abi, + functionName: "remoteIssuingFailure", + args: [transferId, sendTokenAddress, record.sender, sendAmount], + }); + } + return hash && this.publicClient.waitForTransactionReceipt({ hash }); } } async getFee() { if (this.contract && this.sourceNativeToken && this.sourcePublicClient) { - const { abi } = - this.crossInfo?.action === "issue" - ? { abi: (await import("@/abi/backing-dvmevm.json")).default } - : { abi: (await import("@/abi/mappingtoken-dvmevm.json")).default }; - const value = (await this.sourcePublicClient.readContract({ - address: this.contract.sourceAddress, - abi, - functionName: "currentFee", - })) as unknown as bigint; + const address = this.contract.sourceAddress; + const functionName = "currentFee" as const; + + const value = await (this.crossInfo?.action === "issue" + ? this.sourcePublicClient.readContract({ + address, + functionName, + abi: (await import("@/abi/backing-dvmevm")).default, + }) + : this.sourcePublicClient.readContract({ + address, + functionName, + abi: (await import("@/abi/mappingtoken-dvmevm")).default, + })); return { value, token: this.sourceNativeToken }; } } async getDailyLimit() { if (this.contract && this.sourceToken && this.targetToken && this.targetPublicClient) { - const { abi } = - this.crossInfo?.action === "issue" - ? { abi: (await import("@/abi/mappingtoken-dvmevm.json")).default } - : { abi: (await import("@/abi/backing-dvmevm.json")).default }; - - const limit = (await this.targetPublicClient.readContract({ - address: this.contract.targetAddress, - abi, - functionName: "calcMaxWithdraw", - args: [this.targetToken.address], - })) as unknown as bigint; + const address = this.contract.targetAddress; + const functionName = "calcMaxWithdraw" as const; + const args = [this.targetToken.address] as const; + const limit = await (this.crossInfo?.action === "issue" + ? this.targetPublicClient.readContract({ + address, + functionName, + args, + abi: (await import("@/abi/mappingtoken-dvmevm")).default, + }) + : this.targetPublicClient.readContract({ + address, + functionName, + args, + abi: (await import("@/abi/backing-dvmevm")).default, + })); return { limit, spent: 0n, token: this.sourceToken }; } } diff --git a/packages/apps/src/bridges/l2bridge.ts b/packages/apps/src/bridges/l2bridge.ts index 0aa48a2b2..07a2eb85f 100644 --- a/packages/apps/src/bridges/l2bridge.ts +++ b/packages/apps/src/bridges/l2bridge.ts @@ -1,4 +1,4 @@ -import { BridgeCategory, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeLogo, TransferOptions } from "@/types/bridge"; import { BaseBridge } from "./base"; import { ChainConfig, ChainID } from "@/types/chain"; import { Token } from "@/types/token"; @@ -14,7 +14,7 @@ export class L2ArbitrumBridge extends BaseBridge { private readonly l2FixedDataSize = 1600n; private readonly feeScaler = 1.1; private readonly l2GasPriceScaler = 3n; // To ensure a successful transaction, we set the scaler to be 3 times - private helixDaoAddress: Address | undefined; + private helixDAO: Address | undefined; constructor(args: { walletClient?: WalletClient | null; @@ -50,19 +50,19 @@ export class L2ArbitrumBridge extends BaseBridge { targetAddress: "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef", }; } - this.helixDaoAddress = "0x3B9E571AdeCB0c277486036D6097E9C2CCcfa9d9"; + this.helixDAO = "0x3B9E571AdeCB0c277486036D6097E9C2CCcfa9d9"; } - async transfer( - _: string, - recipient: string, + protected async _transfer( + _sender: Address, + recipient: Address, amount: bigint, - // options?: Object | undefined, - ): Promise { - await this.validateNetwork("source"); - + options?: TransferOptions & { estimateGas?: boolean }, + ): Promise { const params = await this.getL1toL2Params(); - if (params && this.contract && this.sourceToken && this.publicClient && this.walletClient) { + const account = await this.getSigner(); + + if (params && account && this.contract && this.sourceToken && this.sourcePublicClient && this.helixDAO) { const innerData = encodeAbiParameters( [ { name: "x", type: "uint256" }, @@ -70,25 +70,24 @@ export class L2ArbitrumBridge extends BaseBridge { ], [params.maxSubmissionCost, "0x"], ); - const abi = (await import("@/abi/l1-gateway-router.json")).default; + const estimateGas = options?.estimateGas ?? false; - const hash = await this.walletClient.writeContract({ + const defaultParams = { address: this.contract.sourceAddress, - abi, + abi: (await import("@/abi/l1-gateway-router")).default, functionName: "outboundTransferCustomRefund", - args: [ - this.sourceToken.address, - this.helixDaoAddress, - recipient, - amount, - this.l2GasLimit, - params.gasPrice, - innerData, - ], + args: [this.sourceToken.address, this.helixDAO, recipient, amount, this.l2GasLimit, params.gasPrice, innerData], value: params.deposit, gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + account, + } as const; + + if (estimateGas) { + return this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await this.walletClient.writeContract(defaultParams); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } @@ -104,13 +103,13 @@ export class L2ArbitrumBridge extends BaseBridge { const inboxAddress = (await l1Client.readContract({ address: this.contract.sourceAddress, - abi: (await import("@/abi/l1-gateway-router.json")).default, + abi: (await import("@/abi/l1-gateway-router")).default, functionName: "inbox", })) as unknown as Address; const maxSubmissionCost = (await l1Client.readContract({ address: inboxAddress, - abi: (await import("@/abi/inbox.json")).default, + abi: (await import("@/abi/inbox")).default, functionName: "calculateRetryableSubmissionFee", args: [this.l2FixedDataSize, scaleL1BaseFee], })) as unknown as bigint; diff --git a/packages/apps/src/bridges/lnbridge-base.ts b/packages/apps/src/bridges/lnbridge-base.ts index 0712138b7..3865ac2e4 100644 --- a/packages/apps/src/bridges/lnbridge-base.ts +++ b/packages/apps/src/bridges/lnbridge-base.ts @@ -1,8 +1,8 @@ import { ChainConfig } from "@/types/chain"; import { BaseBridge } from "./base"; -import { TransactionReceipt } from "viem"; +import { Address, TransactionReceipt } from "viem"; import { Token } from "@/types/token"; -import { BridgeCategory, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeLogo, TransferOptions } from "@/types/bridge"; import { PublicClient, WalletClient } from "wagmi"; export class LnBridgeBase extends BaseBridge { @@ -43,12 +43,12 @@ export class LnBridgeBase extends BaseBridge { } } - async transfer( - _sender: string, - _recipient: string, + protected async _transfer( + _sender: Address, + _recipient: Address, _amount: bigint, - _options?: Object | undefined, - ): Promise { + _options?: TransferOptions & { estimateGas?: boolean }, + ): Promise { return; } } diff --git a/packages/apps/src/bridges/lnbridge-default.ts b/packages/apps/src/bridges/lnbridge-default.ts index dc96b135d..8f1f26192 100644 --- a/packages/apps/src/bridges/lnbridge-default.ts +++ b/packages/apps/src/bridges/lnbridge-default.ts @@ -1,10 +1,10 @@ -import { TransactionReceipt } from "viem"; +import { Address, TransactionReceipt } from "viem"; import { LnBridgeBase } from "./lnbridge-base"; import { ChainConfig, ChainID } from "@/types/chain"; import { Token } from "@/types/token"; import { PublicClient, WalletClient } from "wagmi"; import { isProduction } from "@/utils/env"; -import { BridgeCategory, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeLogo, TransferOptions } from "@/types/bridge"; export class LnBridgeDefault extends LnBridgeBase { constructor(args: { @@ -54,43 +54,54 @@ export class LnBridgeDefault extends LnBridgeBase { } } - async transfer( - _: string, - recipient: string, + protected async _transfer( + _sender: Address, + recipient: Address, amount: bigint, - options: { - remoteChainId: bigint; - relayer: string; - sourceToken: string; - targetToken: string; - transferId: string; - totalFee: bigint; - withdrawNonce: bigint; - }, - ): Promise { - await this.validateNetwork("source"); + options?: TransferOptions & { estimateGas?: boolean }, + ): Promise { + const account = await this.getSigner(); + const provider = options?.relayer; + const transferId = options?.transferId; - if (this.contract && this.sourceToken && this.publicClient && this.walletClient) { - const abi = (await import(`../abi/lnbridgev20-default.json`)).default; - const snapshot = [ - options.remoteChainId, - options.relayer, - options.sourceToken, - options.targetToken, - options.transferId, - options.totalFee, - options.withdrawNonce, - ]; + if ( + account && + provider && + transferId && + this.contract && + this.sourcePublicClient && + this.targetChain && + this.sourceToken && + this.targetToken + ) { + const estimateGas = options?.estimateGas ?? false; + const totalFee = options?.totalFee ?? 0n; + const snapshot = { + remoteChainId: BigInt(this.targetChain.id), + provider, + sourceToken: this.sourceToken.address, + targetToken: this.targetToken.address, + transferId, + totalFee: totalFee, + withdrawNonce: options?.withdrawNonce || 0n, + }; - const hash = await this.walletClient.writeContract({ + const defaultParams = { address: this.contract.sourceAddress, - abi, + abi: (await import(`../abi/lnbridgev20-default`)).default, functionName: "transferAndLockMargin", args: [snapshot, amount, recipient], - value: this.sourceToken.type === "native" ? amount + options.totalFee : undefined, + value: this.sourceToken.type === "native" ? amount + totalFee : undefined, gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + account, + } as const; + + if (estimateGas) { + return this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await this.walletClient.writeContract(defaultParams); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } @@ -105,7 +116,7 @@ export class LnBridgeDefault extends LnBridgeBase { this.publicClient && this.walletClient ) { - const abi = (await import(`../abi/lnbridgev20-default.json`)).default; + const abi = (await import(`../abi/lnbridgev20-default`)).default; const hash = await this.walletClient.writeContract({ address: this.contract.targetAddress, @@ -130,7 +141,7 @@ export class LnBridgeDefault extends LnBridgeBase { this.publicClient && this.walletClient ) { - const abi = (await import(`../abi/lnbridgev20-default.json`)).default; + const abi = (await import(`../abi/lnbridgev20-default`)).default; const hash = await this.walletClient.writeContract({ address: this.contract.sourceAddress, diff --git a/packages/apps/src/bridges/lnbridge-opposite.ts b/packages/apps/src/bridges/lnbridge-opposite.ts index 2b03bec61..5b8ba2080 100644 --- a/packages/apps/src/bridges/lnbridge-opposite.ts +++ b/packages/apps/src/bridges/lnbridge-opposite.ts @@ -1,9 +1,9 @@ -import { TransactionReceipt } from "viem"; +import { Address, TransactionReceipt } from "viem"; import { LnBridgeBase } from "./lnbridge-base"; import { ChainConfig, ChainID } from "@/types/chain"; import { Token } from "@/types/token"; import { PublicClient, WalletClient } from "wagmi"; -import { BridgeCategory, BridgeLogo } from "@/types/bridge"; +import { BridgeCategory, BridgeLogo, TransferOptions } from "@/types/bridge"; export class LnBridgeOpposite extends LnBridgeBase { constructor(args: { @@ -35,43 +35,54 @@ export class LnBridgeOpposite extends LnBridgeBase { } } - async transfer( - _: string, - recipient: string, + protected async _transfer( + _sender: Address, + recipient: Address, amount: bigint, - options: { - remoteChainId: bigint; - relayer: string; - sourceToken: string; - targetToken: string; - transferId: string; - totalFee: bigint; - depositedMargin: bigint; - }, - ): Promise { - await this.validateNetwork("source"); + options?: TransferOptions & { estimateGas?: boolean }, + ): Promise { + const account = await this.getSigner(); + const provider = options?.relayer; + const transferId = options?.transferId; - if (this.contract && this.sourceToken && this.publicClient && this.walletClient) { - const abi = (await import(`../abi/lnbridgev20-opposite.json`)).default; - const snapshot = [ - options.remoteChainId, - options.relayer, - options.sourceToken, - options.targetToken, - options.transferId, - options.totalFee, - options.depositedMargin, - ]; + if ( + account && + provider && + transferId && + this.contract && + this.sourcePublicClient && + this.sourceToken && + this.targetToken && + this.targetChain + ) { + const estimateGas = options?.estimateGas ?? false; + const totalFee = options?.totalFee ?? 0n; + const snapshot = { + remoteChainId: BigInt(this.targetChain.id), + provider, + sourceToken: this.sourceToken.address, + targetToken: this.targetToken.address, + transferId, + totalFee: totalFee, + depositedMargin: options?.depositedMargin || 0n, + }; - const hash = await this.walletClient.writeContract({ + const defaultParams = { address: this.contract.sourceAddress, - abi, + abi: (await import(`../abi/lnbridgev20-opposite`)).default, functionName: "transferAndLockMargin", args: [snapshot, amount, recipient], - value: this.sourceToken.type === "native" ? amount + options.totalFee : undefined, + value: this.sourceToken.type === "native" ? amount + totalFee : undefined, gas: this.getTxGasLimit(), - }); - return this.publicClient.waitForTransactionReceipt({ hash }); + account, + } as const; + + if (estimateGas) { + return this.sourcePublicClient.estimateContractGas(defaultParams); + } else if (this.walletClient) { + const hash = await this.walletClient.writeContract(defaultParams); + return this.sourcePublicClient.waitForTransactionReceipt({ hash }); + } } } @@ -86,7 +97,7 @@ export class LnBridgeOpposite extends LnBridgeBase { this.publicClient && this.walletClient ) { - const abi = (await import(`../abi/lnbridgev20-opposite.json`)).default; + const abi = (await import(`../abi/lnbridgev20-opposite`)).default; const hash = await this.walletClient.writeContract({ address: this.contract.sourceAddress, diff --git a/packages/apps/src/components/balance-input.tsx b/packages/apps/src/components/balance-input.tsx index 683bbac1e..80870eb55 100644 --- a/packages/apps/src/components/balance-input.tsx +++ b/packages/apps/src/components/balance-input.tsx @@ -1,42 +1,54 @@ import { Token } from "@/types/token"; import Input from "@/ui/input"; import { formatBalance } from "@/utils/balance"; -import { useEffect, useRef, useState } from "react"; -import { parseUnits } from "viem"; +import { useEffect, useMemo, useRef, useState } from "react"; +import { formatUnits, parseUnits } from "viem"; -export interface BalanceInputValue { +interface Value { formatted: bigint; value: string; } +interface Props { + placeholder?: string; + availableTips?: string; + balance?: bigint; + max?: bigint; + disabled?: boolean; + suffix?: "symbol" | "max"; + dynamic?: boolean; + value?: Value; + token?: Token; + onChange?: (value: Value) => void; +} + export function BalanceInput({ placeholder, balance, - limit, + max, + availableTips = "Max", disabled, suffix, dynamic, value, token, onChange = () => undefined, -}: { - placeholder?: string; - balance?: bigint; - limit?: bigint; - disabled?: boolean; - suffix?: boolean; - dynamic?: boolean; - value?: BalanceInputValue; - token?: Token; - onChange?: (value: BalanceInputValue) => void; -}) { +}: Props) { const tokenRef = useRef(token); const spanRef = useRef(null); const inputRef = useRef(null); + const [enablingMax, setEnablingMax] = useState(false); const [dynamicStyle, setDynamicStyle] = useState("text-sm font-normal"); - const insufficient = balance !== undefined && (value?.formatted || 0n) > balance ? true : false; - const exceeded = limit !== undefined && (value?.formatted || 0n) > limit ? true : false; + const insufficient = balance !== undefined && balance < (value?.formatted || 0n) ? true : false; + const exceeded = max !== undefined && max < (value?.formatted || 0n) ? true : false; + + const _placeholder = useMemo(() => { + if (balance !== undefined && token) { + return `Balance ${formatBalance(balance, token.decimals)}`; + } + return placeholder ?? "Enter an amount"; + }, [balance, placeholder, token]); useEffect(() => { if (dynamic) { @@ -70,11 +82,19 @@ export function BalanceInput({ useEffect(() => { // Fire onChange to update `formatted` if (tokenRef.current?.decimals !== token?.decimals) { - onChange({ value: value?.value || "", formatted: parseUnits(value?.value || "0", token?.decimals || 0) }); + onChange(parseValue(value?.value || "", token?.decimals || 0)); } tokenRef.current = token; }, [value, token, onChange]); + useEffect(() => { + if (enablingMax && exceeded) { + const decimals = token?.decimals ?? 0; + const origin = formatUnits(max ?? 0n, decimals); + onChange(parseValue(origin, decimals)); + } + }, [token?.decimals, max, onChange, enablingMax, exceeded]); + return (
{ + setEnablingMax(false); if (e.target.value) { - if (!Number.isNaN(Number(e.target.value))) { - onChange({ value: e.target.value, formatted: parseUnits(e.target.value, token?.decimals || 0) }); + if (!Number.isNaN(Number(e.target.value)) && token) { + onChange(parseValue(e.target.value, token.decimals)); } } else { onChange({ value: e.target.value, formatted: 0n }); @@ -108,10 +125,28 @@ export function BalanceInput({ value={value?.value} /> - {!!(token && suffix) && {token.symbol}} + {!!(token && suffix === "symbol") && {token.symbol}} + {suffix === "max" && ( + + )} - {insufficient && } - {exceeded && } + {exceeded ? ( + + ) : insufficient ? ( + + ) : null} {value?.value} @@ -122,8 +157,19 @@ export function BalanceInput({ function Message({ text }: { text: string }) { return ( -
- {text} +
+ {text}
); } + +function parseValue(origin: string, decimals: number) { + let value = ""; + let formatted = 0n; + const [i, d] = origin.split(".").concat("-1"); + if (i) { + value = d === "-1" ? i : d ? `${i}.${d.slice(0, decimals)}` : `${i}.`; + formatted = parseUnits(value, decimals); + } + return { value, formatted }; +} diff --git a/packages/apps/src/components/faucet.tsx b/packages/apps/src/components/faucet.tsx index f6c05d4a3..30ec823fe 100644 --- a/packages/apps/src/components/faucet.tsx +++ b/packages/apps/src/components/faucet.tsx @@ -34,7 +34,7 @@ export default function Faucet() { try { setBusy(true); - const abi = (await import("@/abi/faucet.json")).default; + const abi = (await import("@/abi/faucet")).default; const hash = await walletClient.writeContract({ address: sourceToken.address, abi, @@ -63,7 +63,7 @@ export default function Faucet() { let sub$$: Subscription | undefined; if (address && sourceToken?.type === "erc20" && publicClient) { - sub$$ = from(import("@/abi/faucet.json")) + sub$$ = from(import("@/abi/faucet")) .pipe( switchMap((abi) => forkJoin([ diff --git a/packages/apps/src/components/relayer-manage-modal.tsx b/packages/apps/src/components/relayer-manage-modal.tsx index 6f041f742..b87ef1b47 100644 --- a/packages/apps/src/components/relayer-manage-modal.tsx +++ b/packages/apps/src/components/relayer-manage-modal.tsx @@ -228,7 +228,7 @@ export default function RelayerManageModal({ relayerInfo, isOpen, onClose, onSuc children: (
setHeight((prev) => node?.clientHeight || prev)}> - + @@ -261,7 +261,7 @@ export default function RelayerManageModal({ relayerInfo, isOpen, onClose, onSuc ? sourceBalance?.token : undefined } - suffix + suffix="symbol" onChange={setMargin} /> diff --git a/packages/apps/src/components/relayer-register.tsx b/packages/apps/src/components/relayer-register.tsx index edf1cedc4..fe2628286 100644 --- a/packages/apps/src/components/relayer-register.tsx +++ b/packages/apps/src/components/relayer-register.tsx @@ -254,7 +254,7 @@ export default function RelayerRegister() { balance={bridgeCategory === "lnbridgev20-default" ? targetBalance?.value : sourceBalance?.value} token={bridgeCategory === "lnbridgev20-default" ? targetBalance?.token : sourceBalance?.token} value={margin} - suffix + suffix="symbol" disabled={completeMargin} onChange={setMargin} /> @@ -315,7 +315,7 @@ export default function RelayerRegister() { )} - + void; } -export default function TransferAction({ recipient, transferValue, onTransfer }: Props) { +export default function TransferAction({ recipient, transferable, transferValue, onTransfer }: Props) { const { sourceAllowance, sourceValue, targetValue, bridgeClient, fee, approve } = useTransfer(); const [busy, setBusy] = useState(false); const { chain } = useNetwork(); @@ -55,6 +55,8 @@ export default function TransferAction({ recipient, transferValue, onTransfer }: bridgeClient && fee?.value && transferValue.formatted && + transferable !== undefined && + transferValue.formatted <= transferable && isAddress(recipient || "") ) } diff --git a/packages/apps/src/components/transfer-modal.tsx b/packages/apps/src/components/transfer-modal.tsx index 7f3424a90..c8ab80053 100644 --- a/packages/apps/src/components/transfer-modal.tsx +++ b/packages/apps/src/components/transfer-modal.tsx @@ -33,22 +33,18 @@ export default function TransferModal({ onSuccess, refetchRelayers, }: Props) { - const { bridgeClient, sourceValue, targetValue, fee, targetChain, sourceToken, targetToken, transfer } = - useTransfer(); + const { bridgeClient, sourceValue, targetValue, fee, transfer } = useTransfer(); const [busy, setBusy] = useState(false); const handleTransfer = useCallback(async () => { - if (sender && recipient && targetChain && bridgeClient) { + if (sender && recipient && bridgeClient) { try { setBusy(true); const relayer = bridgeClient.isLnBridge() - ? (await refetchRelayers()).data.sortedLnv20RelayInfos?.at(0) + ? (await refetchRelayers()).data.sortedLnv20RelayInfos?.records.at(0) : undefined; const receipt = await transfer(sender, recipient, transferValue.formatted, { - remoteChainId: BigInt(targetChain.id), relayer: relayer?.relayer, - sourceToken: sourceToken?.address, - targetToken: targetToken?.address, transferId: relayer?.lastTransferId, totalFee: ( await bridgeClient.getFee({ @@ -72,18 +68,7 @@ export default function TransferModal({ setBusy(false); } } - }, [ - bridgeClient, - onSuccess, - recipient, - refetchRelayers, - sender, - sourceToken, - targetChain, - targetToken, - transfer, - transferValue, - ]); + }, [bridgeClient, onSuccess, recipient, refetchRelayers, sender, transfer, transferValue]); return ( (); const [isLoadingFee, setIsLoadingFee] = useState(false); + const [estimateGasFee, setEstimateGasFee] = useState(0n); const [targetOptions, setTargetOptions] = useState(defaultTargetOptions); const [isOpen, _, setIsOpenTrue, setIsOpenFalse] = useToggle(false); @@ -75,6 +76,29 @@ export default function Transfer() { skip: !bridgeClient?.isLnBridge(), }); + const transferable = useMemo(() => { + let result: bigint | undefined; + const maxMargin = relayersData?.sortedLnv20RelayInfos?.maxMargin; + + if (sourceBalance) { + const { token, value: balance } = sourceBalance; + result = result === undefined ? balance : result < balance ? result : balance; + if (fee?.token.symbol === token.symbol) { + result = fee.value < result ? result - fee.value : 0n; + } + } + + if (maxMargin) { + const mm = BigInt(maxMargin); + result = result === undefined ? mm : result < mm ? result : mm; + } + + if (result !== undefined) { + result = estimateGasFee < result ? result - estimateGasFee : 0n; + } + return result; + }, [sourceBalance, estimateGasFee, fee, relayersData]); + const searchParams = useSearchParams(); const router = useRouter(); @@ -118,7 +142,7 @@ export default function Transfer() { useEffect(() => { let sub$$: Subscription | undefined; - const relayer = relayersData?.sortedLnv20RelayInfos?.at(0); + const relayer = relayersData?.sortedLnv20RelayInfos?.records.at(0); if (bridgeClient) { setIsLoadingFee(true); @@ -126,7 +150,7 @@ export default function Transfer() { bridgeClient.getFee({ baseFee: BigInt(relayer?.baseFee || 0), protocolFee: BigInt(relayer?.protocolFee || 0), - liquidityFeeRate: relayer?.liquidityFeeRate ? BigInt(relayer.liquidityFeeRate) : undefined, + liquidityFeeRate: BigInt(relayer?.liquidityFeeRate || 0), transferAmount: deferredTransferValue.formatted, }), ).subscribe({ @@ -145,6 +169,37 @@ export default function Transfer() { return () => sub$$?.unsubscribe(); }, [bridgeClient, relayersData, deferredTransferValue, setFee]); + useEffect(() => { + let sub$$: Subscription | undefined; + const relayer = relayersData?.sortedLnv20RelayInfos?.records.at(0); + + // Note: native token + + if (bridgeClient && sourceValue?.token.type === "native" && address && deferredTransferValue.formatted) { + sub$$ = from( + bridgeClient.estimateTransferGasFee(address, recipient ?? address, deferredTransferValue.formatted, { + relayer: relayer?.relayer, + transferId: relayer?.lastTransferId, + totalFee: fee?.value, + withdrawNonce: BigInt(relayer?.withdrawNonce || 0), + depositedMargin: BigInt(relayer?.margin || 0), + }), + ).subscribe({ + next: (gasFee) => { + setEstimateGasFee(gasFee ?? 0n); + }, + error: (err) => { + console.error(err); + setEstimateGasFee(0n); + }, + }); + } else { + setEstimateGasFee(0n); + } + + return () => sub$$?.unsubscribe(); + }, [bridgeClient, sourceValue, fee, address, recipient, deferredTransferValue, relayersData]); + return ( <>
@@ -229,7 +284,9 @@ export default function Transfer() { balance={sourceBalance?.value} token={sourceBalance?.token} value={transferValue} - suffix + suffix="max" + max={transferable} + availableTips="Transferable" dynamic onChange={setTransferValue} /> @@ -265,7 +322,7 @@ export default function Transfer() { {/* action */} , ) => Promise; approve: () => Promise; updateBalance: () => Promise; @@ -131,7 +131,7 @@ export default function TransferProvider({ children }: PropsWithChildren { + async (sender: Address, recipient: Address, amount: bigint, options?: Partial) => { if (address && bridgeClient) { try { const receipt = await bridgeClient.transfer(sender, recipient, amount, options); diff --git a/packages/apps/src/types/bridge.ts b/packages/apps/src/types/bridge.ts index 93455f097..98a2538a9 100644 --- a/packages/apps/src/types/bridge.ts +++ b/packages/apps/src/types/bridge.ts @@ -23,3 +23,11 @@ export type BridgeLogoType = "symbol" | "horizontal"; export type BridgeLogo = { [key in BridgeLogoType]: string; }; + +export interface TransferOptions { + relayer?: Address; + transferId?: Address | null; + totalFee?: bigint; + withdrawNonce?: bigint; + depositedMargin?: bigint; +} diff --git a/packages/apps/src/types/graphql.ts b/packages/apps/src/types/graphql.ts index ffecd8503..63a6d95a2 100644 --- a/packages/apps/src/types/graphql.ts +++ b/packages/apps/src/types/graphql.ts @@ -1,6 +1,7 @@ import { TokenSymbol } from "./token"; import { BridgeCategory } from "./bridge"; import { Network } from "./chain"; +import { Address } from "viem"; export enum RecordStatus { PENDING, @@ -24,18 +25,18 @@ export interface HistoryRecord { id: string; nonce: string; messageNonce?: string | null; - recipient: string; + recipient: Address; requestTxHash: string; responseTxHash?: string | null; reason?: string | null; result: RecordStatus; - sender: string; + sender: Address; startTime: number; toChain: Network; sendToken: TokenSymbol; recvToken: TokenSymbol; - sendTokenAddress?: string | null; - recvTokenAddress?: string | null; + sendTokenAddress?: Address | null; + recvTokenAddress?: Address | null; confirmedBlocks?: string | null; } @@ -73,7 +74,7 @@ interface Lnv20RelayInfo { fromChain: Network; toChain: Network; bridge: BridgeCategory; - relayer: string; + relayer: Address; sendToken?: string | null; transaction_hash: string; timestamp: number; @@ -83,17 +84,20 @@ interface Lnv20RelayInfo { liquidityFeeRate?: number | null; slashCount?: number | null; withdrawNonce?: string | null; - lastTransferId?: string | null; + lastTransferId?: Address | null; cost?: string | null; profit?: string | null; heartbeatTimestamp?: number | null; } export interface RelayersResponseData { - sortedLnv20RelayInfos?: Pick< - Lnv20RelayInfo, - "relayer" | "margin" | "baseFee" | "protocolFee" | "liquidityFeeRate" | "lastTransferId" | "withdrawNonce" - >[]; + sortedLnv20RelayInfos?: { + maxMargin: string; + records: Pick< + Lnv20RelayInfo, + "relayer" | "margin" | "baseFee" | "protocolFee" | "liquidityFeeRate" | "lastTransferId" | "withdrawNonce" + >[]; + }; } export interface RelayersVariables {