From a3c12be028e5c7b225849e1d31aa531d465c367e Mon Sep 17 00:00:00 2001 From: trajan0x <83933037+trajan0x@users.noreply.github.com> Date: Tue, 9 Jan 2024 20:02:22 -0400 Subject: [PATCH] upgrade sdk (#1808) Co-authored-by: Trajan0x --- packages/sdk-router/src/abi/FastBridge.json | 639 +++++++++++++++--- .../sdk-router/src/constants/addresses.ts | 5 +- 2 files changed, 541 insertions(+), 103 deletions(-) diff --git a/packages/sdk-router/src/abi/FastBridge.json b/packages/sdk-router/src/abi/FastBridge.json index 6481a4bd5f..4188dacda8 100644 --- a/packages/sdk-router/src/abi/FastBridge.json +++ b/packages/sdk-router/src/abi/FastBridge.json @@ -1,72 +1,156 @@ [ { "inputs": [ - { "internalType": "address", "name": "_owner", "type": "address" } + { + "internalType": "address", + "name": "_owner", + "type": "address" + } ], "stateMutability": "nonpayable", "type": "constructor" }, - { "inputs": [], "name": "AccessControlBadConfirmation", "type": "error" }, + { + "inputs": [], + "name": "AccessControlBadConfirmation", + "type": "error" + }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "bytes32", "name": "neededRole", "type": "bytes32" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "neededRole", + "type": "bytes32" + } ], "name": "AccessControlUnauthorizedAccount", "type": "error" }, { "inputs": [ - { "internalType": "address", "name": "target", "type": "address" } + { + "internalType": "address", + "name": "target", + "type": "address" + } ], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "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": [], + "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" } + { + "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" }, + { + "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": false, + "indexed": true, "internalType": "bytes32", "name": "transactionId", "type": "bytes32" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "relayer", "type": "address" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "to", "type": "address" @@ -91,13 +175,13 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "internalType": "bytes32", "name": "transactionId", "type": "bytes32" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "to", "type": "address" @@ -122,13 +206,13 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "internalType": "bytes32", "name": "transactionId", "type": "bytes32" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "relayer", "type": "address" @@ -141,13 +225,13 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "internalType": "bytes32", "name": "transactionId", "type": "bytes32" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "relayer", "type": "address" @@ -166,33 +250,51 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "internalType": "bytes32", "name": "transactionId", "type": "bytes32" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "relayer", "type": "address" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { + "indexed": false, + "internalType": "uint32", + "name": "originChainId", + "type": "uint32" + }, { "indexed": false, "internalType": "address", - "name": "token", + "name": "originToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "destToken", "type": "address" }, { "indexed": false, "internalType": "uint256", - "name": "amount", + "name": "originAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "destAmount", "type": "uint256" }, { @@ -209,13 +311,13 @@ "anonymous": false, "inputs": [ { - "indexed": false, + "indexed": true, "internalType": "bytes32", "name": "transactionId", "type": "bytes32" }, { - "indexed": false, + "indexed": true, "internalType": "address", "name": "sender", "type": "address" @@ -225,6 +327,42 @@ "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", @@ -449,62 +587,114 @@ { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DISPUTE_PERIOD", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "FEE_BPS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "FEE_RATE_MAX", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "GOVERNOR_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "GUARD_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_DEADLINE_PERIOD", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "RELAYER_ROLE", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_governor", "type": "address" } + { + "internalType": "address", + "name": "_governor", + "type": "address" + } ], "name": "addGovernor", "outputs": [], @@ -513,7 +703,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "_guard", "type": "address" } + { + "internalType": "address", + "name": "_guard", + "type": "address" + } ], "name": "addGuard", "outputs": [], @@ -522,7 +716,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "_relayer", "type": "address" } + { + "internalType": "address", + "name": "_relayer", + "type": "address" + } ], "name": "addRelayer", "outputs": [], @@ -533,15 +731,31 @@ "inputs": [ { "components": [ - { "internalType": "uint32", "name": "dstChainId", "type": "uint32" }, - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, + { + "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": "address", + "name": "destToken", + "type": "address" + }, { "internalType": "uint256", "name": "originAmount", @@ -552,8 +766,16 @@ "name": "destAmount", "type": "uint256" }, - { "internalType": "bool", "name": "sendChainGas", "type": "bool" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" } + { + "internalType": "bool", + "name": "sendChainGas", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } ], "internalType": "struct IFastBridge.BridgeParams", "name": "params", @@ -566,24 +788,56 @@ "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "bridgeProofs", "outputs": [ - { "internalType": "uint96", "name": "timestamp", "type": "uint96" }, - { "internalType": "address", "name": "relayer", "type": "address" } + { + "internalType": "uint96", + "name": "timestamp", + "type": "uint96" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "bridgeRelays", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "bridgeStatuses", "outputs": [ { @@ -597,25 +851,53 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "transactionId", "type": "bytes32" }, - { "internalType": "address", "name": "relayer", "type": "address" } + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "relayer", + "type": "address" + } ], "name": "canClaim", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "chainGasAmount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes", "name": "request", "type": "bytes" }, - { "internalType": "address", "name": "to", "type": "address" } + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } ], "name": "claim", "outputs": [], @@ -625,13 +907,23 @@ { "inputs": [], "name": "deployBlock", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "transactionId", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "transactionId", + "type": "bytes32" + } ], "name": "dispute", "outputs": [], @@ -639,7 +931,13 @@ "type": "function" }, { - "inputs": [{ "internalType": "bytes", "name": "request", "type": "bytes" }], + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], "name": "getBridgeTransaction", "outputs": [ { @@ -649,7 +947,11 @@ "name": "originChainId", "type": "uint32" }, - { "internalType": "uint32", "name": "destChainId", "type": "uint32" }, + { + "internalType": "uint32", + "name": "destChainId", + "type": "uint32" + }, { "internalType": "address", "name": "originSender", @@ -665,7 +967,11 @@ "name": "originToken", "type": "address" }, - { "internalType": "address", "name": "destToken", "type": "address" }, + { + "internalType": "address", + "name": "destToken", + "type": "address" + }, { "internalType": "uint256", "name": "originAmount", @@ -681,9 +987,21 @@ "name": "originFeeAmount", "type": "uint256" }, - { "internalType": "bool", "name": "sendChainGas", "type": "bool" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "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": "", @@ -695,17 +1013,35 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } ], "name": "getRoleAdmin", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "grantRole", "outputs": [], @@ -714,39 +1050,85 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "hasRole", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "nonce", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "protocolFeeRate", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "protocolFees", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "bytes", "name": "request", "type": "bytes" }, - { "internalType": "bytes32", "name": "destTxHash", "type": "bytes32" } + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "destTxHash", + "type": "bytes32" + } ], "name": "prove", "outputs": [], @@ -755,8 +1137,11 @@ }, { "inputs": [ - { "internalType": "bytes", "name": "request", "type": "bytes" }, - { "internalType": "address", "name": "to", "type": "address" } + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } ], "name": "refund", "outputs": [], @@ -764,7 +1149,13 @@ "type": "function" }, { - "inputs": [{ "internalType": "bytes", "name": "request", "type": "bytes" }], + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + } + ], "name": "relay", "outputs": [], "stateMutability": "payable", @@ -772,7 +1163,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "_governor", "type": "address" } + { + "internalType": "address", + "name": "_governor", + "type": "address" + } ], "name": "removeGovernor", "outputs": [], @@ -781,7 +1176,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "_guard", "type": "address" } + { + "internalType": "address", + "name": "_guard", + "type": "address" + } ], "name": "removeGuard", "outputs": [], @@ -790,7 +1189,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "_relayer", "type": "address" } + { + "internalType": "address", + "name": "_relayer", + "type": "address" + } ], "name": "removeRelayer", "outputs": [], @@ -799,7 +1202,11 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, { "internalType": "address", "name": "callerConfirmation", @@ -813,8 +1220,16 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "role", "type": "bytes32" }, - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "revokeRole", "outputs": [], @@ -836,7 +1251,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "newFeeRate", "type": "uint256" } + { + "internalType": "uint256", + "name": "newFeeRate", + "type": "uint256" + } ], "name": "setProtocolFeeRate", "outputs": [], @@ -845,17 +1264,35 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } ], "name": "sweepProtocolFees", "outputs": [], diff --git a/packages/sdk-router/src/constants/addresses.ts b/packages/sdk-router/src/constants/addresses.ts index e79cdc9f9f..57345f3820 100644 --- a/packages/sdk-router/src/constants/addresses.ts +++ b/packages/sdk-router/src/constants/addresses.ts @@ -61,8 +61,9 @@ export const CCTP_ROUTER_ADDRESS_MAP: AddressMap = generateAddressMap( */ const FAST_BRIDGE_ADDRESS = '' const FAST_BRIDGE_EXCEPTION_MAP: AddressMap = { - [SupportedChainId.OPTIMISM]: '0x743fFbd0DbF88F6fCB7FaDf58fB641da93056EdF', - [SupportedChainId.ARBITRUM]: '0xA9EBFCb6DCD416FE975D5aB862717B329407f4F7', + [SupportedChainId.OPTIMISM]: '0x89fb287cc34c2878549a741f2c82d9c2e4657693', + [SupportedChainId.ARBITRUM]: '0x1a54fa31cbcad8c1cbc3a47dcd00864eac9ac2b0', + [SupportedChainId.ETH]: '0xc3c996af7f7a9245685722e73b6f18f3bb22db3d', } export const FAST_BRIDGE_ADDRESS_MAP: AddressMap = generateAddressMap(