From afdbba35c7c61b5025d3b162e7f92ab852a5f040 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Mon, 19 Aug 2024 11:30:18 +0800 Subject: [PATCH] fix: add oft fee and qa test case --- .changeset/fuzzy-yaks-drive.md | 5 + src/logics/stargate-v2/abis/OFTV2.json | 860 +++++++ src/logics/stargate-v2/contracts/OFTV2.ts | 2136 +++++++++++++++++ .../contracts/factories/OFTV2__factory.ts | 2009 ++++++++++++++++ .../stargate-v2/contracts/factories/index.ts | 1 + src/logics/stargate-v2/contracts/index.ts | 2 + .../stargate-v2/logic.swap-token.test.ts | 10 +- src/logics/stargate-v2/logic.swap-token.ts | 17 +- .../logics/stargate-v2/swap-token-bnb.test.ts | 17 +- .../swap-token-polygonZkevm.test.ts | 17 +- 10 files changed, 5057 insertions(+), 17 deletions(-) create mode 100644 .changeset/fuzzy-yaks-drive.md create mode 100644 src/logics/stargate-v2/abis/OFTV2.json create mode 100644 src/logics/stargate-v2/contracts/OFTV2.ts create mode 100644 src/logics/stargate-v2/contracts/factories/OFTV2__factory.ts diff --git a/.changeset/fuzzy-yaks-drive.md b/.changeset/fuzzy-yaks-drive.md new file mode 100644 index 0000000..393ed88 --- /dev/null +++ b/.changeset/fuzzy-yaks-drive.md @@ -0,0 +1,5 @@ +--- +'@protocolink/logics': patch +--- + +add stargate v2 oft fee diff --git a/src/logics/stargate-v2/abis/OFTV2.json b/src/logics/stargate-v2/abis/OFTV2.json new file mode 100644 index 0000000..72e0b6c --- /dev/null +++ b/src/logics/stargate-v2/abis/OFTV2.json @@ -0,0 +1,860 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "_lzEndpoint", "type": "address" }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "cap", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "ExceedInboundCap", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "cap", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "ExceedOutboundCap", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes32", "name": "_hash", "type": "bytes32" } + ], + "name": "CallOFTReceivedSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "nonce", "type": "uint64" } + ], + "name": "DropFailedMessage", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "FallbackWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes", "name": "_payload", "type": "bytes" }, + { "indexed": false, "internalType": "bytes", "name": "_reason", "type": "bytes" } + ], + "name": "MessageFailed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "_address", "type": "address" }], + "name": "NonContractAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": true, "internalType": "address", "name": "_to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "ReceiveFromChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "indexed": false, "internalType": "bytes32", "name": "_payloadHash", "type": "bytes32" } + ], + "name": "RetryMessageSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "indexed": true, "internalType": "address", "name": "_from", "type": "address" }, + { "indexed": true, "internalType": "bytes32", "name": "_toAddress", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "SendToChain", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint16", "name": "feeBp", "type": "uint16" }], + "name": "SetDefaultFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "dstchainId", "type": "uint16" }, + { "indexed": false, "internalType": "bool", "name": "enabled", "type": "bool" }, + { "indexed": false, "internalType": "uint16", "name": "feeBp", "type": "uint16" } + ], + "name": "SetFeeBp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "feeOwner", "type": "address" }], + "name": "SetFeeOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "chainId", "type": "uint16" }, + { "indexed": false, "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "SetInboundCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "indexed": false, "internalType": "uint16", "name": "_type", "type": "uint16" }, + { "indexed": false, "internalType": "uint256", "name": "_minDstGas", "type": "uint256" } + ], + "name": "SetMinDstGas", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "newOperator", "type": "address" }], + "name": "SetOperator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "chainId", "type": "uint16" }, + { "indexed": false, "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "SetOutboundCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "precrime", "type": "address" }], + "name": "SetPrecrime", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_path", "type": "bytes" } + ], + "name": "SetTrustedRemote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "bool", "name": "_useCustomAdapterParams", "type": "bool" }], + "name": "SetUseCustomAdapterParams", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "addr", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "isWhitelist", "type": "bool" } + ], + "name": "SetWhitelist", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "BP_DENOMINATOR", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NO_EXTRA_GAS", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PT_SEND_AND_CALL", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "bytes", "name": "", "type": "bytes" }, + { "internalType": "uint64", "name": "", "type": "uint64" } + ], + "name": "amountsForCall", + "outputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "bool", "name": "credited", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes32", "name": "_from", "type": "bytes32" }, + { "internalType": "address", "name": "_to", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" }, + { "internalType": "uint256", "name": "_gasForCall", "type": "uint256" } + ], + "name": "callOnOFTReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToFeeBps", + "outputs": [ + { "internalType": "uint16", "name": "feeBP", "type": "uint16" }, + { "internalType": "bool", "name": "enabled", "type": "bool" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToInboundCap", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToLastReceivedTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToLastSentTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToOutboundCap", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToReceivedTokenAmount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToSentTokenAmount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "circulatingSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultFeeBp", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "bytes32", "name": "_toAddress", "type": "bytes32" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" }, + { "internalType": "uint64", "name": "_dstGasForCall", "type": "uint64" }, + { "internalType": "bool", "name": "_useZro", "type": "bool" }, + { "internalType": "bytes", "name": "_adapterParams", "type": "bytes" } + ], + "name": "estimateSendAndCallFee", + "outputs": [ + { "internalType": "uint256", "name": "nativeFee", "type": "uint256" }, + { "internalType": "uint256", "name": "zroFee", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "bytes32", "name": "_toAddress", "type": "bytes32" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "bool", "name": "_useZro", "type": "bool" }, + { "internalType": "bytes", "name": "_adapterParams", "type": "bytes" } + ], + "name": "estimateSendFee", + "outputs": [ + { "internalType": "uint256", "name": "nativeFee", "type": "uint256" }, + { "internalType": "uint256", "name": "zroFee", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "bytes", "name": "", "type": "bytes" }, + { "internalType": "uint64", "name": "", "type": "uint64" } + ], + "name": "failedMessages", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeOwner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" } + ], + "name": "forceResumeReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_version", "type": "uint16" }, + { "internalType": "uint16", "name": "_chainId", "type": "uint16" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256", "name": "_configType", "type": "uint256" } + ], + "name": "getConfig", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }], + "name": "getTrustedRemoteAddress", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" } + ], + "name": "isTrustedRemote", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lzEndpoint", + "outputs": [{ "internalType": "contract ILayerZeroEndpoint", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "lzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "", "type": "uint16" }, + { "internalType": "uint16", "name": "", "type": "uint16" } + ], + "name": "minDstGasLookup", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "nonblockingLzReceive", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "precrime", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "quoteOFTFee", + "outputs": [{ "internalType": "uint256", "name": "fee", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }, + { "internalType": "uint64", "name": "_nonce", "type": "uint64" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" } + ], + "name": "retryMessage", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_from", "type": "address" }, + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "bytes32", "name": "_toAddress", "type": "bytes32" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "uint256", "name": "_minAmount", "type": "uint256" }, + { "internalType": "bytes", "name": "_payload", "type": "bytes" }, + { "internalType": "uint64", "name": "_dstGasForCall", "type": "uint64" }, + { + "components": [ + { "internalType": "address payable", "name": "refundAddress", "type": "address" }, + { "internalType": "address", "name": "zroPaymentAddress", "type": "address" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "internalType": "struct ICommonOFT.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_from", "type": "address" }, + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "bytes32", "name": "_toAddress", "type": "bytes32" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" }, + { "internalType": "uint256", "name": "_minAmount", "type": "uint256" }, + { + "components": [ + { "internalType": "address payable", "name": "refundAddress", "type": "address" }, + { "internalType": "address", "name": "zroPaymentAddress", "type": "address" }, + { "internalType": "bytes", "name": "adapterParams", "type": "bytes" } + ], + "internalType": "struct ICommonOFT.LzCallParams", + "name": "_callParams", + "type": "tuple" + } + ], + "name": "sendFrom", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_version", "type": "uint16" }, + { "internalType": "uint16", "name": "_chainId", "type": "uint16" }, + { "internalType": "uint256", "name": "_configType", "type": "uint256" }, + { "internalType": "bytes", "name": "_config", "type": "bytes" } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_feeBp", "type": "uint16" }], + "name": "setDefaultFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "bool", "name": "_enabled", "type": "bool" }, + { "internalType": "uint16", "name": "_feeBp", "type": "uint16" } + ], + "name": "setFeeBp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_feeOwner", "type": "address" }], + "name": "setFeeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "chainId", "type": "uint16" }, + { "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "setInboundCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_dstChainId", "type": "uint16" }, + { "internalType": "uint16", "name": "_packetType", "type": "uint16" }, + { "internalType": "uint256", "name": "_minGas", "type": "uint256" } + ], + "name": "setMinDstGas", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "chainId", "type": "uint16" }, + { "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "setOutboundCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_precrime", "type": "address" }], + "name": "setPrecrime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }], + "name": "setReceiveVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_srcChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_path", "type": "bytes" } + ], + "name": "setTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }, + { "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bool", "name": "_useCustomAdapterParams", "type": "bool" }], + "name": "setUseCustomAdapterParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "addr", "type": "address" }, + { "internalType": "bool", "name": "isWhitelist", "type": "bool" } + ], + "name": "setWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sharedDecimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }], + "name": "supportsInterface", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "trustedRemoteLookup", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "useCustomAdapterParams", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "whitelist", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/logics/stargate-v2/contracts/OFTV2.ts b/src/logics/stargate-v2/contracts/OFTV2.ts new file mode 100644 index 0000000..6d1b635 --- /dev/null +++ b/src/logics/stargate-v2/contracts/OFTV2.ts @@ -0,0 +1,2136 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PayableOverrides, + PopulatedTransaction, + Signer, + utils, +} from 'ethers'; +import type { FunctionFragment, Result, EventFragment } from '@ethersproject/abi'; +import type { Listener, Provider } from '@ethersproject/providers'; +import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from './common'; + +export declare namespace ICommonOFT { + export type LzCallParamsStruct = { + refundAddress: string; + zroPaymentAddress: string; + adapterParams: BytesLike; + }; + + export type LzCallParamsStructOutput = [string, string, string] & { + refundAddress: string; + zroPaymentAddress: string; + adapterParams: string; + }; +} + +export interface OFTV2Interface extends utils.Interface { + functions: { + 'BP_DENOMINATOR()': FunctionFragment; + 'NO_EXTRA_GAS()': FunctionFragment; + 'PT_SEND()': FunctionFragment; + 'PT_SEND_AND_CALL()': FunctionFragment; + 'allowance(address,address)': FunctionFragment; + 'amountsForCall(uint16,bytes,uint64)': FunctionFragment; + 'approve(address,uint256)': FunctionFragment; + 'balanceOf(address)': FunctionFragment; + 'callOnOFTReceived(uint16,bytes,uint64,bytes32,address,uint256,bytes,uint256)': FunctionFragment; + 'chainIdToFeeBps(uint16)': FunctionFragment; + 'chainIdToInboundCap(uint16)': FunctionFragment; + 'chainIdToLastReceivedTimestamp(uint16)': FunctionFragment; + 'chainIdToLastSentTimestamp(uint16)': FunctionFragment; + 'chainIdToOutboundCap(uint16)': FunctionFragment; + 'chainIdToReceivedTokenAmount(uint16)': FunctionFragment; + 'chainIdToSentTokenAmount(uint16)': FunctionFragment; + 'circulatingSupply()': FunctionFragment; + 'decimals()': FunctionFragment; + 'decreaseAllowance(address,uint256)': FunctionFragment; + 'defaultFeeBp()': FunctionFragment; + 'estimateSendAndCallFee(uint16,bytes32,uint256,bytes,uint64,bool,bytes)': FunctionFragment; + 'estimateSendFee(uint16,bytes32,uint256,bool,bytes)': FunctionFragment; + 'failedMessages(uint16,bytes,uint64)': FunctionFragment; + 'feeOwner()': FunctionFragment; + 'forceResumeReceive(uint16,bytes)': FunctionFragment; + 'getConfig(uint16,uint16,address,uint256)': FunctionFragment; + 'getTrustedRemoteAddress(uint16)': FunctionFragment; + 'increaseAllowance(address,uint256)': FunctionFragment; + 'isTrustedRemote(uint16,bytes)': FunctionFragment; + 'lzEndpoint()': FunctionFragment; + 'lzReceive(uint16,bytes,uint64,bytes)': FunctionFragment; + 'minDstGasLookup(uint16,uint16)': FunctionFragment; + 'name()': FunctionFragment; + 'nonblockingLzReceive(uint16,bytes,uint64,bytes)': FunctionFragment; + 'owner()': FunctionFragment; + 'pause()': FunctionFragment; + 'paused()': FunctionFragment; + 'precrime()': FunctionFragment; + 'quoteOFTFee(uint16,uint256)': FunctionFragment; + 'renounceOwnership()': FunctionFragment; + 'retryMessage(uint16,bytes,uint64,bytes)': FunctionFragment; + 'sendAndCall(address,uint16,bytes32,uint256,uint256,bytes,uint64,(address,address,bytes))': FunctionFragment; + 'sendFrom(address,uint16,bytes32,uint256,uint256,(address,address,bytes))': FunctionFragment; + 'setConfig(uint16,uint16,uint256,bytes)': FunctionFragment; + 'setDefaultFeeBp(uint16)': FunctionFragment; + 'setFeeBp(uint16,bool,uint16)': FunctionFragment; + 'setFeeOwner(address)': FunctionFragment; + 'setInboundCap(uint16,uint256)': FunctionFragment; + 'setMinDstGas(uint16,uint16,uint256)': FunctionFragment; + 'setOutboundCap(uint16,uint256)': FunctionFragment; + 'setPrecrime(address)': FunctionFragment; + 'setReceiveVersion(uint16)': FunctionFragment; + 'setSendVersion(uint16)': FunctionFragment; + 'setTrustedRemote(uint16,bytes)': FunctionFragment; + 'setTrustedRemoteAddress(uint16,bytes)': FunctionFragment; + 'setUseCustomAdapterParams(bool)': FunctionFragment; + 'setWhitelist(address,bool)': FunctionFragment; + 'sharedDecimals()': FunctionFragment; + 'supportsInterface(bytes4)': FunctionFragment; + 'symbol()': FunctionFragment; + 'token()': FunctionFragment; + 'totalSupply()': FunctionFragment; + 'transfer(address,uint256)': FunctionFragment; + 'transferFrom(address,address,uint256)': FunctionFragment; + 'transferOwnership(address)': FunctionFragment; + 'trustedRemoteLookup(uint16)': FunctionFragment; + 'unpause()': FunctionFragment; + 'useCustomAdapterParams()': FunctionFragment; + 'whitelist(address)': FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | 'BP_DENOMINATOR' + | 'NO_EXTRA_GAS' + | 'PT_SEND' + | 'PT_SEND_AND_CALL' + | 'allowance' + | 'amountsForCall' + | 'approve' + | 'balanceOf' + | 'callOnOFTReceived' + | 'chainIdToFeeBps' + | 'chainIdToInboundCap' + | 'chainIdToLastReceivedTimestamp' + | 'chainIdToLastSentTimestamp' + | 'chainIdToOutboundCap' + | 'chainIdToReceivedTokenAmount' + | 'chainIdToSentTokenAmount' + | 'circulatingSupply' + | 'decimals' + | 'decreaseAllowance' + | 'defaultFeeBp' + | 'estimateSendAndCallFee' + | 'estimateSendFee' + | 'failedMessages' + | 'feeOwner' + | 'forceResumeReceive' + | 'getConfig' + | 'getTrustedRemoteAddress' + | 'increaseAllowance' + | 'isTrustedRemote' + | 'lzEndpoint' + | 'lzReceive' + | 'minDstGasLookup' + | 'name' + | 'nonblockingLzReceive' + | 'owner' + | 'pause' + | 'paused' + | 'precrime' + | 'quoteOFTFee' + | 'renounceOwnership' + | 'retryMessage' + | 'sendAndCall' + | 'sendFrom' + | 'setConfig' + | 'setDefaultFeeBp' + | 'setFeeBp' + | 'setFeeOwner' + | 'setInboundCap' + | 'setMinDstGas' + | 'setOutboundCap' + | 'setPrecrime' + | 'setReceiveVersion' + | 'setSendVersion' + | 'setTrustedRemote' + | 'setTrustedRemoteAddress' + | 'setUseCustomAdapterParams' + | 'setWhitelist' + | 'sharedDecimals' + | 'supportsInterface' + | 'symbol' + | 'token' + | 'totalSupply' + | 'transfer' + | 'transferFrom' + | 'transferOwnership' + | 'trustedRemoteLookup' + | 'unpause' + | 'useCustomAdapterParams' + | 'whitelist' + ): FunctionFragment; + + encodeFunctionData(functionFragment: 'BP_DENOMINATOR', values?: undefined): string; + encodeFunctionData(functionFragment: 'NO_EXTRA_GAS', values?: undefined): string; + encodeFunctionData(functionFragment: 'PT_SEND', values?: undefined): string; + encodeFunctionData(functionFragment: 'PT_SEND_AND_CALL', values?: undefined): string; + encodeFunctionData(functionFragment: 'allowance', values: [string, string]): string; + encodeFunctionData(functionFragment: 'amountsForCall', values: [BigNumberish, BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: 'approve', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'balanceOf', values: [string]): string; + encodeFunctionData( + functionFragment: 'callOnOFTReceived', + values: [BigNumberish, BytesLike, BigNumberish, BytesLike, string, BigNumberish, BytesLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: 'chainIdToFeeBps', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'chainIdToInboundCap', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'chainIdToLastReceivedTimestamp', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'chainIdToLastSentTimestamp', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'chainIdToOutboundCap', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'chainIdToReceivedTokenAmount', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'chainIdToSentTokenAmount', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'circulatingSupply', values?: undefined): string; + encodeFunctionData(functionFragment: 'decimals', values?: undefined): string; + encodeFunctionData(functionFragment: 'decreaseAllowance', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'defaultFeeBp', values?: undefined): string; + encodeFunctionData( + functionFragment: 'estimateSendAndCallFee', + values: [BigNumberish, BytesLike, BigNumberish, BytesLike, BigNumberish, boolean, BytesLike] + ): string; + encodeFunctionData( + functionFragment: 'estimateSendFee', + values: [BigNumberish, BytesLike, BigNumberish, boolean, BytesLike] + ): string; + encodeFunctionData(functionFragment: 'failedMessages', values: [BigNumberish, BytesLike, BigNumberish]): string; + encodeFunctionData(functionFragment: 'feeOwner', values?: undefined): string; + encodeFunctionData(functionFragment: 'forceResumeReceive', values: [BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: 'getConfig', values: [BigNumberish, BigNumberish, string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'getTrustedRemoteAddress', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'increaseAllowance', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'isTrustedRemote', values: [BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: 'lzEndpoint', values?: undefined): string; + encodeFunctionData(functionFragment: 'lzReceive', values: [BigNumberish, BytesLike, BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: 'minDstGasLookup', values: [BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'name', values?: undefined): string; + encodeFunctionData( + functionFragment: 'nonblockingLzReceive', + values: [BigNumberish, BytesLike, BigNumberish, BytesLike] + ): string; + encodeFunctionData(functionFragment: 'owner', values?: undefined): string; + encodeFunctionData(functionFragment: 'pause', values?: undefined): string; + encodeFunctionData(functionFragment: 'paused', values?: undefined): string; + encodeFunctionData(functionFragment: 'precrime', values?: undefined): string; + encodeFunctionData(functionFragment: 'quoteOFTFee', values: [BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'renounceOwnership', values?: undefined): string; + encodeFunctionData( + functionFragment: 'retryMessage', + values: [BigNumberish, BytesLike, BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: 'sendAndCall', + values: [ + string, + BigNumberish, + BytesLike, + BigNumberish, + BigNumberish, + BytesLike, + BigNumberish, + ICommonOFT.LzCallParamsStruct + ] + ): string; + encodeFunctionData( + functionFragment: 'sendFrom', + values: [string, BigNumberish, BytesLike, BigNumberish, BigNumberish, ICommonOFT.LzCallParamsStruct] + ): string; + encodeFunctionData( + functionFragment: 'setConfig', + values: [BigNumberish, BigNumberish, BigNumberish, BytesLike] + ): string; + encodeFunctionData(functionFragment: 'setDefaultFeeBp', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'setFeeBp', values: [BigNumberish, boolean, BigNumberish]): string; + encodeFunctionData(functionFragment: 'setFeeOwner', values: [string]): string; + encodeFunctionData(functionFragment: 'setInboundCap', values: [BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'setMinDstGas', values: [BigNumberish, BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'setOutboundCap', values: [BigNumberish, BigNumberish]): string; + encodeFunctionData(functionFragment: 'setPrecrime', values: [string]): string; + encodeFunctionData(functionFragment: 'setReceiveVersion', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'setSendVersion', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'setTrustedRemote', values: [BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: 'setTrustedRemoteAddress', values: [BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: 'setUseCustomAdapterParams', values: [boolean]): string; + encodeFunctionData(functionFragment: 'setWhitelist', values: [string, boolean]): string; + encodeFunctionData(functionFragment: 'sharedDecimals', values?: undefined): string; + encodeFunctionData(functionFragment: 'supportsInterface', values: [BytesLike]): string; + encodeFunctionData(functionFragment: 'symbol', values?: undefined): string; + encodeFunctionData(functionFragment: 'token', values?: undefined): string; + encodeFunctionData(functionFragment: 'totalSupply', values?: undefined): string; + encodeFunctionData(functionFragment: 'transfer', values: [string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'transferFrom', values: [string, string, BigNumberish]): string; + encodeFunctionData(functionFragment: 'transferOwnership', values: [string]): string; + encodeFunctionData(functionFragment: 'trustedRemoteLookup', values: [BigNumberish]): string; + encodeFunctionData(functionFragment: 'unpause', values?: undefined): string; + encodeFunctionData(functionFragment: 'useCustomAdapterParams', values?: undefined): string; + encodeFunctionData(functionFragment: 'whitelist', values: [string]): string; + + decodeFunctionResult(functionFragment: 'BP_DENOMINATOR', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'NO_EXTRA_GAS', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'PT_SEND', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'PT_SEND_AND_CALL', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'allowance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'amountsForCall', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'approve', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'balanceOf', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'callOnOFTReceived', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'chainIdToFeeBps', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'chainIdToInboundCap', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'chainIdToLastReceivedTimestamp', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'chainIdToLastSentTimestamp', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'chainIdToOutboundCap', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'chainIdToReceivedTokenAmount', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'chainIdToSentTokenAmount', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'circulatingSupply', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'decimals', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'decreaseAllowance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'defaultFeeBp', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'estimateSendAndCallFee', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'estimateSendFee', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'failedMessages', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'feeOwner', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'forceResumeReceive', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getConfig', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'getTrustedRemoteAddress', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'increaseAllowance', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'isTrustedRemote', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'lzEndpoint', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'lzReceive', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'minDstGasLookup', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'name', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'nonblockingLzReceive', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'owner', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'pause', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'paused', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'precrime', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'quoteOFTFee', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'renounceOwnership', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'retryMessage', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'sendAndCall', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'sendFrom', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setConfig', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setDefaultFeeBp', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setFeeBp', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setFeeOwner', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setInboundCap', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setMinDstGas', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setOutboundCap', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setPrecrime', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setReceiveVersion', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setSendVersion', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setTrustedRemote', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setTrustedRemoteAddress', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setUseCustomAdapterParams', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'setWhitelist', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'sharedDecimals', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'supportsInterface', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'symbol', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'token', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'totalSupply', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'transfer', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'transferFrom', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'transferOwnership', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'trustedRemoteLookup', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'unpause', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'useCustomAdapterParams', data: BytesLike): Result; + decodeFunctionResult(functionFragment: 'whitelist', data: BytesLike): Result; + + events: { + 'Approval(address,address,uint256)': EventFragment; + 'CallOFTReceivedSuccess(uint16,bytes,uint64,bytes32)': EventFragment; + 'DropFailedMessage(uint16,bytes,uint64)': EventFragment; + 'FallbackWithdraw(address,uint256)': EventFragment; + 'MessageFailed(uint16,bytes,uint64,bytes,bytes)': EventFragment; + 'NonContractAddress(address)': EventFragment; + 'OwnershipTransferred(address,address)': EventFragment; + 'Paused(address)': EventFragment; + 'ReceiveFromChain(uint16,address,uint256)': EventFragment; + 'RetryMessageSuccess(uint16,bytes,uint64,bytes32)': EventFragment; + 'SendToChain(uint16,address,bytes32,uint256)': EventFragment; + 'SetDefaultFeeBp(uint16)': EventFragment; + 'SetFeeBp(uint16,bool,uint16)': EventFragment; + 'SetFeeOwner(address)': EventFragment; + 'SetInboundCap(uint16,uint256)': EventFragment; + 'SetMinDstGas(uint16,uint16,uint256)': EventFragment; + 'SetOperator(address)': EventFragment; + 'SetOutboundCap(uint16,uint256)': EventFragment; + 'SetPrecrime(address)': EventFragment; + 'SetTrustedRemote(uint16,bytes)': EventFragment; + 'SetTrustedRemoteAddress(uint16,bytes)': EventFragment; + 'SetUseCustomAdapterParams(bool)': EventFragment; + 'SetWhitelist(address,bool)': EventFragment; + 'Transfer(address,address,uint256)': EventFragment; + 'Unpaused(address)': EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: 'Approval'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'CallOFTReceivedSuccess'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'DropFailedMessage'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'FallbackWithdraw'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'MessageFailed'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'NonContractAddress'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'OwnershipTransferred'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Paused'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'ReceiveFromChain'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'RetryMessageSuccess'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SendToChain'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetDefaultFeeBp'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetFeeBp'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetFeeOwner'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetInboundCap'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetMinDstGas'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetOperator'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetOutboundCap'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetPrecrime'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetTrustedRemote'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetTrustedRemoteAddress'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetUseCustomAdapterParams'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'SetWhitelist'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Transfer'): EventFragment; + getEvent(nameOrSignatureOrTopic: 'Unpaused'): EventFragment; +} + +export interface ApprovalEventObject { + owner: string; + spender: string; + value: BigNumber; +} +export type ApprovalEvent = TypedEvent<[string, string, BigNumber], ApprovalEventObject>; + +export type ApprovalEventFilter = TypedEventFilter; + +export interface CallOFTReceivedSuccessEventObject { + _srcChainId: number; + _srcAddress: string; + _nonce: BigNumber; + _hash: string; +} +export type CallOFTReceivedSuccessEvent = TypedEvent< + [number, string, BigNumber, string], + CallOFTReceivedSuccessEventObject +>; + +export type CallOFTReceivedSuccessEventFilter = TypedEventFilter; + +export interface DropFailedMessageEventObject { + srcChainId: number; + srcAddress: string; + nonce: BigNumber; +} +export type DropFailedMessageEvent = TypedEvent<[number, string, BigNumber], DropFailedMessageEventObject>; + +export type DropFailedMessageEventFilter = TypedEventFilter; + +export interface FallbackWithdrawEventObject { + to: string; + amount: BigNumber; +} +export type FallbackWithdrawEvent = TypedEvent<[string, BigNumber], FallbackWithdrawEventObject>; + +export type FallbackWithdrawEventFilter = TypedEventFilter; + +export interface MessageFailedEventObject { + _srcChainId: number; + _srcAddress: string; + _nonce: BigNumber; + _payload: string; + _reason: string; +} +export type MessageFailedEvent = TypedEvent<[number, string, BigNumber, string, string], MessageFailedEventObject>; + +export type MessageFailedEventFilter = TypedEventFilter; + +export interface NonContractAddressEventObject { + _address: string; +} +export type NonContractAddressEvent = TypedEvent<[string], NonContractAddressEventObject>; + +export type NonContractAddressEventFilter = TypedEventFilter; + +export interface OwnershipTransferredEventObject { + previousOwner: string; + newOwner: string; +} +export type OwnershipTransferredEvent = TypedEvent<[string, string], OwnershipTransferredEventObject>; + +export type OwnershipTransferredEventFilter = TypedEventFilter; + +export interface PausedEventObject { + account: string; +} +export type PausedEvent = TypedEvent<[string], PausedEventObject>; + +export type PausedEventFilter = TypedEventFilter; + +export interface ReceiveFromChainEventObject { + _srcChainId: number; + _to: string; + _amount: BigNumber; +} +export type ReceiveFromChainEvent = TypedEvent<[number, string, BigNumber], ReceiveFromChainEventObject>; + +export type ReceiveFromChainEventFilter = TypedEventFilter; + +export interface RetryMessageSuccessEventObject { + _srcChainId: number; + _srcAddress: string; + _nonce: BigNumber; + _payloadHash: string; +} +export type RetryMessageSuccessEvent = TypedEvent<[number, string, BigNumber, string], RetryMessageSuccessEventObject>; + +export type RetryMessageSuccessEventFilter = TypedEventFilter; + +export interface SendToChainEventObject { + _dstChainId: number; + _from: string; + _toAddress: string; + _amount: BigNumber; +} +export type SendToChainEvent = TypedEvent<[number, string, string, BigNumber], SendToChainEventObject>; + +export type SendToChainEventFilter = TypedEventFilter; + +export interface SetDefaultFeeBpEventObject { + feeBp: number; +} +export type SetDefaultFeeBpEvent = TypedEvent<[number], SetDefaultFeeBpEventObject>; + +export type SetDefaultFeeBpEventFilter = TypedEventFilter; + +export interface SetFeeBpEventObject { + dstchainId: number; + enabled: boolean; + feeBp: number; +} +export type SetFeeBpEvent = TypedEvent<[number, boolean, number], SetFeeBpEventObject>; + +export type SetFeeBpEventFilter = TypedEventFilter; + +export interface SetFeeOwnerEventObject { + feeOwner: string; +} +export type SetFeeOwnerEvent = TypedEvent<[string], SetFeeOwnerEventObject>; + +export type SetFeeOwnerEventFilter = TypedEventFilter; + +export interface SetInboundCapEventObject { + chainId: number; + cap: BigNumber; +} +export type SetInboundCapEvent = TypedEvent<[number, BigNumber], SetInboundCapEventObject>; + +export type SetInboundCapEventFilter = TypedEventFilter; + +export interface SetMinDstGasEventObject { + _dstChainId: number; + _type: number; + _minDstGas: BigNumber; +} +export type SetMinDstGasEvent = TypedEvent<[number, number, BigNumber], SetMinDstGasEventObject>; + +export type SetMinDstGasEventFilter = TypedEventFilter; + +export interface SetOperatorEventObject { + newOperator: string; +} +export type SetOperatorEvent = TypedEvent<[string], SetOperatorEventObject>; + +export type SetOperatorEventFilter = TypedEventFilter; + +export interface SetOutboundCapEventObject { + chainId: number; + cap: BigNumber; +} +export type SetOutboundCapEvent = TypedEvent<[number, BigNumber], SetOutboundCapEventObject>; + +export type SetOutboundCapEventFilter = TypedEventFilter; + +export interface SetPrecrimeEventObject { + precrime: string; +} +export type SetPrecrimeEvent = TypedEvent<[string], SetPrecrimeEventObject>; + +export type SetPrecrimeEventFilter = TypedEventFilter; + +export interface SetTrustedRemoteEventObject { + _remoteChainId: number; + _path: string; +} +export type SetTrustedRemoteEvent = TypedEvent<[number, string], SetTrustedRemoteEventObject>; + +export type SetTrustedRemoteEventFilter = TypedEventFilter; + +export interface SetTrustedRemoteAddressEventObject { + _remoteChainId: number; + _remoteAddress: string; +} +export type SetTrustedRemoteAddressEvent = TypedEvent<[number, string], SetTrustedRemoteAddressEventObject>; + +export type SetTrustedRemoteAddressEventFilter = TypedEventFilter; + +export interface SetUseCustomAdapterParamsEventObject { + _useCustomAdapterParams: boolean; +} +export type SetUseCustomAdapterParamsEvent = TypedEvent<[boolean], SetUseCustomAdapterParamsEventObject>; + +export type SetUseCustomAdapterParamsEventFilter = TypedEventFilter; + +export interface SetWhitelistEventObject { + addr: string; + isWhitelist: boolean; +} +export type SetWhitelistEvent = TypedEvent<[string, boolean], SetWhitelistEventObject>; + +export type SetWhitelistEventFilter = TypedEventFilter; + +export interface TransferEventObject { + from: string; + to: string; + value: BigNumber; +} +export type TransferEvent = TypedEvent<[string, string, BigNumber], TransferEventObject>; + +export type TransferEventFilter = TypedEventFilter; + +export interface UnpausedEventObject { + account: string; +} +export type UnpausedEvent = TypedEvent<[string], UnpausedEventObject>; + +export type UnpausedEventFilter = TypedEventFilter; + +export interface OFTV2 extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: OFTV2Interface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners(eventFilter?: TypedEventFilter): Array>; + listeners(eventName?: string): Array; + removeAllListeners(eventFilter: TypedEventFilter): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + BP_DENOMINATOR(overrides?: CallOverrides): Promise<[BigNumber]>; + + NO_EXTRA_GAS(overrides?: CallOverrides): Promise<[BigNumber]>; + + PT_SEND(overrides?: CallOverrides): Promise<[number]>; + + PT_SEND_AND_CALL(overrides?: CallOverrides): Promise<[number]>; + + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + amountsForCall( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber, boolean] & { amount: BigNumber; credited: boolean }>; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise<[BigNumber]>; + + callOnOFTReceived( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _from: BytesLike, + _to: string, + _amount: BigNumberish, + _payload: BytesLike, + _gasForCall: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + chainIdToFeeBps( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise<[number, boolean] & { feeBP: number; enabled: boolean }>; + + chainIdToInboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + chainIdToLastReceivedTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + chainIdToLastSentTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + chainIdToOutboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + chainIdToReceivedTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + chainIdToSentTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + circulatingSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + decimals(overrides?: CallOverrides): Promise<[number]>; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + defaultFeeBp(overrides?: CallOverrides): Promise<[number]>; + + estimateSendAndCallFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber, BigNumber] & { nativeFee: BigNumber; zroFee: BigNumber }>; + + estimateSendFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber, BigNumber] & { nativeFee: BigNumber; zroFee: BigNumber }>; + + failedMessages( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise<[string]>; + + feeOwner(overrides?: CallOverrides): Promise<[string]>; + + forceResumeReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getConfig( + _version: BigNumberish, + _chainId: BigNumberish, + arg2: string, + _configType: BigNumberish, + overrides?: CallOverrides + ): Promise<[string]>; + + getTrustedRemoteAddress(_remoteChainId: BigNumberish, overrides?: CallOverrides): Promise<[string]>; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + isTrustedRemote(_srcChainId: BigNumberish, _srcAddress: BytesLike, overrides?: CallOverrides): Promise<[boolean]>; + + lzEndpoint(overrides?: CallOverrides): Promise<[string]>; + + lzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + minDstGasLookup(arg0: BigNumberish, arg1: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + name(overrides?: CallOverrides): Promise<[string]>; + + nonblockingLzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + owner(overrides?: CallOverrides): Promise<[string]>; + + pause(overrides?: Overrides & { from?: string }): Promise; + + paused(overrides?: CallOverrides): Promise<[boolean]>; + + precrime(overrides?: CallOverrides): Promise<[string]>; + + quoteOFTFee( + _dstChainId: BigNumberish, + _amount: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber] & { fee: BigNumber }>; + + renounceOwnership(overrides?: Overrides & { from?: string }): Promise; + + retryMessage( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendAndCall( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendFrom( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + setConfig( + _version: BigNumberish, + _chainId: BigNumberish, + _configType: BigNumberish, + _config: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setDefaultFeeBp(_feeBp: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setFeeBp( + _dstChainId: BigNumberish, + _enabled: boolean, + _feeBp: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setFeeOwner(_feeOwner: string, overrides?: Overrides & { from?: string }): Promise; + + setInboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setMinDstGas( + _dstChainId: BigNumberish, + _packetType: BigNumberish, + _minGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setOutboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setPrecrime(_precrime: string, overrides?: Overrides & { from?: string }): Promise; + + setReceiveVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setSendVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setTrustedRemote( + _srcChainId: BigNumberish, + _path: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setTrustedRemoteAddress( + _remoteChainId: BigNumberish, + _remoteAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setUseCustomAdapterParams( + _useCustomAdapterParams: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + setWhitelist( + addr: string, + isWhitelist: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + sharedDecimals(overrides?: CallOverrides): Promise<[number]>; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise<[boolean]>; + + symbol(overrides?: CallOverrides): Promise<[string]>; + + token(overrides?: CallOverrides): Promise<[string]>; + + totalSupply(overrides?: CallOverrides): Promise<[BigNumber]>; + + transfer(to: string, amount: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; + + trustedRemoteLookup(arg0: BigNumberish, overrides?: CallOverrides): Promise<[string]>; + + unpause(overrides?: Overrides & { from?: string }): Promise; + + useCustomAdapterParams(overrides?: CallOverrides): Promise<[boolean]>; + + whitelist(arg0: string, overrides?: CallOverrides): Promise<[boolean]>; + }; + + BP_DENOMINATOR(overrides?: CallOverrides): Promise; + + NO_EXTRA_GAS(overrides?: CallOverrides): Promise; + + PT_SEND(overrides?: CallOverrides): Promise; + + PT_SEND_AND_CALL(overrides?: CallOverrides): Promise; + + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + amountsForCall( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber, boolean] & { amount: BigNumber; credited: boolean }>; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + callOnOFTReceived( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _from: BytesLike, + _to: string, + _amount: BigNumberish, + _payload: BytesLike, + _gasForCall: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + chainIdToFeeBps( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise<[number, boolean] & { feeBP: number; enabled: boolean }>; + + chainIdToInboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastReceivedTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastSentTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToOutboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToReceivedTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToSentTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + circulatingSupply(overrides?: CallOverrides): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + defaultFeeBp(overrides?: CallOverrides): Promise; + + estimateSendAndCallFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber, BigNumber] & { nativeFee: BigNumber; zroFee: BigNumber }>; + + estimateSendFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber, BigNumber] & { nativeFee: BigNumber; zroFee: BigNumber }>; + + failedMessages(arg0: BigNumberish, arg1: BytesLike, arg2: BigNumberish, overrides?: CallOverrides): Promise; + + feeOwner(overrides?: CallOverrides): Promise; + + forceResumeReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getConfig( + _version: BigNumberish, + _chainId: BigNumberish, + arg2: string, + _configType: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTrustedRemoteAddress(_remoteChainId: BigNumberish, overrides?: CallOverrides): Promise; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + isTrustedRemote(_srcChainId: BigNumberish, _srcAddress: BytesLike, overrides?: CallOverrides): Promise; + + lzEndpoint(overrides?: CallOverrides): Promise; + + lzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + minDstGasLookup(arg0: BigNumberish, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + name(overrides?: CallOverrides): Promise; + + nonblockingLzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + owner(overrides?: CallOverrides): Promise; + + pause(overrides?: Overrides & { from?: string }): Promise; + + paused(overrides?: CallOverrides): Promise; + + precrime(overrides?: CallOverrides): Promise; + + quoteOFTFee(_dstChainId: BigNumberish, _amount: BigNumberish, overrides?: CallOverrides): Promise; + + renounceOwnership(overrides?: Overrides & { from?: string }): Promise; + + retryMessage( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendAndCall( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendFrom( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + setConfig( + _version: BigNumberish, + _chainId: BigNumberish, + _configType: BigNumberish, + _config: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setDefaultFeeBp(_feeBp: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setFeeBp( + _dstChainId: BigNumberish, + _enabled: boolean, + _feeBp: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setFeeOwner(_feeOwner: string, overrides?: Overrides & { from?: string }): Promise; + + setInboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setMinDstGas( + _dstChainId: BigNumberish, + _packetType: BigNumberish, + _minGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setOutboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setPrecrime(_precrime: string, overrides?: Overrides & { from?: string }): Promise; + + setReceiveVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setSendVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setTrustedRemote( + _srcChainId: BigNumberish, + _path: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setTrustedRemoteAddress( + _remoteChainId: BigNumberish, + _remoteAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setUseCustomAdapterParams( + _useCustomAdapterParams: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + setWhitelist( + addr: string, + isWhitelist: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + sharedDecimals(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + token(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer(to: string, amount: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; + + trustedRemoteLookup(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + unpause(overrides?: Overrides & { from?: string }): Promise; + + useCustomAdapterParams(overrides?: CallOverrides): Promise; + + whitelist(arg0: string, overrides?: CallOverrides): Promise; + + callStatic: { + BP_DENOMINATOR(overrides?: CallOverrides): Promise; + + NO_EXTRA_GAS(overrides?: CallOverrides): Promise; + + PT_SEND(overrides?: CallOverrides): Promise; + + PT_SEND_AND_CALL(overrides?: CallOverrides): Promise; + + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + amountsForCall( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber, boolean] & { amount: BigNumber; credited: boolean }>; + + approve(spender: string, amount: BigNumberish, overrides?: CallOverrides): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + callOnOFTReceived( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _from: BytesLike, + _to: string, + _amount: BigNumberish, + _payload: BytesLike, + _gasForCall: BigNumberish, + overrides?: CallOverrides + ): Promise; + + chainIdToFeeBps( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise<[number, boolean] & { feeBP: number; enabled: boolean }>; + + chainIdToInboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastReceivedTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastSentTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToOutboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToReceivedTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToSentTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + circulatingSupply(overrides?: CallOverrides): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance(spender: string, subtractedValue: BigNumberish, overrides?: CallOverrides): Promise; + + defaultFeeBp(overrides?: CallOverrides): Promise; + + estimateSendAndCallFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber, BigNumber] & { nativeFee: BigNumber; zroFee: BigNumber }>; + + estimateSendFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber, BigNumber] & { nativeFee: BigNumber; zroFee: BigNumber }>; + + failedMessages(arg0: BigNumberish, arg1: BytesLike, arg2: BigNumberish, overrides?: CallOverrides): Promise; + + feeOwner(overrides?: CallOverrides): Promise; + + forceResumeReceive(_srcChainId: BigNumberish, _srcAddress: BytesLike, overrides?: CallOverrides): Promise; + + getConfig( + _version: BigNumberish, + _chainId: BigNumberish, + arg2: string, + _configType: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTrustedRemoteAddress(_remoteChainId: BigNumberish, overrides?: CallOverrides): Promise; + + increaseAllowance(spender: string, addedValue: BigNumberish, overrides?: CallOverrides): Promise; + + isTrustedRemote(_srcChainId: BigNumberish, _srcAddress: BytesLike, overrides?: CallOverrides): Promise; + + lzEndpoint(overrides?: CallOverrides): Promise; + + lzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: CallOverrides + ): Promise; + + minDstGasLookup(arg0: BigNumberish, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + name(overrides?: CallOverrides): Promise; + + nonblockingLzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: CallOverrides + ): Promise; + + owner(overrides?: CallOverrides): Promise; + + pause(overrides?: CallOverrides): Promise; + + paused(overrides?: CallOverrides): Promise; + + precrime(overrides?: CallOverrides): Promise; + + quoteOFTFee(_dstChainId: BigNumberish, _amount: BigNumberish, overrides?: CallOverrides): Promise; + + renounceOwnership(overrides?: CallOverrides): Promise; + + retryMessage( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: CallOverrides + ): Promise; + + sendAndCall( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: CallOverrides + ): Promise; + + sendFrom( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: CallOverrides + ): Promise; + + setConfig( + _version: BigNumberish, + _chainId: BigNumberish, + _configType: BigNumberish, + _config: BytesLike, + overrides?: CallOverrides + ): Promise; + + setDefaultFeeBp(_feeBp: BigNumberish, overrides?: CallOverrides): Promise; + + setFeeBp( + _dstChainId: BigNumberish, + _enabled: boolean, + _feeBp: BigNumberish, + overrides?: CallOverrides + ): Promise; + + setFeeOwner(_feeOwner: string, overrides?: CallOverrides): Promise; + + setInboundCap(chainId: BigNumberish, cap: BigNumberish, overrides?: CallOverrides): Promise; + + setMinDstGas( + _dstChainId: BigNumberish, + _packetType: BigNumberish, + _minGas: BigNumberish, + overrides?: CallOverrides + ): Promise; + + setOutboundCap(chainId: BigNumberish, cap: BigNumberish, overrides?: CallOverrides): Promise; + + setPrecrime(_precrime: string, overrides?: CallOverrides): Promise; + + setReceiveVersion(_version: BigNumberish, overrides?: CallOverrides): Promise; + + setSendVersion(_version: BigNumberish, overrides?: CallOverrides): Promise; + + setTrustedRemote(_srcChainId: BigNumberish, _path: BytesLike, overrides?: CallOverrides): Promise; + + setTrustedRemoteAddress( + _remoteChainId: BigNumberish, + _remoteAddress: BytesLike, + overrides?: CallOverrides + ): Promise; + + setUseCustomAdapterParams(_useCustomAdapterParams: boolean, overrides?: CallOverrides): Promise; + + setWhitelist(addr: string, isWhitelist: boolean, overrides?: CallOverrides): Promise; + + sharedDecimals(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + token(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer(to: string, amount: BigNumberish, overrides?: CallOverrides): Promise; + + transferFrom(from: string, to: string, amount: BigNumberish, overrides?: CallOverrides): Promise; + + transferOwnership(newOwner: string, overrides?: CallOverrides): Promise; + + trustedRemoteLookup(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + unpause(overrides?: CallOverrides): Promise; + + useCustomAdapterParams(overrides?: CallOverrides): Promise; + + whitelist(arg0: string, overrides?: CallOverrides): Promise; + }; + + filters: { + 'Approval(address,address,uint256)'( + owner?: string | null, + spender?: string | null, + value?: null + ): ApprovalEventFilter; + Approval(owner?: string | null, spender?: string | null, value?: null): ApprovalEventFilter; + + 'CallOFTReceivedSuccess(uint16,bytes,uint64,bytes32)'( + _srcChainId?: BigNumberish | null, + _srcAddress?: null, + _nonce?: null, + _hash?: null + ): CallOFTReceivedSuccessEventFilter; + CallOFTReceivedSuccess( + _srcChainId?: BigNumberish | null, + _srcAddress?: null, + _nonce?: null, + _hash?: null + ): CallOFTReceivedSuccessEventFilter; + + 'DropFailedMessage(uint16,bytes,uint64)'( + srcChainId?: null, + srcAddress?: null, + nonce?: null + ): DropFailedMessageEventFilter; + DropFailedMessage(srcChainId?: null, srcAddress?: null, nonce?: null): DropFailedMessageEventFilter; + + 'FallbackWithdraw(address,uint256)'(to?: string | null, amount?: null): FallbackWithdrawEventFilter; + FallbackWithdraw(to?: string | null, amount?: null): FallbackWithdrawEventFilter; + + 'MessageFailed(uint16,bytes,uint64,bytes,bytes)'( + _srcChainId?: null, + _srcAddress?: null, + _nonce?: null, + _payload?: null, + _reason?: null + ): MessageFailedEventFilter; + MessageFailed( + _srcChainId?: null, + _srcAddress?: null, + _nonce?: null, + _payload?: null, + _reason?: null + ): MessageFailedEventFilter; + + 'NonContractAddress(address)'(_address?: null): NonContractAddressEventFilter; + NonContractAddress(_address?: null): NonContractAddressEventFilter; + + 'OwnershipTransferred(address,address)'( + previousOwner?: string | null, + newOwner?: string | null + ): OwnershipTransferredEventFilter; + OwnershipTransferred(previousOwner?: string | null, newOwner?: string | null): OwnershipTransferredEventFilter; + + 'Paused(address)'(account?: null): PausedEventFilter; + Paused(account?: null): PausedEventFilter; + + 'ReceiveFromChain(uint16,address,uint256)'( + _srcChainId?: BigNumberish | null, + _to?: string | null, + _amount?: null + ): ReceiveFromChainEventFilter; + ReceiveFromChain( + _srcChainId?: BigNumberish | null, + _to?: string | null, + _amount?: null + ): ReceiveFromChainEventFilter; + + 'RetryMessageSuccess(uint16,bytes,uint64,bytes32)'( + _srcChainId?: null, + _srcAddress?: null, + _nonce?: null, + _payloadHash?: null + ): RetryMessageSuccessEventFilter; + RetryMessageSuccess( + _srcChainId?: null, + _srcAddress?: null, + _nonce?: null, + _payloadHash?: null + ): RetryMessageSuccessEventFilter; + + 'SendToChain(uint16,address,bytes32,uint256)'( + _dstChainId?: BigNumberish | null, + _from?: string | null, + _toAddress?: BytesLike | null, + _amount?: null + ): SendToChainEventFilter; + SendToChain( + _dstChainId?: BigNumberish | null, + _from?: string | null, + _toAddress?: BytesLike | null, + _amount?: null + ): SendToChainEventFilter; + + 'SetDefaultFeeBp(uint16)'(feeBp?: null): SetDefaultFeeBpEventFilter; + SetDefaultFeeBp(feeBp?: null): SetDefaultFeeBpEventFilter; + + 'SetFeeBp(uint16,bool,uint16)'(dstchainId?: null, enabled?: null, feeBp?: null): SetFeeBpEventFilter; + SetFeeBp(dstchainId?: null, enabled?: null, feeBp?: null): SetFeeBpEventFilter; + + 'SetFeeOwner(address)'(feeOwner?: null): SetFeeOwnerEventFilter; + SetFeeOwner(feeOwner?: null): SetFeeOwnerEventFilter; + + 'SetInboundCap(uint16,uint256)'(chainId?: BigNumberish | null, cap?: null): SetInboundCapEventFilter; + SetInboundCap(chainId?: BigNumberish | null, cap?: null): SetInboundCapEventFilter; + + 'SetMinDstGas(uint16,uint16,uint256)'(_dstChainId?: null, _type?: null, _minDstGas?: null): SetMinDstGasEventFilter; + SetMinDstGas(_dstChainId?: null, _type?: null, _minDstGas?: null): SetMinDstGasEventFilter; + + 'SetOperator(address)'(newOperator?: null): SetOperatorEventFilter; + SetOperator(newOperator?: null): SetOperatorEventFilter; + + 'SetOutboundCap(uint16,uint256)'(chainId?: BigNumberish | null, cap?: null): SetOutboundCapEventFilter; + SetOutboundCap(chainId?: BigNumberish | null, cap?: null): SetOutboundCapEventFilter; + + 'SetPrecrime(address)'(precrime?: null): SetPrecrimeEventFilter; + SetPrecrime(precrime?: null): SetPrecrimeEventFilter; + + 'SetTrustedRemote(uint16,bytes)'(_remoteChainId?: null, _path?: null): SetTrustedRemoteEventFilter; + SetTrustedRemote(_remoteChainId?: null, _path?: null): SetTrustedRemoteEventFilter; + + 'SetTrustedRemoteAddress(uint16,bytes)'( + _remoteChainId?: null, + _remoteAddress?: null + ): SetTrustedRemoteAddressEventFilter; + SetTrustedRemoteAddress(_remoteChainId?: null, _remoteAddress?: null): SetTrustedRemoteAddressEventFilter; + + 'SetUseCustomAdapterParams(bool)'(_useCustomAdapterParams?: null): SetUseCustomAdapterParamsEventFilter; + SetUseCustomAdapterParams(_useCustomAdapterParams?: null): SetUseCustomAdapterParamsEventFilter; + + 'SetWhitelist(address,bool)'(addr?: string | null, isWhitelist?: null): SetWhitelistEventFilter; + SetWhitelist(addr?: string | null, isWhitelist?: null): SetWhitelistEventFilter; + + 'Transfer(address,address,uint256)'(from?: string | null, to?: string | null, value?: null): TransferEventFilter; + Transfer(from?: string | null, to?: string | null, value?: null): TransferEventFilter; + + 'Unpaused(address)'(account?: null): UnpausedEventFilter; + Unpaused(account?: null): UnpausedEventFilter; + }; + + estimateGas: { + BP_DENOMINATOR(overrides?: CallOverrides): Promise; + + NO_EXTRA_GAS(overrides?: CallOverrides): Promise; + + PT_SEND(overrides?: CallOverrides): Promise; + + PT_SEND_AND_CALL(overrides?: CallOverrides): Promise; + + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + amountsForCall( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise; + + approve(spender: string, amount: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + callOnOFTReceived( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _from: BytesLike, + _to: string, + _amount: BigNumberish, + _payload: BytesLike, + _gasForCall: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + chainIdToFeeBps(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToInboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastReceivedTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastSentTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToOutboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToReceivedTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToSentTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + circulatingSupply(overrides?: CallOverrides): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + defaultFeeBp(overrides?: CallOverrides): Promise; + + estimateSendAndCallFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise; + + estimateSendFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise; + + failedMessages( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise; + + feeOwner(overrides?: CallOverrides): Promise; + + forceResumeReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getConfig( + _version: BigNumberish, + _chainId: BigNumberish, + arg2: string, + _configType: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTrustedRemoteAddress(_remoteChainId: BigNumberish, overrides?: CallOverrides): Promise; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + isTrustedRemote(_srcChainId: BigNumberish, _srcAddress: BytesLike, overrides?: CallOverrides): Promise; + + lzEndpoint(overrides?: CallOverrides): Promise; + + lzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + minDstGasLookup(arg0: BigNumberish, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + name(overrides?: CallOverrides): Promise; + + nonblockingLzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + owner(overrides?: CallOverrides): Promise; + + pause(overrides?: Overrides & { from?: string }): Promise; + + paused(overrides?: CallOverrides): Promise; + + precrime(overrides?: CallOverrides): Promise; + + quoteOFTFee(_dstChainId: BigNumberish, _amount: BigNumberish, overrides?: CallOverrides): Promise; + + renounceOwnership(overrides?: Overrides & { from?: string }): Promise; + + retryMessage( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendAndCall( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendFrom( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + setConfig( + _version: BigNumberish, + _chainId: BigNumberish, + _configType: BigNumberish, + _config: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setDefaultFeeBp(_feeBp: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setFeeBp( + _dstChainId: BigNumberish, + _enabled: boolean, + _feeBp: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setFeeOwner(_feeOwner: string, overrides?: Overrides & { from?: string }): Promise; + + setInboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setMinDstGas( + _dstChainId: BigNumberish, + _packetType: BigNumberish, + _minGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setOutboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setPrecrime(_precrime: string, overrides?: Overrides & { from?: string }): Promise; + + setReceiveVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setSendVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setTrustedRemote( + _srcChainId: BigNumberish, + _path: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setTrustedRemoteAddress( + _remoteChainId: BigNumberish, + _remoteAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setUseCustomAdapterParams( + _useCustomAdapterParams: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + setWhitelist(addr: string, isWhitelist: boolean, overrides?: Overrides & { from?: string }): Promise; + + sharedDecimals(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + token(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer(to: string, amount: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; + + trustedRemoteLookup(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + unpause(overrides?: Overrides & { from?: string }): Promise; + + useCustomAdapterParams(overrides?: CallOverrides): Promise; + + whitelist(arg0: string, overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + BP_DENOMINATOR(overrides?: CallOverrides): Promise; + + NO_EXTRA_GAS(overrides?: CallOverrides): Promise; + + PT_SEND(overrides?: CallOverrides): Promise; + + PT_SEND_AND_CALL(overrides?: CallOverrides): Promise; + + allowance(owner: string, spender: string, overrides?: CallOverrides): Promise; + + amountsForCall( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise; + + approve( + spender: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + balanceOf(account: string, overrides?: CallOverrides): Promise; + + callOnOFTReceived( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _from: BytesLike, + _to: string, + _amount: BigNumberish, + _payload: BytesLike, + _gasForCall: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + chainIdToFeeBps(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToInboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastReceivedTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToLastSentTimestamp(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToOutboundCap(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToReceivedTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + chainIdToSentTokenAmount(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + circulatingSupply(overrides?: CallOverrides): Promise; + + decimals(overrides?: CallOverrides): Promise; + + decreaseAllowance( + spender: string, + subtractedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + defaultFeeBp(overrides?: CallOverrides): Promise; + + estimateSendAndCallFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise; + + estimateSendFee( + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _useZro: boolean, + _adapterParams: BytesLike, + overrides?: CallOverrides + ): Promise; + + failedMessages( + arg0: BigNumberish, + arg1: BytesLike, + arg2: BigNumberish, + overrides?: CallOverrides + ): Promise; + + feeOwner(overrides?: CallOverrides): Promise; + + forceResumeReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getConfig( + _version: BigNumberish, + _chainId: BigNumberish, + arg2: string, + _configType: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTrustedRemoteAddress(_remoteChainId: BigNumberish, overrides?: CallOverrides): Promise; + + increaseAllowance( + spender: string, + addedValue: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + isTrustedRemote( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + overrides?: CallOverrides + ): Promise; + + lzEndpoint(overrides?: CallOverrides): Promise; + + lzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + minDstGasLookup(arg0: BigNumberish, arg1: BigNumberish, overrides?: CallOverrides): Promise; + + name(overrides?: CallOverrides): Promise; + + nonblockingLzReceive( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + owner(overrides?: CallOverrides): Promise; + + pause(overrides?: Overrides & { from?: string }): Promise; + + paused(overrides?: CallOverrides): Promise; + + precrime(overrides?: CallOverrides): Promise; + + quoteOFTFee( + _dstChainId: BigNumberish, + _amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + renounceOwnership(overrides?: Overrides & { from?: string }): Promise; + + retryMessage( + _srcChainId: BigNumberish, + _srcAddress: BytesLike, + _nonce: BigNumberish, + _payload: BytesLike, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendAndCall( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _payload: BytesLike, + _dstGasForCall: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + sendFrom( + _from: string, + _dstChainId: BigNumberish, + _toAddress: BytesLike, + _amount: BigNumberish, + _minAmount: BigNumberish, + _callParams: ICommonOFT.LzCallParamsStruct, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + setConfig( + _version: BigNumberish, + _chainId: BigNumberish, + _configType: BigNumberish, + _config: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setDefaultFeeBp(_feeBp: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setFeeBp( + _dstChainId: BigNumberish, + _enabled: boolean, + _feeBp: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setFeeOwner(_feeOwner: string, overrides?: Overrides & { from?: string }): Promise; + + setInboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setMinDstGas( + _dstChainId: BigNumberish, + _packetType: BigNumberish, + _minGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setOutboundCap( + chainId: BigNumberish, + cap: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + setPrecrime(_precrime: string, overrides?: Overrides & { from?: string }): Promise; + + setReceiveVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setSendVersion(_version: BigNumberish, overrides?: Overrides & { from?: string }): Promise; + + setTrustedRemote( + _srcChainId: BigNumberish, + _path: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setTrustedRemoteAddress( + _remoteChainId: BigNumberish, + _remoteAddress: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + setUseCustomAdapterParams( + _useCustomAdapterParams: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + setWhitelist( + addr: string, + isWhitelist: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + sharedDecimals(overrides?: CallOverrides): Promise; + + supportsInterface(interfaceId: BytesLike, overrides?: CallOverrides): Promise; + + symbol(overrides?: CallOverrides): Promise; + + token(overrides?: CallOverrides): Promise; + + totalSupply(overrides?: CallOverrides): Promise; + + transfer( + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + transferFrom( + from: string, + to: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership(newOwner: string, overrides?: Overrides & { from?: string }): Promise; + + trustedRemoteLookup(arg0: BigNumberish, overrides?: CallOverrides): Promise; + + unpause(overrides?: Overrides & { from?: string }): Promise; + + useCustomAdapterParams(overrides?: CallOverrides): Promise; + + whitelist(arg0: string, overrides?: CallOverrides): Promise; + }; +} diff --git a/src/logics/stargate-v2/contracts/factories/OFTV2__factory.ts b/src/logics/stargate-v2/contracts/factories/OFTV2__factory.ts new file mode 100644 index 0000000..1a8ae4f --- /dev/null +++ b/src/logics/stargate-v2/contracts/factories/OFTV2__factory.ts @@ -0,0 +1,2009 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from 'ethers'; +import type { Provider } from '@ethersproject/providers'; +import type { OFTV2, OFTV2Interface } from '../OFTV2'; + +const _abi = [ + { + inputs: [ + { + internalType: 'address', + name: '_lzEndpoint', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'cap', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ExceedInboundCap', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'cap', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'ExceedOutboundCap', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint64', + name: '_nonce', + type: 'uint64', + }, + { + indexed: false, + internalType: 'bytes32', + name: '_hash', + type: 'bytes32', + }, + ], + name: 'CallOFTReceivedSuccess', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: 'srcChainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bytes', + name: 'srcAddress', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint64', + name: 'nonce', + type: 'uint64', + }, + ], + name: 'DropFailedMessage', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'FallbackWithdraw', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint64', + name: '_nonce', + type: 'uint64', + }, + { + indexed: false, + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + { + indexed: false, + internalType: 'bytes', + name: '_reason', + type: 'bytes', + }, + ], + name: 'MessageFailed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: '_address', + type: 'address', + }, + ], + name: 'NonContractAddress', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'Paused', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + indexed: true, + internalType: 'address', + name: '_to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'ReceiveFromChain', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint64', + name: '_nonce', + type: 'uint64', + }, + { + indexed: false, + internalType: 'bytes32', + name: '_payloadHash', + type: 'bytes32', + }, + ], + name: 'RetryMessageSuccess', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + indexed: true, + internalType: 'address', + name: '_from', + type: 'address', + }, + { + indexed: true, + internalType: 'bytes32', + name: '_toAddress', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'SendToChain', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: 'feeBp', + type: 'uint16', + }, + ], + name: 'SetDefaultFeeBp', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: 'dstchainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bool', + name: 'enabled', + type: 'bool', + }, + { + indexed: false, + internalType: 'uint16', + name: 'feeBp', + type: 'uint16', + }, + ], + name: 'SetFeeBp', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'feeOwner', + type: 'address', + }, + ], + name: 'SetFeeOwner', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint16', + name: 'chainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'uint256', + name: 'cap', + type: 'uint256', + }, + ], + name: 'SetInboundCap', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'uint16', + name: '_type', + type: 'uint16', + }, + { + indexed: false, + internalType: 'uint256', + name: '_minDstGas', + type: 'uint256', + }, + ], + name: 'SetMinDstGas', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'newOperator', + type: 'address', + }, + ], + name: 'SetOperator', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint16', + name: 'chainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'uint256', + name: 'cap', + type: 'uint256', + }, + ], + name: 'SetOutboundCap', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'precrime', + type: 'address', + }, + ], + name: 'SetPrecrime', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: '_remoteChainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bytes', + name: '_path', + type: 'bytes', + }, + ], + name: 'SetTrustedRemote', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint16', + name: '_remoteChainId', + type: 'uint16', + }, + { + indexed: false, + internalType: 'bytes', + name: '_remoteAddress', + type: 'bytes', + }, + ], + name: 'SetTrustedRemoteAddress', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bool', + name: '_useCustomAdapterParams', + type: 'bool', + }, + ], + name: 'SetUseCustomAdapterParams', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'addr', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'isWhitelist', + type: 'bool', + }, + ], + name: 'SetWhitelist', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'Unpaused', + type: 'event', + }, + { + inputs: [], + name: 'BP_DENOMINATOR', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NO_EXTRA_GAS', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'PT_SEND', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'PT_SEND_AND_CALL', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '', + type: 'uint64', + }, + ], + name: 'amountsForCall', + outputs: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'credited', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '_nonce', + type: 'uint64', + }, + { + internalType: 'bytes32', + name: '_from', + type: 'bytes32', + }, + { + internalType: 'address', + name: '_to', + type: 'address', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + { + internalType: 'uint256', + name: '_gasForCall', + type: 'uint256', + }, + ], + name: 'callOnOFTReceived', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'chainIdToFeeBps', + outputs: [ + { + internalType: 'uint16', + name: 'feeBP', + type: 'uint16', + }, + { + internalType: 'bool', + name: 'enabled', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'chainIdToInboundCap', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'chainIdToLastReceivedTimestamp', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'chainIdToLastSentTimestamp', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'chainIdToOutboundCap', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'chainIdToReceivedTokenAmount', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'chainIdToSentTokenAmount', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'circulatingSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'decimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'subtractedValue', + type: 'uint256', + }, + ], + name: 'decreaseAllowance', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'defaultFeeBp', + outputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + internalType: 'bytes32', + name: '_toAddress', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '_dstGasForCall', + type: 'uint64', + }, + { + internalType: 'bool', + name: '_useZro', + type: 'bool', + }, + { + internalType: 'bytes', + name: '_adapterParams', + type: 'bytes', + }, + ], + name: 'estimateSendAndCallFee', + outputs: [ + { + internalType: 'uint256', + name: 'nativeFee', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'zroFee', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + internalType: 'bytes32', + name: '_toAddress', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'bool', + name: '_useZro', + type: 'bool', + }, + { + internalType: 'bytes', + name: '_adapterParams', + type: 'bytes', + }, + ], + name: 'estimateSendFee', + outputs: [ + { + internalType: 'uint256', + name: 'nativeFee', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'zroFee', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '', + type: 'uint64', + }, + ], + name: 'failedMessages', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'feeOwner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + ], + name: 'forceResumeReceive', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_version', + type: 'uint16', + }, + { + internalType: 'uint16', + name: '_chainId', + type: 'uint16', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint256', + name: '_configType', + type: 'uint256', + }, + ], + name: 'getConfig', + outputs: [ + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_remoteChainId', + type: 'uint16', + }, + ], + name: 'getTrustedRemoteAddress', + outputs: [ + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'addedValue', + type: 'uint256', + }, + ], + name: 'increaseAllowance', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + ], + name: 'isTrustedRemote', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'lzEndpoint', + outputs: [ + { + internalType: 'contract ILayerZeroEndpoint', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '_nonce', + type: 'uint64', + }, + { + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + ], + name: 'lzReceive', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'minDstGasLookup', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '_nonce', + type: 'uint64', + }, + { + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + ], + name: 'nonblockingLzReceive', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'pause', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'paused', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'precrime', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + ], + name: 'quoteOFTFee', + outputs: [ + { + internalType: 'uint256', + name: 'fee', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_srcAddress', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '_nonce', + type: 'uint64', + }, + { + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + ], + name: 'retryMessage', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_from', + type: 'address', + }, + { + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + internalType: 'bytes32', + name: '_toAddress', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_minAmount', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_payload', + type: 'bytes', + }, + { + internalType: 'uint64', + name: '_dstGasForCall', + type: 'uint64', + }, + { + components: [ + { + internalType: 'address payable', + name: 'refundAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'zroPaymentAddress', + type: 'address', + }, + { + internalType: 'bytes', + name: 'adapterParams', + type: 'bytes', + }, + ], + internalType: 'struct ICommonOFT.LzCallParams', + name: '_callParams', + type: 'tuple', + }, + ], + name: 'sendAndCall', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_from', + type: 'address', + }, + { + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + internalType: 'bytes32', + name: '_toAddress', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: '_amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: '_minAmount', + type: 'uint256', + }, + { + components: [ + { + internalType: 'address payable', + name: 'refundAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'zroPaymentAddress', + type: 'address', + }, + { + internalType: 'bytes', + name: 'adapterParams', + type: 'bytes', + }, + ], + internalType: 'struct ICommonOFT.LzCallParams', + name: '_callParams', + type: 'tuple', + }, + ], + name: 'sendFrom', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_version', + type: 'uint16', + }, + { + internalType: 'uint16', + name: '_chainId', + type: 'uint16', + }, + { + internalType: 'uint256', + name: '_configType', + type: 'uint256', + }, + { + internalType: 'bytes', + name: '_config', + type: 'bytes', + }, + ], + name: 'setConfig', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_feeBp', + type: 'uint16', + }, + ], + name: 'setDefaultFeeBp', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + internalType: 'bool', + name: '_enabled', + type: 'bool', + }, + { + internalType: 'uint16', + name: '_feeBp', + type: 'uint16', + }, + ], + name: 'setFeeBp', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_feeOwner', + type: 'address', + }, + ], + name: 'setFeeOwner', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: 'chainId', + type: 'uint16', + }, + { + internalType: 'uint256', + name: 'cap', + type: 'uint256', + }, + ], + name: 'setInboundCap', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_dstChainId', + type: 'uint16', + }, + { + internalType: 'uint16', + name: '_packetType', + type: 'uint16', + }, + { + internalType: 'uint256', + name: '_minGas', + type: 'uint256', + }, + ], + name: 'setMinDstGas', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: 'chainId', + type: 'uint16', + }, + { + internalType: 'uint256', + name: 'cap', + type: 'uint256', + }, + ], + name: 'setOutboundCap', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_precrime', + type: 'address', + }, + ], + name: 'setPrecrime', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_version', + type: 'uint16', + }, + ], + name: 'setReceiveVersion', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_version', + type: 'uint16', + }, + ], + name: 'setSendVersion', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_srcChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_path', + type: 'bytes', + }, + ], + name: 'setTrustedRemote', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '_remoteChainId', + type: 'uint16', + }, + { + internalType: 'bytes', + name: '_remoteAddress', + type: 'bytes', + }, + ], + name: 'setTrustedRemoteAddress', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bool', + name: '_useCustomAdapterParams', + type: 'bool', + }, + ], + name: 'setUseCustomAdapterParams', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'addr', + type: 'address', + }, + { + internalType: 'bool', + name: 'isWhitelist', + type: 'bool', + }, + ], + name: 'setWhitelist', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'sharedDecimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes4', + name: 'interfaceId', + type: 'bytes4', + }, + ], + name: 'supportsInterface', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'symbol', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'token', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint16', + name: '', + type: 'uint16', + }, + ], + name: 'trustedRemoteLookup', + outputs: [ + { + internalType: 'bytes', + name: '', + type: 'bytes', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'unpause', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'useCustomAdapterParams', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'whitelist', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] as const; + +export class OFTV2__factory { + static readonly abi = _abi; + static createInterface(): OFTV2Interface { + return new utils.Interface(_abi) as OFTV2Interface; + } + static connect(address: string, signerOrProvider: Signer | Provider): OFTV2 { + return new Contract(address, _abi, signerOrProvider) as OFTV2; + } +} diff --git a/src/logics/stargate-v2/contracts/factories/index.ts b/src/logics/stargate-v2/contracts/factories/index.ts index fcbc13c..ecd6696 100644 --- a/src/logics/stargate-v2/contracts/factories/index.ts +++ b/src/logics/stargate-v2/contracts/factories/index.ts @@ -1,5 +1,6 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ +export { OFTV2__factory } from './OFTV2__factory'; export { OFTWrapper__factory } from './OFTWrapper__factory'; export { StargatePool__factory } from './StargatePool__factory'; diff --git a/src/logics/stargate-v2/contracts/index.ts b/src/logics/stargate-v2/contracts/index.ts index 150ff9e..f44cd53 100644 --- a/src/logics/stargate-v2/contracts/index.ts +++ b/src/logics/stargate-v2/contracts/index.ts @@ -1,8 +1,10 @@ /* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ +export type { OFTV2 } from './OFTV2'; export type { OFTWrapper } from './OFTWrapper'; export type { StargatePool } from './StargatePool'; export * as factories from './factories'; +export { OFTV2__factory } from './factories/OFTV2__factory'; export { OFTWrapper__factory } from './factories/OFTWrapper__factory'; export { StargatePool__factory } from './factories/StargatePool__factory'; diff --git a/src/logics/stargate-v2/logic.swap-token.test.ts b/src/logics/stargate-v2/logic.swap-token.test.ts index f1cd4da..a18fe01 100644 --- a/src/logics/stargate-v2/logic.swap-token.test.ts +++ b/src/logics/stargate-v2/logic.swap-token.test.ts @@ -29,6 +29,8 @@ describe('StargateV2 SwapTokenLogic', function () { output: new common.TokenAmount(common.polygonZkevmTokens.Cake, '1'), receiver: account, fee: '0', + oftFee: '0', + slippage: 50, }, options: { account }, }, @@ -38,6 +40,8 @@ describe('StargateV2 SwapTokenLogic', function () { output: new common.TokenAmount(common.bnbTokens.Cake, '1'), receiver: account, fee: '0.1', + oftFee: '0.1', + slippage: 50, }, options: { account }, }, @@ -47,6 +51,8 @@ describe('StargateV2 SwapTokenLogic', function () { output: new common.TokenAmount(common.bnbTokens.Cake, '1'), receiver: account, fee: '0.1', + oftFee: '0', + slippage: 50, balanceBps: 5000, }, options: { account }, @@ -89,7 +95,7 @@ describe('StargateV2 SwapTokenLogic', function () { const logic = new SwapTokenLogic(fields.input.token.chainId); const routerLogic = await logic.build(fields, options); const sig = routerLogic.data.substring(0, 10); - const { input, balanceBps, fee } = fields; + const { input, balanceBps, fee, oftFee } = fields; const pool = getPoolConfigByTokenAddress(input.token.chainId, input.token.address); expect(routerLogic.to).to.eq(pool.address); @@ -108,7 +114,7 @@ describe('StargateV2 SwapTokenLogic', function () { expect(routerLogic.inputs[0].amountOrOffset).to.eq(common.getParamOffset(3)); } else { expect(routerLogic.inputs[0].balanceBps).to.eq(core.BPS_NOT_USED); - expect(routerLogic.inputs[0].amountOrOffset).eq(input.amountWei); + expect(routerLogic.inputs[0].amountOrOffset).eq(input.clone().add(oftFee).amountWei); } expect(routerLogic.wrapMode).to.eq(core.WrapMode.none); expect(routerLogic.approveTo).to.eq(constants.AddressZero); diff --git a/src/logics/stargate-v2/logic.swap-token.ts b/src/logics/stargate-v2/logic.swap-token.ts index 223feb3..4fb5555 100644 --- a/src/logics/stargate-v2/logic.swap-token.ts +++ b/src/logics/stargate-v2/logic.swap-token.ts @@ -1,5 +1,5 @@ import { BigNumber, constants, utils } from 'ethers'; -import { OFTWrapper__factory } from './contracts'; +import { OFTV2__factory, OFTWrapper__factory } from './contracts'; import { PoolId, getDestChainIds, @@ -19,12 +19,15 @@ export type SwapTokenLogicTokenList = { export type SwapTokenLogicParams = core.TokenToTokenExactInParams<{ receiver: string; + slippage?: number; }>; export type SwapTokenLogicFields = core.TokenToTokenExactInFields<{ receiver: string; fee: string; + oftFee: string; // lzTokenFee: string; + slippage?: number; }>; export type SwapTokenLogicOptions = Pick; @@ -59,11 +62,12 @@ export class SwapTokenLogic extends core.Logic implements core.LogicBuilderInter } public async quote(params: SwapTokenLogicParams) { - const { input, tokenOut, receiver } = params; + const { input, tokenOut, receiver, slippage } = params; const pool = getPoolConfigByTokenAddress(input.token.chainId, input.token.address); let output = new common.TokenAmount(tokenOut); let fee = BigNumber.from('0'); + let oftFee = BigNumber.from('0'); if (pool.id === PoolId.OFT) { const oftWrapper = OFTWrapper__factory.connect(pool.address, this.provider); const oft = pool.proxyOFT ? pool.proxyOFT : input.token.address; @@ -87,6 +91,7 @@ export class SwapTokenLogic extends core.Logic implements core.LogicBuilderInter ); fee = common.calcSlippage(fee, -1); // slightly higher than the quoted fee + oftFee = await OFTV2__factory.connect(oft, this.provider).quoteOFTFee(destChainId, srcAmount); const [amount] = await oftWrapper.getAmountAndFees(oft, srcAmount, feeObj.callerBps); output = output.setWei(amount); } @@ -95,7 +100,9 @@ export class SwapTokenLogic extends core.Logic implements core.LogicBuilderInter input, output, fee: common.toBigUnit(fee, common.getNativeToken(this.chainId).decimals), + oftFee: common.toBigUnit(oftFee, input.token.decimals), receiver, + slippage, }; // } else { @@ -137,7 +144,7 @@ export class SwapTokenLogic extends core.Logic implements core.LogicBuilderInter } async build(fields: SwapTokenLogicFields, options: SwapTokenLogicOptions) { - const { input, output, fee, /*lzTokenFee,*/ receiver, balanceBps } = fields; + const { input, output, fee, oftFee, /*lzTokenFee,*/ receiver, balanceBps, slippage } = fields; const { account } = options; const refundAddress = account; @@ -147,7 +154,7 @@ export class SwapTokenLogic extends core.Logic implements core.LogicBuilderInter const destChainId = getStargateChainId(output.token.chainId); const receiverBytes32 = utils.hexZeroPad(utils.solidityPack(['address'], [receiver]), 32); const amount = input.amountWei; - const minAmount = output.amountWei; + const minAmount = slippage ? common.calcSlippage(output.amountWei, slippage) : output.amountWei; const adapterParams = utils.solidityPack(['uint16', 'uint256'], [1, 200000]); const lzCallParams = { refundAddress, @@ -213,7 +220,7 @@ export class SwapTokenLogic extends core.Logic implements core.LogicBuilderInter const inputs = [ core.newLogicInput({ - input: new common.TokenAmount(input.token, input.amount), + input: new common.TokenAmount(input.token, input.clone().add(oftFee).amount), balanceBps, amountOffset, }), diff --git a/test/logics/stargate-v2/swap-token-bnb.test.ts b/test/logics/stargate-v2/swap-token-bnb.test.ts index ff09243..483884a 100644 --- a/test/logics/stargate-v2/swap-token-bnb.test.ts +++ b/test/logics/stargate-v2/swap-token-bnb.test.ts @@ -21,6 +21,13 @@ describe('bnb: Test StargateV2 SwapToken Logic', function () { snapshotAndRevertEach(); const testCases = [ + { + params: { + input: new common.TokenAmount(common.bnbTokens.Cake, '0.062839188248295809'), + tokenOut: common.polygonZkevmTokens.Cake, + slippage: 500, + }, + }, { params: { input: new common.TokenAmount(common.bnbTokens.Cake, '1'), @@ -41,17 +48,17 @@ describe('bnb: Test StargateV2 SwapToken Logic', function () { // 1. get input or output const stargateSwapTokenLogic = new stargate.SwapTokenLogic(chainId); const quotation = await stargateSwapTokenLogic.quote({ receiver: user.address, ...params }); - const { input, fee } = quotation; + const { input, fee, oftFee } = quotation; // 2. build funds, tokensReturn const feeTokenAmount = new common.TokenAmount(getNativeToken(chainId), fee); const funds = new common.TokenAmounts([feeTokenAmount]); const tokensReturn = [input.token.elasticAddress]; if (balanceBps) { - funds.add(utils.calcRequiredAmountByBalanceBps(input, balanceBps)); + funds.add(utils.calcRequiredAmountByBalanceBps(input, balanceBps).add(oftFee)); tokensReturn.push(input.token.elasticAddress); } else { - funds.add(input); + funds.add(input.clone().add(oftFee)); } // 3. build router logics @@ -74,9 +81,9 @@ describe('bnb: Test StargateV2 SwapToken Logic', function () { await expect(user.sendTransaction(transactionRequest)).to.not.be.reverted; if (input.token.isNative) { - await expect(user.address).to.changeBalance(getNativeToken(chainId), -input.add(fee).amount, 1); + await expect(user.address).to.changeBalance(getNativeToken(chainId), -input.add(fee).add(oftFee).amount, 1); } else { - await expect(user.address).to.changeBalance(input.token, -input.amount); + await expect(user.address).to.changeBalance(input.token, -input.clone().add(oftFee).amount, 1); await expect(user.address).to.changeBalance(getNativeToken(chainId), -fee, 1); } }); diff --git a/test/logics/stargate-v2/swap-token-polygonZkevm.test.ts b/test/logics/stargate-v2/swap-token-polygonZkevm.test.ts index e398f36..9d67743 100644 --- a/test/logics/stargate-v2/swap-token-polygonZkevm.test.ts +++ b/test/logics/stargate-v2/swap-token-polygonZkevm.test.ts @@ -27,6 +27,13 @@ describe('polygonZkevm: Test StargateV2 SwapToken Logic', function () { snapshotAndRevertEach(); const testCases = [ + { + params: { + input: new common.TokenAmount(common.polygonZkevmTokens.Cake, '0.062839188248295809'), + tokenOut: common.bnbTokens.Cake, + slippage: 500, + }, + }, { params: { input: new common.TokenAmount(common.polygonZkevmTokens.Cake, '1'), @@ -47,17 +54,17 @@ describe('polygonZkevm: Test StargateV2 SwapToken Logic', function () { // 1. get input or output const stargateSwapTokenLogic = new stargate.SwapTokenLogic(chainId); const quotation = await stargateSwapTokenLogic.quote({ receiver: user.address, ...params }); - const { input, fee } = quotation; + const { input, fee, oftFee } = quotation; // 2. build funds, tokensReturn const feeTokenAmount = new common.TokenAmount(getNativeToken(chainId), fee); const funds = new common.TokenAmounts([feeTokenAmount]); const tokensReturn = [input.token.elasticAddress]; if (balanceBps) { - funds.add(utils.calcRequiredAmountByBalanceBps(input, balanceBps)); + funds.add(utils.calcRequiredAmountByBalanceBps(input, balanceBps).add(oftFee)); tokensReturn.push(input.token.elasticAddress); } else { - funds.add(input); + funds.add(input.clone().add(oftFee)); } // 3. build router logics @@ -80,9 +87,9 @@ describe('polygonZkevm: Test StargateV2 SwapToken Logic', function () { await expect(user.sendTransaction(transactionRequest)).to.not.be.reverted; if (input.token.isNative) { - await expect(user.address).to.changeBalance(getNativeToken(chainId), -input.add(fee).amount, 1); + await expect(user.address).to.changeBalance(getNativeToken(chainId), -input.add(fee).add(oftFee).amount, 1); } else { - await expect(user.address).to.changeBalance(input.token, -input.amount); + await expect(user.address).to.changeBalance(input.token, -input.clone().add(oftFee).amount, 1); await expect(user.address).to.changeBalance(getNativeToken(chainId), -fee, 1); } });