From 6d6bcfd7dd6b9bd81b25ddb40c3bc84baa23cf14 Mon Sep 17 00:00:00 2001 From: parodime Date: Wed, 8 Jan 2025 13:28:16 -0500 Subject: [PATCH] wip - testing --- .../api/src/constants/networkConfig.ts | 250 +- .../rfq-indexer/indexer/abis/FastBridgeV1.ts | 774 +++++ .../rfq-indexer/indexer/abis/FastBridgeV2.ts | 2525 ++++++++++++----- packages/rfq-indexer/indexer/ponder.config.ts | 343 +-- packages/rfq-indexer/indexer/src/index.ts | 70 +- packages/rfq-indexer/indexer/src/types.ts | 9 - 6 files changed, 2812 insertions(+), 1159 deletions(-) create mode 100644 packages/rfq-indexer/indexer/abis/FastBridgeV1.ts diff --git a/packages/rfq-indexer/api/src/constants/networkConfig.ts b/packages/rfq-indexer/api/src/constants/networkConfig.ts index 579f8f7273..9b637d51ea 100644 --- a/packages/rfq-indexer/api/src/constants/networkConfig.ts +++ b/packages/rfq-indexer/api/src/constants/networkConfig.ts @@ -1,129 +1,129 @@ -import { createPublicClient, http } from 'viem' -import { - mainnet, - arbitrum, - optimism, - base, - scroll, - linea, - bsc, - blast, - worldchain, -} from 'viem/chains' +// import { createPublicClient, http } from 'viem' +// import { +// mainnet, +// arbitrum, +// optimism, +// base, +// scroll, +// linea, +// bsc, +// blast, +// worldchain, +// } from 'viem/chains' -import { FastBridgeV2Abi } from './abis/FastBridgeV2' +// import { FastBridgeV2Abi } from './abis/FastBridgeV2' -interface NetworkEntry { - name: string - FastBridgeV2: { - address: string - abi: any - } - client: any -} +// interface NetworkEntry { +// name: string +// FastBridgeV2: { +// address: string +// abi: any +// } +// client: any +// } -type NetworkConfig = { - [chainId: number]: NetworkEntry -} +// type NetworkConfig = { +// [chainId: number]: NetworkEntry +// } -export const networkConfig: NetworkConfig = { - 1: { - name: 'Ethereum', - FastBridgeV2: { - address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: mainnet, - transport: http(), - }), - }, - 42161: { - name: 'Arbitrum', - FastBridgeV2: { - address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: arbitrum, - transport: http(), - }), - }, - 10: { - name: 'Optimism', - FastBridgeV2: { - address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: optimism, - transport: http(), - }), - }, - 8453: { - name: 'Base', - FastBridgeV2: { - address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: base, - transport: http(), - }), - }, - 534352: { - name: 'Scroll', - FastBridgeV2: { - address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: scroll, - transport: http(), - }), - }, - 59144: { - name: 'Linea', - FastBridgeV2: { - address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: linea, - transport: http(), - }), - }, - 56: { - name: 'BNB Chain', - FastBridgeV2: { - address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: bsc, - transport: http(), - }), - }, - 81457: { - name: 'Blast', - FastBridgeV2: { - address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: blast, - transport: http(), - }), - }, - 480: { - name: 'Worldchain', - FastBridgeV2: { - address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - abi: FastBridgeV2Abi, - }, - client: createPublicClient({ - chain: worldchain, - transport: http(), - }), - }, -} as const +// export const networkConfig: NetworkConfig = { +// 1: { +// name: 'Ethereum', +// FastBridgeV2: { +// address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: mainnet, +// transport: http(), +// }), +// }, +// 42161: { +// name: 'Arbitrum', +// FastBridgeV2: { +// address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: arbitrum, +// transport: http(), +// }), +// }, +// 10: { +// name: 'Optimism', +// FastBridgeV2: { +// address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: optimism, +// transport: http(), +// }), +// }, +// 8453: { +// name: 'Base', +// FastBridgeV2: { +// address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: base, +// transport: http(), +// }), +// }, +// 534352: { +// name: 'Scroll', +// FastBridgeV2: { +// address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: scroll, +// transport: http(), +// }), +// }, +// 59144: { +// name: 'Linea', +// FastBridgeV2: { +// address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: linea, +// transport: http(), +// }), +// }, +// 56: { +// name: 'BNB Chain', +// FastBridgeV2: { +// address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: bsc, +// transport: http(), +// }), +// }, +// 81457: { +// name: 'Blast', +// FastBridgeV2: { +// address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: blast, +// transport: http(), +// }), +// }, +// 480: { +// name: 'Worldchain', +// FastBridgeV2: { +// address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', +// abi: FastBridgeV2Abi, +// }, +// client: createPublicClient({ +// chain: worldchain, +// transport: http(), +// }), +// }, +// } as const diff --git a/packages/rfq-indexer/indexer/abis/FastBridgeV1.ts b/packages/rfq-indexer/indexer/abis/FastBridgeV1.ts new file mode 100644 index 0000000000..0fd9943d0c --- /dev/null +++ b/packages/rfq-indexer/indexer/abis/FastBridgeV1.ts @@ -0,0 +1,774 @@ +export const ABI_FastBridgeV1 = [ + { + inputs: [{ internalType: 'address', name: '_owner', type: 'address' }], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [], + name: 'AccessControlBadConfirmation', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'bytes32', name: 'neededRole', type: 'bytes32' }, + ], + name: 'AccessControlUnauthorizedAccount', + type: 'error', + }, + { + inputs: [{ internalType: 'address', name: 'target', type: 'address' }], + name: 'AddressEmptyCode', + type: 'error', + }, + { + inputs: [{ internalType: 'address', name: 'account', type: 'address' }], + name: 'AddressInsufficientBalance', + type: 'error', + }, + { + inputs: [], + name: 'AmountIncorrect', + type: 'error', + }, + { + inputs: [], + name: 'ChainIncorrect', + type: 'error', + }, + { + inputs: [], + name: 'DeadlineExceeded', + type: 'error', + }, + { + inputs: [], + name: 'DeadlineNotExceeded', + type: 'error', + }, + { + inputs: [], + name: 'DeadlineTooShort', + type: 'error', + }, + { + inputs: [], + name: 'DisputePeriodNotPassed', + type: 'error', + }, + { + inputs: [], + name: 'DisputePeriodPassed', + type: 'error', + }, + { + inputs: [], + name: 'FailedInnerCall', + type: 'error', + }, + { + inputs: [], + name: 'MsgValueIncorrect', + type: 'error', + }, + { + inputs: [{ internalType: 'address', name: 'token', type: 'address' }], + name: 'SafeERC20FailedOperation', + type: 'error', + }, + { + inputs: [], + name: 'SenderIncorrect', + type: 'error', + }, + { + inputs: [], + name: 'StatusIncorrect', + type: 'error', + }, + { + inputs: [], + name: 'TokenNotContract', + type: 'error', + }, + { + inputs: [], + name: 'TransactionRelayed', + type: 'error', + }, + { + inputs: [], + name: 'ZeroAddress', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'transactionId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'relayer', + type: 'address', + }, + { indexed: true, internalType: 'address', name: 'to', type: 'address' }, + { + indexed: false, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'BridgeDepositClaimed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'transactionId', + type: 'bytes32', + }, + { indexed: true, internalType: 'address', name: 'to', type: 'address' }, + { + indexed: false, + internalType: 'address', + name: 'token', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'BridgeDepositRefunded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'transactionId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'relayer', + type: 'address', + }, + ], + name: 'BridgeProofDisputed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'transactionId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'relayer', + type: 'address', + }, + { + indexed: false, + internalType: 'bytes32', + name: 'transactionHash', + type: 'bytes32', + }, + ], + name: 'BridgeProofProvided', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'transactionId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'relayer', + type: 'address', + }, + { indexed: true, internalType: 'address', name: 'to', type: 'address' }, + { + indexed: false, + internalType: 'uint32', + name: 'originChainId', + type: 'uint32', + }, + { + indexed: false, + internalType: 'address', + name: 'originToken', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'destToken', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'originAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'destAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'chainGasAmount', + type: 'uint256', + }, + ], + name: 'BridgeRelayed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'transactionId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { indexed: false, internalType: 'bytes', name: 'request', type: 'bytes' }, + { + indexed: false, + internalType: 'uint32', + name: 'destChainId', + type: 'uint32', + }, + { + indexed: false, + internalType: 'address', + name: 'originToken', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'destToken', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'originAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'destAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'bool', + name: 'sendChainGas', + type: 'bool', + }, + ], + name: 'BridgeRequested', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'oldChainGasAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'newChainGasAmount', + type: 'uint256', + }, + ], + name: 'ChainGasAmountUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'oldFeeRate', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'newFeeRate', + type: 'uint256', + }, + ], + name: 'FeeRateUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + 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: 'FeesSwept', + 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', + }, + { + inputs: [], + name: 'DEFAULT_ADMIN_ROLE', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'DISPUTE_PERIOD', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'FEE_BPS', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'FEE_RATE_MAX', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'GOVERNOR_ROLE', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'GUARD_ROLE', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'MIN_DEADLINE_PERIOD', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'REFUNDER_ROLE', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'REFUND_DELAY', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'RELAYER_ROLE', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { internalType: 'uint32', name: 'dstChainId', type: 'uint32' }, + { internalType: 'address', name: 'sender', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { internalType: 'address', name: 'originToken', type: 'address' }, + { internalType: 'address', name: 'destToken', type: 'address' }, + { internalType: 'uint256', name: 'originAmount', type: 'uint256' }, + { internalType: 'uint256', name: 'destAmount', type: 'uint256' }, + { internalType: 'bool', name: 'sendChainGas', type: 'bool' }, + { internalType: 'uint256', name: 'deadline', type: 'uint256' }, + ], + internalType: 'struct IFastBridge.BridgeParams', + name: 'params', + type: 'tuple', + }, + ], + name: 'bridge', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + name: 'bridgeProofs', + outputs: [ + { internalType: 'uint96', name: 'timestamp', type: 'uint96' }, + { internalType: 'address', name: 'relayer', type: 'address' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + name: 'bridgeRelays', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + name: 'bridgeStatuses', + outputs: [ + { internalType: 'enum FastBridge.BridgeStatus', name: '', type: 'uint8' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'transactionId', type: 'bytes32' }, + { internalType: 'address', name: 'relayer', type: 'address' }, + ], + name: 'canClaim', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'chainGasAmount', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes', name: 'request', type: 'bytes' }, + { internalType: 'address', name: 'to', type: 'address' }, + ], + name: 'claim', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'deployBlock', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'transactionId', type: 'bytes32' }, + ], + name: 'dispute', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes', name: 'request', type: 'bytes' }], + name: 'getBridgeTransaction', + outputs: [ + { + components: [ + { internalType: 'uint32', name: 'originChainId', type: 'uint32' }, + { internalType: 'uint32', name: 'destChainId', type: 'uint32' }, + { internalType: 'address', name: 'originSender', type: 'address' }, + { internalType: 'address', name: 'destRecipient', type: 'address' }, + { internalType: 'address', name: 'originToken', type: 'address' }, + { internalType: 'address', name: 'destToken', type: 'address' }, + { internalType: 'uint256', name: 'originAmount', type: 'uint256' }, + { internalType: 'uint256', name: 'destAmount', type: 'uint256' }, + { internalType: 'uint256', name: 'originFeeAmount', type: 'uint256' }, + { internalType: 'bool', name: 'sendChainGas', type: 'bool' }, + { internalType: 'uint256', name: 'deadline', type: 'uint256' }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + ], + internalType: 'struct IFastBridge.BridgeTransaction', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'pure', + 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: [], + name: 'nonce', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'protocolFeeRate', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'protocolFees', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes', name: 'request', type: 'bytes' }, + { internalType: 'bytes32', name: 'destTxHash', type: 'bytes32' }, + ], + name: 'prove', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes', name: 'request', type: 'bytes' }], + name: 'refund', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes', name: 'request', type: 'bytes' }], + name: 'relay', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'role', type: 'bytes32' }, + { internalType: 'address', name: 'callerConfirmation', type: 'address' }, + ], + name: 'renounceRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'role', type: 'bytes32' }, + { internalType: 'address', name: 'account', type: 'address' }, + ], + name: 'revokeRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: 'newChainGasAmount', type: 'uint256' }, + ], + name: 'setChainGasAmount', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: 'newFeeRate', type: 'uint256' }], + name: 'setProtocolFeeRate', + 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: 'token', type: 'address' }, + { internalType: 'address', name: 'recipient', type: 'address' }, + ], + name: 'sweepProtocolFees', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const diff --git a/packages/rfq-indexer/indexer/abis/FastBridgeV2.ts b/packages/rfq-indexer/indexer/abis/FastBridgeV2.ts index fde30f002e..e46debe6bc 100644 --- a/packages/rfq-indexer/indexer/abis/FastBridgeV2.ts +++ b/packages/rfq-indexer/indexer/abis/FastBridgeV2.ts @@ -1,774 +1,1751 @@ -export const FastBridgeV2Abi = [ - { - inputs: [{ internalType: 'address', name: '_owner', type: 'address' }], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [], - name: 'AccessControlBadConfirmation', - type: 'error', - }, - { - inputs: [ - { internalType: 'address', name: 'account', type: 'address' }, - { internalType: 'bytes32', name: 'neededRole', type: 'bytes32' }, - ], - name: 'AccessControlUnauthorizedAccount', - type: 'error', - }, - { - inputs: [{ internalType: 'address', name: 'target', type: 'address' }], - name: 'AddressEmptyCode', - type: 'error', - }, - { - inputs: [{ internalType: 'address', name: 'account', type: 'address' }], - name: 'AddressInsufficientBalance', - type: 'error', - }, - { - inputs: [], - name: 'AmountIncorrect', - type: 'error', - }, - { - inputs: [], - name: 'ChainIncorrect', - type: 'error', - }, - { - inputs: [], - name: 'DeadlineExceeded', - type: 'error', - }, - { - inputs: [], - name: 'DeadlineNotExceeded', - type: 'error', - }, - { - inputs: [], - name: 'DeadlineTooShort', - type: 'error', - }, - { - inputs: [], - name: 'DisputePeriodNotPassed', - type: 'error', - }, - { - inputs: [], - name: 'DisputePeriodPassed', - type: 'error', - }, - { - inputs: [], - name: 'FailedInnerCall', - type: 'error', - }, - { - inputs: [], - name: 'MsgValueIncorrect', - type: 'error', - }, - { - inputs: [{ internalType: 'address', name: 'token', type: 'address' }], - name: 'SafeERC20FailedOperation', - type: 'error', - }, - { - inputs: [], - name: 'SenderIncorrect', - type: 'error', - }, - { - inputs: [], - name: 'StatusIncorrect', - type: 'error', - }, - { - inputs: [], - name: 'TokenNotContract', - type: 'error', - }, - { - inputs: [], - name: 'TransactionRelayed', - type: 'error', - }, - { - inputs: [], - name: 'ZeroAddress', - type: 'error', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'transactionId', - type: 'bytes32', - }, - { - indexed: true, - internalType: 'address', - name: 'relayer', - type: 'address', - }, - { indexed: true, internalType: 'address', name: 'to', type: 'address' }, - { - indexed: false, - internalType: 'address', - name: 'token', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'BridgeDepositClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'transactionId', - type: 'bytes32', - }, - { indexed: true, internalType: 'address', name: 'to', type: 'address' }, - { - indexed: false, - internalType: 'address', - name: 'token', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'BridgeDepositRefunded', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'transactionId', - type: 'bytes32', - }, - { - indexed: true, - internalType: 'address', - name: 'relayer', - type: 'address', - }, - ], - name: 'BridgeProofDisputed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'transactionId', - type: 'bytes32', - }, - { - indexed: true, - internalType: 'address', - name: 'relayer', - type: 'address', - }, - { - indexed: false, - internalType: 'bytes32', - name: 'transactionHash', - type: 'bytes32', - }, - ], - name: 'BridgeProofProvided', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'transactionId', - type: 'bytes32', - }, - { - indexed: true, - internalType: 'address', - name: 'relayer', - type: 'address', - }, - { indexed: true, internalType: 'address', name: 'to', type: 'address' }, - { - indexed: false, - internalType: 'uint32', - name: 'originChainId', - type: 'uint32', - }, - { - indexed: false, - internalType: 'address', - name: 'originToken', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'destToken', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'originAmount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'destAmount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'chainGasAmount', - type: 'uint256', - }, - ], - name: 'BridgeRelayed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'bytes32', - name: 'transactionId', - type: 'bytes32', - }, - { - indexed: true, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { indexed: false, internalType: 'bytes', name: 'request', type: 'bytes' }, - { - indexed: false, - internalType: 'uint32', - name: 'destChainId', - type: 'uint32', - }, - { - indexed: false, - internalType: 'address', - name: 'originToken', - type: 'address', - }, - { - indexed: false, - internalType: 'address', - name: 'destToken', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'originAmount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'destAmount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'sendChainGas', - type: 'bool', - }, - ], - name: 'BridgeRequested', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'oldChainGasAmount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newChainGasAmount', - type: 'uint256', - }, - ], - name: 'ChainGasAmountUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'oldFeeRate', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newFeeRate', - type: 'uint256', - }, - ], - name: 'FeeRateUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - 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: 'FeesSwept', - 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', - }, - { - inputs: [], - name: 'DEFAULT_ADMIN_ROLE', - outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'DISPUTE_PERIOD', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'FEE_BPS', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'FEE_RATE_MAX', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'GOVERNOR_ROLE', - outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'GUARD_ROLE', - outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'MIN_DEADLINE_PERIOD', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'REFUNDER_ROLE', - outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'REFUND_DELAY', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'RELAYER_ROLE', - outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { - components: [ - { internalType: 'uint32', name: 'dstChainId', type: 'uint32' }, - { internalType: 'address', name: 'sender', type: 'address' }, - { internalType: 'address', name: 'to', type: 'address' }, - { internalType: 'address', name: 'originToken', type: 'address' }, - { internalType: 'address', name: 'destToken', type: 'address' }, - { internalType: 'uint256', name: 'originAmount', type: 'uint256' }, - { internalType: 'uint256', name: 'destAmount', type: 'uint256' }, - { internalType: 'bool', name: 'sendChainGas', type: 'bool' }, - { internalType: 'uint256', name: 'deadline', type: 'uint256' }, - ], - internalType: 'struct IFastBridge.BridgeParams', - name: 'params', - type: 'tuple', - }, - ], - name: 'bridge', - outputs: [], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - name: 'bridgeProofs', - outputs: [ - { internalType: 'uint96', name: 'timestamp', type: 'uint96' }, - { internalType: 'address', name: 'relayer', type: 'address' }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - name: 'bridgeRelays', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - name: 'bridgeStatuses', - outputs: [ - { internalType: 'enum FastBridge.BridgeStatus', name: '', type: 'uint8' }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes32', name: 'transactionId', type: 'bytes32' }, - { internalType: 'address', name: 'relayer', type: 'address' }, - ], - name: 'canClaim', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'chainGasAmount', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes', name: 'request', type: 'bytes' }, - { internalType: 'address', name: 'to', type: 'address' }, - ], - name: 'claim', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'deployBlock', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes32', name: 'transactionId', type: 'bytes32' }, - ], - name: 'dispute', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'bytes', name: 'request', type: 'bytes' }], - name: 'getBridgeTransaction', - outputs: [ - { - components: [ - { internalType: 'uint32', name: 'originChainId', type: 'uint32' }, - { internalType: 'uint32', name: 'destChainId', type: 'uint32' }, - { internalType: 'address', name: 'originSender', type: 'address' }, - { internalType: 'address', name: 'destRecipient', type: 'address' }, - { internalType: 'address', name: 'originToken', type: 'address' }, - { internalType: 'address', name: 'destToken', type: 'address' }, - { internalType: 'uint256', name: 'originAmount', type: 'uint256' }, - { internalType: 'uint256', name: 'destAmount', type: 'uint256' }, - { internalType: 'uint256', name: 'originFeeAmount', type: 'uint256' }, - { internalType: 'bool', name: 'sendChainGas', type: 'bool' }, - { internalType: 'uint256', name: 'deadline', type: 'uint256' }, - { internalType: 'uint256', name: 'nonce', type: 'uint256' }, - ], - internalType: 'struct IFastBridge.BridgeTransaction', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'pure', - 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: [], - name: 'nonce', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'protocolFeeRate', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ internalType: 'address', name: '', type: 'address' }], - name: 'protocolFees', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes', name: 'request', type: 'bytes' }, - { internalType: 'bytes32', name: 'destTxHash', type: 'bytes32' }, - ], - name: 'prove', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'bytes', name: 'request', type: 'bytes' }], - name: 'refund', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'bytes', name: 'request', type: 'bytes' }], - name: 'relay', - outputs: [], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes32', name: 'role', type: 'bytes32' }, - { internalType: 'address', name: 'callerConfirmation', type: 'address' }, - ], - name: 'renounceRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes32', name: 'role', type: 'bytes32' }, - { internalType: 'address', name: 'account', type: 'address' }, - ], - name: 'revokeRole', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { internalType: 'uint256', name: 'newChainGasAmount', type: 'uint256' }, - ], - name: 'setChainGasAmount', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'uint256', name: 'newFeeRate', type: 'uint256' }], - name: 'setProtocolFeeRate', - 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: 'token', type: 'address' }, - { internalType: 'address', name: 'recipient', type: 'address' }, - ], - name: 'sweepProtocolFees', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -] as const +export const ABI_FastBridgeV2 = [ + { + "inputs": [ + { + "internalType": "address", + "name": "defaultAdmin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccessControlBadConfirmation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "neededRole", + "type": "bytes32" + } + ], + "name": "AccessControlUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "AmountIncorrect", + "type": "error" + }, + { + "inputs": [], + "name": "BridgeTransactionV2__InvalidEncodedTx", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "version", + "type": "uint16" + } + ], + "name": "BridgeTransactionV2__UnsupportedVersion", + "type": "error" + }, + { + "inputs": [], + "name": "CancelDelayBelowMin", + "type": "error" + }, + { + "inputs": [], + "name": "ChainIncorrect", + "type": "error" + }, + { + "inputs": [], + "name": "DeadlineExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "DeadlineNotExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "DeadlineTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "DisputePeriodNotPassed", + "type": "error" + }, + { + "inputs": [], + "name": "DisputePeriodPassed", + "type": "error" + }, + { + "inputs": [], + "name": "ExclusivityParamsIncorrect", + "type": "error" + }, + { + "inputs": [], + "name": "ExclusivityPeriodNotPassed", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [], + "name": "FeeRateAboveMax", + "type": "error" + }, + { + "inputs": [], + "name": "MsgValueIncorrect", + "type": "error" + }, + { + "inputs": [], + "name": "MulticallTarget__UndeterminedRevert", + "type": "error" + }, + { + "inputs": [], + "name": "RecipientIncorrectReturnValue", + "type": "error" + }, + { + "inputs": [], + "name": "RecipientNoReturnValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [], + "name": "SenderIncorrect", + "type": "error" + }, + { + "inputs": [], + "name": "StatusIncorrect", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotContract", + "type": "error" + }, + { + "inputs": [], + "name": "TransactionRelayed", + "type": "error" + }, + { + "inputs": [], + "name": "ZapDataLengthAboveMax", + "type": "error" + }, + { + "inputs": [], + "name": "ZapNativeNotSupported", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "relayer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BridgeDepositClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BridgeDepositRefunded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "name": "BridgeProofDisputed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "relayer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "transactionHash", + "type": "bytes32" + } + ], + "name": "BridgeProofProvided", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "quoteId", + "type": "bytes" + } + ], + "name": "BridgeQuoteDetails", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "relayer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "originChainId", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "originAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "destAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "chainGasAmount", + "type": "uint256" + } + ], + "name": "BridgeRelayed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "request", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "destChainId", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "originAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "destAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "sendChainGas", + "type": "bool" + } + ], + "name": "BridgeRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldCancelDelay", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newCancelDelay", + "type": "uint256" + } + ], + "name": "CancelDelayUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldFeeRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newFeeRate", + "type": "uint256" + } + ], + "name": "FeeRateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "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": "FeesSwept", + "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" + }, + { + "inputs": [], + "name": "CANCELER_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": "DEFAULT_CANCEL_DELAY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DISPUTE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FEE_BPS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "FEE_RATE_MAX", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GOVERNOR_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GUARD_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_ZAP_DATA_LENGTH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_CANCEL_DELAY", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_DEADLINE_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NATIVE_GAS_TOKEN", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PROVER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "QUOTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "dstChainId", + "type": "uint32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "originAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destAmount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "sendChainGas", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "internalType": "struct IFastBridge.BridgeParams", + "name": "params", + "type": "tuple" + } + ], + "name": "bridge", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + } + ], + "name": "bridgeProofs", + "outputs": [ + { + "internalType": "uint96", + "name": "timestamp", + "type": "uint96" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "bridgeRelayDetails", + "outputs": [ + { + "internalType": "uint48", + "name": "blockNumber", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "blockTimestamp", + "type": "uint48" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + } + ], + "name": "bridgeRelays", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + } + ], + "name": "bridgeStatuses", + "outputs": [ + { + "internalType": "enum IFastBridgeV2.BridgeStatus", + "name": "status", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "bridgeTxDetails", + "outputs": [ + { + "internalType": "enum IFastBridgeV2.BridgeStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint32", + "name": "destChainId", + "type": "uint32" + }, + { + "internalType": "uint56", + "name": "proofBlockTimestamp", + "type": "uint56" + }, + { + "internalType": "address", + "name": "proofRelayer", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "dstChainId", + "type": "uint32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "originAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destAmount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "sendChainGas", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "internalType": "struct IFastBridge.BridgeParams", + "name": "params", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "address", + "name": "quoteRelayer", + "type": "address" + }, + { + "internalType": "int256", + "name": "quoteExclusivitySeconds", + "type": "int256" + }, + { + "internalType": "bytes", + "name": "quoteId", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "zapNative", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "zapData", + "type": "bytes" + } + ], + "internalType": "struct IFastBridgeV2.BridgeParamsV2", + "name": "paramsV2", + "type": "tuple" + } + ], + "name": "bridgeV2", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "name": "canClaim", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cancelDelay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], + "name": "cancelV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "chainGasAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], + "name": "claimV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deployBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + } + ], + "name": "dispute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], + "name": "getBridgeTransaction", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "originChainId", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "destChainId", + "type": "uint32" + }, + { + "internalType": "address", + "name": "originSender", + "type": "address" + }, + { + "internalType": "address", + "name": "destRecipient", + "type": "address" + }, + { + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "originAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "originFeeAmount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "sendChainGas", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "internalType": "struct IFastBridge.BridgeTransaction", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], + "name": "getBridgeTransactionV2", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "originChainId", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "destChainId", + "type": "uint32" + }, + { + "internalType": "address", + "name": "originSender", + "type": "address" + }, + { + "internalType": "address", + "name": "destRecipient", + "type": "address" + }, + { + "internalType": "address", + "name": "originToken", + "type": "address" + }, + { + "internalType": "address", + "name": "destToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "originAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "originFeeAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "address", + "name": "exclusivityRelayer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "exclusivityEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "zapNative", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "zapData", + "type": "bytes" + } + ], + "internalType": "struct IFastBridgeV2.BridgeTransactionV2", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "pure", + "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": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "ignoreReverts", + "type": "bool" + } + ], + "name": "multicallNoResults", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "bool", + "name": "ignoreReverts", + "type": "bool" + } + ], + "name": "multicallWithResults", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "internalType": "struct IMulticallTarget.Result[]", + "name": "results", + "type": "tuple[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "protocolFeeRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "protocolFees", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "destTxHash", + "type": "bytes32" + } + ], + "name": "prove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "destTxHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "name": "proveV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], + "name": "refund", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], + "name": "relay", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } + ], + "name": "relayV2", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "callerConfirmation", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "senderNonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newCancelDelay", + "type": "uint256" + } + ], + "name": "setCancelDelay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFeeRate", + "type": "uint256" + } + ], + "name": "setProtocolFeeRate", + "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": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "sweepProtocolFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] as const \ No newline at end of file diff --git a/packages/rfq-indexer/indexer/ponder.config.ts b/packages/rfq-indexer/indexer/ponder.config.ts index 2329d0e89f..d6a6cc255f 100644 --- a/packages/rfq-indexer/indexer/ponder.config.ts +++ b/packages/rfq-indexer/indexer/ponder.config.ts @@ -1,251 +1,104 @@ -import { createConfig } from '@ponder/core' +import { createConfig, loadBalance, rateLimit } from '@ponder/core' import { http } from 'viem' +import dotenv from 'dotenv'; -import { FastBridgeV2Abi } from '@/abis/FastBridgeV2' -import { AddressConfig } from '@/indexer/src/types' - -// Mainnets -const ethereumChainId = 1 -const optimismChainId = 10 -const arbitrumChainId = 42161 -const baseChainId = 8453 -const blastChainId = 81457 -const scrollChainId = 534352 -const lineaChainId = 59144 -const bnbChainId = 56 -const worldchainChainId = 480 - -const configByChainId = { - [1]: { - transport: http(process.env.ETH_MAINNET_RPC), - chainName: 'ethereum', - FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - // FastBridgeV2StartBlock: 19420718, first block - FastBridgeV2StartBlock: 20426589, // new block - }, - [10]: { - transport: http(process.env.OPTIMISM_MAINNET_RPC), - chainName: 'optimism', - FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - // FastBridgeV2StartBlock: 117334308, first block - FastBridgeV2StartBlock: 123416470, // new block - }, - [42161]: { - transport: http(process.env.ARBITRUM_MAINNET_RPC), - chainName: 'arbitrum', - FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - // FastBridgeV2StartBlock: 189700328, first block - FastBridgeV2StartBlock: 237979967, // new block - }, - [8453]: { - transport: http(process.env.BASE_MAINNET_RPC), - chainName: 'base', - FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - // FastBridgeV2StartBlock: 12478374, first block - FastBridgeV2StartBlock: 17821292, // new block - }, - [81457]: { - transport: http(process.env.BLAST_MAINNET_RPC), - chainName: 'blast', - FastBridgeV2Address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', - // FastBridgeV2StartBlock: 6378234, first block - FastBridgeV2StartBlock: 6811045, // new block - }, - [534352]: { - transport: http(process.env.SCROLL_MAINNET_RPC), - chainName: 'scroll', - FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - // FastBridgeV2StartBlock: 5357000, first block - FastBridgeV2StartBlock: 7941653, // new block - }, - [59144]: { - transport: http(process.env.LINEA_MAINNET_RPC), - chainName: 'linea', - FastBridgeV2Address: '0x34F52752975222d5994C206cE08C1d5B329f24dD', - FastBridgeV2StartBlock: 7124666, // first block and new block - }, - [56]: { - transport: http(process.env.BNB_MAINNET_RPC), - chainName: 'bnb', - FastBridgeV2Address: '0x5523D3c98809DdDB82C686E152F5C58B1B0fB59E', - FastBridgeV2StartBlock: 40497843, // first block and new block - }, - [480]: { - transport: http(process.env.WORLDCHAIN_MAINNET_RPC), - chainName: 'worldchain', - FastBridgeV2Address: '0x05C62156C7C47E76223A560210EA648De5e6B53B', - FastBridgeV2StartBlock: 4598830, // first block and new block - }, - disableCache: true, -} - -export const networkDetails = { - [ethereumChainId]: { - name: configByChainId[ethereumChainId].chainName, - FastBridgeV2: { - address: configByChainId[ethereumChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[ethereumChainId].FastBridgeV2StartBlock, - }, - }, - [optimismChainId]: { - name: configByChainId[optimismChainId].chainName, - FastBridgeV2: { - address: configByChainId[optimismChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[optimismChainId].FastBridgeV2StartBlock, - }, - }, - [arbitrumChainId]: { - name: configByChainId[arbitrumChainId].chainName, - FastBridgeV2: { - address: configByChainId[arbitrumChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[arbitrumChainId].FastBridgeV2StartBlock, - }, - }, - [baseChainId]: { - name: configByChainId[baseChainId].chainName, - FastBridgeV2: { - address: configByChainId[baseChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[baseChainId].FastBridgeV2StartBlock, - }, - }, - [blastChainId]: { - name: configByChainId[blastChainId].chainName, - FastBridgeV2: { - address: configByChainId[blastChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[blastChainId].FastBridgeV2StartBlock, - }, - }, - [scrollChainId]: { - name: configByChainId[scrollChainId].chainName, - FastBridgeV2: { - address: configByChainId[scrollChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[scrollChainId].FastBridgeV2StartBlock, - }, - }, - [lineaChainId]: { - name: configByChainId[lineaChainId].chainName, - FastBridgeV2: { - address: configByChainId[lineaChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[lineaChainId].FastBridgeV2StartBlock, - }, - }, - [bnbChainId]: { - name: configByChainId[bnbChainId].chainName, - FastBridgeV2: { - address: configByChainId[bnbChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[bnbChainId].FastBridgeV2StartBlock, - }, - }, - [worldchainChainId]: { - name: configByChainId[worldchainChainId].chainName, - FastBridgeV2: { - address: configByChainId[worldchainChainId].FastBridgeV2Address, - abi: FastBridgeV2Abi, - startBlock: configByChainId[worldchainChainId].FastBridgeV2StartBlock, - }, - }, -} as Record - -const config = createConfig({ - networks: { - [configByChainId[ethereumChainId].chainName]: { - chainId: ethereumChainId, - transport: configByChainId[ethereumChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[optimismChainId].chainName]: { - chainId: optimismChainId, - transport: configByChainId[optimismChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[arbitrumChainId].chainName]: { - chainId: arbitrumChainId, - transport: configByChainId[arbitrumChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[baseChainId].chainName]: { - chainId: baseChainId, - transport: configByChainId[baseChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[blastChainId].chainName]: { - chainId: blastChainId, - transport: configByChainId[blastChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[scrollChainId].chainName]: { - chainId: scrollChainId, - transport: configByChainId[scrollChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[lineaChainId].chainName]: { - chainId: lineaChainId, - transport: configByChainId[lineaChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[bnbChainId].chainName]: { - chainId: bnbChainId, - transport: configByChainId[bnbChainId].transport, - // disableCache: configByChainId.disableCache, - }, - [configByChainId[worldchainChainId].chainName]: { - chainId: worldchainChainId, - transport: configByChainId[worldchainChainId].transport, - // disableCache: configByChainId.disableCache, - }, - }, +import { ABI_FastBridgeV1 } from '@/abis/FastBridgeV1' +import { ABI_FastBridgeV2 } from '@/abis/FastBridgeV2'; +import { privateEncrypt } from 'crypto'; + + +dotenv.config(); + +const getContractNetwork = (chainId: number, contractLabel: string) => { + contractLabel=contractLabel.toUpperCase() + const startBlockEnvVar = `CONTRACT_${contractLabel}_STARTBLOCK_${chainId}`; + const addressEnvVar = `CONTRACT_${contractLabel}_ADDRESS_${chainId}`; + + const startBlock = process.env[startBlockEnvVar]; + const contractAddr = process.env[addressEnvVar]; + + // if no env vars found, assume this chain+contract is legitimately not applicable & return nothing + if (!startBlock && !contractAddr) { + return {}; + } + + if (!startBlock) { + throw new Error(`Environment variable ${startBlockEnvVar} must be defined`); + } + + if (!contractAddr) { + throw new Error(`Environment variable ${addressEnvVar} must be defined`); + } + + console.log(`Including ${contractLabel} ${chainId.toString().padStart(10)}:${contractAddr.slice(0,6)} blocks ${startBlock.toString().padStart(10)} - `); + + return { + [chainId]: { + contractAddr, + startBlock: parseInt(startBlock, 10), + } + }; +}; + +const getConfigNetwork = (chainId: number) => { + const transportEnvVarName = `RPC_URL_${chainId}`; + const url = process.env[transportEnvVarName]; + + if (!url) { + throw new Error(`RPC_URL_${chainId} must be defined`); + } + + if (!url.startsWith('http')) { + throw new Error(`RPC_URL_${chainId} must be an HTTP/S URL`); + } + + const requestsPerSecond = process.env[`RPC_LIMIT_RPS_${chainId}`] ? parseInt(process.env[`RPC_LIMIT_RPS_${chainId}`]!, 10) : 9999; + const transport = rateLimit(http(url), { requestsPerSecond }); + + return { + chainId, + transport, + }; +}; + + + +// infer chain ID list from RPC_URL_ env vars that are configured +const chainIds = Object.keys(process.env) + .filter(key => key.startsWith('RPC_URL_')) + .map(key => parseInt(key.replace('RPC_URL_', ''), 10)); + +// generate contract network records +const contractNetworks_FastBridgeV1 = chainIds.reduce((acc, chainId) => { + return { ...acc, ...getContractNetwork(chainId, "FASTBRIDGEV1") }; +}, {}); + +const contractNetworks_FastBridgeV2 = chainIds.reduce((acc, chainId) => { + return { ...acc, ...getContractNetwork(chainId, "FASTBRIDGEV2") }; +}, {}); + + +console.log(contractNetworks_FastBridgeV2) + +const configNetworks = chainIds.reduce((acc, chainId) => { + return { + ...acc, + [chainId]: getConfigNetwork(chainId) + }; +}, {}); + +export default createConfig({ + networks: configNetworks, contracts: { - FastBridgeV2: { - network: { - [configByChainId[ethereumChainId].chainName]: { - address: networkDetails[ethereumChainId]?.FastBridgeV2.address, - startBlock: networkDetails[ethereumChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[optimismChainId].chainName]: { - address: networkDetails[optimismChainId]?.FastBridgeV2.address, - startBlock: networkDetails[optimismChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[arbitrumChainId].chainName]: { - address: networkDetails[arbitrumChainId]?.FastBridgeV2.address, - startBlock: networkDetails[arbitrumChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[baseChainId].chainName]: { - address: networkDetails[baseChainId]?.FastBridgeV2.address, - startBlock: networkDetails[baseChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[blastChainId].chainName]: { - address: networkDetails[blastChainId]?.FastBridgeV2.address, - startBlock: networkDetails[blastChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[scrollChainId].chainName]: { - address: networkDetails[scrollChainId]?.FastBridgeV2.address, - startBlock: networkDetails[scrollChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[lineaChainId].chainName]: { - address: networkDetails[lineaChainId]?.FastBridgeV2.address, - startBlock: networkDetails[lineaChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[bnbChainId].chainName]: { - address: networkDetails[bnbChainId]?.FastBridgeV2.address, - startBlock: networkDetails[bnbChainId]?.FastBridgeV2.startBlock, - }, - [configByChainId[worldchainChainId].chainName]: { - address: networkDetails[worldchainChainId]?.FastBridgeV2.address, - startBlock: - networkDetails[worldchainChainId]?.FastBridgeV2.startBlock, - }, - }, - abi: FastBridgeV2Abi, + v2: { + abi: ABI_FastBridgeV2, + network: contractNetworks_FastBridgeV2, + }, + v1: { + abi: ABI_FastBridgeV1, + network: contractNetworks_FastBridgeV1, }, }, -}) +}); + -export default config diff --git a/packages/rfq-indexer/indexer/src/index.ts b/packages/rfq-indexer/indexer/src/index.ts index 2fe6711830..b54a53e0ad 100644 --- a/packages/rfq-indexer/indexer/src/index.ts +++ b/packages/rfq-indexer/indexer/src/index.ts @@ -4,9 +4,67 @@ import { ponder } from '@/generated' import { formatAmount } from './utils/formatAmount' import { getChainName } from './utils/chains' + +//* ############ FastBridgeV2 ########### *// + +/* ORIGIN CHAIN EVENTS */ + +ponder.on('v2:BridgeRequested', async ({ event, context }) => { + + + const { + db: { BridgeRequestEvents }, + network: { chainId }, + } = context + + const { + args: { + transactionId, + sender, + request, + destChainId, + originToken, + destToken, + originAmount, + destAmount, + sendChainGas, + }, + block: { timestamp }, + transaction: { hash }, + log: { blockNumber }, + } = event + + await BridgeRequestEvents.create({ + id: transactionId, + data: { + transactionId, + sender: trim(sender), + request, + originChainId: Number(chainId), + originChain: getChainName(Number(chainId)), + destChainId: Number(destChainId), + destChain: getChainName(Number(destChainId)), + originToken: trim(originToken), + destToken: trim(destToken), + originAmount, + originAmountFormatted: formatAmount(originAmount, originToken), + destAmount, + destAmountFormatted: formatAmount(destAmount, destToken), + sendChainGas, + blockNumber: BigInt(blockNumber), + blockTimestamp: Number(timestamp), + transactionHash: hash, + }, + }) +}) + + + +//* ############ FastBridgeV1 ########### *// + /* ORIGIN CHAIN EVENTS */ -ponder.on('FastBridgeV2:BridgeRequested', async ({ event, context }) => { +ponder.on('v1:BridgeRequested', async ({ event, context }) => { const { db: { BridgeRequestEvents }, network: { chainId }, @@ -53,7 +111,7 @@ ponder.on('FastBridgeV2:BridgeRequested', async ({ event, context }) => { }) }) -ponder.on('FastBridgeV2:BridgeDepositRefunded', async ({ event, context }) => { +ponder.on('v1:BridgeDepositRefunded', async ({ event, context }) => { const { args: { transactionId, to, token, amount }, block: { timestamp }, @@ -83,7 +141,7 @@ ponder.on('FastBridgeV2:BridgeDepositRefunded', async ({ event, context }) => { }) }) -ponder.on('FastBridgeV2:BridgeProofProvided', async ({ event, context }) => { +ponder.on('v1:BridgeProofProvided', async ({ event, context }) => { const { args: { transactionId, relayer }, block: { timestamp }, @@ -118,7 +176,7 @@ ponder.on('FastBridgeV2:BridgeProofProvided', async ({ event, context }) => { }) }) -ponder.on('FastBridgeV2:BridgeDepositClaimed', async ({ event, context }) => { +ponder.on('v1:BridgeDepositClaimed', async ({ event, context }) => { const { args: { transactionId, relayer, to, token, amount }, block: { timestamp }, @@ -149,7 +207,7 @@ ponder.on('FastBridgeV2:BridgeDepositClaimed', async ({ event, context }) => { }) }) -ponder.on('FastBridgeV2:BridgeProofDisputed', async ({ event, context }) => { +ponder.on('v1:BridgeProofDisputed', async ({ event, context }) => { const { args: { transactionId, relayer }, block: { timestamp }, @@ -184,7 +242,7 @@ ponder.on('FastBridgeV2:BridgeProofDisputed', async ({ event, context }) => { /* DESTINATION CHAIN EVENTS */ -ponder.on('FastBridgeV2:BridgeRelayed', async ({ event, context }) => { +ponder.on('v1:BridgeRelayed', async ({ event, context }) => { const { args: { transactionId, diff --git a/packages/rfq-indexer/indexer/src/types.ts b/packages/rfq-indexer/indexer/src/types.ts index e1f2809a9a..7d9cadc0c2 100644 --- a/packages/rfq-indexer/indexer/src/types.ts +++ b/packages/rfq-indexer/indexer/src/types.ts @@ -1,10 +1 @@ import { type Abi, type Address } from 'viem' - -export interface AddressConfig { - name: string - FastBridgeV2: { - address: Address - abi: Abi - startBlock: number - } -}