diff --git a/README.md b/README.md index c455889..1a8a442 100644 --- a/README.md +++ b/README.md @@ -179,18 +179,18 @@ A Swap configuration is fed into the `route` function: ``` - `tokenIn`: The token put into the swap (out of wallet) -- `amountIn`: The amount of tokenIn put into the swap (out of wallet) +- `amountIn`: The exact amount of tokenIn put into the swap (out of wallet) - `amountInMax`: The max. amount of tokenIn put into the swap (out of wallet) - `tokenOut`: The token expected to come out of the swap (into wallet) -- `amountOut`: The amount of tokenOut expected to come out of the swap (into wallet) +- `amountOut`: The exact amount of tokenOut expected to come out of the swap (into wallet) - `amountOutMin`: The min. amount of tokenOut expected to come out of the swap (into wallet) The following combinations of provided amounts are possible: - Pass `amountOutMin`. Swap will return at least `amountOutMin` into the wallet. `amountIn` will be calculated automatically and can vary. -- Pass `amountOut`. Swap will take at max `amountInMax` out of the wallet (calculated based on provided `amountOut`). `amountInMax` will be calculated automatically and can vary. +- Pass `amountOut`. Swap will take at max `amountInMax` out of the wallet (calculated based on provided, exact `amountOut`). `amountInMax` will be calculated automatically and can vary. - Pass `amountInMax`. Swap will take at max `amountInMax` out of the wallet. `amountOut` will be calculated automatically and can vary. -- Pass `amountIn`. Swap will return at least `amountOutMin` into the the wallet (calculated based on provided `amountIn`). `amountOutMin` will be calculated automatically and can vary. +- Pass `amountIn`. Swap will return at least `amountOutMin` into the the wallet (calculated based on provided, exact `amountIn`). `amountOutMin` will be calculated automatically and can vary. ### Route diff --git a/dev.html b/dev.html index 8c394c1..71c7c0a 100644 --- a/dev.html +++ b/dev.html @@ -6,7 +6,7 @@ Development - + diff --git a/dist/esm/index.evm.js b/dist/esm/index.evm.js index d4e45c6..ab7db4f 100644 --- a/dist/esm/index.evm.js +++ b/dist/esm/index.evm.js @@ -309,7 +309,7 @@ const route$1 = ({ } catch (e) { return resolve() } if([amountIn, amountInMax, amountOut, amountOutMin].every((amount)=>{ return amount == undefined })) { return resolve() } - if(slippage || exchange.slippage) { + if(exchange.slippage && slippage !== false) { try { ({ amountIn, amountInMax, amountOut, amountOutMin, amounts } = await calculateAmountsWithSlippage({ exchange, @@ -385,6 +385,7 @@ class Exchange { amountOut, amountInMax, amountOutMin, + slippage, }) { if(tokenIn === tokenOut){ return Promise.resolve() } @@ -424,7 +425,7 @@ class Exchange { getAmounts: this.getAmounts, getPrep: this.getPrep, getTransaction: this.getTransaction, - slippage: this.slippage, + slippage, }) } } @@ -660,6 +661,7 @@ let getPrep$3 = async({ }; return { transaction } + }; let getTransaction$4 = ({ @@ -1955,9 +1957,6 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0] const SENDER_AS_RECIPIENT = '0x0000000000000000000000000000000000000001'; const ROUTER_AS_RECIPIENT = '0x0000000000000000000000000000000000000002'; -const PERMIT_STRUCT = '((address token,uint160 amount,uint48 expiration,uint48 nonce) details,address spender,uint256 sigDeadline)'; -const SIGNATURE_LENGTH = 65; -const EIP_2098_SIGNATURE_LENGTH = 64; // Replaces 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with the wrapped token and implies wrapping. // @@ -2263,85 +2262,46 @@ let getPrep = async({ if(tokenIn === Blockchains[blockchain].currency.address) { return } // NATIVE - const allowanceForPermit2 = await request({ + const allowance = await request({ blockchain, address: tokenIn, method: 'allowance', api: Token[blockchain]['20'], - params: [account, exchange[blockchain].permit.address] + params: [account, exchange[blockchain].router.address] }); - if(allowanceForPermit2.lt(amountIn)) { - - let transaction = { - blockchain, - from: account, - to: tokenIn, - api: Token[blockchain]['20'], - method: 'approve', - params: [exchange[blockchain].permit.address, Blockchains[blockchain].maxInt] - }; - - return { transaction } - - } else { // permit2 + if(allowance.gte(amountIn)) { return } - const allowanceWithinPermit2 = await request({ - blockchain, - address: exchange[blockchain].permit.address, - method: 'allowance', - api: exchange[blockchain].permit.api, - params: [account, tokenIn, exchange[blockchain].router.address] - }); + let transaction = { + blockchain, + from: account, + to: tokenIn, + api: Token[blockchain]['20'], + method: 'approve', + params: [exchange[blockchain].router.address, amountIn.sub(allowance)] + }; + + return { transaction } - if( - allowanceWithinPermit2.amount.lt(amountIn) || - (allowanceWithinPermit2.expiration - 1800) < (Math.floor(Date.now() / 1000)) - ) { +}; - const deadline = Math.floor(Date.now() / 1000) + 2592000; // 1 Month - - const signature = { - types: { - Domain: [ - { name: "name", type: "string" }, - { name: "version", type: "string" }, - { name: "chainId", type: "uint256" }, - { name: "verifyingContract", type: "address" } - ], - PermitSingle: [ - { name: "details", type: "PermitDetails" }, - { name: "spender", type: "address" }, - { name: "sigDeadline", type: "uint256" } - ], - PermitDetails: [ - { name: "token", type: "address" }, - { name: "amount", type: "uint160" }, - { name: "expiration", type: "uint48" }, - { name: "nonce", type: "uint48" } - ] - }, - primaryType: "PermitSingle", - domain: { - chainId: Blockchains[blockchain].networkId, - name: "Permit2", - verifyingContract: exchange[blockchain].permit.address, - version: "1" - }, - message: { - details: { - token: tokenIn, - amount: "1461501637330902918203684832716283019655932542975", // max uint160 - expiration: deadline, - nonce: allowanceWithinPermit2.nonce - }, - spender: exchange[blockchain].router.address, - sigDeadline: deadline - } - }; +let packPath = (pools)=>{ + if(pools.length == 1) { + return ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]) + } else if (pools.length == 2) { + return ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]) + } else { + throw 'more than 2 pools not supported!' + } +}; - return { signature } - } +let packPathReverse = (pools)=>{ + if(pools.length == 1) { + return ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[1], pools[0].fee, pools[0].path[0]]) + } else if (pools.length == 2) { + return ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[1].path[1], pools[1].fee, pools[1].path[0], pools[0].fee, pools[0].path[0]]) + } else { + throw 'more than 2 pools not supported!' } }; @@ -2359,85 +2319,57 @@ let getTransaction$1 = async({ amountInMaxInput, amountOutMinInput, account, - permit2, inputTokenPushed, }) => { - let commands = []; - let inputs = []; let value = "0"; + const contract = new ethers.Contract(exchange[blockchain].router.address, exchange[blockchain].router.api); + const exactInput = !!(amountOutMinInput || amountInInput); + const wrapETH = path[0] === Blockchains[blockchain].currency.address; + const unwrapETH = path[path.length-1] === Blockchains[blockchain].currency.address; + const recipient = unwrapETH ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT; + const refundETH = wrapETH || unwrapETH; - if(permit2) { - const length = ethers.utils.arrayify(permit2.signature).length; - let signature; - if (length === SIGNATURE_LENGTH || length === EIP_2098_SIGNATURE_LENGTH) { - signature = ethers.utils.joinSignature(ethers.utils.splitSignature(permit2.signature)); - } - commands.push("0a"); // PERMIT2_PERMIT - inputs.push( - ethers.utils.defaultAbiCoder.encode( - [PERMIT_STRUCT, "bytes"], - [permit2, signature] - ) - ); - } + let multicalls = []; - if (path[0] === Blockchains[blockchain].currency.address) { - commands.push("0b"); // WRAP_ETH - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [ROUTER_AS_RECIPIENT, (amountIn || amountInMax).toString()] - ) - ); + if (wrapETH) { value = (amountIn || amountInMax).toString(); + if(exactInput) { // exactOut does not need to wrapETH! + multicalls.push( + contract.interface.encodeFunctionData('wrapETH', [(amountIn || amountInMax)]) + ); + } } - - let packedPath; - if(pools.length === 1) { - packedPath = ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]); - } else if(pools.length === 2) { - packedPath = ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]); - } - - if (amountOutMinInput || amountInInput) { - commands.push("00"); // V3_SWAP_EXACT_IN (minimum out) - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains[blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountIn || amountInMax).toString(), - (amountOut || amountOutMin).toString(), - packedPath, - path[0] === Blockchains[blockchain].currency.address ? false : !inputTokenPushed - ] - ) + if (exactInput) { + multicalls.push( + contract.interface.encodeFunctionData('exactInput', [{ + path: packPath(pools), + amountIn: wrapETH ? 0 : (amountIn || amountInMax), + amountOutMinimum: amountOutMin, + recipient + }]) ); } else { - commands.push("01"); // V3_SWAP_EXACT_OUT (maximum in) - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains[blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountOut || amountOutMin).toString(), - (amountIn || amountInMax).toString(), - packedPath, - path[0] === Blockchains[blockchain].currency.address ? false : !inputTokenPushed - ] - ) + multicalls.push( + contract.interface.encodeFunctionData('exactOutput', [{ + path: packPathReverse(pools), + amountOut, + amountInMaximum: amountInMax, + recipient + }]) + ); + } + + if (unwrapETH) { + multicalls.push( + contract.interface.encodeFunctionData('unwrapWETH9(uint256)', [amountOut || amountOutMin]) ); } - if (path[path.length-1] === Blockchains[blockchain].currency.address) { - commands.push("0c"); // UNWRAP_WETH - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [SENDER_AS_RECIPIENT, (amountOut || amountOutMin).toString()] - ) + if(refundETH) { + multicalls.push( + contract.interface.encodeFunctionData('refundETH') ); } @@ -2446,18 +2378,15 @@ let getTransaction$1 = async({ from: account, to: exchange[blockchain].router.address, api: exchange[blockchain].router.api, - method: 'execute', - params: { - commands: `0x${commands.join('')}`, - inputs, - }, + method: 'multicall', + params: { data: multicalls }, value }; return transaction }; -const ROUTER = [{"inputs":[{"components":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"weth9","type":"address"},{"internalType":"address","name":"seaportV1_5","type":"address"},{"internalType":"address","name":"seaportV1_4","type":"address"},{"internalType":"address","name":"openseaConduit","type":"address"},{"internalType":"address","name":"nftxZap","type":"address"},{"internalType":"address","name":"x2y2","type":"address"},{"internalType":"address","name":"foundation","type":"address"},{"internalType":"address","name":"sudoswap","type":"address"},{"internalType":"address","name":"elementMarket","type":"address"},{"internalType":"address","name":"nft20Zap","type":"address"},{"internalType":"address","name":"cryptopunks","type":"address"},{"internalType":"address","name":"looksRareV2","type":"address"},{"internalType":"address","name":"routerRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareToken","type":"address"},{"internalType":"address","name":"v2Factory","type":"address"},{"internalType":"address","name":"v3Factory","type":"address"},{"internalType":"bytes32","name":"pairInitCodeHash","type":"bytes32"},{"internalType":"bytes32","name":"poolInitCodeHash","type":"bytes32"}],"internalType":"struct RouterParameters","name":"params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BalanceTooLow","type":"error"},{"inputs":[],"name":"BuyPunkFailed","type":"error"},{"inputs":[],"name":"ContractLocked","type":"error"},{"inputs":[],"name":"ETHNotAccepted","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandIndex","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"ExecutionFailed","type":"error"},{"inputs":[],"name":"FromAddressIsNotOwner","type":"error"},{"inputs":[],"name":"InsufficientETH","type":"error"},{"inputs":[],"name":"InsufficientToken","type":"error"},{"inputs":[],"name":"InvalidBips","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandType","type":"uint256"}],"name":"InvalidCommandType","type":"error"},{"inputs":[],"name":"InvalidOwnerERC1155","type":"error"},{"inputs":[],"name":"InvalidOwnerERC721","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"InvalidSpender","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"SliceOutOfBounds","type":"error"},{"inputs":[],"name":"TransactionDeadlinePassed","type":"error"},{"inputs":[],"name":"UnableToClaim","type":"error"},{"inputs":[],"name":"UnsafeCast","type":"error"},{"inputs":[],"name":"V2InvalidPath","type":"error"},{"inputs":[],"name":"V2TooLittleReceived","type":"error"},{"inputs":[],"name":"V2TooMuchRequested","type":"error"},{"inputs":[],"name":"V3InvalidAmountOut","type":"error"},{"inputs":[],"name":"V3InvalidCaller","type":"error"},{"inputs":[],"name":"V3InvalidSwap","type":"error"},{"inputs":[],"name":"V3TooLittleReceived","type":"error"},{"inputs":[],"name":"V3TooMuchRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsSent","type":"event"},{"inputs":[{"internalType":"bytes","name":"looksRareClaim","type":"bytes"}],"name":"collectRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]; +const ROUTER = [{"inputs":[{"internalType":"address","name":"_factoryV2","type":"address"},{"internalType":"address","name":"factoryV3","type":"address"},{"internalType":"address","name":"_positionManager","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callPositionManager","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"paths","type":"bytes[]"},{"internalType":"uint128[]","name":"amounts","type":"uint128[]"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getApprovalType","outputs":[{"internalType":"enum IApproveAndCall.ApprovalType","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"internalType":"struct IApproveAndCall.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IApproveAndCall.MintParams","name":"params","type":"tuple"}],"name":"mint","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"previousBlockhash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"pull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"wrapETH","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]; const FACTORY = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":true,"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"FeeAmountEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":false,"internalType":"int24","name":"tickSpacing","type":"int24"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"enableFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"feeAmountTickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]; const POOL = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]; const QUOTER = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"quoteExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactInputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"quoteExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactOutputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"path","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"view","type":"function"}]; @@ -2486,11 +2415,11 @@ const exchange$9 = { slippage: true, fees: [100, 500, 3000, 10000], - blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum'], + blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'], ethereum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2512,7 +2441,7 @@ const exchange$9 = { bsc: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2', api: UniswapV3.ROUTER }, factory: { @@ -2534,7 +2463,7 @@ const exchange$9 = { polygon: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2556,7 +2485,7 @@ const exchange$9 = { optimism: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2578,7 +2507,7 @@ const exchange$9 = { arbitrum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2600,7 +2529,7 @@ const exchange$9 = { base: { router: { - address: '0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC', + address: '0x2626664c2603336E57B271c5C0b26F421741e481', api: UniswapV3.ROUTER }, factory: { @@ -2620,6 +2549,28 @@ const exchange$9 = { } }, + avalanche: { + router: { + address: '0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE', + api: UniswapV3.ROUTER + }, + factory: { + address: '0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD', + api: UniswapV3.FACTORY + }, + pool: { + api: UniswapV3.POOL + }, + quoter: { + address: '0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F', + api: UniswapV3.QUOTER + }, + permit: { + address: '0x000000000022d473030f116ddee9f6b43ac78ba3', + api: UniswapV3.PERMIT2 + } + }, + }; var uniswap_v3 = (scope)=>{ @@ -3100,6 +3051,7 @@ exchanges.fantom = [ exchanges.fantom.forEach((exchange)=>{ exchanges.fantom[exchange.name] = exchange; }); exchanges.avalanche = [ + uniswap_v3('avalanche'), trader_joe_v2_1('avalanche'), wavax('avalanche'), ]; diff --git a/dist/esm/index.js b/dist/esm/index.js index d419812..42dedf0 100644 --- a/dist/esm/index.js +++ b/dist/esm/index.js @@ -311,7 +311,7 @@ const route$1 = ({ } catch (e) { return resolve() } if([amountIn, amountInMax, amountOut, amountOutMin].every((amount)=>{ return amount == undefined })) { return resolve() } - if(slippage || exchange.slippage) { + if(exchange.slippage && slippage !== false) { try { ({ amountIn, amountInMax, amountOut, amountOutMin, amounts } = await calculateAmountsWithSlippage({ exchange, @@ -387,6 +387,7 @@ class Exchange { amountOut, amountInMax, amountOutMin, + slippage, }) { if(tokenIn === tokenOut){ return Promise.resolve() } @@ -426,7 +427,7 @@ class Exchange { getAmounts: this.getAmounts, getPrep: this.getPrep, getTransaction: this.getTransaction, - slippage: this.slippage, + slippage, }) } } @@ -662,6 +663,7 @@ let getPrep$3 = async({ }; return { transaction } + }; let getTransaction$5 = ({ @@ -3742,9 +3744,6 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0] const SENDER_AS_RECIPIENT = '0x0000000000000000000000000000000000000001'; const ROUTER_AS_RECIPIENT = '0x0000000000000000000000000000000000000002'; -const PERMIT_STRUCT = '((address token,uint160 amount,uint48 expiration,uint48 nonce) details,address spender,uint256 sigDeadline)'; -const SIGNATURE_LENGTH = 65; -const EIP_2098_SIGNATURE_LENGTH = 64; // Replaces 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with the wrapped token and implies wrapping. // @@ -4050,85 +4049,46 @@ let getPrep = async({ if(tokenIn === Blockchains[blockchain].currency.address) { return } // NATIVE - const allowanceForPermit2 = await request({ + const allowance = await request({ blockchain, address: tokenIn, method: 'allowance', api: Token[blockchain]['20'], - params: [account, exchange[blockchain].permit.address] + params: [account, exchange[blockchain].router.address] }); - if(allowanceForPermit2.lt(amountIn)) { - - let transaction = { - blockchain, - from: account, - to: tokenIn, - api: Token[blockchain]['20'], - method: 'approve', - params: [exchange[blockchain].permit.address, Blockchains[blockchain].maxInt] - }; - - return { transaction } - - } else { // permit2 + if(allowance.gte(amountIn)) { return } - const allowanceWithinPermit2 = await request({ - blockchain, - address: exchange[blockchain].permit.address, - method: 'allowance', - api: exchange[blockchain].permit.api, - params: [account, tokenIn, exchange[blockchain].router.address] - }); + let transaction = { + blockchain, + from: account, + to: tokenIn, + api: Token[blockchain]['20'], + method: 'approve', + params: [exchange[blockchain].router.address, amountIn.sub(allowance)] + }; + + return { transaction } - if( - allowanceWithinPermit2.amount.lt(amountIn) || - (allowanceWithinPermit2.expiration - 1800) < (Math.floor(Date.now() / 1000)) - ) { +}; - const deadline = Math.floor(Date.now() / 1000) + 2592000; // 1 Month - - const signature = { - types: { - Domain: [ - { name: "name", type: "string" }, - { name: "version", type: "string" }, - { name: "chainId", type: "uint256" }, - { name: "verifyingContract", type: "address" } - ], - PermitSingle: [ - { name: "details", type: "PermitDetails" }, - { name: "spender", type: "address" }, - { name: "sigDeadline", type: "uint256" } - ], - PermitDetails: [ - { name: "token", type: "address" }, - { name: "amount", type: "uint160" }, - { name: "expiration", type: "uint48" }, - { name: "nonce", type: "uint48" } - ] - }, - primaryType: "PermitSingle", - domain: { - chainId: Blockchains[blockchain].networkId, - name: "Permit2", - verifyingContract: exchange[blockchain].permit.address, - version: "1" - }, - message: { - details: { - token: tokenIn, - amount: "1461501637330902918203684832716283019655932542975", // max uint160 - expiration: deadline, - nonce: allowanceWithinPermit2.nonce - }, - spender: exchange[blockchain].router.address, - sigDeadline: deadline - } - }; +let packPath = (pools)=>{ + if(pools.length == 1) { + return ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]) + } else if (pools.length == 2) { + return ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]) + } else { + throw 'more than 2 pools not supported!' + } +}; - return { signature } - } +let packPathReverse = (pools)=>{ + if(pools.length == 1) { + return ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[1], pools[0].fee, pools[0].path[0]]) + } else if (pools.length == 2) { + return ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[1].path[1], pools[1].fee, pools[1].path[0], pools[0].fee, pools[0].path[0]]) + } else { + throw 'more than 2 pools not supported!' } }; @@ -4146,85 +4106,57 @@ let getTransaction$1 = async({ amountInMaxInput, amountOutMinInput, account, - permit2, inputTokenPushed, }) => { - let commands = []; - let inputs = []; let value = "0"; + const contract = new ethers.Contract(exchange[blockchain].router.address, exchange[blockchain].router.api); + const exactInput = !!(amountOutMinInput || amountInInput); + const wrapETH = path[0] === Blockchains[blockchain].currency.address; + const unwrapETH = path[path.length-1] === Blockchains[blockchain].currency.address; + const recipient = unwrapETH ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT; + const refundETH = wrapETH || unwrapETH; - if(permit2) { - const length = ethers.utils.arrayify(permit2.signature).length; - let signature; - if (length === SIGNATURE_LENGTH || length === EIP_2098_SIGNATURE_LENGTH) { - signature = ethers.utils.joinSignature(ethers.utils.splitSignature(permit2.signature)); - } - commands.push("0a"); // PERMIT2_PERMIT - inputs.push( - ethers.utils.defaultAbiCoder.encode( - [PERMIT_STRUCT, "bytes"], - [permit2, signature] - ) - ); - } + let multicalls = []; - if (path[0] === Blockchains[blockchain].currency.address) { - commands.push("0b"); // WRAP_ETH - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [ROUTER_AS_RECIPIENT, (amountIn || amountInMax).toString()] - ) - ); + if (wrapETH) { value = (amountIn || amountInMax).toString(); + if(exactInput) { // exactOut does not need to wrapETH! + multicalls.push( + contract.interface.encodeFunctionData('wrapETH', [(amountIn || amountInMax)]) + ); + } } - - let packedPath; - if(pools.length === 1) { - packedPath = ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]); - } else if(pools.length === 2) { - packedPath = ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]); - } - - if (amountOutMinInput || amountInInput) { - commands.push("00"); // V3_SWAP_EXACT_IN (minimum out) - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains[blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountIn || amountInMax).toString(), - (amountOut || amountOutMin).toString(), - packedPath, - path[0] === Blockchains[blockchain].currency.address ? false : !inputTokenPushed - ] - ) + if (exactInput) { + multicalls.push( + contract.interface.encodeFunctionData('exactInput', [{ + path: packPath(pools), + amountIn: wrapETH ? 0 : (amountIn || amountInMax), + amountOutMinimum: amountOutMin, + recipient + }]) ); } else { - commands.push("01"); // V3_SWAP_EXACT_OUT (maximum in) - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains[blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountOut || amountOutMin).toString(), - (amountIn || amountInMax).toString(), - packedPath, - path[0] === Blockchains[blockchain].currency.address ? false : !inputTokenPushed - ] - ) + multicalls.push( + contract.interface.encodeFunctionData('exactOutput', [{ + path: packPathReverse(pools), + amountOut, + amountInMaximum: amountInMax, + recipient + }]) ); } - if (path[path.length-1] === Blockchains[blockchain].currency.address) { - commands.push("0c"); // UNWRAP_WETH - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [SENDER_AS_RECIPIENT, (amountOut || amountOutMin).toString()] - ) + if (unwrapETH) { + multicalls.push( + contract.interface.encodeFunctionData('unwrapWETH9(uint256)', [amountOut || amountOutMin]) + ); + } + + if(refundETH) { + multicalls.push( + contract.interface.encodeFunctionData('refundETH') ); } @@ -4233,18 +4165,15 @@ let getTransaction$1 = async({ from: account, to: exchange[blockchain].router.address, api: exchange[blockchain].router.api, - method: 'execute', - params: { - commands: `0x${commands.join('')}`, - inputs, - }, + method: 'multicall', + params: { data: multicalls }, value }; return transaction }; -const ROUTER = [{"inputs":[{"components":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"weth9","type":"address"},{"internalType":"address","name":"seaportV1_5","type":"address"},{"internalType":"address","name":"seaportV1_4","type":"address"},{"internalType":"address","name":"openseaConduit","type":"address"},{"internalType":"address","name":"nftxZap","type":"address"},{"internalType":"address","name":"x2y2","type":"address"},{"internalType":"address","name":"foundation","type":"address"},{"internalType":"address","name":"sudoswap","type":"address"},{"internalType":"address","name":"elementMarket","type":"address"},{"internalType":"address","name":"nft20Zap","type":"address"},{"internalType":"address","name":"cryptopunks","type":"address"},{"internalType":"address","name":"looksRareV2","type":"address"},{"internalType":"address","name":"routerRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareToken","type":"address"},{"internalType":"address","name":"v2Factory","type":"address"},{"internalType":"address","name":"v3Factory","type":"address"},{"internalType":"bytes32","name":"pairInitCodeHash","type":"bytes32"},{"internalType":"bytes32","name":"poolInitCodeHash","type":"bytes32"}],"internalType":"struct RouterParameters","name":"params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BalanceTooLow","type":"error"},{"inputs":[],"name":"BuyPunkFailed","type":"error"},{"inputs":[],"name":"ContractLocked","type":"error"},{"inputs":[],"name":"ETHNotAccepted","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandIndex","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"ExecutionFailed","type":"error"},{"inputs":[],"name":"FromAddressIsNotOwner","type":"error"},{"inputs":[],"name":"InsufficientETH","type":"error"},{"inputs":[],"name":"InsufficientToken","type":"error"},{"inputs":[],"name":"InvalidBips","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandType","type":"uint256"}],"name":"InvalidCommandType","type":"error"},{"inputs":[],"name":"InvalidOwnerERC1155","type":"error"},{"inputs":[],"name":"InvalidOwnerERC721","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"InvalidSpender","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"SliceOutOfBounds","type":"error"},{"inputs":[],"name":"TransactionDeadlinePassed","type":"error"},{"inputs":[],"name":"UnableToClaim","type":"error"},{"inputs":[],"name":"UnsafeCast","type":"error"},{"inputs":[],"name":"V2InvalidPath","type":"error"},{"inputs":[],"name":"V2TooLittleReceived","type":"error"},{"inputs":[],"name":"V2TooMuchRequested","type":"error"},{"inputs":[],"name":"V3InvalidAmountOut","type":"error"},{"inputs":[],"name":"V3InvalidCaller","type":"error"},{"inputs":[],"name":"V3InvalidSwap","type":"error"},{"inputs":[],"name":"V3TooLittleReceived","type":"error"},{"inputs":[],"name":"V3TooMuchRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsSent","type":"event"},{"inputs":[{"internalType":"bytes","name":"looksRareClaim","type":"bytes"}],"name":"collectRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]; +const ROUTER = [{"inputs":[{"internalType":"address","name":"_factoryV2","type":"address"},{"internalType":"address","name":"factoryV3","type":"address"},{"internalType":"address","name":"_positionManager","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callPositionManager","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"paths","type":"bytes[]"},{"internalType":"uint128[]","name":"amounts","type":"uint128[]"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getApprovalType","outputs":[{"internalType":"enum IApproveAndCall.ApprovalType","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"internalType":"struct IApproveAndCall.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IApproveAndCall.MintParams","name":"params","type":"tuple"}],"name":"mint","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"previousBlockhash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"pull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"wrapETH","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]; const FACTORY = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":true,"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"FeeAmountEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":false,"internalType":"int24","name":"tickSpacing","type":"int24"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"enableFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"feeAmountTickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]; const POOL = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]; const QUOTER = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"quoteExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactInputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"quoteExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactOutputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"path","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"view","type":"function"}]; @@ -4273,11 +4202,11 @@ const exchange$9 = { slippage: true, fees: [100, 500, 3000, 10000], - blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum'], + blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'], ethereum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4299,7 +4228,7 @@ const exchange$9 = { bsc: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2', api: UniswapV3.ROUTER }, factory: { @@ -4321,7 +4250,7 @@ const exchange$9 = { polygon: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4343,7 +4272,7 @@ const exchange$9 = { optimism: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4365,7 +4294,7 @@ const exchange$9 = { arbitrum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4387,7 +4316,7 @@ const exchange$9 = { base: { router: { - address: '0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC', + address: '0x2626664c2603336E57B271c5C0b26F421741e481', api: UniswapV3.ROUTER }, factory: { @@ -4407,6 +4336,28 @@ const exchange$9 = { } }, + avalanche: { + router: { + address: '0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE', + api: UniswapV3.ROUTER + }, + factory: { + address: '0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD', + api: UniswapV3.FACTORY + }, + pool: { + api: UniswapV3.POOL + }, + quoter: { + address: '0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F', + api: UniswapV3.QUOTER + }, + permit: { + address: '0x000000000022d473030f116ddee9f6b43ac78ba3', + api: UniswapV3.PERMIT2 + } + }, + }; var uniswap_v3 = (scope)=>{ @@ -4892,6 +4843,7 @@ exchanges.fantom = [ exchanges.fantom.forEach((exchange)=>{ exchanges.fantom[exchange.name] = exchange; }); exchanges.avalanche = [ + uniswap_v3('avalanche'), trader_joe_v2_1('avalanche'), wavax('avalanche'), ]; diff --git a/dist/esm/index.solana.js b/dist/esm/index.solana.js index 90a8b1f..f9874a3 100644 --- a/dist/esm/index.solana.js +++ b/dist/esm/index.solana.js @@ -311,7 +311,7 @@ const route$1 = ({ } catch (e) { return resolve() } if([amountIn, amountInMax, amountOut, amountOutMin].every((amount)=>{ return amount == undefined })) { return resolve() } - if(slippage || exchange.slippage) { + if(exchange.slippage && slippage !== false) { try { ({ amountIn, amountInMax, amountOut, amountOutMin, amounts } = await calculateAmountsWithSlippage({ exchange, @@ -387,6 +387,7 @@ class Exchange { amountOut, amountInMax, amountOutMin, + slippage, }) { if(tokenIn === tokenOut){ return Promise.resolve() } @@ -426,7 +427,7 @@ class Exchange { getAmounts: this.getAmounts, getPrep: this.getPrep, getTransaction: this.getTransaction, - slippage: this.slippage, + slippage, }) } } diff --git a/dist/umd/index.evm.js b/dist/umd/index.evm.js index 986afe6..f0868ef 100644 --- a/dist/umd/index.evm.js +++ b/dist/umd/index.evm.js @@ -315,7 +315,7 @@ } catch (e) { return resolve() } if([amountIn, amountInMax, amountOut, amountOutMin].every((amount)=>{ return amount == undefined })) { return resolve() } - if(slippage || exchange.slippage) { + if(exchange.slippage && slippage !== false) { try { ({ amountIn, amountInMax, amountOut, amountOutMin, amounts } = await calculateAmountsWithSlippage({ exchange, @@ -391,6 +391,7 @@ amountOut, amountInMax, amountOutMin, + slippage, }) { if(tokenIn === tokenOut){ return Promise.resolve() } @@ -430,7 +431,7 @@ getAmounts: this.getAmounts, getPrep: this.getPrep, getTransaction: this.getTransaction, - slippage: this.slippage, + slippage, }) } } @@ -666,6 +667,7 @@ }; return { transaction } + }; let getTransaction$4 = ({ @@ -1961,9 +1963,6 @@ const SENDER_AS_RECIPIENT = '0x0000000000000000000000000000000000000001'; const ROUTER_AS_RECIPIENT = '0x0000000000000000000000000000000000000002'; - const PERMIT_STRUCT = '((address token,uint160 amount,uint48 expiration,uint48 nonce) details,address spender,uint256 sigDeadline)'; - const SIGNATURE_LENGTH = 65; - const EIP_2098_SIGNATURE_LENGTH = 64; // Replaces 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with the wrapped token and implies wrapping. // @@ -2269,85 +2268,46 @@ if(tokenIn === Blockchains__default['default'][blockchain].currency.address) { return } // NATIVE - const allowanceForPermit2 = await web3ClientEvm.request({ + const allowance = await web3ClientEvm.request({ blockchain, address: tokenIn, method: 'allowance', api: Token__default['default'][blockchain]['20'], - params: [account, exchange[blockchain].permit.address] + params: [account, exchange[blockchain].router.address] }); - if(allowanceForPermit2.lt(amountIn)) { - - let transaction = { - blockchain, - from: account, - to: tokenIn, - api: Token__default['default'][blockchain]['20'], - method: 'approve', - params: [exchange[blockchain].permit.address, Blockchains__default['default'][blockchain].maxInt] - }; - - return { transaction } - - } else { // permit2 + if(allowance.gte(amountIn)) { return } - const allowanceWithinPermit2 = await web3ClientEvm.request({ - blockchain, - address: exchange[blockchain].permit.address, - method: 'allowance', - api: exchange[blockchain].permit.api, - params: [account, tokenIn, exchange[blockchain].router.address] - }); + let transaction = { + blockchain, + from: account, + to: tokenIn, + api: Token__default['default'][blockchain]['20'], + method: 'approve', + params: [exchange[blockchain].router.address, amountIn.sub(allowance)] + }; + + return { transaction } - if( - allowanceWithinPermit2.amount.lt(amountIn) || - (allowanceWithinPermit2.expiration - 1800) < (Math.floor(Date.now() / 1000)) - ) { + }; - const deadline = Math.floor(Date.now() / 1000) + 2592000; // 1 Month - - const signature = { - types: { - Domain: [ - { name: "name", type: "string" }, - { name: "version", type: "string" }, - { name: "chainId", type: "uint256" }, - { name: "verifyingContract", type: "address" } - ], - PermitSingle: [ - { name: "details", type: "PermitDetails" }, - { name: "spender", type: "address" }, - { name: "sigDeadline", type: "uint256" } - ], - PermitDetails: [ - { name: "token", type: "address" }, - { name: "amount", type: "uint160" }, - { name: "expiration", type: "uint48" }, - { name: "nonce", type: "uint48" } - ] - }, - primaryType: "PermitSingle", - domain: { - chainId: Blockchains__default['default'][blockchain].networkId, - name: "Permit2", - verifyingContract: exchange[blockchain].permit.address, - version: "1" - }, - message: { - details: { - token: tokenIn, - amount: "1461501637330902918203684832716283019655932542975", // max uint160 - expiration: deadline, - nonce: allowanceWithinPermit2.nonce - }, - spender: exchange[blockchain].router.address, - sigDeadline: deadline - } - }; + let packPath = (pools)=>{ + if(pools.length == 1) { + return ethers.ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]) + } else if (pools.length == 2) { + return ethers.ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]) + } else { + throw 'more than 2 pools not supported!' + } + }; - return { signature } - } + let packPathReverse = (pools)=>{ + if(pools.length == 1) { + return ethers.ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[1], pools[0].fee, pools[0].path[0]]) + } else if (pools.length == 2) { + return ethers.ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[1].path[1], pools[1].fee, pools[1].path[0], pools[0].fee, pools[0].path[0]]) + } else { + throw 'more than 2 pools not supported!' } }; @@ -2365,85 +2325,57 @@ amountInMaxInput, amountOutMinInput, account, - permit2, inputTokenPushed, }) => { - let commands = []; - let inputs = []; let value = "0"; + const contract = new ethers.ethers.Contract(exchange[blockchain].router.address, exchange[blockchain].router.api); + const exactInput = !!(amountOutMinInput || amountInInput); + const wrapETH = path[0] === Blockchains__default['default'][blockchain].currency.address; + const unwrapETH = path[path.length-1] === Blockchains__default['default'][blockchain].currency.address; + const recipient = unwrapETH ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT; + const refundETH = wrapETH || unwrapETH; - if(permit2) { - const length = ethers.ethers.utils.arrayify(permit2.signature).length; - let signature; - if (length === SIGNATURE_LENGTH || length === EIP_2098_SIGNATURE_LENGTH) { - signature = ethers.ethers.utils.joinSignature(ethers.ethers.utils.splitSignature(permit2.signature)); - } - commands.push("0a"); // PERMIT2_PERMIT - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - [PERMIT_STRUCT, "bytes"], - [permit2, signature] - ) - ); - } + let multicalls = []; - if (path[0] === Blockchains__default['default'][blockchain].currency.address) { - commands.push("0b"); // WRAP_ETH - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [ROUTER_AS_RECIPIENT, (amountIn || amountInMax).toString()] - ) - ); + if (wrapETH) { value = (amountIn || amountInMax).toString(); + if(exactInput) { // exactOut does not need to wrapETH! + multicalls.push( + contract.interface.encodeFunctionData('wrapETH', [(amountIn || amountInMax)]) + ); + } } - - let packedPath; - if(pools.length === 1) { - packedPath = ethers.ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]); - } else if(pools.length === 2) { - packedPath = ethers.ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]); - } - - if (amountOutMinInput || amountInInput) { - commands.push("00"); // V3_SWAP_EXACT_IN (minimum out) - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains__default['default'][blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountIn || amountInMax).toString(), - (amountOut || amountOutMin).toString(), - packedPath, - path[0] === Blockchains__default['default'][blockchain].currency.address ? false : !inputTokenPushed - ] - ) + if (exactInput) { + multicalls.push( + contract.interface.encodeFunctionData('exactInput', [{ + path: packPath(pools), + amountIn: wrapETH ? 0 : (amountIn || amountInMax), + amountOutMinimum: amountOutMin, + recipient + }]) ); } else { - commands.push("01"); // V3_SWAP_EXACT_OUT (maximum in) - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains__default['default'][blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountOut || amountOutMin).toString(), - (amountIn || amountInMax).toString(), - packedPath, - path[0] === Blockchains__default['default'][blockchain].currency.address ? false : !inputTokenPushed - ] - ) + multicalls.push( + contract.interface.encodeFunctionData('exactOutput', [{ + path: packPathReverse(pools), + amountOut, + amountInMaximum: amountInMax, + recipient + }]) + ); + } + + if (unwrapETH) { + multicalls.push( + contract.interface.encodeFunctionData('unwrapWETH9(uint256)', [amountOut || amountOutMin]) ); } - if (path[path.length-1] === Blockchains__default['default'][blockchain].currency.address) { - commands.push("0c"); // UNWRAP_WETH - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [SENDER_AS_RECIPIENT, (amountOut || amountOutMin).toString()] - ) + if(refundETH) { + multicalls.push( + contract.interface.encodeFunctionData('refundETH') ); } @@ -2452,18 +2384,15 @@ from: account, to: exchange[blockchain].router.address, api: exchange[blockchain].router.api, - method: 'execute', - params: { - commands: `0x${commands.join('')}`, - inputs, - }, + method: 'multicall', + params: { data: multicalls }, value }; return transaction }; - const ROUTER = [{"inputs":[{"components":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"weth9","type":"address"},{"internalType":"address","name":"seaportV1_5","type":"address"},{"internalType":"address","name":"seaportV1_4","type":"address"},{"internalType":"address","name":"openseaConduit","type":"address"},{"internalType":"address","name":"nftxZap","type":"address"},{"internalType":"address","name":"x2y2","type":"address"},{"internalType":"address","name":"foundation","type":"address"},{"internalType":"address","name":"sudoswap","type":"address"},{"internalType":"address","name":"elementMarket","type":"address"},{"internalType":"address","name":"nft20Zap","type":"address"},{"internalType":"address","name":"cryptopunks","type":"address"},{"internalType":"address","name":"looksRareV2","type":"address"},{"internalType":"address","name":"routerRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareToken","type":"address"},{"internalType":"address","name":"v2Factory","type":"address"},{"internalType":"address","name":"v3Factory","type":"address"},{"internalType":"bytes32","name":"pairInitCodeHash","type":"bytes32"},{"internalType":"bytes32","name":"poolInitCodeHash","type":"bytes32"}],"internalType":"struct RouterParameters","name":"params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BalanceTooLow","type":"error"},{"inputs":[],"name":"BuyPunkFailed","type":"error"},{"inputs":[],"name":"ContractLocked","type":"error"},{"inputs":[],"name":"ETHNotAccepted","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandIndex","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"ExecutionFailed","type":"error"},{"inputs":[],"name":"FromAddressIsNotOwner","type":"error"},{"inputs":[],"name":"InsufficientETH","type":"error"},{"inputs":[],"name":"InsufficientToken","type":"error"},{"inputs":[],"name":"InvalidBips","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandType","type":"uint256"}],"name":"InvalidCommandType","type":"error"},{"inputs":[],"name":"InvalidOwnerERC1155","type":"error"},{"inputs":[],"name":"InvalidOwnerERC721","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"InvalidSpender","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"SliceOutOfBounds","type":"error"},{"inputs":[],"name":"TransactionDeadlinePassed","type":"error"},{"inputs":[],"name":"UnableToClaim","type":"error"},{"inputs":[],"name":"UnsafeCast","type":"error"},{"inputs":[],"name":"V2InvalidPath","type":"error"},{"inputs":[],"name":"V2TooLittleReceived","type":"error"},{"inputs":[],"name":"V2TooMuchRequested","type":"error"},{"inputs":[],"name":"V3InvalidAmountOut","type":"error"},{"inputs":[],"name":"V3InvalidCaller","type":"error"},{"inputs":[],"name":"V3InvalidSwap","type":"error"},{"inputs":[],"name":"V3TooLittleReceived","type":"error"},{"inputs":[],"name":"V3TooMuchRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsSent","type":"event"},{"inputs":[{"internalType":"bytes","name":"looksRareClaim","type":"bytes"}],"name":"collectRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]; + const ROUTER = [{"inputs":[{"internalType":"address","name":"_factoryV2","type":"address"},{"internalType":"address","name":"factoryV3","type":"address"},{"internalType":"address","name":"_positionManager","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callPositionManager","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"paths","type":"bytes[]"},{"internalType":"uint128[]","name":"amounts","type":"uint128[]"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getApprovalType","outputs":[{"internalType":"enum IApproveAndCall.ApprovalType","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"internalType":"struct IApproveAndCall.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IApproveAndCall.MintParams","name":"params","type":"tuple"}],"name":"mint","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"previousBlockhash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"pull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"wrapETH","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]; const FACTORY = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":true,"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"FeeAmountEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":false,"internalType":"int24","name":"tickSpacing","type":"int24"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"enableFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"feeAmountTickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]; const POOL = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]; const QUOTER = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"quoteExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactInputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"quoteExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactOutputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"path","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"view","type":"function"}]; @@ -2492,11 +2421,11 @@ slippage: true, fees: [100, 500, 3000, 10000], - blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum'], + blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'], ethereum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2518,7 +2447,7 @@ bsc: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2', api: UniswapV3.ROUTER }, factory: { @@ -2540,7 +2469,7 @@ polygon: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2562,7 +2491,7 @@ optimism: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2584,7 +2513,7 @@ arbitrum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -2606,7 +2535,7 @@ base: { router: { - address: '0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC', + address: '0x2626664c2603336E57B271c5C0b26F421741e481', api: UniswapV3.ROUTER }, factory: { @@ -2626,6 +2555,28 @@ } }, + avalanche: { + router: { + address: '0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE', + api: UniswapV3.ROUTER + }, + factory: { + address: '0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD', + api: UniswapV3.FACTORY + }, + pool: { + api: UniswapV3.POOL + }, + quoter: { + address: '0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F', + api: UniswapV3.QUOTER + }, + permit: { + address: '0x000000000022d473030f116ddee9f6b43ac78ba3', + api: UniswapV3.PERMIT2 + } + }, + }; var uniswap_v3 = (scope)=>{ @@ -3106,6 +3057,7 @@ exchanges.fantom.forEach((exchange)=>{ exchanges.fantom[exchange.name] = exchange; }); exchanges.avalanche = [ + uniswap_v3('avalanche'), trader_joe_v2_1('avalanche'), wavax('avalanche'), ]; diff --git a/dist/umd/index.js b/dist/umd/index.js index 9e29f0d..a69fb79 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -316,7 +316,7 @@ } catch (e) { return resolve() } if([amountIn, amountInMax, amountOut, amountOutMin].every((amount)=>{ return amount == undefined })) { return resolve() } - if(slippage || exchange.slippage) { + if(exchange.slippage && slippage !== false) { try { ({ amountIn, amountInMax, amountOut, amountOutMin, amounts } = await calculateAmountsWithSlippage({ exchange, @@ -392,6 +392,7 @@ amountOut, amountInMax, amountOutMin, + slippage, }) { if(tokenIn === tokenOut){ return Promise.resolve() } @@ -431,7 +432,7 @@ getAmounts: this.getAmounts, getPrep: this.getPrep, getTransaction: this.getTransaction, - slippage: this.slippage, + slippage, }) } } @@ -667,6 +668,7 @@ }; return { transaction } + }; let getTransaction$5 = ({ @@ -3747,9 +3749,6 @@ const SENDER_AS_RECIPIENT = '0x0000000000000000000000000000000000000001'; const ROUTER_AS_RECIPIENT = '0x0000000000000000000000000000000000000002'; - const PERMIT_STRUCT = '((address token,uint160 amount,uint48 expiration,uint48 nonce) details,address spender,uint256 sigDeadline)'; - const SIGNATURE_LENGTH = 65; - const EIP_2098_SIGNATURE_LENGTH = 64; // Replaces 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with the wrapped token and implies wrapping. // @@ -4055,85 +4054,46 @@ if(tokenIn === Blockchains__default['default'][blockchain].currency.address) { return } // NATIVE - const allowanceForPermit2 = await web3Client.request({ + const allowance = await web3Client.request({ blockchain, address: tokenIn, method: 'allowance', api: Token__default['default'][blockchain]['20'], - params: [account, exchange[blockchain].permit.address] + params: [account, exchange[blockchain].router.address] }); - if(allowanceForPermit2.lt(amountIn)) { - - let transaction = { - blockchain, - from: account, - to: tokenIn, - api: Token__default['default'][blockchain]['20'], - method: 'approve', - params: [exchange[blockchain].permit.address, Blockchains__default['default'][blockchain].maxInt] - }; - - return { transaction } - - } else { // permit2 + if(allowance.gte(amountIn)) { return } - const allowanceWithinPermit2 = await web3Client.request({ - blockchain, - address: exchange[blockchain].permit.address, - method: 'allowance', - api: exchange[blockchain].permit.api, - params: [account, tokenIn, exchange[blockchain].router.address] - }); + let transaction = { + blockchain, + from: account, + to: tokenIn, + api: Token__default['default'][blockchain]['20'], + method: 'approve', + params: [exchange[blockchain].router.address, amountIn.sub(allowance)] + }; + + return { transaction } - if( - allowanceWithinPermit2.amount.lt(amountIn) || - (allowanceWithinPermit2.expiration - 1800) < (Math.floor(Date.now() / 1000)) - ) { + }; - const deadline = Math.floor(Date.now() / 1000) + 2592000; // 1 Month - - const signature = { - types: { - Domain: [ - { name: "name", type: "string" }, - { name: "version", type: "string" }, - { name: "chainId", type: "uint256" }, - { name: "verifyingContract", type: "address" } - ], - PermitSingle: [ - { name: "details", type: "PermitDetails" }, - { name: "spender", type: "address" }, - { name: "sigDeadline", type: "uint256" } - ], - PermitDetails: [ - { name: "token", type: "address" }, - { name: "amount", type: "uint160" }, - { name: "expiration", type: "uint48" }, - { name: "nonce", type: "uint48" } - ] - }, - primaryType: "PermitSingle", - domain: { - chainId: Blockchains__default['default'][blockchain].networkId, - name: "Permit2", - verifyingContract: exchange[blockchain].permit.address, - version: "1" - }, - message: { - details: { - token: tokenIn, - amount: "1461501637330902918203684832716283019655932542975", // max uint160 - expiration: deadline, - nonce: allowanceWithinPermit2.nonce - }, - spender: exchange[blockchain].router.address, - sigDeadline: deadline - } - }; + let packPath = (pools)=>{ + if(pools.length == 1) { + return ethers.ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]) + } else if (pools.length == 2) { + return ethers.ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]) + } else { + throw 'more than 2 pools not supported!' + } + }; - return { signature } - } + let packPathReverse = (pools)=>{ + if(pools.length == 1) { + return ethers.ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[1], pools[0].fee, pools[0].path[0]]) + } else if (pools.length == 2) { + return ethers.ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[1].path[1], pools[1].fee, pools[1].path[0], pools[0].fee, pools[0].path[0]]) + } else { + throw 'more than 2 pools not supported!' } }; @@ -4151,85 +4111,57 @@ amountInMaxInput, amountOutMinInput, account, - permit2, inputTokenPushed, }) => { - let commands = []; - let inputs = []; let value = "0"; + const contract = new ethers.ethers.Contract(exchange[blockchain].router.address, exchange[blockchain].router.api); + const exactInput = !!(amountOutMinInput || amountInInput); + const wrapETH = path[0] === Blockchains__default['default'][blockchain].currency.address; + const unwrapETH = path[path.length-1] === Blockchains__default['default'][blockchain].currency.address; + const recipient = unwrapETH ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT; + const refundETH = wrapETH || unwrapETH; - if(permit2) { - const length = ethers.ethers.utils.arrayify(permit2.signature).length; - let signature; - if (length === SIGNATURE_LENGTH || length === EIP_2098_SIGNATURE_LENGTH) { - signature = ethers.ethers.utils.joinSignature(ethers.ethers.utils.splitSignature(permit2.signature)); - } - commands.push("0a"); // PERMIT2_PERMIT - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - [PERMIT_STRUCT, "bytes"], - [permit2, signature] - ) - ); - } + let multicalls = []; - if (path[0] === Blockchains__default['default'][blockchain].currency.address) { - commands.push("0b"); // WRAP_ETH - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [ROUTER_AS_RECIPIENT, (amountIn || amountInMax).toString()] - ) - ); + if (wrapETH) { value = (amountIn || amountInMax).toString(); + if(exactInput) { // exactOut does not need to wrapETH! + multicalls.push( + contract.interface.encodeFunctionData('wrapETH', [(amountIn || amountInMax)]) + ); + } } - - let packedPath; - if(pools.length === 1) { - packedPath = ethers.ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]); - } else if(pools.length === 2) { - packedPath = ethers.ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]); - } - - if (amountOutMinInput || amountInInput) { - commands.push("00"); // V3_SWAP_EXACT_IN (minimum out) - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains__default['default'][blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountIn || amountInMax).toString(), - (amountOut || amountOutMin).toString(), - packedPath, - path[0] === Blockchains__default['default'][blockchain].currency.address ? false : !inputTokenPushed - ] - ) + if (exactInput) { + multicalls.push( + contract.interface.encodeFunctionData('exactInput', [{ + path: packPath(pools), + amountIn: wrapETH ? 0 : (amountIn || amountInMax), + amountOutMinimum: amountOutMin, + recipient + }]) ); } else { - commands.push("01"); // V3_SWAP_EXACT_OUT (maximum in) - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains__default['default'][blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountOut || amountOutMin).toString(), - (amountIn || amountInMax).toString(), - packedPath, - path[0] === Blockchains__default['default'][blockchain].currency.address ? false : !inputTokenPushed - ] - ) + multicalls.push( + contract.interface.encodeFunctionData('exactOutput', [{ + path: packPathReverse(pools), + amountOut, + amountInMaximum: amountInMax, + recipient + }]) ); } - if (path[path.length-1] === Blockchains__default['default'][blockchain].currency.address) { - commands.push("0c"); // UNWRAP_WETH - inputs.push( - ethers.ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [SENDER_AS_RECIPIENT, (amountOut || amountOutMin).toString()] - ) + if (unwrapETH) { + multicalls.push( + contract.interface.encodeFunctionData('unwrapWETH9(uint256)', [amountOut || amountOutMin]) + ); + } + + if(refundETH) { + multicalls.push( + contract.interface.encodeFunctionData('refundETH') ); } @@ -4238,18 +4170,15 @@ from: account, to: exchange[blockchain].router.address, api: exchange[blockchain].router.api, - method: 'execute', - params: { - commands: `0x${commands.join('')}`, - inputs, - }, + method: 'multicall', + params: { data: multicalls }, value }; return transaction }; - const ROUTER = [{"inputs":[{"components":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"weth9","type":"address"},{"internalType":"address","name":"seaportV1_5","type":"address"},{"internalType":"address","name":"seaportV1_4","type":"address"},{"internalType":"address","name":"openseaConduit","type":"address"},{"internalType":"address","name":"nftxZap","type":"address"},{"internalType":"address","name":"x2y2","type":"address"},{"internalType":"address","name":"foundation","type":"address"},{"internalType":"address","name":"sudoswap","type":"address"},{"internalType":"address","name":"elementMarket","type":"address"},{"internalType":"address","name":"nft20Zap","type":"address"},{"internalType":"address","name":"cryptopunks","type":"address"},{"internalType":"address","name":"looksRareV2","type":"address"},{"internalType":"address","name":"routerRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareToken","type":"address"},{"internalType":"address","name":"v2Factory","type":"address"},{"internalType":"address","name":"v3Factory","type":"address"},{"internalType":"bytes32","name":"pairInitCodeHash","type":"bytes32"},{"internalType":"bytes32","name":"poolInitCodeHash","type":"bytes32"}],"internalType":"struct RouterParameters","name":"params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BalanceTooLow","type":"error"},{"inputs":[],"name":"BuyPunkFailed","type":"error"},{"inputs":[],"name":"ContractLocked","type":"error"},{"inputs":[],"name":"ETHNotAccepted","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandIndex","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"ExecutionFailed","type":"error"},{"inputs":[],"name":"FromAddressIsNotOwner","type":"error"},{"inputs":[],"name":"InsufficientETH","type":"error"},{"inputs":[],"name":"InsufficientToken","type":"error"},{"inputs":[],"name":"InvalidBips","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandType","type":"uint256"}],"name":"InvalidCommandType","type":"error"},{"inputs":[],"name":"InvalidOwnerERC1155","type":"error"},{"inputs":[],"name":"InvalidOwnerERC721","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"InvalidSpender","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"SliceOutOfBounds","type":"error"},{"inputs":[],"name":"TransactionDeadlinePassed","type":"error"},{"inputs":[],"name":"UnableToClaim","type":"error"},{"inputs":[],"name":"UnsafeCast","type":"error"},{"inputs":[],"name":"V2InvalidPath","type":"error"},{"inputs":[],"name":"V2TooLittleReceived","type":"error"},{"inputs":[],"name":"V2TooMuchRequested","type":"error"},{"inputs":[],"name":"V3InvalidAmountOut","type":"error"},{"inputs":[],"name":"V3InvalidCaller","type":"error"},{"inputs":[],"name":"V3InvalidSwap","type":"error"},{"inputs":[],"name":"V3TooLittleReceived","type":"error"},{"inputs":[],"name":"V3TooMuchRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsSent","type":"event"},{"inputs":[{"internalType":"bytes","name":"looksRareClaim","type":"bytes"}],"name":"collectRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]; + const ROUTER = [{"inputs":[{"internalType":"address","name":"_factoryV2","type":"address"},{"internalType":"address","name":"factoryV3","type":"address"},{"internalType":"address","name":"_positionManager","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callPositionManager","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"paths","type":"bytes[]"},{"internalType":"uint128[]","name":"amounts","type":"uint128[]"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getApprovalType","outputs":[{"internalType":"enum IApproveAndCall.ApprovalType","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"internalType":"struct IApproveAndCall.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IApproveAndCall.MintParams","name":"params","type":"tuple"}],"name":"mint","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"previousBlockhash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"pull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"wrapETH","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]; const FACTORY = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":true,"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"FeeAmountEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":false,"internalType":"int24","name":"tickSpacing","type":"int24"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"enableFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"feeAmountTickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]; const POOL = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]; const QUOTER = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"quoteExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactInputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"quoteExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactOutputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"path","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"view","type":"function"}]; @@ -4278,11 +4207,11 @@ slippage: true, fees: [100, 500, 3000, 10000], - blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum'], + blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'], ethereum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4304,7 +4233,7 @@ bsc: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2', api: UniswapV3.ROUTER }, factory: { @@ -4326,7 +4255,7 @@ polygon: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4348,7 +4277,7 @@ optimism: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4370,7 +4299,7 @@ arbitrum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -4392,7 +4321,7 @@ base: { router: { - address: '0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC', + address: '0x2626664c2603336E57B271c5C0b26F421741e481', api: UniswapV3.ROUTER }, factory: { @@ -4412,6 +4341,28 @@ } }, + avalanche: { + router: { + address: '0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE', + api: UniswapV3.ROUTER + }, + factory: { + address: '0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD', + api: UniswapV3.FACTORY + }, + pool: { + api: UniswapV3.POOL + }, + quoter: { + address: '0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F', + api: UniswapV3.QUOTER + }, + permit: { + address: '0x000000000022d473030f116ddee9f6b43ac78ba3', + api: UniswapV3.PERMIT2 + } + }, + }; var uniswap_v3 = (scope)=>{ @@ -4897,6 +4848,7 @@ exchanges.fantom.forEach((exchange)=>{ exchanges.fantom[exchange.name] = exchange; }); exchanges.avalanche = [ + uniswap_v3('avalanche'), trader_joe_v2_1('avalanche'), wavax('avalanche'), ]; diff --git a/dist/umd/index.solana.js b/dist/umd/index.solana.js index 086cccf..df7da71 100644 --- a/dist/umd/index.solana.js +++ b/dist/umd/index.solana.js @@ -316,7 +316,7 @@ } catch (e) { return resolve() } if([amountIn, amountInMax, amountOut, amountOutMin].every((amount)=>{ return amount == undefined })) { return resolve() } - if(slippage || exchange.slippage) { + if(exchange.slippage && slippage !== false) { try { ({ amountIn, amountInMax, amountOut, amountOutMin, amounts } = await calculateAmountsWithSlippage({ exchange, @@ -392,6 +392,7 @@ amountOut, amountInMax, amountOutMin, + slippage, }) { if(tokenIn === tokenOut){ return Promise.resolve() } @@ -431,7 +432,7 @@ getAmounts: this.getAmounts, getPrep: this.getPrep, getTransaction: this.getTransaction, - slippage: this.slippage, + slippage, }) } } diff --git a/examples/uniswap_v3.md b/examples/uniswap_v3.md index b3e7ea8..a24a823 100644 --- a/examples/uniswap_v3.md +++ b/examples/uniswap_v3.md @@ -24,8 +24,8 @@ wallet.sendTransaction(transaction) let route = await Web3Exchanges.uniswap_v3.route({ blockchain: 'optimism', tokenIn: Web3Blockchains.optimism.currency.address, - tokenOut: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', // DAI - amountOutMin: 1 + tokenOut: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', // USDT + amountOutMin: 0.01 }) let wallets = await Web3Wallets.getWallets() @@ -63,8 +63,48 @@ wallet.sendTransaction(transaction) ```javascript let route = await Web3Exchanges.uniswap_v3.route({ blockchain: 'optimism', - tokenIn: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', // DAI - tokenOut: '0x4200000000000000000000000000000000000042', // OPTIMSM + tokenIn: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', + tokenOut: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', + amountOutMin: 0.01 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +# NATIVE TO TOKEN (OPTIMISM, 1 pool) + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'optimism', + tokenIn: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", + tokenOut: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', + amountInMax: 0.1 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +# TOKEN TO TOKEN (OPTIMISM, 2 pools) + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'optimism', + tokenIn: '0x76FB31fb4af56892A25e32cFC43De717950c9278', + tokenOut: '0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1', amountOutMin: 0.01 }) diff --git a/examples/uniswap_v3/base.md b/examples/uniswap_v3/base.md new file mode 100644 index 0000000..6bef1b0 --- /dev/null +++ b/examples/uniswap_v3/base.md @@ -0,0 +1,175 @@ +# 1 Pool + +## ETH TO TOKEN + +### amountOutMin + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: Web3Blockchains.base.currency.address, + tokenOut: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDCb + amountOutMin: 1 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +### amountOut + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: Web3Blockchains.base.currency.address, + tokenOut: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDCb + amountOut: 1 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +## TOKEN to ETH + +### amountOutMin + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDCb, + tokenOut: Web3Blockchains.base.currency.address, + amountOutMin: 0.000377697 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +### amountOut + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDCb, + tokenOut: Web3Blockchains.base.currency.address, + amountOut: 0.000377697 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +## TOKEN to TOKEN + +### amountOutMin + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDCb, + tokenOut: '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', // DAI + amountOutMin: 1 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +### amountOut + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDCb, + tokenOut: '0x6223901eA64608c75Da8497d5eff15D19A1D8fd5', // DAI + amountOut: 1 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +# 2 Pools + +## TOKEN to TOKEN + +### amountOutMin + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDCb, + tokenOut: '0x6223901eA64608c75Da8497d5eff15D19A1D8fd5', // CORGI + amountOutMin: 1 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +## ETH TO TOKEN + +### amountOutMin + +```javascript +let route = await Web3Exchanges.uniswap_v3.route({ + blockchain: 'base', + tokenIn: Web3Blockchains.base.currency.address, + tokenOut: '0x0c03ce270b4826ec62e7dd007f0b716068639f7b', + amountOutMin: 1 +}) + +let wallets = await Web3Wallets.getWallets() +let wallet = wallets[0] +let account = await wallet.account() + +let prep = await route.getPrep({ account }) + +let transaction = await route.getTransaction({ account }) +wallet.sendTransaction(transaction) +``` + +## TOKEN to ETH diff --git a/package.evm.json b/package.evm.json index 7749c3e..3c7ca0b 100644 --- a/package.evm.json +++ b/package.evm.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-exchanges-evm", "moduleName": "Web3Exchanges", - "version": "13.8.6", + "version": "13.10.0", "description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.", "main": "dist/umd/index.evm.js", "module": "dist/esm/index.evm.js", diff --git a/package.json b/package.json index 9bfb97d..3675033 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-exchanges", "moduleName": "Web3Exchanges", - "version": "13.8.6", + "version": "13.10.0", "description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.", "main": "dist/umd/index.js", "module": "dist/esm/index.js", diff --git a/package.solana.json b/package.solana.json index 55df9b7..0324ff3 100644 --- a/package.solana.json +++ b/package.solana.json @@ -1,7 +1,7 @@ { "name": "@depay/web3-exchanges-solana", "moduleName": "Web3Exchanges", - "version": "13.8.6", + "version": "13.10.0", "description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.", "main": "dist/umd/index.solana.js", "module": "dist/esm/index.solana.js", diff --git a/src/classes/Exchange.js b/src/classes/Exchange.js index a1a676a..9ae7fa5 100644 --- a/src/classes/Exchange.js +++ b/src/classes/Exchange.js @@ -50,7 +50,7 @@ const route = ({ } catch { return resolve() } if([amountIn, amountInMax, amountOut, amountOutMin].every((amount)=>{ return amount == undefined })) { return resolve() } - if(slippage || exchange.slippage) { + if(exchange.slippage && slippage !== false) { try { ({ amountIn, amountInMax, amountOut, amountOutMin, amounts } = await calculateAmountsWithSlippage({ exchange, @@ -126,6 +126,7 @@ class Exchange { amountOut, amountInMax, amountOutMin, + slippage, }) { if(tokenIn === tokenOut){ return Promise.resolve() } @@ -165,7 +166,7 @@ class Exchange { getAmounts: this.getAmounts, getPrep: this.getPrep, getTransaction: this.getTransaction, - slippage: this.slippage, + slippage, }) } } diff --git a/src/exchanges.js b/src/exchanges.js index ad2cfaa..10bf4a7 100644 --- a/src/exchanges.js +++ b/src/exchanges.js @@ -89,6 +89,7 @@ exchanges.fantom = [ exchanges.fantom.forEach((exchange)=>{ exchanges.fantom[exchange.name] = exchange }) exchanges.avalanche = [ + uniswap_v3('avalanche'), trader_joe_v2_1('avalanche'), wavax('avalanche'), ] @@ -214,6 +215,7 @@ exchanges.fantom = [ exchanges.fantom.forEach((exchange)=>{ exchanges.fantom[exchange.name] = exchange }) exchanges.avalanche = [ + uniswap_v3('avalanche'), trader_joe_v2_1('avalanche'), wavax('avalanche'), ] diff --git a/src/exchanges/uniswap_v3.js b/src/exchanges/uniswap_v3.js index ab0afed..fd8ffc9 100644 --- a/src/exchanges/uniswap_v3.js +++ b/src/exchanges/uniswap_v3.js @@ -11,11 +11,11 @@ const exchange = { slippage: true, fees: [100, 500, 3000, 10000], - blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum'], + blockchains: ['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche'], ethereum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -37,7 +37,7 @@ const exchange = { bsc: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2', api: UniswapV3.ROUTER }, factory: { @@ -59,7 +59,7 @@ const exchange = { polygon: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -81,7 +81,7 @@ const exchange = { optimism: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -103,7 +103,7 @@ const exchange = { arbitrum: { router: { - address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', + address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', api: UniswapV3.ROUTER }, factory: { @@ -125,7 +125,7 @@ const exchange = { base: { router: { - address: '0x198EF79F1F515F02dFE9e3115eD9fC07183f02fC', + address: '0x2626664c2603336E57B271c5C0b26F421741e481', api: UniswapV3.ROUTER }, factory: { @@ -145,6 +145,28 @@ const exchange = { } }, + avalanche: { + router: { + address: '0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE', + api: UniswapV3.ROUTER + }, + factory: { + address: '0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD', + api: UniswapV3.FACTORY + }, + pool: { + api: UniswapV3.POOL + }, + quoter: { + address: '0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F', + api: UniswapV3.QUOTER + }, + permit: { + address: '0x000000000022d473030f116ddee9f6b43ac78ba3', + api: UniswapV3.PERMIT2 + } + }, + } export default (scope)=>{ diff --git a/src/platforms/evm/uniswap_v2.js b/src/platforms/evm/uniswap_v2.js index 7477854..e791941 100644 --- a/src/platforms/evm/uniswap_v2.js +++ b/src/platforms/evm/uniswap_v2.js @@ -244,6 +244,7 @@ let getPrep = async({ } return { transaction } + } let getTransaction = ({ diff --git a/src/platforms/evm/uniswap_v3.js b/src/platforms/evm/uniswap_v3.js index 2224b57..b13960a 100644 --- a/src/platforms/evm/uniswap_v3.js +++ b/src/platforms/evm/uniswap_v3.js @@ -18,9 +18,6 @@ import Blockchains from '@depay/web3-blockchains' const SENDER_AS_RECIPIENT = '0x0000000000000000000000000000000000000001' const ROUTER_AS_RECIPIENT = '0x0000000000000000000000000000000000000002' -const PERMIT_STRUCT = '((address token,uint160 amount,uint48 expiration,uint48 nonce) details,address spender,uint256 sigDeadline)' -const SIGNATURE_LENGTH = 65 -const EIP_2098_SIGNATURE_LENGTH = 64 // Replaces 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with the wrapped token and implies wrapping. // @@ -326,85 +323,46 @@ let getPrep = async({ if(tokenIn === Blockchains[blockchain].currency.address) { return } // NATIVE - const allowanceForPermit2 = await request({ + const allowance = await request({ blockchain, address: tokenIn, method: 'allowance', api: Token[blockchain]['20'], - params: [account, exchange[blockchain].permit.address] + params: [account, exchange[blockchain].router.address] }) - if(allowanceForPermit2.lt(amountIn)) { + if(allowance.gte(amountIn)) { return } - let transaction = { - blockchain, - from: account, - to: tokenIn, - api: Token[blockchain]['20'], - method: 'approve', - params: [exchange[blockchain].permit.address, Blockchains[blockchain].maxInt] - } - - return { transaction } - - } else { // permit2 - - const allowanceWithinPermit2 = await request({ - blockchain, - address: exchange[blockchain].permit.address, - method: 'allowance', - api: exchange[blockchain].permit.api, - params: [account, tokenIn, exchange[blockchain].router.address] - }) + let transaction = { + blockchain, + from: account, + to: tokenIn, + api: Token[blockchain]['20'], + method: 'approve', + params: [exchange[blockchain].router.address, amountIn.sub(allowance)] + } + + return { transaction } - if( - allowanceWithinPermit2.amount.lt(amountIn) || - (allowanceWithinPermit2.expiration - 1800) < (Math.floor(Date.now() / 1000)) - ) { +} - const deadline = Math.floor(Date.now() / 1000) + 2592000 // 1 Month - - const signature = { - types: { - Domain: [ - { name: "name", type: "string" }, - { name: "version", type: "string" }, - { name: "chainId", type: "uint256" }, - { name: "verifyingContract", type: "address" } - ], - PermitSingle: [ - { name: "details", type: "PermitDetails" }, - { name: "spender", type: "address" }, - { name: "sigDeadline", type: "uint256" } - ], - PermitDetails: [ - { name: "token", type: "address" }, - { name: "amount", type: "uint160" }, - { name: "expiration", type: "uint48" }, - { name: "nonce", type: "uint48" } - ] - }, - primaryType: "PermitSingle", - domain: { - chainId: Blockchains[blockchain].networkId, - name: "Permit2", - verifyingContract: exchange[blockchain].permit.address, - version: "1" - }, - message: { - details: { - token: tokenIn, - amount: "1461501637330902918203684832716283019655932542975", // max uint160 - expiration: deadline, - nonce: allowanceWithinPermit2.nonce - }, - spender: exchange[blockchain].router.address, - sigDeadline: deadline - } - } +let packPath = (pools)=>{ + if(pools.length == 1) { + return ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]) + } else if (pools.length == 2) { + return ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]) + } else { + throw 'more than 2 pools not supported!' + } +} - return { signature } - } +let packPathReverse = (pools)=>{ + if(pools.length == 1) { + return ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[1], pools[0].fee, pools[0].path[0]]) + } else if (pools.length == 2) { + return ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[1].path[1], pools[1].fee, pools[1].path[0], pools[0].fee, pools[0].path[0]]) + } else { + throw 'more than 2 pools not supported!' } } @@ -422,85 +380,57 @@ let getTransaction = async({ amountInMaxInput, amountOutMinInput, account, - permit2, inputTokenPushed, }) => { - let commands = [] - let inputs = [] let value = "0" + const contract = new ethers.Contract(exchange[blockchain].router.address, exchange[blockchain].router.api) + const exactInput = !!(amountOutMinInput || amountInInput) + const wrapETH = path[0] === Blockchains[blockchain].currency.address + const unwrapETH = path[path.length-1] === Blockchains[blockchain].currency.address + const recipient = unwrapETH ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT + const refundETH = wrapETH || unwrapETH - if(permit2) { - const length = ethers.utils.arrayify(permit2.signature).length - let signature - if (length === SIGNATURE_LENGTH || length === EIP_2098_SIGNATURE_LENGTH) { - signature = ethers.utils.joinSignature(ethers.utils.splitSignature(permit2.signature)) - } - commands.push("0a") // PERMIT2_PERMIT - inputs.push( - ethers.utils.defaultAbiCoder.encode( - [PERMIT_STRUCT, "bytes"], - [permit2, signature] - ) - ) - } + let multicalls = [] - if (path[0] === Blockchains[blockchain].currency.address) { - commands.push("0b") // WRAP_ETH - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [ROUTER_AS_RECIPIENT, (amountIn || amountInMax).toString()] - ) - ) + if (wrapETH) { value = (amountIn || amountInMax).toString() + if(exactInput) { // exactOut does not need to wrapETH! + multicalls.push( + contract.interface.encodeFunctionData('wrapETH', [(amountIn || amountInMax)]) + ) + } } - - let packedPath - if(pools.length === 1) { - packedPath = ethers.utils.solidityPack(["address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1]]) - } else if(pools.length === 2) { - packedPath = ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [pools[0].path[0], pools[0].fee, pools[0].path[1], pools[1].fee, pools[1].path[1]]) - } - - if (amountOutMinInput || amountInInput) { - commands.push("00") // V3_SWAP_EXACT_IN (minimum out) - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains[blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountIn || amountInMax).toString(), - (amountOut || amountOutMin).toString(), - packedPath, - path[0] === Blockchains[blockchain].currency.address ? false : !inputTokenPushed - ] - ) + if (exactInput) { + multicalls.push( + contract.interface.encodeFunctionData('exactInput', [{ + path: packPath(pools), + amountIn: wrapETH ? 0 : (amountIn || amountInMax), + amountOutMinimum: amountOutMin, + recipient + }]) ) } else { - commands.push("01") // V3_SWAP_EXACT_OUT (maximum in) - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "bytes", "bool"], - [ - path[path.length-1] === Blockchains[blockchain].currency.address ? ROUTER_AS_RECIPIENT : SENDER_AS_RECIPIENT, - (amountOut || amountOutMin).toString(), - (amountIn || amountInMax).toString(), - packedPath, - path[0] === Blockchains[blockchain].currency.address ? false : !inputTokenPushed - ] - ) + multicalls.push( + contract.interface.encodeFunctionData('exactOutput', [{ + path: packPathReverse(pools), + amountOut, + amountInMaximum: amountInMax, + recipient + }]) ) } - if (path[path.length-1] === Blockchains[blockchain].currency.address) { - commands.push("0c") // UNWRAP_WETH - inputs.push( - ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [SENDER_AS_RECIPIENT, (amountOut || amountOutMin).toString()] - ) + if (unwrapETH) { + multicalls.push( + contract.interface.encodeFunctionData('unwrapWETH9(uint256)', [amountOut || amountOutMin]) + ) + } + + if(refundETH) { + multicalls.push( + contract.interface.encodeFunctionData('refundETH') ) } @@ -509,18 +439,15 @@ let getTransaction = async({ from: account, to: exchange[blockchain].router.address, api: exchange[blockchain].router.api, - method: 'execute', - params: { - commands: `0x${commands.join('')}`, - inputs, - }, + method: 'multicall', + params: { data: multicalls }, value } return transaction } -const ROUTER = [{"inputs":[{"components":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"weth9","type":"address"},{"internalType":"address","name":"seaportV1_5","type":"address"},{"internalType":"address","name":"seaportV1_4","type":"address"},{"internalType":"address","name":"openseaConduit","type":"address"},{"internalType":"address","name":"nftxZap","type":"address"},{"internalType":"address","name":"x2y2","type":"address"},{"internalType":"address","name":"foundation","type":"address"},{"internalType":"address","name":"sudoswap","type":"address"},{"internalType":"address","name":"elementMarket","type":"address"},{"internalType":"address","name":"nft20Zap","type":"address"},{"internalType":"address","name":"cryptopunks","type":"address"},{"internalType":"address","name":"looksRareV2","type":"address"},{"internalType":"address","name":"routerRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareToken","type":"address"},{"internalType":"address","name":"v2Factory","type":"address"},{"internalType":"address","name":"v3Factory","type":"address"},{"internalType":"bytes32","name":"pairInitCodeHash","type":"bytes32"},{"internalType":"bytes32","name":"poolInitCodeHash","type":"bytes32"}],"internalType":"struct RouterParameters","name":"params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BalanceTooLow","type":"error"},{"inputs":[],"name":"BuyPunkFailed","type":"error"},{"inputs":[],"name":"ContractLocked","type":"error"},{"inputs":[],"name":"ETHNotAccepted","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandIndex","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"ExecutionFailed","type":"error"},{"inputs":[],"name":"FromAddressIsNotOwner","type":"error"},{"inputs":[],"name":"InsufficientETH","type":"error"},{"inputs":[],"name":"InsufficientToken","type":"error"},{"inputs":[],"name":"InvalidBips","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandType","type":"uint256"}],"name":"InvalidCommandType","type":"error"},{"inputs":[],"name":"InvalidOwnerERC1155","type":"error"},{"inputs":[],"name":"InvalidOwnerERC721","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"InvalidSpender","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"SliceOutOfBounds","type":"error"},{"inputs":[],"name":"TransactionDeadlinePassed","type":"error"},{"inputs":[],"name":"UnableToClaim","type":"error"},{"inputs":[],"name":"UnsafeCast","type":"error"},{"inputs":[],"name":"V2InvalidPath","type":"error"},{"inputs":[],"name":"V2TooLittleReceived","type":"error"},{"inputs":[],"name":"V2TooMuchRequested","type":"error"},{"inputs":[],"name":"V3InvalidAmountOut","type":"error"},{"inputs":[],"name":"V3InvalidCaller","type":"error"},{"inputs":[],"name":"V3InvalidSwap","type":"error"},{"inputs":[],"name":"V3TooLittleReceived","type":"error"},{"inputs":[],"name":"V3TooMuchRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsSent","type":"event"},{"inputs":[{"internalType":"bytes","name":"looksRareClaim","type":"bytes"}],"name":"collectRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] +const ROUTER = [{"inputs":[{"internalType":"address","name":"_factoryV2","type":"address"},{"internalType":"address","name":"factoryV3","type":"address"},{"internalType":"address","name":"_positionManager","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMax","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"approveZeroThenMaxMinusOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callPositionManager","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"paths","type":"bytes[]"},{"internalType":"uint128[]","name":"amounts","type":"uint128[]"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint24","name":"maximumTickDivergence","type":"uint24"},{"internalType":"uint32","name":"secondsAgo","type":"uint32"}],"name":"checkOracleSlippage","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getApprovalType","outputs":[{"internalType":"enum IApproveAndCall.ApprovalType","name":"","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"internalType":"struct IApproveAndCall.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IApproveAndCall.MintParams","name":"params","type":"tuple"}],"name":"mint","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"previousBlockhash","type":"bytes32"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"pull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"wrapETH","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}] const FACTORY = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":true,"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"FeeAmountEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"},{"indexed":false,"internalType":"int24","name":"tickSpacing","type":"int24"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"createPool","outputs":[{"internalType":"address","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"enableFeeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"feeAmountTickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint24","name":"","type":"uint24"}],"name":"getPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameters","outputs":[{"internalType":"address","name":"factory","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}] const POOL = [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint128","name":"amount0","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"amount1","type":"uint128"}],"name":"CollectProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paid1","type":"uint256"}],"name":"Flash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextOld","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"observationCardinalityNextNew","type":"uint16"}],"name":"IncreaseObservationCardinalityNext","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":true,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"feeProtocol0Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1Old","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol0New","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"feeProtocol1New","type":"uint8"}],"name":"SetFeeProtocol","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"},{"indexed":false,"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"},{"indexed":false,"internalType":"int24","name":"tick","type":"int24"}],"name":"Swap","type":"event"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Requested","type":"uint128"},{"internalType":"uint128","name":"amount1Requested","type":"uint128"}],"name":"collectProtocol","outputs":[{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal0X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeGrowthGlobal1X128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"}],"name":"increaseObservationCardinalityNext","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLiquidityPerTick","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"},{"internalType":"int56","name":"tickCumulative","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityCumulativeX128","type":"uint160"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"secondsAgos","type":"uint32[]"}],"name":"observe","outputs":[{"internalType":"int56[]","name":"tickCumulatives","type":"int56[]"},{"internalType":"uint160[]","name":"secondsPerLiquidityCumulativeX128s","type":"uint160[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"positions","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"token0","type":"uint128"},{"internalType":"uint128","name":"token1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"feeProtocol0","type":"uint8"},{"internalType":"uint8","name":"feeProtocol1","type":"uint8"}],"name":"setFeeProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slot0","outputs":[{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"uint16","name":"observationIndex","type":"uint16"},{"internalType":"uint16","name":"observationCardinality","type":"uint16"},{"internalType":"uint16","name":"observationCardinalityNext","type":"uint16"},{"internalType":"uint8","name":"feeProtocol","type":"uint8"},{"internalType":"bool","name":"unlocked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"snapshotCumulativesInside","outputs":[{"internalType":"int56","name":"tickCumulativeInside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityInsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsInside","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"amountSpecified","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int16","name":"","type":"int16"}],"name":"tickBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"ticks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"feeGrowthOutside0X128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthOutside1X128","type":"uint256"},{"internalType":"int56","name":"tickCumulativeOutside","type":"int56"},{"internalType":"uint160","name":"secondsPerLiquidityOutsideX128","type":"uint160"},{"internalType":"uint32","name":"secondsOutside","type":"uint32"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] const QUOTER = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"quoteExactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactInputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"quoteExactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160[]","name":"sqrtPriceX96AfterList","type":"uint160[]"},{"internalType":"uint32[]","name":"initializedTicksCrossedList","type":"uint32[]"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IQuoterV2.QuoteExactOutputSingleParams","name":"params","type":"tuple"}],"name":"quoteExactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceX96After","type":"uint160"},{"internalType":"uint32","name":"initializedTicksCrossed","type":"uint32"},{"internalType":"uint256","name":"gasEstimate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"path","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"view","type":"function"}] diff --git a/tests/units/exchanges/uniswap_v3/basics.evm.spec.js b/tests/units/exchanges/uniswap_v3/basics.evm.spec.js index 85e6548..d219af7 100644 --- a/tests/units/exchanges/uniswap_v3/basics.evm.spec.js +++ b/tests/units/exchanges/uniswap_v3/basics.evm.spec.js @@ -8,12 +8,12 @@ describe('uniswap_v3', () => { it('provides basic structured data for uniswap_v3', ()=> { let exchange = Exchanges.uniswap_v3 expect(exchange.name).toEqual('uniswap_v3') - expect(exchange.blockchains).toEqual(['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum']) + expect(exchange.blockchains).toEqual(['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche']) expect(exchange.label).toEqual('Uniswap v3') expect(exchange.logo).toEqual('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGRhdGEtdGVzdGlkPSJ1bmlzd2FwLWxvZ28iIGNsYXNzPSJyZ3c2ZXo0NHAgcmd3NmV6NGVqIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMjAuMzUyNiAxOS45MjQyQzIwLjI5MjggMjAuMTU0OSAyMC4xODg1IDIwLjM3MTUgMjAuMDQ1NSAyMC41NjE4QzE5Ljc3OTMgMjAuOTA4OCAxOS40MjcgMjEuMTc5NCAxOS4wMjM5IDIxLjM0NjZDMTguNjYxNCAyMS41MDM1IDE4LjI3NzQgMjEuNjA1IDE3Ljg4NDkgMjEuNjQ3NUMxNy44MDQyIDIxLjY1NzggMTcuNzIwNiAyMS42NjQxIDE3LjYzOTUgMjEuNjcwM0wxNy42MjYzIDIxLjY3MTNDMTcuMzc3NyAyMS42ODA4IDE3LjEzODcgMjEuNzcgMTYuOTQ0MiAyMS45MjU4QzE2Ljc0OTcgMjIuMDgxNyAxNi42MSAyMi4yOTYgMTYuNTQ1NSAyMi41MzczQzE2LjUxNiAyMi42NTc0IDE2LjQ5NCAyMi43NzkyIDE2LjQ3OTggMjIuOTAyMUMxNi40NTcyIDIzLjA4NzQgMTYuNDQ1NiAyMy4yNzcxIDE2LjQzMyAyMy40ODIzQzE2LjQyNCAyMy42Mjk1IDE2LjQxNDQgMjMuNzg0OCAxNi40IDIzLjk1MjFDMTYuMzE1NiAyNC42MzM3IDE2LjExOTMgMjUuMjk2NSAxNS44MTkyIDI1LjkxMzZDMTUuNzU3OSAyNi4wNDMzIDE1LjY5NTQgMjYuMTY5MS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router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.ethereum.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.ethereum.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.ethereum.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.ethereum.factory.api).toEqual(UniswapV3.FACTORY) @@ -21,7 +21,7 @@ describe('uniswap_v3', () => { expect(exchange.ethereum.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.ethereum.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.bsc.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.bsc.router.address).toEqual('0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2') expect(exchange.bsc.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.bsc.factory.address).toEqual('0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7') expect(exchange.bsc.factory.api).toEqual(UniswapV3.FACTORY) @@ -29,7 +29,7 @@ describe('uniswap_v3', () => { expect(exchange.bsc.quoter.address).toEqual('0x78D78E420Da98ad378D7799bE8f4AF69033EB077') expect(exchange.bsc.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.polygon.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.polygon.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.polygon.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.polygon.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.polygon.factory.api).toEqual(UniswapV3.FACTORY) @@ -37,7 +37,7 @@ describe('uniswap_v3', () => { expect(exchange.polygon.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.polygon.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.optimism.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.optimism.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.optimism.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.optimism.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.optimism.factory.api).toEqual(UniswapV3.FACTORY) @@ -45,7 +45,7 @@ describe('uniswap_v3', () => { expect(exchange.optimism.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.optimism.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.arbitrum.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.arbitrum.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.arbitrum.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.arbitrum.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.arbitrum.factory.api).toEqual(UniswapV3.FACTORY) @@ -53,6 +53,22 @@ describe('uniswap_v3', () => { expect(exchange.arbitrum.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.arbitrum.quoter.api).toEqual(UniswapV3.QUOTER) + expect(exchange.base.router.address).toEqual('0x2626664c2603336E57B271c5C0b26F421741e481') + expect(exchange.base.router.api).toEqual(UniswapV3.ROUTER) + expect(exchange.base.factory.address).toEqual('0x33128a8fC17869897dcE68Ed026d694621f6FDfD') + expect(exchange.base.factory.api).toEqual(UniswapV3.FACTORY) + expect(exchange.base.pool.api).toEqual(UniswapV3.POOL) + expect(exchange.base.quoter.address).toEqual('0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a') + expect(exchange.base.quoter.api).toEqual(UniswapV3.QUOTER) + + expect(exchange.avalanche.router.address).toEqual('0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE') + expect(exchange.avalanche.router.api).toEqual(UniswapV3.ROUTER) + expect(exchange.avalanche.factory.address).toEqual('0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD') + expect(exchange.avalanche.factory.api).toEqual(UniswapV3.FACTORY) + expect(exchange.avalanche.pool.api).toEqual(UniswapV3.POOL) + expect(exchange.avalanche.quoter.address).toEqual('0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F') + expect(exchange.avalanche.quoter.api).toEqual(UniswapV3.QUOTER) + }) }) }) diff --git a/tests/units/exchanges/uniswap_v3/basics.spec.js b/tests/units/exchanges/uniswap_v3/basics.spec.js index 4b1a2d5..5f0ece2 100644 --- a/tests/units/exchanges/uniswap_v3/basics.spec.js +++ b/tests/units/exchanges/uniswap_v3/basics.spec.js @@ -8,12 +8,12 @@ describe('uniswap_v3', () => { it('provides basic structured data for uniswap_v3', ()=> { let exchange = Exchanges.uniswap_v3 expect(exchange.name).toEqual('uniswap_v3') - expect(exchange.blockchains).toEqual(['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum']) + expect(exchange.blockchains).toEqual(['ethereum', 'bsc', 'polygon', 'optimism', 'arbitrum', 'base', 'avalanche']) expect(exchange.label).toEqual('Uniswap v3') expect(exchange.logo).toEqual('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGRhdGEtdGVzdGlkPSJ1bmlzd2FwLWxvZ28iIGNsYXNzPSJyZ3c2ZXo0NHAgcmd3NmV6NGVqIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMjAuMzUyNiAxOS45MjQyQzIwLjI5MjggMjAuMTU0OSAyMC4xODg1IDIwLjM3MTUgMjAuMDQ1NSAyMC41NjE4QzE5Ljc3OTMgMjAuOTA4OCAxOS40MjcgMjEuMTc5NCAxOS4wMjM5IDIxLjM0NjZDMTgu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yAyOS40NjI5IDM5LjUxMDJMMjkuNzMxMiAzOS41MTY2QzI5LjkxNTcgMzkuNTAzNCAzMC4wOTkgMzkuNDc3IDMwLjI3OTcgMzkuNDM3NkMzMC42NTQxIDM5LjM0OTIgMzEuMDE5IDM5LjIyNDEgMzEuMzY5MSAzOS4wNjQyTDMxLjMxODcgMzkuMTA0NlpNMjEuMDgwMSAzNi45NjE5QzIxLjExMjMgMzYuOTk4OSAyMS4xNDQ5IDM3LjAzNTUgMjEuMTc3OSAzNy4wNzE4QzIxLjE2NDQgMzcuMDU2NyAyMS4xNTEgMzcuMDQxNSAyMS4xMzc1IDM3LjAyNjRMMjEuMTM3NSAzNy4wMjY0TDIxLjEzNzUgMzcuMDI2NEwyMS4xMzc1IDM3LjAyNjRDMjEuMTE4NCAzNy4wMDQ5IDIxLjA5OTMgMzYuOTgzNCAyMS4wODAxIDM2Ljk2MTlaIiBmaWxsPSJjdXJyZW50Q29sb3IiPjwvcGF0aD48L3N2Zz4K') expect(exchange.slippage).toEqual(true) - expect(exchange.ethereum.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.ethereum.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.ethereum.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.ethereum.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.ethereum.factory.api).toEqual(UniswapV3.FACTORY) @@ -21,7 +21,7 @@ describe('uniswap_v3', () => { expect(exchange.ethereum.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.ethereum.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.bsc.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.bsc.router.address).toEqual('0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2') expect(exchange.bsc.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.bsc.factory.address).toEqual('0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7') expect(exchange.bsc.factory.api).toEqual(UniswapV3.FACTORY) @@ -29,7 +29,7 @@ describe('uniswap_v3', () => { expect(exchange.bsc.quoter.address).toEqual('0x78D78E420Da98ad378D7799bE8f4AF69033EB077') expect(exchange.bsc.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.polygon.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.polygon.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.polygon.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.polygon.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.polygon.factory.api).toEqual(UniswapV3.FACTORY) @@ -37,7 +37,7 @@ describe('uniswap_v3', () => { expect(exchange.polygon.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.polygon.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.optimism.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.optimism.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.optimism.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.optimism.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.optimism.factory.api).toEqual(UniswapV3.FACTORY) @@ -45,7 +45,7 @@ describe('uniswap_v3', () => { expect(exchange.optimism.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.optimism.quoter.api).toEqual(UniswapV3.QUOTER) - expect(exchange.arbitrum.router.address).toEqual('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad') + expect(exchange.arbitrum.router.address).toEqual('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45') expect(exchange.arbitrum.router.api).toEqual(UniswapV3.ROUTER) expect(exchange.arbitrum.factory.address).toEqual('0x1F98431c8aD98523631AE4a59f267346ea31F984') expect(exchange.arbitrum.factory.api).toEqual(UniswapV3.FACTORY) @@ -53,6 +53,22 @@ describe('uniswap_v3', () => { expect(exchange.arbitrum.quoter.address).toEqual('0x61fFE014bA17989E743c5F6cB21bF9697530B21e') expect(exchange.arbitrum.quoter.api).toEqual(UniswapV3.QUOTER) + expect(exchange.base.router.address).toEqual('0x2626664c2603336E57B271c5C0b26F421741e481') + expect(exchange.base.router.api).toEqual(UniswapV3.ROUTER) + expect(exchange.base.factory.address).toEqual('0x33128a8fC17869897dcE68Ed026d694621f6FDfD') + expect(exchange.base.factory.api).toEqual(UniswapV3.FACTORY) + expect(exchange.base.pool.api).toEqual(UniswapV3.POOL) + expect(exchange.base.quoter.address).toEqual('0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a') + expect(exchange.base.quoter.api).toEqual(UniswapV3.QUOTER) + + expect(exchange.avalanche.router.address).toEqual('0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE') + expect(exchange.avalanche.router.api).toEqual(UniswapV3.ROUTER) + expect(exchange.avalanche.factory.address).toEqual('0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD') + expect(exchange.avalanche.factory.api).toEqual(UniswapV3.FACTORY) + expect(exchange.avalanche.pool.api).toEqual(UniswapV3.POOL) + expect(exchange.avalanche.quoter.address).toEqual('0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F') + expect(exchange.avalanche.quoter.api).toEqual(UniswapV3.QUOTER) + }) }) }) diff --git a/tests/units/exchanges/uniswap_v3/route.evm.spec.js b/tests/units/exchanges/uniswap_v3/route.evm.spec.js index fda02e4..2527ccf 100644 --- a/tests/units/exchanges/uniswap_v3/route.evm.spec.js +++ b/tests/units/exchanges/uniswap_v3/route.evm.spec.js @@ -163,19 +163,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b1f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) @@ -232,19 +221,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) @@ -293,19 +271,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c0000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) @@ -354,19 +321,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b1f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) }) @@ -432,25 +388,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x010c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x496169970000000000000000000000000000000000000000000000000de0b6b3a7640000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -506,25 +454,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x000c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x496169970000000000000000000000000000000000000000000000000de0b6b3a7640000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -572,25 +512,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x000c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x4961699700000000000000000000000000000000000000000000000254beb02d1dcc0000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -638,25 +570,18 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x010c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x4961699700000000000000000000000000000000000000000000000254beb02d1dcc0000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -723,25 +648,16 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountInBN.add(slippage).toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x12210e8a') expect(transaction.value).toEqual(fetchedAmountInBN.add(slippage).toString()) }) @@ -797,25 +713,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountInBN.add(slippage).toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data[0]).toEqual('0x1c58db4f00000000000000000000000000000000000000000000000257ba858980818000') + expect([ + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[1])).toEqual(true) + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual(fetchedAmountInBN.add(slippage).toString()) }) @@ -863,25 +771,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - amountInBN.toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data[0]).toEqual('0x1c58db4f0000000000000000000000000000000000000000000000000de0b6b3a7640000') + expect([ + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[1])).toEqual(true) + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual(amountInBN.toString()) }) @@ -929,25 +829,16 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - amountInBN.toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x12210e8a') expect(transaction.value).toEqual(amountInBN.toString()) }) }) @@ -1032,19 +923,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb84200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) @@ -1119,19 +1006,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) @@ -1196,19 +1079,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) @@ -1273,19 +1152,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb84200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) }) diff --git a/tests/units/exchanges/uniswap_v3/route.spec.js b/tests/units/exchanges/uniswap_v3/route.spec.js index 3e2bde4..00dc008 100644 --- a/tests/units/exchanges/uniswap_v3/route.spec.js +++ b/tests/units/exchanges/uniswap_v3/route.spec.js @@ -163,19 +163,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b1f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) @@ -232,19 +221,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) @@ -293,19 +271,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c0000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) @@ -354,19 +321,8 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data).toEqual(["0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b1f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000"]) expect(transaction.value).toEqual('0') }) }) @@ -432,25 +388,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x010c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x496169970000000000000000000000000000000000000000000000000de0b6b3a7640000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -506,25 +454,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x000c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000257ba8589808180000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x496169970000000000000000000000000000000000000000000000000de0b6b3a7640000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -572,25 +512,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x000c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x4961699700000000000000000000000000000000000000000000000254beb02d1dcc0000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -638,25 +570,18 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x010c') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address]), - true - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x4961699700000000000000000000000000000000000000000000000254beb02d1dcc0000') + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual('0') }) @@ -723,25 +648,16 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountInBN.add(slippage).toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0x09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000257ba858980818000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x12210e8a') expect(transaction.value).toEqual(fetchedAmountInBN.add(slippage).toString()) }) @@ -797,25 +713,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - fetchedAmountInBN.add(slippage).toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data[0]).toEqual('0x1c58db4f00000000000000000000000000000000000000000000000257ba858980818000') + expect([ + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[1])).toEqual(true) + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual(fetchedAmountInBN.add(slippage).toString()) }) @@ -863,25 +771,17 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - amountInBN.toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect(transaction.params.data[0]).toEqual('0x1c58db4f0000000000000000000000000000000000000000000000000de0b6b3a7640000') + expect([ + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002b0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002b4200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002b82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + '0xb858183f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000254beb02d1dcc0000000000000000000000000000000000000000000000000000000000000000002bb31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000', + ].includes(transaction.params.data[1])).toEqual(true) + expect(transaction.params.data[2]).toEqual('0x12210e8a') expect(transaction.value).toEqual(amountInBN.toString()) }) @@ -929,25 +829,16 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x0b01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256"], - [ - "0x0000000000000000000000000000000000000002", - amountInBN.toString(), - ] - ), - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address"], [Blockchains[blockchain].wrapped.address, fee, tokenOut]), - false - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000002ba0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) + expect(transaction.params.data[1]).toEqual('0x12210e8a') expect(transaction.value).toEqual(amountInBN.toString()) }) }) @@ -1032,19 +923,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountOutBN.toString(), - fetchedAmountInBN.add(slippage).toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb84200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) @@ -1119,19 +1006,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountInBN.add(slippage).toString(), - amountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000257ba85898081800000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) @@ -1196,19 +1079,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x00') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - amountInBN.toString(), - fetchedAmountOutBN.toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb84200000000000000000000000000000000000006000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + '0xb858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000000000000000042a0bed124a09ac2bd941b10349d8d224fe3c955eb000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb81f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) @@ -1273,19 +1152,15 @@ describe('uniswap_v3', () => { expect(transaction.from).toEqual(fromAddress) expect(transaction.to).toEqual(exchange[blockchain].router.address) expect(transaction.api).toEqual(exchange[blockchain].router.api) - expect(transaction.method).toEqual('execute') - expect(transaction.params.commands).toEqual('0x01') - expect(transaction.params.inputs).toEqual([ - ethers.utils.defaultAbiCoder.encode(["address", "uint256", "uint256", "bytes", "bool"], - [ - "0x0000000000000000000000000000000000000001", - fetchedAmountOutBN.toString(), - amountInBN.toString(), - ethers.utils.solidityPack(["address","uint24","address","uint24","address"], [tokenIn, fee, Blockchains[blockchain].wrapped.address, fee, tokenOut]), - true - ] - ) - ]) + expect(transaction.method).toEqual('multicall') + expect([ + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb80d500b1d8e8ef31e21c99d1db9a6444d3adf1270000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb84200000000000000000000000000000000000006000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb882af49447d8a07e3bd95bd0d56f35241523fbab1000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + '0x09b8134600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000029020c00000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000421f9840a85d5af5bf1d1762f925bdaddc4201f984000bb8b31f66aa3c1e785363f0875a1b74e27b85fd66c7000bb8a0bed124a09ac2bd941b10349d8d224fe3c955eb000000000000000000000000000000000000000000000000000000000000', + ].includes(transaction.params.data[0])).toEqual(true) expect(transaction.value).toEqual('0') }) })