@hyperbridge/sdk 1.3.21 → 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +98 -9
- package/dist/browser/index.js +1751 -1985
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.d.ts +98 -9
- package/dist/node/index.js +1751 -1985
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import { TextDecoder as TextDecoder$1, TextEncoder as TextEncoder$1 } from 'util';
|
|
4
4
|
import { createConsola, LogLevels } from 'consola';
|
|
5
5
|
import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
|
|
6
|
-
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits, hexToString as hexToString$1 } from 'viem';
|
|
6
|
+
import { toHex, hexToBytes, encodePacked, keccak256, encodeAbiParameters, bytesToHex, concatHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, maxUint256, formatUnits, parseUnits, parseAbiParameters, hexToString as hexToString$1 } from 'viem';
|
|
7
7
|
import mergeRace from '@async-generator/merge-race';
|
|
8
8
|
import { unichain, polygon, gnosisChiado, gnosis, bscTestnet, bsc, soneium, baseSepolia, base, optimismSepolia, optimism, arbitrumSepolia, arbitrum, mainnet, sepolia } from 'viem/chains';
|
|
9
9
|
import { hasWindow, isNode, env } from 'std-env';
|
|
@@ -3451,71 +3451,43 @@ var addresses = {
|
|
|
3451
3451
|
["EVM-137" /* POLYGON_MAINNET */]: "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
|
|
3452
3452
|
["EVM-130" /* UNICHAIN_MAINNET */]: "0x1F98400000000000000000000000000000000002"
|
|
3453
3453
|
},
|
|
3454
|
-
BatchExecutor: {
|
|
3455
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x4CC58B5D8FBf838d062E4b21F75C327835B5F0ef",
|
|
3456
|
-
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3457
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3458
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3459
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3460
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3461
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3462
|
-
},
|
|
3463
3454
|
UniversalRouter: {
|
|
3464
3455
|
["EVM-97" /* BSC_CHAPEL */]: "0xcc6d5ece3d4a57245bf5a2f64f3ed9179b81f714",
|
|
3465
|
-
["EVM-1" /* MAINNET */]: "
|
|
3466
|
-
["EVM-56" /* BSC_MAINNET */]: "
|
|
3467
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "
|
|
3468
|
-
["EVM-8453" /* BASE_MAINNET */]: "
|
|
3469
|
-
["EVM-137" /* POLYGON_MAINNET */]: "
|
|
3470
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "
|
|
3471
|
-
},
|
|
3472
|
-
UniswapV3Router: {
|
|
3473
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3474
|
-
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3475
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3476
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3477
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3478
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3479
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3480
|
-
},
|
|
3481
|
-
UniswapV3Factory: {
|
|
3482
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3483
|
-
["EVM-1" /* MAINNET */]: "0x1F98431c8aD98523631AE4a59f267346ea31F984",
|
|
3484
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3485
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3486
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3487
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3488
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3456
|
+
["EVM-1" /* MAINNET */]: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
|
|
3457
|
+
["EVM-56" /* BSC_MAINNET */]: "0xd9C500DfF816a1Da21A48A732d3498Bf09dc9AEB",
|
|
3458
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0xa51afafe0263b40edaef0df8781ea9aa03e381a3",
|
|
3459
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x6ff5693b99212da76ad316178a184ab56d299b43",
|
|
3460
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x1095692a6237d83c6a72f3f5efedb9a670c49223",
|
|
3461
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0xef740bf23acae26f6492b10de645d6b98dc8eaf3"
|
|
3489
3462
|
},
|
|
3490
3463
|
UniswapV3Quoter: {
|
|
3491
3464
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3492
3465
|
["EVM-1" /* MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3493
|
-
["EVM-56" /* BSC_MAINNET */]: "
|
|
3494
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "
|
|
3495
|
-
["EVM-8453" /* BASE_MAINNET */]: "
|
|
3496
|
-
["EVM-137" /* POLYGON_MAINNET */]: "
|
|
3497
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "
|
|
3498
|
-
},
|
|
3499
|
-
UniswapV4PoolManager: {
|
|
3500
|
-
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3501
|
-
["EVM-1" /* MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3502
|
-
["EVM-56" /* BSC_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3503
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3504
|
-
["EVM-8453" /* BASE_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3505
|
-
["EVM-137" /* POLYGON_MAINNET */]: "0x0000000000000000000000000000000000000000",
|
|
3506
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "0x0000000000000000000000000000000000000000"
|
|
3466
|
+
["EVM-56" /* BSC_MAINNET */]: "0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997",
|
|
3467
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3468
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",
|
|
3469
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x61fFE014bA17989E743c5F6cB21bF9697530B21e",
|
|
3470
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x385a5cf5f83e99f7bb2852b6a19c3538b9fa7658"
|
|
3507
3471
|
},
|
|
3508
3472
|
UniswapV4Quoter: {
|
|
3509
3473
|
["EVM-97" /* BSC_CHAPEL */]: "0x0000000000000000000000000000000000000000",
|
|
3510
3474
|
["EVM-1" /* MAINNET */]: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203",
|
|
3511
|
-
["EVM-56" /* BSC_MAINNET */]: "
|
|
3512
|
-
["EVM-42161" /* ARBITRUM_MAINNET */]: "
|
|
3513
|
-
["EVM-8453" /* BASE_MAINNET */]: "
|
|
3514
|
-
["EVM-137" /* POLYGON_MAINNET */]: "
|
|
3515
|
-
["EVM-130" /* UNICHAIN_MAINNET */]: "
|
|
3475
|
+
["EVM-56" /* BSC_MAINNET */]: "0xd0737C9762912dD34c3271197E362Aa736Df0926",
|
|
3476
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x3972c00f7ed4885e145823eb7c655375d275a1c5",
|
|
3477
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x0d5e0f971ed27fbff6c2837bf31316121532048d",
|
|
3478
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0xb3d5c3dfc3a7aebff71895a7191796bffc2c81b9",
|
|
3479
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203"
|
|
3516
3480
|
},
|
|
3517
3481
|
Calldispatcher: {
|
|
3518
3482
|
["EVM-11155111" /* SEPOLIA */]: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155"
|
|
3483
|
+
},
|
|
3484
|
+
Permit2: {
|
|
3485
|
+
["EVM-1" /* MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3486
|
+
["EVM-56" /* BSC_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3487
|
+
["EVM-42161" /* ARBITRUM_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3488
|
+
["EVM-8453" /* BASE_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3489
|
+
["EVM-137" /* POLYGON_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
3490
|
+
["EVM-130" /* UNICHAIN_MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
|
|
3519
3491
|
}
|
|
3520
3492
|
};
|
|
3521
3493
|
var createRpcUrls = (env2) => ({
|
|
@@ -3607,27 +3579,18 @@ var ChainConfigService = class {
|
|
|
3607
3579
|
getUniswapV2FactoryAddress(chain) {
|
|
3608
3580
|
return addresses.UniswapV2Factory[chain];
|
|
3609
3581
|
}
|
|
3610
|
-
getBatchExecutorAddress(chain) {
|
|
3611
|
-
return addresses.BatchExecutor[chain];
|
|
3612
|
-
}
|
|
3613
3582
|
getUniversalRouterAddress(chain) {
|
|
3614
3583
|
return addresses.UniversalRouter[chain];
|
|
3615
3584
|
}
|
|
3616
|
-
getUniswapV3RouterAddress(chain) {
|
|
3617
|
-
return addresses.UniswapV3Router[chain];
|
|
3618
|
-
}
|
|
3619
|
-
getUniswapV3FactoryAddress(chain) {
|
|
3620
|
-
return addresses.UniswapV3Factory[chain];
|
|
3621
|
-
}
|
|
3622
3585
|
getUniswapV3QuoterAddress(chain) {
|
|
3623
3586
|
return addresses.UniswapV3Quoter[chain];
|
|
3624
3587
|
}
|
|
3625
|
-
getUniswapV4PoolManagerAddress(chain) {
|
|
3626
|
-
return addresses.UniswapV4PoolManager[chain];
|
|
3627
|
-
}
|
|
3628
3588
|
getUniswapV4QuoterAddress(chain) {
|
|
3629
3589
|
return addresses.UniswapV4Quoter[chain];
|
|
3630
3590
|
}
|
|
3591
|
+
getPermit2Address(chain) {
|
|
3592
|
+
return addresses.Permit2[chain];
|
|
3593
|
+
}
|
|
3631
3594
|
getCoingeckoId(chain) {
|
|
3632
3595
|
return coingeckoIds[chain];
|
|
3633
3596
|
}
|
|
@@ -3736,8 +3699,8 @@ function calculateMMRSize(numberOfLeaves) {
|
|
|
3736
3699
|
}
|
|
3737
3700
|
async function generateRootWithProof(postRequest, treeSize) {
|
|
3738
3701
|
const { generate_root_with_proof: generate_root_with_proof2 } = await load_ckb_mmr();
|
|
3739
|
-
const { commitment: hash, encodePacked:
|
|
3740
|
-
const result = JSON.parse(generate_root_with_proof2(hexToBytes(
|
|
3702
|
+
const { commitment: hash, encodePacked: encodePacked3 } = postRequestCommitment(postRequest);
|
|
3703
|
+
const result = JSON.parse(generate_root_with_proof2(hexToBytes(encodePacked3), treeSize));
|
|
3741
3704
|
const { root, proof, mmr_size, leaf_positions, keccak_hash_calldata } = result;
|
|
3742
3705
|
if (keccak_hash_calldata !== hash) {
|
|
3743
3706
|
console.log("keccak_hash", keccak_hash_calldata);
|
|
@@ -9818,1950 +9781,985 @@ var ABI4 = [
|
|
|
9818
9781
|
];
|
|
9819
9782
|
var IntentGateway_default = { ABI: ABI4 };
|
|
9820
9783
|
|
|
9821
|
-
// src/abis/
|
|
9784
|
+
// src/abis/uniswapV3Quoter.ts
|
|
9822
9785
|
var ABI5 = [
|
|
9823
9786
|
{
|
|
9824
9787
|
inputs: [
|
|
9825
9788
|
{
|
|
9826
|
-
internalType: "
|
|
9827
|
-
name: "
|
|
9828
|
-
type: "
|
|
9789
|
+
internalType: "bytes",
|
|
9790
|
+
name: "path",
|
|
9791
|
+
type: "bytes"
|
|
9792
|
+
},
|
|
9793
|
+
{
|
|
9794
|
+
internalType: "uint256",
|
|
9795
|
+
name: "amountIn",
|
|
9796
|
+
type: "uint256"
|
|
9829
9797
|
}
|
|
9830
9798
|
],
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
},
|
|
9834
|
-
{
|
|
9835
|
-
anonymous: false,
|
|
9836
|
-
inputs: [
|
|
9799
|
+
name: "quoteExactInput",
|
|
9800
|
+
outputs: [
|
|
9837
9801
|
{
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
type: "address"
|
|
9802
|
+
internalType: "uint256",
|
|
9803
|
+
name: "amountOut",
|
|
9804
|
+
type: "uint256"
|
|
9842
9805
|
},
|
|
9843
9806
|
{
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
type: "address"
|
|
9807
|
+
internalType: "uint160[]",
|
|
9808
|
+
name: "sqrtPriceX96AfterList",
|
|
9809
|
+
type: "uint160[]"
|
|
9848
9810
|
},
|
|
9849
9811
|
{
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
type: "address"
|
|
9812
|
+
internalType: "uint32[]",
|
|
9813
|
+
name: "initializedTicksCrossedList",
|
|
9814
|
+
type: "uint32[]"
|
|
9854
9815
|
},
|
|
9855
9816
|
{
|
|
9856
|
-
indexed: false,
|
|
9857
9817
|
internalType: "uint256",
|
|
9858
|
-
name: "",
|
|
9818
|
+
name: "gasEstimate",
|
|
9859
9819
|
type: "uint256"
|
|
9860
9820
|
}
|
|
9861
9821
|
],
|
|
9862
|
-
|
|
9863
|
-
type: "
|
|
9864
|
-
},
|
|
9865
|
-
{
|
|
9866
|
-
anonymous: false,
|
|
9867
|
-
inputs: [
|
|
9868
|
-
{
|
|
9869
|
-
indexed: false,
|
|
9870
|
-
internalType: "address",
|
|
9871
|
-
name: "feeCollector_",
|
|
9872
|
-
type: "address"
|
|
9873
|
-
}
|
|
9874
|
-
],
|
|
9875
|
-
name: "SetFeeCollector",
|
|
9876
|
-
type: "event"
|
|
9877
|
-
},
|
|
9878
|
-
{
|
|
9879
|
-
anonymous: false,
|
|
9880
|
-
inputs: [
|
|
9881
|
-
{
|
|
9882
|
-
indexed: false,
|
|
9883
|
-
internalType: "address",
|
|
9884
|
-
name: "feeCollectorSetter_",
|
|
9885
|
-
type: "address"
|
|
9886
|
-
}
|
|
9887
|
-
],
|
|
9888
|
-
name: "SetFeeCollectorSetter",
|
|
9889
|
-
type: "event"
|
|
9822
|
+
stateMutability: "nonpayable",
|
|
9823
|
+
type: "function"
|
|
9890
9824
|
},
|
|
9891
9825
|
{
|
|
9892
|
-
anonymous: false,
|
|
9893
9826
|
inputs: [
|
|
9894
9827
|
{
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9828
|
+
components: [
|
|
9829
|
+
{
|
|
9830
|
+
internalType: "address",
|
|
9831
|
+
name: "tokenIn",
|
|
9832
|
+
type: "address"
|
|
9833
|
+
},
|
|
9834
|
+
{
|
|
9835
|
+
internalType: "address",
|
|
9836
|
+
name: "tokenOut",
|
|
9837
|
+
type: "address"
|
|
9838
|
+
},
|
|
9839
|
+
{
|
|
9840
|
+
internalType: "uint256",
|
|
9841
|
+
name: "amountIn",
|
|
9842
|
+
type: "uint256"
|
|
9843
|
+
},
|
|
9844
|
+
{
|
|
9845
|
+
internalType: "uint24",
|
|
9846
|
+
name: "fee",
|
|
9847
|
+
type: "uint24"
|
|
9848
|
+
},
|
|
9849
|
+
{
|
|
9850
|
+
internalType: "uint160",
|
|
9851
|
+
name: "sqrtPriceLimitX96",
|
|
9852
|
+
type: "uint160"
|
|
9853
|
+
}
|
|
9854
|
+
],
|
|
9855
|
+
internalType: "struct IQuoterV2.QuoteExactInputSingleParams",
|
|
9856
|
+
name: "params",
|
|
9857
|
+
type: "tuple"
|
|
9899
9858
|
}
|
|
9900
9859
|
],
|
|
9901
|
-
name: "
|
|
9902
|
-
|
|
9903
|
-
},
|
|
9904
|
-
{
|
|
9905
|
-
inputs: [
|
|
9860
|
+
name: "quoteExactInputSingle",
|
|
9861
|
+
outputs: [
|
|
9906
9862
|
{
|
|
9907
9863
|
internalType: "uint256",
|
|
9908
|
-
name: "",
|
|
9864
|
+
name: "amountOut",
|
|
9909
9865
|
type: "uint256"
|
|
9910
|
-
}
|
|
9911
|
-
],
|
|
9912
|
-
name: "allPairs",
|
|
9913
|
-
outputs: [
|
|
9866
|
+
},
|
|
9914
9867
|
{
|
|
9915
|
-
internalType: "
|
|
9916
|
-
name: "",
|
|
9917
|
-
type: "
|
|
9918
|
-
}
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
inputs: [],
|
|
9925
|
-
name: "allPairsLength",
|
|
9926
|
-
outputs: [
|
|
9868
|
+
internalType: "uint160",
|
|
9869
|
+
name: "sqrtPriceX96After",
|
|
9870
|
+
type: "uint160"
|
|
9871
|
+
},
|
|
9872
|
+
{
|
|
9873
|
+
internalType: "uint32",
|
|
9874
|
+
name: "initializedTicksCrossed",
|
|
9875
|
+
type: "uint32"
|
|
9876
|
+
},
|
|
9927
9877
|
{
|
|
9928
9878
|
internalType: "uint256",
|
|
9929
|
-
name: "",
|
|
9879
|
+
name: "gasEstimate",
|
|
9930
9880
|
type: "uint256"
|
|
9931
9881
|
}
|
|
9932
9882
|
],
|
|
9933
|
-
stateMutability: "
|
|
9883
|
+
stateMutability: "nonpayable",
|
|
9934
9884
|
type: "function"
|
|
9935
9885
|
},
|
|
9936
9886
|
{
|
|
9937
9887
|
inputs: [
|
|
9938
9888
|
{
|
|
9939
|
-
internalType: "
|
|
9940
|
-
name: "
|
|
9941
|
-
type: "
|
|
9889
|
+
internalType: "bytes",
|
|
9890
|
+
name: "path",
|
|
9891
|
+
type: "bytes"
|
|
9942
9892
|
},
|
|
9943
9893
|
{
|
|
9944
|
-
internalType: "
|
|
9945
|
-
name: "
|
|
9946
|
-
type: "
|
|
9894
|
+
internalType: "uint256",
|
|
9895
|
+
name: "amountOut",
|
|
9896
|
+
type: "uint256"
|
|
9947
9897
|
}
|
|
9948
9898
|
],
|
|
9949
|
-
name: "
|
|
9899
|
+
name: "quoteExactOutput",
|
|
9950
9900
|
outputs: [
|
|
9951
9901
|
{
|
|
9952
|
-
internalType: "
|
|
9953
|
-
name: "
|
|
9954
|
-
type: "
|
|
9902
|
+
internalType: "uint256",
|
|
9903
|
+
name: "amountIn",
|
|
9904
|
+
type: "uint256"
|
|
9905
|
+
},
|
|
9906
|
+
{
|
|
9907
|
+
internalType: "uint160[]",
|
|
9908
|
+
name: "sqrtPriceX96AfterList",
|
|
9909
|
+
type: "uint160[]"
|
|
9910
|
+
},
|
|
9911
|
+
{
|
|
9912
|
+
internalType: "uint32[]",
|
|
9913
|
+
name: "initializedTicksCrossedList",
|
|
9914
|
+
type: "uint32[]"
|
|
9915
|
+
},
|
|
9916
|
+
{
|
|
9917
|
+
internalType: "uint256",
|
|
9918
|
+
name: "gasEstimate",
|
|
9919
|
+
type: "uint256"
|
|
9955
9920
|
}
|
|
9956
9921
|
],
|
|
9957
9922
|
stateMutability: "nonpayable",
|
|
9958
9923
|
type: "function"
|
|
9959
9924
|
},
|
|
9960
9925
|
{
|
|
9961
|
-
inputs: [
|
|
9962
|
-
name: "feeCollector",
|
|
9963
|
-
outputs: [
|
|
9926
|
+
inputs: [
|
|
9964
9927
|
{
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9928
|
+
components: [
|
|
9929
|
+
{
|
|
9930
|
+
internalType: "address",
|
|
9931
|
+
name: "tokenIn",
|
|
9932
|
+
type: "address"
|
|
9933
|
+
},
|
|
9934
|
+
{
|
|
9935
|
+
internalType: "address",
|
|
9936
|
+
name: "tokenOut",
|
|
9937
|
+
type: "address"
|
|
9938
|
+
},
|
|
9939
|
+
{
|
|
9940
|
+
internalType: "uint256",
|
|
9941
|
+
name: "amount",
|
|
9942
|
+
type: "uint256"
|
|
9943
|
+
},
|
|
9944
|
+
{
|
|
9945
|
+
internalType: "uint24",
|
|
9946
|
+
name: "fee",
|
|
9947
|
+
type: "uint24"
|
|
9948
|
+
},
|
|
9949
|
+
{
|
|
9950
|
+
internalType: "uint160",
|
|
9951
|
+
name: "sqrtPriceLimitX96",
|
|
9952
|
+
type: "uint160"
|
|
9953
|
+
}
|
|
9954
|
+
],
|
|
9955
|
+
internalType: "struct IQuoterV2.QuoteExactOutputSingleParams",
|
|
9956
|
+
name: "params",
|
|
9957
|
+
type: "tuple"
|
|
9968
9958
|
}
|
|
9969
9959
|
],
|
|
9970
|
-
|
|
9971
|
-
type: "function"
|
|
9972
|
-
},
|
|
9973
|
-
{
|
|
9974
|
-
inputs: [],
|
|
9975
|
-
name: "feeCollectorSetter",
|
|
9960
|
+
name: "quoteExactOutputSingle",
|
|
9976
9961
|
outputs: [
|
|
9977
9962
|
{
|
|
9978
|
-
internalType: "
|
|
9979
|
-
name: "",
|
|
9980
|
-
type: "
|
|
9963
|
+
internalType: "uint256",
|
|
9964
|
+
name: "amountIn",
|
|
9965
|
+
type: "uint256"
|
|
9966
|
+
},
|
|
9967
|
+
{
|
|
9968
|
+
internalType: "uint160",
|
|
9969
|
+
name: "sqrtPriceX96After",
|
|
9970
|
+
type: "uint160"
|
|
9971
|
+
},
|
|
9972
|
+
{
|
|
9973
|
+
internalType: "uint32",
|
|
9974
|
+
name: "initializedTicksCrossed",
|
|
9975
|
+
type: "uint32"
|
|
9976
|
+
},
|
|
9977
|
+
{
|
|
9978
|
+
internalType: "uint256",
|
|
9979
|
+
name: "gasEstimate",
|
|
9980
|
+
type: "uint256"
|
|
9981
9981
|
}
|
|
9982
9982
|
],
|
|
9983
|
-
stateMutability: "
|
|
9983
|
+
stateMutability: "nonpayable",
|
|
9984
9984
|
type: "function"
|
|
9985
|
+
}
|
|
9986
|
+
];
|
|
9987
|
+
var uniswapV3Quoter_default = { ABI: ABI5 };
|
|
9988
|
+
|
|
9989
|
+
// src/abis/uniswapV4Quoter.ts
|
|
9990
|
+
var UNISWAP_V4_QUOTER_ABI = [
|
|
9991
|
+
{
|
|
9992
|
+
type: "constructor",
|
|
9993
|
+
inputs: [{ name: "_poolManager", type: "address", internalType: "contract IPoolManager" }],
|
|
9994
|
+
stateMutability: "nonpayable"
|
|
9985
9995
|
},
|
|
9986
9996
|
{
|
|
9997
|
+
type: "function",
|
|
9998
|
+
name: "_quoteExactInput",
|
|
9987
9999
|
inputs: [
|
|
9988
10000
|
{
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10001
|
+
name: "params",
|
|
10002
|
+
type: "tuple",
|
|
10003
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10004
|
+
components: [
|
|
10005
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10006
|
+
{
|
|
10007
|
+
name: "path",
|
|
10008
|
+
type: "tuple[]",
|
|
10009
|
+
internalType: "struct PathKey[]",
|
|
10010
|
+
components: [
|
|
10011
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10012
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10013
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10014
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10015
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10016
|
+
]
|
|
10017
|
+
},
|
|
10018
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10019
|
+
]
|
|
10005
10020
|
}
|
|
10006
10021
|
],
|
|
10007
|
-
|
|
10008
|
-
|
|
10022
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10023
|
+
stateMutability: "nonpayable"
|
|
10009
10024
|
},
|
|
10010
10025
|
{
|
|
10011
|
-
|
|
10012
|
-
name: "
|
|
10013
|
-
|
|
10026
|
+
type: "function",
|
|
10027
|
+
name: "_quoteExactInputSingle",
|
|
10028
|
+
inputs: [
|
|
10014
10029
|
{
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10030
|
+
name: "params",
|
|
10031
|
+
type: "tuple",
|
|
10032
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10033
|
+
components: [
|
|
10034
|
+
{
|
|
10035
|
+
name: "poolKey",
|
|
10036
|
+
type: "tuple",
|
|
10037
|
+
internalType: "struct PoolKey",
|
|
10038
|
+
components: [
|
|
10039
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10040
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10041
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10042
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10043
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10044
|
+
]
|
|
10045
|
+
},
|
|
10046
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10047
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10048
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10049
|
+
]
|
|
10018
10050
|
}
|
|
10019
10051
|
],
|
|
10020
|
-
|
|
10021
|
-
|
|
10052
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10053
|
+
stateMutability: "nonpayable"
|
|
10022
10054
|
},
|
|
10023
10055
|
{
|
|
10024
|
-
|
|
10025
|
-
name: "
|
|
10026
|
-
|
|
10056
|
+
type: "function",
|
|
10057
|
+
name: "_quoteExactOutput",
|
|
10058
|
+
inputs: [
|
|
10027
10059
|
{
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10060
|
+
name: "params",
|
|
10061
|
+
type: "tuple",
|
|
10062
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10063
|
+
components: [
|
|
10064
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10065
|
+
{
|
|
10066
|
+
name: "path",
|
|
10067
|
+
type: "tuple[]",
|
|
10068
|
+
internalType: "struct PathKey[]",
|
|
10069
|
+
components: [
|
|
10070
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10071
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10072
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10073
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10074
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10075
|
+
]
|
|
10076
|
+
},
|
|
10077
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10078
|
+
]
|
|
10031
10079
|
}
|
|
10032
10080
|
],
|
|
10033
|
-
|
|
10034
|
-
|
|
10081
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10082
|
+
stateMutability: "nonpayable"
|
|
10035
10083
|
},
|
|
10036
10084
|
{
|
|
10085
|
+
type: "function",
|
|
10086
|
+
name: "_quoteExactOutputSingle",
|
|
10037
10087
|
inputs: [
|
|
10038
10088
|
{
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10089
|
+
name: "params",
|
|
10090
|
+
type: "tuple",
|
|
10091
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10092
|
+
components: [
|
|
10093
|
+
{
|
|
10094
|
+
name: "poolKey",
|
|
10095
|
+
type: "tuple",
|
|
10096
|
+
internalType: "struct PoolKey",
|
|
10097
|
+
components: [
|
|
10098
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10099
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10100
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10101
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10102
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10103
|
+
]
|
|
10104
|
+
},
|
|
10105
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10106
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10107
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10108
|
+
]
|
|
10042
10109
|
}
|
|
10043
10110
|
],
|
|
10044
|
-
name: "
|
|
10045
|
-
|
|
10046
|
-
stateMutability: "nonpayable",
|
|
10047
|
-
type: "function"
|
|
10111
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10112
|
+
stateMutability: "nonpayable"
|
|
10048
10113
|
},
|
|
10049
10114
|
{
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
type: "
|
|
10115
|
+
type: "function",
|
|
10116
|
+
name: "msgSender",
|
|
10117
|
+
inputs: [],
|
|
10118
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
10119
|
+
stateMutability: "view"
|
|
10120
|
+
},
|
|
10121
|
+
{
|
|
10122
|
+
type: "function",
|
|
10123
|
+
name: "poolManager",
|
|
10124
|
+
inputs: [],
|
|
10125
|
+
outputs: [{ name: "", type: "address", internalType: "contract IPoolManager" }],
|
|
10126
|
+
stateMutability: "view"
|
|
10061
10127
|
},
|
|
10062
10128
|
{
|
|
10129
|
+
type: "function",
|
|
10130
|
+
name: "quoteExactInput",
|
|
10063
10131
|
inputs: [
|
|
10064
10132
|
{
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10133
|
+
name: "params",
|
|
10134
|
+
type: "tuple",
|
|
10135
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10136
|
+
components: [
|
|
10137
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10138
|
+
{
|
|
10139
|
+
name: "path",
|
|
10140
|
+
type: "tuple[]",
|
|
10141
|
+
internalType: "struct PathKey[]",
|
|
10142
|
+
components: [
|
|
10143
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10144
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10145
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10146
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10147
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10148
|
+
]
|
|
10149
|
+
},
|
|
10150
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10151
|
+
]
|
|
10068
10152
|
}
|
|
10069
10153
|
],
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
var uniswapV2Factory_default = { ABI: ABI5 };
|
|
10077
|
-
|
|
10078
|
-
// src/abis/uniswapV3Factory.ts
|
|
10079
|
-
var ABI6 = [
|
|
10154
|
+
outputs: [
|
|
10155
|
+
{ name: "amountOut", type: "uint256", internalType: "uint256" },
|
|
10156
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10157
|
+
],
|
|
10158
|
+
stateMutability: "nonpayable"
|
|
10159
|
+
},
|
|
10080
10160
|
{
|
|
10081
|
-
|
|
10161
|
+
type: "function",
|
|
10162
|
+
name: "quoteExactInputSingle",
|
|
10082
10163
|
inputs: [
|
|
10083
10164
|
{
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10165
|
+
name: "params",
|
|
10166
|
+
type: "tuple",
|
|
10167
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10168
|
+
components: [
|
|
10169
|
+
{
|
|
10170
|
+
name: "poolKey",
|
|
10171
|
+
type: "tuple",
|
|
10172
|
+
internalType: "struct PoolKey",
|
|
10173
|
+
components: [
|
|
10174
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10175
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10176
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10177
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10178
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10179
|
+
]
|
|
10180
|
+
},
|
|
10181
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10182
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10183
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10184
|
+
]
|
|
10094
10185
|
}
|
|
10095
10186
|
],
|
|
10096
|
-
|
|
10097
|
-
|
|
10187
|
+
outputs: [
|
|
10188
|
+
{ name: "amountOut", type: "uint256", internalType: "uint256" },
|
|
10189
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10190
|
+
],
|
|
10191
|
+
stateMutability: "nonpayable"
|
|
10098
10192
|
},
|
|
10099
10193
|
{
|
|
10100
|
-
|
|
10194
|
+
type: "function",
|
|
10195
|
+
name: "quoteExactOutput",
|
|
10101
10196
|
inputs: [
|
|
10102
10197
|
{
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10198
|
+
name: "params",
|
|
10199
|
+
type: "tuple",
|
|
10200
|
+
internalType: "struct IV4Quoter.QuoteExactParams",
|
|
10201
|
+
components: [
|
|
10202
|
+
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
10203
|
+
{
|
|
10204
|
+
name: "path",
|
|
10205
|
+
type: "tuple[]",
|
|
10206
|
+
internalType: "struct PathKey[]",
|
|
10207
|
+
components: [
|
|
10208
|
+
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
10209
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10210
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10211
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
10212
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10213
|
+
]
|
|
10214
|
+
},
|
|
10215
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
10216
|
+
]
|
|
10113
10217
|
}
|
|
10114
10218
|
],
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
inputs: [
|
|
10121
|
-
{
|
|
10122
|
-
indexed: true,
|
|
10123
|
-
internalType: "address",
|
|
10124
|
-
name: "token0",
|
|
10125
|
-
type: "address"
|
|
10126
|
-
},
|
|
10127
|
-
{
|
|
10128
|
-
indexed: true,
|
|
10129
|
-
internalType: "address",
|
|
10130
|
-
name: "token1",
|
|
10131
|
-
type: "address"
|
|
10132
|
-
},
|
|
10133
|
-
{
|
|
10134
|
-
indexed: true,
|
|
10135
|
-
internalType: "uint24",
|
|
10136
|
-
name: "fee",
|
|
10137
|
-
type: "uint24"
|
|
10138
|
-
},
|
|
10139
|
-
{
|
|
10140
|
-
indexed: false,
|
|
10141
|
-
internalType: "int24",
|
|
10142
|
-
name: "tickSpacing",
|
|
10143
|
-
type: "int24"
|
|
10144
|
-
},
|
|
10145
|
-
{
|
|
10146
|
-
indexed: false,
|
|
10147
|
-
internalType: "address",
|
|
10148
|
-
name: "pool",
|
|
10149
|
-
type: "address"
|
|
10150
|
-
}
|
|
10151
|
-
],
|
|
10152
|
-
name: "PoolCreated",
|
|
10153
|
-
type: "event"
|
|
10219
|
+
outputs: [
|
|
10220
|
+
{ name: "amountIn", type: "uint256", internalType: "uint256" },
|
|
10221
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10222
|
+
],
|
|
10223
|
+
stateMutability: "nonpayable"
|
|
10154
10224
|
},
|
|
10155
10225
|
{
|
|
10226
|
+
type: "function",
|
|
10227
|
+
name: "quoteExactOutputSingle",
|
|
10156
10228
|
inputs: [
|
|
10157
10229
|
{
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10230
|
+
name: "params",
|
|
10231
|
+
type: "tuple",
|
|
10232
|
+
internalType: "struct IV4Quoter.QuoteExactSingleParams",
|
|
10233
|
+
components: [
|
|
10234
|
+
{
|
|
10235
|
+
name: "poolKey",
|
|
10236
|
+
type: "tuple",
|
|
10237
|
+
internalType: "struct PoolKey",
|
|
10238
|
+
components: [
|
|
10239
|
+
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
10240
|
+
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
10241
|
+
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
10242
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
10243
|
+
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
10244
|
+
]
|
|
10245
|
+
},
|
|
10246
|
+
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
10247
|
+
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
10248
|
+
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
10249
|
+
]
|
|
10171
10250
|
}
|
|
10172
10251
|
],
|
|
10173
|
-
name: "createPool",
|
|
10174
10252
|
outputs: [
|
|
10175
|
-
{
|
|
10176
|
-
|
|
10177
|
-
name: "pool",
|
|
10178
|
-
type: "address"
|
|
10179
|
-
}
|
|
10180
|
-
],
|
|
10181
|
-
stateMutability: "nonpayable",
|
|
10182
|
-
type: "function"
|
|
10183
|
-
},
|
|
10184
|
-
{
|
|
10185
|
-
inputs: [
|
|
10186
|
-
{
|
|
10187
|
-
internalType: "uint24",
|
|
10188
|
-
name: "fee",
|
|
10189
|
-
type: "uint24"
|
|
10190
|
-
},
|
|
10191
|
-
{
|
|
10192
|
-
internalType: "int24",
|
|
10193
|
-
name: "tickSpacing",
|
|
10194
|
-
type: "int24"
|
|
10195
|
-
}
|
|
10253
|
+
{ name: "amountIn", type: "uint256", internalType: "uint256" },
|
|
10254
|
+
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
10196
10255
|
],
|
|
10197
|
-
|
|
10198
|
-
outputs: [],
|
|
10199
|
-
stateMutability: "nonpayable",
|
|
10200
|
-
type: "function"
|
|
10256
|
+
stateMutability: "nonpayable"
|
|
10201
10257
|
},
|
|
10202
10258
|
{
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
}
|
|
10209
|
-
],
|
|
10210
|
-
name: "feeAmountTickSpacing",
|
|
10211
|
-
outputs: [
|
|
10212
|
-
{
|
|
10213
|
-
internalType: "int24",
|
|
10214
|
-
name: "",
|
|
10215
|
-
type: "int24"
|
|
10216
|
-
}
|
|
10217
|
-
],
|
|
10218
|
-
stateMutability: "view",
|
|
10219
|
-
type: "function"
|
|
10259
|
+
type: "function",
|
|
10260
|
+
name: "unlockCallback",
|
|
10261
|
+
inputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
|
|
10262
|
+
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
10263
|
+
stateMutability: "nonpayable"
|
|
10220
10264
|
},
|
|
10221
10265
|
{
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
name: "tokenA",
|
|
10226
|
-
type: "address"
|
|
10227
|
-
},
|
|
10228
|
-
{
|
|
10229
|
-
internalType: "address",
|
|
10230
|
-
name: "tokenB",
|
|
10231
|
-
type: "address"
|
|
10232
|
-
},
|
|
10233
|
-
{
|
|
10234
|
-
internalType: "uint24",
|
|
10235
|
-
name: "fee",
|
|
10236
|
-
type: "uint24"
|
|
10237
|
-
}
|
|
10238
|
-
],
|
|
10239
|
-
name: "getPool",
|
|
10240
|
-
outputs: [
|
|
10241
|
-
{
|
|
10242
|
-
internalType: "address",
|
|
10243
|
-
name: "pool",
|
|
10244
|
-
type: "address"
|
|
10245
|
-
}
|
|
10246
|
-
],
|
|
10247
|
-
stateMutability: "view",
|
|
10248
|
-
type: "function"
|
|
10266
|
+
type: "error",
|
|
10267
|
+
name: "NotEnoughLiquidity",
|
|
10268
|
+
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }]
|
|
10249
10269
|
},
|
|
10270
|
+
{ type: "error", name: "NotPoolManager", inputs: [] },
|
|
10271
|
+
{ type: "error", name: "NotSelf", inputs: [] },
|
|
10250
10272
|
{
|
|
10251
|
-
|
|
10252
|
-
name: "
|
|
10253
|
-
|
|
10254
|
-
{
|
|
10255
|
-
internalType: "address",
|
|
10256
|
-
name: "",
|
|
10257
|
-
type: "address"
|
|
10258
|
-
}
|
|
10259
|
-
],
|
|
10260
|
-
stateMutability: "view",
|
|
10261
|
-
type: "function"
|
|
10273
|
+
type: "error",
|
|
10274
|
+
name: "QuoteSwap",
|
|
10275
|
+
inputs: [{ name: "amount", type: "uint256", internalType: "uint256" }]
|
|
10262
10276
|
},
|
|
10277
|
+
{ type: "error", name: "UnexpectedCallSuccess", inputs: [] },
|
|
10263
10278
|
{
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
name: "_owner",
|
|
10268
|
-
type: "address"
|
|
10269
|
-
}
|
|
10270
|
-
],
|
|
10271
|
-
name: "setOwner",
|
|
10272
|
-
outputs: [],
|
|
10273
|
-
stateMutability: "nonpayable",
|
|
10274
|
-
type: "function"
|
|
10279
|
+
type: "error",
|
|
10280
|
+
name: "UnexpectedRevertBytes",
|
|
10281
|
+
inputs: [{ name: "revertData", type: "bytes", internalType: "bytes" }]
|
|
10275
10282
|
}
|
|
10276
|
-
];
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
{
|
|
10285
|
-
|
|
10286
|
-
internalType: "address",
|
|
10287
|
-
name: "owner",
|
|
10288
|
-
type: "address"
|
|
10289
|
-
},
|
|
10290
|
-
{
|
|
10291
|
-
indexed: true,
|
|
10292
|
-
internalType: "int24",
|
|
10293
|
-
name: "tickLower",
|
|
10294
|
-
type: "int24"
|
|
10295
|
-
},
|
|
10296
|
-
{
|
|
10297
|
-
indexed: true,
|
|
10298
|
-
internalType: "int24",
|
|
10299
|
-
name: "tickUpper",
|
|
10300
|
-
type: "int24"
|
|
10301
|
-
},
|
|
10302
|
-
{
|
|
10303
|
-
indexed: false,
|
|
10304
|
-
internalType: "uint128",
|
|
10305
|
-
name: "amount",
|
|
10306
|
-
type: "uint128"
|
|
10307
|
-
},
|
|
10308
|
-
{
|
|
10309
|
-
indexed: false,
|
|
10310
|
-
internalType: "uint256",
|
|
10311
|
-
name: "amount0",
|
|
10312
|
-
type: "uint256"
|
|
10313
|
-
},
|
|
10314
|
-
{
|
|
10315
|
-
indexed: false,
|
|
10316
|
-
internalType: "uint256",
|
|
10317
|
-
name: "amount1",
|
|
10318
|
-
type: "uint256"
|
|
10319
|
-
}
|
|
10320
|
-
],
|
|
10321
|
-
name: "Burn",
|
|
10322
|
-
type: "event"
|
|
10323
|
-
},
|
|
10324
|
-
{
|
|
10325
|
-
anonymous: false,
|
|
10326
|
-
inputs: [
|
|
10327
|
-
{
|
|
10328
|
-
indexed: true,
|
|
10329
|
-
internalType: "address",
|
|
10330
|
-
name: "owner",
|
|
10331
|
-
type: "address"
|
|
10332
|
-
},
|
|
10333
|
-
{
|
|
10334
|
-
indexed: false,
|
|
10335
|
-
internalType: "address",
|
|
10336
|
-
name: "recipient",
|
|
10337
|
-
type: "address"
|
|
10338
|
-
},
|
|
10339
|
-
{
|
|
10340
|
-
indexed: true,
|
|
10341
|
-
internalType: "int24",
|
|
10342
|
-
name: "tickLower",
|
|
10343
|
-
type: "int24"
|
|
10344
|
-
},
|
|
10345
|
-
{
|
|
10346
|
-
indexed: true,
|
|
10347
|
-
internalType: "int24",
|
|
10348
|
-
name: "tickUpper",
|
|
10349
|
-
type: "int24"
|
|
10350
|
-
},
|
|
10351
|
-
{
|
|
10352
|
-
indexed: false,
|
|
10353
|
-
internalType: "uint128",
|
|
10354
|
-
name: "amount0",
|
|
10355
|
-
type: "uint128"
|
|
10356
|
-
},
|
|
10357
|
-
{
|
|
10358
|
-
indexed: false,
|
|
10359
|
-
internalType: "uint128",
|
|
10360
|
-
name: "amount1",
|
|
10361
|
-
type: "uint128"
|
|
10362
|
-
}
|
|
10363
|
-
],
|
|
10364
|
-
name: "Collect",
|
|
10365
|
-
type: "event"
|
|
10366
|
-
},
|
|
10367
|
-
{
|
|
10368
|
-
anonymous: false,
|
|
10369
|
-
inputs: [
|
|
10370
|
-
{
|
|
10371
|
-
indexed: true,
|
|
10372
|
-
internalType: "address",
|
|
10373
|
-
name: "sender",
|
|
10374
|
-
type: "address"
|
|
10375
|
-
},
|
|
10376
|
-
{
|
|
10377
|
-
indexed: true,
|
|
10378
|
-
internalType: "address",
|
|
10379
|
-
name: "recipient",
|
|
10380
|
-
type: "address"
|
|
10381
|
-
},
|
|
10382
|
-
{
|
|
10383
|
-
indexed: false,
|
|
10384
|
-
internalType: "uint128",
|
|
10385
|
-
name: "amount0",
|
|
10386
|
-
type: "uint128"
|
|
10387
|
-
},
|
|
10388
|
-
{
|
|
10389
|
-
indexed: false,
|
|
10390
|
-
internalType: "uint128",
|
|
10391
|
-
name: "amount1",
|
|
10392
|
-
type: "uint128"
|
|
10393
|
-
}
|
|
10394
|
-
],
|
|
10395
|
-
name: "CollectProtocol",
|
|
10396
|
-
type: "event"
|
|
10397
|
-
},
|
|
10398
|
-
{
|
|
10399
|
-
anonymous: false,
|
|
10400
|
-
inputs: [
|
|
10401
|
-
{
|
|
10402
|
-
indexed: true,
|
|
10403
|
-
internalType: "address",
|
|
10404
|
-
name: "sender",
|
|
10405
|
-
type: "address"
|
|
10406
|
-
},
|
|
10407
|
-
{
|
|
10408
|
-
indexed: true,
|
|
10409
|
-
internalType: "address",
|
|
10410
|
-
name: "recipient",
|
|
10411
|
-
type: "address"
|
|
10412
|
-
},
|
|
10413
|
-
{
|
|
10414
|
-
indexed: false,
|
|
10415
|
-
internalType: "uint256",
|
|
10416
|
-
name: "amount0",
|
|
10417
|
-
type: "uint256"
|
|
10418
|
-
},
|
|
10419
|
-
{
|
|
10420
|
-
indexed: false,
|
|
10421
|
-
internalType: "uint256",
|
|
10422
|
-
name: "amount1",
|
|
10423
|
-
type: "uint256"
|
|
10424
|
-
},
|
|
10425
|
-
{
|
|
10426
|
-
indexed: false,
|
|
10427
|
-
internalType: "uint256",
|
|
10428
|
-
name: "paid0",
|
|
10429
|
-
type: "uint256"
|
|
10430
|
-
},
|
|
10431
|
-
{
|
|
10432
|
-
indexed: false,
|
|
10433
|
-
internalType: "uint256",
|
|
10434
|
-
name: "paid1",
|
|
10435
|
-
type: "uint256"
|
|
10436
|
-
}
|
|
10437
|
-
],
|
|
10438
|
-
name: "Flash",
|
|
10439
|
-
type: "event"
|
|
10440
|
-
},
|
|
10441
|
-
{
|
|
10442
|
-
anonymous: false,
|
|
10443
|
-
inputs: [
|
|
10444
|
-
{
|
|
10445
|
-
indexed: false,
|
|
10446
|
-
internalType: "uint16",
|
|
10447
|
-
name: "observationCardinalityNextOld",
|
|
10448
|
-
type: "uint16"
|
|
10449
|
-
},
|
|
10450
|
-
{
|
|
10451
|
-
indexed: false,
|
|
10452
|
-
internalType: "uint16",
|
|
10453
|
-
name: "observationCardinalityNextNew",
|
|
10454
|
-
type: "uint16"
|
|
10455
|
-
}
|
|
10456
|
-
],
|
|
10457
|
-
name: "IncreaseObservationCardinalityNext",
|
|
10458
|
-
type: "event"
|
|
10459
|
-
},
|
|
10460
|
-
{
|
|
10461
|
-
anonymous: false,
|
|
10462
|
-
inputs: [
|
|
10463
|
-
{
|
|
10464
|
-
indexed: false,
|
|
10465
|
-
internalType: "uint160",
|
|
10466
|
-
name: "sqrtPriceX96",
|
|
10467
|
-
type: "uint160"
|
|
10468
|
-
},
|
|
10469
|
-
{
|
|
10470
|
-
indexed: false,
|
|
10471
|
-
internalType: "int24",
|
|
10472
|
-
name: "tick",
|
|
10473
|
-
type: "int24"
|
|
10474
|
-
}
|
|
10475
|
-
],
|
|
10476
|
-
name: "Initialize",
|
|
10477
|
-
type: "event"
|
|
10478
|
-
},
|
|
10479
|
-
{
|
|
10480
|
-
anonymous: false,
|
|
10481
|
-
inputs: [
|
|
10482
|
-
{
|
|
10483
|
-
indexed: false,
|
|
10484
|
-
internalType: "address",
|
|
10485
|
-
name: "sender",
|
|
10486
|
-
type: "address"
|
|
10487
|
-
},
|
|
10488
|
-
{
|
|
10489
|
-
indexed: true,
|
|
10490
|
-
internalType: "address",
|
|
10491
|
-
name: "owner",
|
|
10492
|
-
type: "address"
|
|
10493
|
-
},
|
|
10494
|
-
{
|
|
10495
|
-
indexed: true,
|
|
10496
|
-
internalType: "int24",
|
|
10497
|
-
name: "tickLower",
|
|
10498
|
-
type: "int24"
|
|
10499
|
-
},
|
|
10500
|
-
{
|
|
10501
|
-
indexed: true,
|
|
10502
|
-
internalType: "int24",
|
|
10503
|
-
name: "tickUpper",
|
|
10504
|
-
type: "int24"
|
|
10505
|
-
},
|
|
10506
|
-
{
|
|
10507
|
-
indexed: false,
|
|
10508
|
-
internalType: "uint128",
|
|
10509
|
-
name: "amount",
|
|
10510
|
-
type: "uint128"
|
|
10511
|
-
},
|
|
10512
|
-
{
|
|
10513
|
-
indexed: false,
|
|
10514
|
-
internalType: "uint256",
|
|
10515
|
-
name: "amount0",
|
|
10516
|
-
type: "uint256"
|
|
10517
|
-
},
|
|
10518
|
-
{
|
|
10519
|
-
indexed: false,
|
|
10520
|
-
internalType: "uint256",
|
|
10521
|
-
name: "amount1",
|
|
10522
|
-
type: "uint256"
|
|
10523
|
-
}
|
|
10524
|
-
],
|
|
10525
|
-
name: "Mint",
|
|
10526
|
-
type: "event"
|
|
10527
|
-
},
|
|
10528
|
-
{
|
|
10529
|
-
anonymous: false,
|
|
10530
|
-
inputs: [
|
|
10531
|
-
{
|
|
10532
|
-
indexed: false,
|
|
10533
|
-
internalType: "uint8",
|
|
10534
|
-
name: "feeProtocol0Old",
|
|
10535
|
-
type: "uint8"
|
|
10536
|
-
},
|
|
10537
|
-
{
|
|
10538
|
-
indexed: false,
|
|
10539
|
-
internalType: "uint8",
|
|
10540
|
-
name: "feeProtocol1Old",
|
|
10541
|
-
type: "uint8"
|
|
10542
|
-
},
|
|
10543
|
-
{
|
|
10544
|
-
indexed: false,
|
|
10545
|
-
internalType: "uint8",
|
|
10546
|
-
name: "feeProtocol0New",
|
|
10547
|
-
type: "uint8"
|
|
10548
|
-
},
|
|
10549
|
-
{
|
|
10550
|
-
indexed: false,
|
|
10551
|
-
internalType: "uint8",
|
|
10552
|
-
name: "feeProtocol1New",
|
|
10553
|
-
type: "uint8"
|
|
10554
|
-
}
|
|
10555
|
-
],
|
|
10556
|
-
name: "SetFeeProtocol",
|
|
10557
|
-
type: "event"
|
|
10558
|
-
},
|
|
10559
|
-
{
|
|
10560
|
-
anonymous: false,
|
|
10561
|
-
inputs: [
|
|
10562
|
-
{
|
|
10563
|
-
indexed: true,
|
|
10564
|
-
internalType: "address",
|
|
10565
|
-
name: "sender",
|
|
10566
|
-
type: "address"
|
|
10567
|
-
},
|
|
10568
|
-
{
|
|
10569
|
-
indexed: true,
|
|
10570
|
-
internalType: "address",
|
|
10571
|
-
name: "recipient",
|
|
10572
|
-
type: "address"
|
|
10573
|
-
},
|
|
10574
|
-
{
|
|
10575
|
-
indexed: false,
|
|
10576
|
-
internalType: "int256",
|
|
10577
|
-
name: "amount0",
|
|
10578
|
-
type: "int256"
|
|
10579
|
-
},
|
|
10580
|
-
{
|
|
10581
|
-
indexed: false,
|
|
10582
|
-
internalType: "int256",
|
|
10583
|
-
name: "amount1",
|
|
10584
|
-
type: "int256"
|
|
10585
|
-
},
|
|
10586
|
-
{
|
|
10587
|
-
indexed: false,
|
|
10588
|
-
internalType: "uint160",
|
|
10589
|
-
name: "sqrtPriceX96",
|
|
10590
|
-
type: "uint160"
|
|
10591
|
-
},
|
|
10592
|
-
{
|
|
10593
|
-
indexed: false,
|
|
10594
|
-
internalType: "uint128",
|
|
10595
|
-
name: "liquidity",
|
|
10596
|
-
type: "uint128"
|
|
10597
|
-
},
|
|
10598
|
-
{
|
|
10599
|
-
indexed: false,
|
|
10600
|
-
internalType: "int24",
|
|
10601
|
-
name: "tick",
|
|
10602
|
-
type: "int24"
|
|
10603
|
-
}
|
|
10604
|
-
],
|
|
10605
|
-
name: "Swap",
|
|
10606
|
-
type: "event"
|
|
10607
|
-
},
|
|
10608
|
-
{
|
|
10609
|
-
inputs: [
|
|
10610
|
-
{
|
|
10611
|
-
internalType: "int24",
|
|
10612
|
-
name: "tickLower",
|
|
10613
|
-
type: "int24"
|
|
10614
|
-
},
|
|
10615
|
-
{
|
|
10616
|
-
internalType: "int24",
|
|
10617
|
-
name: "tickUpper",
|
|
10618
|
-
type: "int24"
|
|
10619
|
-
},
|
|
10620
|
-
{
|
|
10621
|
-
internalType: "uint128",
|
|
10622
|
-
name: "amount",
|
|
10623
|
-
type: "uint128"
|
|
10624
|
-
}
|
|
10625
|
-
],
|
|
10626
|
-
name: "burn",
|
|
10627
|
-
outputs: [
|
|
10628
|
-
{
|
|
10629
|
-
internalType: "uint256",
|
|
10630
|
-
name: "amount0",
|
|
10631
|
-
type: "uint256"
|
|
10632
|
-
},
|
|
10633
|
-
{
|
|
10634
|
-
internalType: "uint256",
|
|
10635
|
-
name: "amount1",
|
|
10636
|
-
type: "uint256"
|
|
10637
|
-
}
|
|
10638
|
-
],
|
|
10639
|
-
stateMutability: "nonpayable",
|
|
10640
|
-
type: "function"
|
|
10641
|
-
},
|
|
10642
|
-
{
|
|
10643
|
-
inputs: [
|
|
10644
|
-
{
|
|
10645
|
-
internalType: "address",
|
|
10646
|
-
name: "recipient",
|
|
10647
|
-
type: "address"
|
|
10648
|
-
},
|
|
10649
|
-
{
|
|
10650
|
-
internalType: "int24",
|
|
10651
|
-
name: "tickLower",
|
|
10652
|
-
type: "int24"
|
|
10653
|
-
},
|
|
10654
|
-
{
|
|
10655
|
-
internalType: "int24",
|
|
10656
|
-
name: "tickUpper",
|
|
10657
|
-
type: "int24"
|
|
10658
|
-
},
|
|
10659
|
-
{
|
|
10660
|
-
internalType: "uint128",
|
|
10661
|
-
name: "amount0Requested",
|
|
10662
|
-
type: "uint128"
|
|
10663
|
-
},
|
|
10664
|
-
{
|
|
10665
|
-
internalType: "uint128",
|
|
10666
|
-
name: "amount1Requested",
|
|
10667
|
-
type: "uint128"
|
|
10668
|
-
}
|
|
10669
|
-
],
|
|
10670
|
-
name: "collect",
|
|
10671
|
-
outputs: [
|
|
10672
|
-
{
|
|
10673
|
-
internalType: "uint128",
|
|
10674
|
-
name: "amount0",
|
|
10675
|
-
type: "uint128"
|
|
10676
|
-
},
|
|
10677
|
-
{
|
|
10678
|
-
internalType: "uint128",
|
|
10679
|
-
name: "amount1",
|
|
10680
|
-
type: "uint128"
|
|
10681
|
-
}
|
|
10682
|
-
],
|
|
10683
|
-
stateMutability: "nonpayable",
|
|
10684
|
-
type: "function"
|
|
10685
|
-
},
|
|
10686
|
-
{
|
|
10687
|
-
inputs: [
|
|
10688
|
-
{
|
|
10689
|
-
internalType: "address",
|
|
10690
|
-
name: "recipient",
|
|
10691
|
-
type: "address"
|
|
10692
|
-
},
|
|
10693
|
-
{
|
|
10694
|
-
internalType: "uint128",
|
|
10695
|
-
name: "amount0Requested",
|
|
10696
|
-
type: "uint128"
|
|
10697
|
-
},
|
|
10698
|
-
{
|
|
10699
|
-
internalType: "uint128",
|
|
10700
|
-
name: "amount1Requested",
|
|
10701
|
-
type: "uint128"
|
|
10702
|
-
}
|
|
10703
|
-
],
|
|
10704
|
-
name: "collectProtocol",
|
|
10705
|
-
outputs: [
|
|
10706
|
-
{
|
|
10707
|
-
internalType: "uint128",
|
|
10708
|
-
name: "amount0",
|
|
10709
|
-
type: "uint128"
|
|
10710
|
-
},
|
|
10711
|
-
{
|
|
10712
|
-
internalType: "uint128",
|
|
10713
|
-
name: "amount1",
|
|
10714
|
-
type: "uint128"
|
|
10715
|
-
}
|
|
10716
|
-
],
|
|
10717
|
-
stateMutability: "nonpayable",
|
|
10718
|
-
type: "function"
|
|
10719
|
-
},
|
|
10720
|
-
{
|
|
10721
|
-
inputs: [],
|
|
10722
|
-
name: "factory",
|
|
10723
|
-
outputs: [
|
|
10724
|
-
{
|
|
10725
|
-
internalType: "address",
|
|
10726
|
-
name: "",
|
|
10727
|
-
type: "address"
|
|
10728
|
-
}
|
|
10729
|
-
],
|
|
10730
|
-
stateMutability: "view",
|
|
10731
|
-
type: "function"
|
|
10732
|
-
},
|
|
10733
|
-
{
|
|
10734
|
-
inputs: [],
|
|
10735
|
-
name: "fee",
|
|
10736
|
-
outputs: [
|
|
10737
|
-
{
|
|
10738
|
-
internalType: "uint24",
|
|
10739
|
-
name: "",
|
|
10740
|
-
type: "uint24"
|
|
10741
|
-
}
|
|
10742
|
-
],
|
|
10743
|
-
stateMutability: "view",
|
|
10744
|
-
type: "function"
|
|
10745
|
-
},
|
|
10746
|
-
{
|
|
10747
|
-
inputs: [],
|
|
10748
|
-
name: "feeGrowthGlobal0X128",
|
|
10749
|
-
outputs: [
|
|
10750
|
-
{
|
|
10751
|
-
internalType: "uint256",
|
|
10752
|
-
name: "",
|
|
10753
|
-
type: "uint256"
|
|
10754
|
-
}
|
|
10755
|
-
],
|
|
10756
|
-
stateMutability: "view",
|
|
10757
|
-
type: "function"
|
|
10758
|
-
},
|
|
10759
|
-
{
|
|
10760
|
-
inputs: [],
|
|
10761
|
-
name: "feeGrowthGlobal1X128",
|
|
10762
|
-
outputs: [
|
|
10763
|
-
{
|
|
10764
|
-
internalType: "uint256",
|
|
10765
|
-
name: "",
|
|
10766
|
-
type: "uint256"
|
|
10767
|
-
}
|
|
10768
|
-
],
|
|
10769
|
-
stateMutability: "view",
|
|
10770
|
-
type: "function"
|
|
10771
|
-
},
|
|
10772
|
-
{
|
|
10773
|
-
inputs: [
|
|
10774
|
-
{
|
|
10775
|
-
internalType: "address",
|
|
10776
|
-
name: "recipient",
|
|
10777
|
-
type: "address"
|
|
10778
|
-
},
|
|
10779
|
-
{
|
|
10780
|
-
internalType: "uint256",
|
|
10781
|
-
name: "amount0",
|
|
10782
|
-
type: "uint256"
|
|
10783
|
-
},
|
|
10784
|
-
{
|
|
10785
|
-
internalType: "uint256",
|
|
10786
|
-
name: "amount1",
|
|
10787
|
-
type: "uint256"
|
|
10788
|
-
},
|
|
10789
|
-
{
|
|
10790
|
-
internalType: "bytes",
|
|
10791
|
-
name: "data",
|
|
10792
|
-
type: "bytes"
|
|
10793
|
-
}
|
|
10794
|
-
],
|
|
10795
|
-
name: "flash",
|
|
10796
|
-
outputs: [],
|
|
10797
|
-
stateMutability: "nonpayable",
|
|
10798
|
-
type: "function"
|
|
10799
|
-
},
|
|
10800
|
-
{
|
|
10801
|
-
inputs: [
|
|
10802
|
-
{
|
|
10803
|
-
internalType: "uint16",
|
|
10804
|
-
name: "observationCardinalityNext",
|
|
10805
|
-
type: "uint16"
|
|
10806
|
-
}
|
|
10807
|
-
],
|
|
10808
|
-
name: "increaseObservationCardinalityNext",
|
|
10809
|
-
outputs: [],
|
|
10810
|
-
stateMutability: "nonpayable",
|
|
10811
|
-
type: "function"
|
|
10812
|
-
},
|
|
10813
|
-
{
|
|
10814
|
-
inputs: [
|
|
10815
|
-
{
|
|
10816
|
-
internalType: "uint160",
|
|
10817
|
-
name: "sqrtPriceX96",
|
|
10818
|
-
type: "uint160"
|
|
10819
|
-
}
|
|
10820
|
-
],
|
|
10821
|
-
name: "initialize",
|
|
10822
|
-
outputs: [],
|
|
10823
|
-
stateMutability: "nonpayable",
|
|
10824
|
-
type: "function"
|
|
10825
|
-
},
|
|
10826
|
-
{
|
|
10827
|
-
inputs: [],
|
|
10828
|
-
name: "liquidity",
|
|
10829
|
-
outputs: [
|
|
10830
|
-
{
|
|
10831
|
-
internalType: "uint128",
|
|
10832
|
-
name: "",
|
|
10833
|
-
type: "uint128"
|
|
10834
|
-
}
|
|
10835
|
-
],
|
|
10836
|
-
stateMutability: "view",
|
|
10837
|
-
type: "function"
|
|
10838
|
-
},
|
|
10839
|
-
{
|
|
10840
|
-
inputs: [],
|
|
10841
|
-
name: "maxLiquidityPerTick",
|
|
10842
|
-
outputs: [
|
|
10843
|
-
{
|
|
10844
|
-
internalType: "uint128",
|
|
10845
|
-
name: "",
|
|
10846
|
-
type: "uint128"
|
|
10847
|
-
}
|
|
10848
|
-
],
|
|
10849
|
-
stateMutability: "view",
|
|
10850
|
-
type: "function"
|
|
10851
|
-
},
|
|
10852
|
-
{
|
|
10853
|
-
inputs: [
|
|
10854
|
-
{
|
|
10855
|
-
internalType: "address",
|
|
10856
|
-
name: "recipient",
|
|
10857
|
-
type: "address"
|
|
10858
|
-
},
|
|
10859
|
-
{
|
|
10860
|
-
internalType: "int24",
|
|
10861
|
-
name: "tickLower",
|
|
10862
|
-
type: "int24"
|
|
10863
|
-
},
|
|
10864
|
-
{
|
|
10865
|
-
internalType: "int24",
|
|
10866
|
-
name: "tickUpper",
|
|
10867
|
-
type: "int24"
|
|
10868
|
-
},
|
|
10869
|
-
{
|
|
10870
|
-
internalType: "uint128",
|
|
10871
|
-
name: "amount",
|
|
10872
|
-
type: "uint128"
|
|
10873
|
-
},
|
|
10874
|
-
{
|
|
10875
|
-
internalType: "bytes",
|
|
10876
|
-
name: "data",
|
|
10877
|
-
type: "bytes"
|
|
10878
|
-
}
|
|
10879
|
-
],
|
|
10880
|
-
name: "mint",
|
|
10881
|
-
outputs: [
|
|
10882
|
-
{
|
|
10883
|
-
internalType: "uint256",
|
|
10884
|
-
name: "amount0",
|
|
10885
|
-
type: "uint256"
|
|
10886
|
-
},
|
|
10887
|
-
{
|
|
10888
|
-
internalType: "uint256",
|
|
10889
|
-
name: "amount1",
|
|
10890
|
-
type: "uint256"
|
|
10891
|
-
}
|
|
10892
|
-
],
|
|
10893
|
-
stateMutability: "nonpayable",
|
|
10894
|
-
type: "function"
|
|
10895
|
-
},
|
|
10896
|
-
{
|
|
10897
|
-
inputs: [
|
|
10898
|
-
{
|
|
10899
|
-
internalType: "uint256",
|
|
10900
|
-
name: "index",
|
|
10901
|
-
type: "uint256"
|
|
10902
|
-
}
|
|
10903
|
-
],
|
|
10904
|
-
name: "observations",
|
|
10905
|
-
outputs: [
|
|
10906
|
-
{
|
|
10907
|
-
internalType: "uint32",
|
|
10908
|
-
name: "blockTimestamp",
|
|
10909
|
-
type: "uint32"
|
|
10910
|
-
},
|
|
10911
|
-
{
|
|
10912
|
-
internalType: "int56",
|
|
10913
|
-
name: "tickCumulative",
|
|
10914
|
-
type: "int56"
|
|
10915
|
-
},
|
|
10916
|
-
{
|
|
10917
|
-
internalType: "uint160",
|
|
10918
|
-
name: "secondsPerLiquidityCumulativeX128",
|
|
10919
|
-
type: "uint160"
|
|
10920
|
-
},
|
|
10921
|
-
{
|
|
10922
|
-
internalType: "bool",
|
|
10923
|
-
name: "initialized",
|
|
10924
|
-
type: "bool"
|
|
10925
|
-
}
|
|
10926
|
-
],
|
|
10927
|
-
stateMutability: "view",
|
|
10928
|
-
type: "function"
|
|
10929
|
-
},
|
|
10930
|
-
{
|
|
10931
|
-
inputs: [
|
|
10932
|
-
{
|
|
10933
|
-
internalType: "uint32[]",
|
|
10934
|
-
name: "secondsAgos",
|
|
10935
|
-
type: "uint32[]"
|
|
10936
|
-
}
|
|
10937
|
-
],
|
|
10938
|
-
name: "observe",
|
|
10939
|
-
outputs: [
|
|
10940
|
-
{
|
|
10941
|
-
internalType: "int56[]",
|
|
10942
|
-
name: "tickCumulatives",
|
|
10943
|
-
type: "int56[]"
|
|
10944
|
-
},
|
|
10945
|
-
{
|
|
10946
|
-
internalType: "uint160[]",
|
|
10947
|
-
name: "secondsPerLiquidityCumulativeX128s",
|
|
10948
|
-
type: "uint160[]"
|
|
10949
|
-
}
|
|
10950
|
-
],
|
|
10951
|
-
stateMutability: "view",
|
|
10952
|
-
type: "function"
|
|
10953
|
-
},
|
|
10954
|
-
{
|
|
10955
|
-
inputs: [
|
|
10956
|
-
{
|
|
10957
|
-
internalType: "bytes32",
|
|
10958
|
-
name: "key",
|
|
10959
|
-
type: "bytes32"
|
|
10960
|
-
}
|
|
10961
|
-
],
|
|
10962
|
-
name: "positions",
|
|
10963
|
-
outputs: [
|
|
10964
|
-
{
|
|
10965
|
-
internalType: "uint128",
|
|
10966
|
-
name: "_liquidity",
|
|
10967
|
-
type: "uint128"
|
|
10968
|
-
},
|
|
10969
|
-
{
|
|
10970
|
-
internalType: "uint256",
|
|
10971
|
-
name: "feeGrowthInside0LastX128",
|
|
10972
|
-
type: "uint256"
|
|
10973
|
-
},
|
|
10974
|
-
{
|
|
10975
|
-
internalType: "uint256",
|
|
10976
|
-
name: "feeGrowthInside1LastX128",
|
|
10977
|
-
type: "uint256"
|
|
10978
|
-
},
|
|
10979
|
-
{
|
|
10980
|
-
internalType: "uint128",
|
|
10981
|
-
name: "tokensOwed0",
|
|
10982
|
-
type: "uint128"
|
|
10983
|
-
},
|
|
10984
|
-
{
|
|
10985
|
-
internalType: "uint128",
|
|
10986
|
-
name: "tokensOwed1",
|
|
10987
|
-
type: "uint128"
|
|
10988
|
-
}
|
|
10989
|
-
],
|
|
10990
|
-
stateMutability: "view",
|
|
10991
|
-
type: "function"
|
|
10992
|
-
},
|
|
10993
|
-
{
|
|
10994
|
-
inputs: [],
|
|
10995
|
-
name: "protocolFees",
|
|
10996
|
-
outputs: [
|
|
10997
|
-
{
|
|
10998
|
-
internalType: "uint128",
|
|
10999
|
-
name: "token0",
|
|
11000
|
-
type: "uint128"
|
|
11001
|
-
},
|
|
11002
|
-
{
|
|
11003
|
-
internalType: "uint128",
|
|
11004
|
-
name: "token1",
|
|
11005
|
-
type: "uint128"
|
|
11006
|
-
}
|
|
11007
|
-
],
|
|
11008
|
-
stateMutability: "view",
|
|
11009
|
-
type: "function"
|
|
11010
|
-
},
|
|
11011
|
-
{
|
|
11012
|
-
inputs: [
|
|
11013
|
-
{
|
|
11014
|
-
internalType: "uint8",
|
|
11015
|
-
name: "feeProtocol0",
|
|
11016
|
-
type: "uint8"
|
|
11017
|
-
},
|
|
11018
|
-
{
|
|
11019
|
-
internalType: "uint8",
|
|
11020
|
-
name: "feeProtocol1",
|
|
11021
|
-
type: "uint8"
|
|
11022
|
-
}
|
|
11023
|
-
],
|
|
11024
|
-
name: "setFeeProtocol",
|
|
11025
|
-
outputs: [],
|
|
11026
|
-
stateMutability: "nonpayable",
|
|
11027
|
-
type: "function"
|
|
11028
|
-
},
|
|
11029
|
-
{
|
|
11030
|
-
inputs: [],
|
|
11031
|
-
name: "slot0",
|
|
11032
|
-
outputs: [
|
|
11033
|
-
{
|
|
11034
|
-
internalType: "uint160",
|
|
11035
|
-
name: "sqrtPriceX96",
|
|
11036
|
-
type: "uint160"
|
|
11037
|
-
},
|
|
11038
|
-
{
|
|
11039
|
-
internalType: "int24",
|
|
11040
|
-
name: "tick",
|
|
11041
|
-
type: "int24"
|
|
11042
|
-
},
|
|
11043
|
-
{
|
|
11044
|
-
internalType: "uint16",
|
|
11045
|
-
name: "observationIndex",
|
|
11046
|
-
type: "uint16"
|
|
11047
|
-
},
|
|
11048
|
-
{
|
|
11049
|
-
internalType: "uint16",
|
|
11050
|
-
name: "observationCardinality",
|
|
11051
|
-
type: "uint16"
|
|
11052
|
-
},
|
|
11053
|
-
{
|
|
11054
|
-
internalType: "uint16",
|
|
11055
|
-
name: "observationCardinalityNext",
|
|
11056
|
-
type: "uint16"
|
|
11057
|
-
},
|
|
11058
|
-
{
|
|
11059
|
-
internalType: "uint8",
|
|
11060
|
-
name: "feeProtocol",
|
|
11061
|
-
type: "uint8"
|
|
11062
|
-
},
|
|
11063
|
-
{
|
|
11064
|
-
internalType: "bool",
|
|
11065
|
-
name: "unlocked",
|
|
11066
|
-
type: "bool"
|
|
11067
|
-
}
|
|
11068
|
-
],
|
|
11069
|
-
stateMutability: "view",
|
|
11070
|
-
type: "function"
|
|
11071
|
-
},
|
|
11072
|
-
{
|
|
11073
|
-
inputs: [
|
|
11074
|
-
{
|
|
11075
|
-
internalType: "int24",
|
|
11076
|
-
name: "tickLower",
|
|
11077
|
-
type: "int24"
|
|
11078
|
-
},
|
|
11079
|
-
{
|
|
11080
|
-
internalType: "int24",
|
|
11081
|
-
name: "tickUpper",
|
|
11082
|
-
type: "int24"
|
|
11083
|
-
}
|
|
11084
|
-
],
|
|
11085
|
-
name: "snapshotCumulativesInside",
|
|
11086
|
-
outputs: [
|
|
11087
|
-
{
|
|
11088
|
-
internalType: "int56",
|
|
11089
|
-
name: "tickCumulativeInside",
|
|
11090
|
-
type: "int56"
|
|
11091
|
-
},
|
|
11092
|
-
{
|
|
11093
|
-
internalType: "uint160",
|
|
11094
|
-
name: "secondsPerLiquidityInsideX128",
|
|
11095
|
-
type: "uint160"
|
|
11096
|
-
},
|
|
11097
|
-
{
|
|
11098
|
-
internalType: "uint32",
|
|
11099
|
-
name: "secondsInside",
|
|
11100
|
-
type: "uint32"
|
|
11101
|
-
}
|
|
11102
|
-
],
|
|
11103
|
-
stateMutability: "view",
|
|
11104
|
-
type: "function"
|
|
11105
|
-
},
|
|
11106
|
-
{
|
|
11107
|
-
inputs: [
|
|
11108
|
-
{
|
|
11109
|
-
internalType: "address",
|
|
11110
|
-
name: "recipient",
|
|
11111
|
-
type: "address"
|
|
11112
|
-
},
|
|
11113
|
-
{
|
|
11114
|
-
internalType: "bool",
|
|
11115
|
-
name: "zeroForOne",
|
|
11116
|
-
type: "bool"
|
|
11117
|
-
},
|
|
11118
|
-
{
|
|
11119
|
-
internalType: "int256",
|
|
11120
|
-
name: "amountSpecified",
|
|
11121
|
-
type: "int256"
|
|
11122
|
-
},
|
|
11123
|
-
{
|
|
11124
|
-
internalType: "uint160",
|
|
11125
|
-
name: "sqrtPriceLimitX96",
|
|
11126
|
-
type: "uint160"
|
|
11127
|
-
},
|
|
11128
|
-
{
|
|
11129
|
-
internalType: "bytes",
|
|
11130
|
-
name: "data",
|
|
11131
|
-
type: "bytes"
|
|
11132
|
-
}
|
|
11133
|
-
],
|
|
11134
|
-
name: "swap",
|
|
11135
|
-
outputs: [
|
|
11136
|
-
{
|
|
11137
|
-
internalType: "int256",
|
|
11138
|
-
name: "amount0",
|
|
11139
|
-
type: "int256"
|
|
11140
|
-
},
|
|
11141
|
-
{
|
|
11142
|
-
internalType: "int256",
|
|
11143
|
-
name: "amount1",
|
|
11144
|
-
type: "int256"
|
|
11145
|
-
}
|
|
11146
|
-
],
|
|
11147
|
-
stateMutability: "nonpayable",
|
|
11148
|
-
type: "function"
|
|
11149
|
-
},
|
|
11150
|
-
{
|
|
11151
|
-
inputs: [
|
|
11152
|
-
{
|
|
11153
|
-
internalType: "int16",
|
|
11154
|
-
name: "wordPosition",
|
|
11155
|
-
type: "int16"
|
|
11156
|
-
}
|
|
11157
|
-
],
|
|
11158
|
-
name: "tickBitmap",
|
|
11159
|
-
outputs: [
|
|
11160
|
-
{
|
|
11161
|
-
internalType: "uint256",
|
|
11162
|
-
name: "",
|
|
11163
|
-
type: "uint256"
|
|
11164
|
-
}
|
|
11165
|
-
],
|
|
11166
|
-
stateMutability: "view",
|
|
11167
|
-
type: "function"
|
|
11168
|
-
},
|
|
11169
|
-
{
|
|
11170
|
-
inputs: [],
|
|
11171
|
-
name: "tickSpacing",
|
|
11172
|
-
outputs: [
|
|
11173
|
-
{
|
|
11174
|
-
internalType: "int24",
|
|
11175
|
-
name: "",
|
|
11176
|
-
type: "int24"
|
|
11177
|
-
}
|
|
11178
|
-
],
|
|
11179
|
-
stateMutability: "view",
|
|
11180
|
-
type: "function"
|
|
11181
|
-
},
|
|
11182
|
-
{
|
|
11183
|
-
inputs: [
|
|
11184
|
-
{
|
|
11185
|
-
internalType: "int24",
|
|
11186
|
-
name: "tick",
|
|
11187
|
-
type: "int24"
|
|
11188
|
-
}
|
|
11189
|
-
],
|
|
11190
|
-
name: "ticks",
|
|
11191
|
-
outputs: [
|
|
11192
|
-
{
|
|
11193
|
-
internalType: "uint128",
|
|
11194
|
-
name: "liquidityGross",
|
|
11195
|
-
type: "uint128"
|
|
11196
|
-
},
|
|
11197
|
-
{
|
|
11198
|
-
internalType: "int128",
|
|
11199
|
-
name: "liquidityNet",
|
|
11200
|
-
type: "int128"
|
|
11201
|
-
},
|
|
11202
|
-
{
|
|
11203
|
-
internalType: "uint256",
|
|
11204
|
-
name: "feeGrowthOutside0X128",
|
|
11205
|
-
type: "uint256"
|
|
11206
|
-
},
|
|
11207
|
-
{
|
|
11208
|
-
internalType: "uint256",
|
|
11209
|
-
name: "feeGrowthOutside1X128",
|
|
11210
|
-
type: "uint256"
|
|
11211
|
-
},
|
|
11212
|
-
{
|
|
11213
|
-
internalType: "int56",
|
|
11214
|
-
name: "tickCumulativeOutside",
|
|
11215
|
-
type: "int56"
|
|
11216
|
-
},
|
|
11217
|
-
{
|
|
11218
|
-
internalType: "uint160",
|
|
11219
|
-
name: "secondsPerLiquidityOutsideX128",
|
|
11220
|
-
type: "uint160"
|
|
11221
|
-
},
|
|
11222
|
-
{
|
|
11223
|
-
internalType: "uint32",
|
|
11224
|
-
name: "secondsOutside",
|
|
11225
|
-
type: "uint32"
|
|
11226
|
-
},
|
|
11227
|
-
{
|
|
11228
|
-
internalType: "bool",
|
|
11229
|
-
name: "initialized",
|
|
11230
|
-
type: "bool"
|
|
11231
|
-
}
|
|
11232
|
-
],
|
|
11233
|
-
stateMutability: "view",
|
|
11234
|
-
type: "function"
|
|
11235
|
-
},
|
|
11236
|
-
{
|
|
11237
|
-
inputs: [],
|
|
11238
|
-
name: "token0",
|
|
11239
|
-
outputs: [
|
|
11240
|
-
{
|
|
11241
|
-
internalType: "address",
|
|
11242
|
-
name: "",
|
|
11243
|
-
type: "address"
|
|
11244
|
-
}
|
|
10283
|
+
];
|
|
10284
|
+
|
|
10285
|
+
// src/abis/permit2.ts
|
|
10286
|
+
var PERMIT2_ABI = [
|
|
10287
|
+
{
|
|
10288
|
+
inputs: [
|
|
10289
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
10290
|
+
{ internalType: "address", name: "spender", type: "address" },
|
|
10291
|
+
{ internalType: "uint160", name: "amount", type: "uint160" },
|
|
10292
|
+
{ internalType: "uint48", name: "expiration", type: "uint48" }
|
|
11245
10293
|
],
|
|
11246
|
-
|
|
10294
|
+
name: "approve",
|
|
10295
|
+
outputs: [],
|
|
10296
|
+
stateMutability: "nonpayable",
|
|
11247
10297
|
type: "function"
|
|
11248
10298
|
},
|
|
11249
10299
|
{
|
|
11250
|
-
inputs: [
|
|
11251
|
-
|
|
10300
|
+
inputs: [
|
|
10301
|
+
{ internalType: "address", name: "owner", type: "address" },
|
|
10302
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
10303
|
+
{ internalType: "address", name: "spender", type: "address" }
|
|
10304
|
+
],
|
|
10305
|
+
name: "allowance",
|
|
11252
10306
|
outputs: [
|
|
11253
|
-
{
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
type: "address"
|
|
11257
|
-
}
|
|
10307
|
+
{ internalType: "uint160", name: "amount", type: "uint160" },
|
|
10308
|
+
{ internalType: "uint48", name: "expiration", type: "uint48" },
|
|
10309
|
+
{ internalType: "uint48", name: "nonce", type: "uint48" }
|
|
11258
10310
|
],
|
|
11259
10311
|
stateMutability: "view",
|
|
11260
10312
|
type: "function"
|
|
11261
10313
|
}
|
|
11262
10314
|
];
|
|
11263
|
-
var uniswapV3Pool_default = { ABI: ABI7 };
|
|
11264
10315
|
|
|
11265
|
-
// src/abis/
|
|
11266
|
-
var
|
|
11267
|
-
{
|
|
11268
|
-
inputs: [
|
|
11269
|
-
{
|
|
11270
|
-
internalType: "bytes",
|
|
11271
|
-
name: "path",
|
|
11272
|
-
type: "bytes"
|
|
11273
|
-
},
|
|
11274
|
-
{
|
|
11275
|
-
internalType: "uint256",
|
|
11276
|
-
name: "amountIn",
|
|
11277
|
-
type: "uint256"
|
|
11278
|
-
}
|
|
11279
|
-
],
|
|
11280
|
-
name: "quoteExactInput",
|
|
11281
|
-
outputs: [
|
|
11282
|
-
{
|
|
11283
|
-
internalType: "uint256",
|
|
11284
|
-
name: "amountOut",
|
|
11285
|
-
type: "uint256"
|
|
11286
|
-
},
|
|
11287
|
-
{
|
|
11288
|
-
internalType: "uint160[]",
|
|
11289
|
-
name: "sqrtPriceX96AfterList",
|
|
11290
|
-
type: "uint160[]"
|
|
11291
|
-
},
|
|
11292
|
-
{
|
|
11293
|
-
internalType: "uint32[]",
|
|
11294
|
-
name: "initializedTicksCrossedList",
|
|
11295
|
-
type: "uint32[]"
|
|
11296
|
-
},
|
|
11297
|
-
{
|
|
11298
|
-
internalType: "uint256",
|
|
11299
|
-
name: "gasEstimate",
|
|
11300
|
-
type: "uint256"
|
|
11301
|
-
}
|
|
11302
|
-
],
|
|
11303
|
-
stateMutability: "nonpayable",
|
|
11304
|
-
type: "function"
|
|
11305
|
-
},
|
|
10316
|
+
// src/abis/universalRouter.ts
|
|
10317
|
+
var ABI6 = [
|
|
11306
10318
|
{
|
|
11307
10319
|
inputs: [
|
|
11308
10320
|
{
|
|
11309
10321
|
components: [
|
|
11310
10322
|
{
|
|
11311
10323
|
internalType: "address",
|
|
11312
|
-
name: "
|
|
10324
|
+
name: "permit2",
|
|
11313
10325
|
type: "address"
|
|
11314
10326
|
},
|
|
11315
10327
|
{
|
|
11316
10328
|
internalType: "address",
|
|
11317
|
-
name: "
|
|
10329
|
+
name: "weth9",
|
|
11318
10330
|
type: "address"
|
|
11319
10331
|
},
|
|
11320
10332
|
{
|
|
11321
|
-
internalType: "
|
|
11322
|
-
name: "
|
|
11323
|
-
type: "
|
|
10333
|
+
internalType: "address",
|
|
10334
|
+
name: "v2Factory",
|
|
10335
|
+
type: "address"
|
|
11324
10336
|
},
|
|
11325
10337
|
{
|
|
11326
|
-
internalType: "
|
|
11327
|
-
name: "
|
|
11328
|
-
type: "
|
|
10338
|
+
internalType: "address",
|
|
10339
|
+
name: "v3Factory",
|
|
10340
|
+
type: "address"
|
|
11329
10341
|
},
|
|
11330
10342
|
{
|
|
11331
|
-
internalType: "
|
|
11332
|
-
name: "
|
|
11333
|
-
type: "
|
|
10343
|
+
internalType: "bytes32",
|
|
10344
|
+
name: "pairInitCodeHash",
|
|
10345
|
+
type: "bytes32"
|
|
10346
|
+
},
|
|
10347
|
+
{
|
|
10348
|
+
internalType: "bytes32",
|
|
10349
|
+
name: "poolInitCodeHash",
|
|
10350
|
+
type: "bytes32"
|
|
10351
|
+
},
|
|
10352
|
+
{
|
|
10353
|
+
internalType: "address",
|
|
10354
|
+
name: "v4PoolManager",
|
|
10355
|
+
type: "address"
|
|
10356
|
+
},
|
|
10357
|
+
{
|
|
10358
|
+
internalType: "address",
|
|
10359
|
+
name: "v3NFTPositionManager",
|
|
10360
|
+
type: "address"
|
|
10361
|
+
},
|
|
10362
|
+
{
|
|
10363
|
+
internalType: "address",
|
|
10364
|
+
name: "v4PositionManager",
|
|
10365
|
+
type: "address"
|
|
11334
10366
|
}
|
|
11335
10367
|
],
|
|
11336
|
-
internalType: "struct
|
|
10368
|
+
internalType: "struct RouterParameters",
|
|
11337
10369
|
name: "params",
|
|
11338
10370
|
type: "tuple"
|
|
11339
10371
|
}
|
|
11340
10372
|
],
|
|
11341
|
-
|
|
11342
|
-
|
|
10373
|
+
stateMutability: "nonpayable",
|
|
10374
|
+
type: "constructor"
|
|
10375
|
+
},
|
|
10376
|
+
{
|
|
10377
|
+
inputs: [],
|
|
10378
|
+
name: "BalanceTooLow",
|
|
10379
|
+
type: "error"
|
|
10380
|
+
},
|
|
10381
|
+
{
|
|
10382
|
+
inputs: [],
|
|
10383
|
+
name: "ContractLocked",
|
|
10384
|
+
type: "error"
|
|
10385
|
+
},
|
|
10386
|
+
{
|
|
10387
|
+
inputs: [
|
|
10388
|
+
{
|
|
10389
|
+
internalType: "Currency",
|
|
10390
|
+
name: "currency",
|
|
10391
|
+
type: "address"
|
|
10392
|
+
}
|
|
10393
|
+
],
|
|
10394
|
+
name: "DeltaNotNegative",
|
|
10395
|
+
type: "error"
|
|
10396
|
+
},
|
|
10397
|
+
{
|
|
10398
|
+
inputs: [
|
|
10399
|
+
{
|
|
10400
|
+
internalType: "Currency",
|
|
10401
|
+
name: "currency",
|
|
10402
|
+
type: "address"
|
|
10403
|
+
}
|
|
10404
|
+
],
|
|
10405
|
+
name: "DeltaNotPositive",
|
|
10406
|
+
type: "error"
|
|
10407
|
+
},
|
|
10408
|
+
{
|
|
10409
|
+
inputs: [],
|
|
10410
|
+
name: "ETHNotAccepted",
|
|
10411
|
+
type: "error"
|
|
10412
|
+
},
|
|
10413
|
+
{
|
|
10414
|
+
inputs: [
|
|
11343
10415
|
{
|
|
11344
10416
|
internalType: "uint256",
|
|
11345
|
-
name: "
|
|
10417
|
+
name: "commandIndex",
|
|
11346
10418
|
type: "uint256"
|
|
11347
10419
|
},
|
|
11348
10420
|
{
|
|
11349
|
-
internalType: "
|
|
11350
|
-
name: "
|
|
11351
|
-
type: "
|
|
11352
|
-
}
|
|
10421
|
+
internalType: "bytes",
|
|
10422
|
+
name: "message",
|
|
10423
|
+
type: "bytes"
|
|
10424
|
+
}
|
|
10425
|
+
],
|
|
10426
|
+
name: "ExecutionFailed",
|
|
10427
|
+
type: "error"
|
|
10428
|
+
},
|
|
10429
|
+
{
|
|
10430
|
+
inputs: [],
|
|
10431
|
+
name: "FromAddressIsNotOwner",
|
|
10432
|
+
type: "error"
|
|
10433
|
+
},
|
|
10434
|
+
{
|
|
10435
|
+
inputs: [],
|
|
10436
|
+
name: "InputLengthMismatch",
|
|
10437
|
+
type: "error"
|
|
10438
|
+
},
|
|
10439
|
+
{
|
|
10440
|
+
inputs: [],
|
|
10441
|
+
name: "InsufficientBalance",
|
|
10442
|
+
type: "error"
|
|
10443
|
+
},
|
|
10444
|
+
{
|
|
10445
|
+
inputs: [],
|
|
10446
|
+
name: "InsufficientETH",
|
|
10447
|
+
type: "error"
|
|
10448
|
+
},
|
|
10449
|
+
{
|
|
10450
|
+
inputs: [],
|
|
10451
|
+
name: "InsufficientToken",
|
|
10452
|
+
type: "error"
|
|
10453
|
+
},
|
|
10454
|
+
{
|
|
10455
|
+
inputs: [
|
|
11353
10456
|
{
|
|
11354
|
-
internalType: "
|
|
11355
|
-
name: "
|
|
11356
|
-
type: "
|
|
11357
|
-
}
|
|
10457
|
+
internalType: "bytes4",
|
|
10458
|
+
name: "action",
|
|
10459
|
+
type: "bytes4"
|
|
10460
|
+
}
|
|
10461
|
+
],
|
|
10462
|
+
name: "InvalidAction",
|
|
10463
|
+
type: "error"
|
|
10464
|
+
},
|
|
10465
|
+
{
|
|
10466
|
+
inputs: [],
|
|
10467
|
+
name: "InvalidBips",
|
|
10468
|
+
type: "error"
|
|
10469
|
+
},
|
|
10470
|
+
{
|
|
10471
|
+
inputs: [
|
|
11358
10472
|
{
|
|
11359
10473
|
internalType: "uint256",
|
|
11360
|
-
name: "
|
|
10474
|
+
name: "commandType",
|
|
11361
10475
|
type: "uint256"
|
|
11362
10476
|
}
|
|
11363
10477
|
],
|
|
11364
|
-
|
|
11365
|
-
type: "
|
|
10478
|
+
name: "InvalidCommandType",
|
|
10479
|
+
type: "error"
|
|
10480
|
+
},
|
|
10481
|
+
{
|
|
10482
|
+
inputs: [],
|
|
10483
|
+
name: "InvalidEthSender",
|
|
10484
|
+
type: "error"
|
|
10485
|
+
},
|
|
10486
|
+
{
|
|
10487
|
+
inputs: [],
|
|
10488
|
+
name: "InvalidPath",
|
|
10489
|
+
type: "error"
|
|
10490
|
+
},
|
|
10491
|
+
{
|
|
10492
|
+
inputs: [],
|
|
10493
|
+
name: "InvalidReserves",
|
|
10494
|
+
type: "error"
|
|
10495
|
+
},
|
|
10496
|
+
{
|
|
10497
|
+
inputs: [],
|
|
10498
|
+
name: "LengthMismatch",
|
|
10499
|
+
type: "error"
|
|
11366
10500
|
},
|
|
11367
10501
|
{
|
|
11368
10502
|
inputs: [
|
|
11369
10503
|
{
|
|
11370
|
-
internalType: "
|
|
11371
|
-
name: "
|
|
11372
|
-
type: "
|
|
11373
|
-
}
|
|
10504
|
+
internalType: "uint256",
|
|
10505
|
+
name: "tokenId",
|
|
10506
|
+
type: "uint256"
|
|
10507
|
+
}
|
|
10508
|
+
],
|
|
10509
|
+
name: "NotAuthorizedForToken",
|
|
10510
|
+
type: "error"
|
|
10511
|
+
},
|
|
10512
|
+
{
|
|
10513
|
+
inputs: [],
|
|
10514
|
+
name: "NotPoolManager",
|
|
10515
|
+
type: "error"
|
|
10516
|
+
},
|
|
10517
|
+
{
|
|
10518
|
+
inputs: [],
|
|
10519
|
+
name: "OnlyMintAllowed",
|
|
10520
|
+
type: "error"
|
|
10521
|
+
},
|
|
10522
|
+
{
|
|
10523
|
+
inputs: [],
|
|
10524
|
+
name: "SliceOutOfBounds",
|
|
10525
|
+
type: "error"
|
|
10526
|
+
},
|
|
10527
|
+
{
|
|
10528
|
+
inputs: [],
|
|
10529
|
+
name: "TransactionDeadlinePassed",
|
|
10530
|
+
type: "error"
|
|
10531
|
+
},
|
|
10532
|
+
{
|
|
10533
|
+
inputs: [],
|
|
10534
|
+
name: "UnsafeCast",
|
|
10535
|
+
type: "error"
|
|
10536
|
+
},
|
|
10537
|
+
{
|
|
10538
|
+
inputs: [
|
|
11374
10539
|
{
|
|
11375
10540
|
internalType: "uint256",
|
|
11376
|
-
name: "
|
|
10541
|
+
name: "action",
|
|
11377
10542
|
type: "uint256"
|
|
11378
10543
|
}
|
|
11379
10544
|
],
|
|
11380
|
-
name: "
|
|
11381
|
-
|
|
10545
|
+
name: "UnsupportedAction",
|
|
10546
|
+
type: "error"
|
|
10547
|
+
},
|
|
10548
|
+
{
|
|
10549
|
+
inputs: [],
|
|
10550
|
+
name: "V2InvalidPath",
|
|
10551
|
+
type: "error"
|
|
10552
|
+
},
|
|
10553
|
+
{
|
|
10554
|
+
inputs: [],
|
|
10555
|
+
name: "V2TooLittleReceived",
|
|
10556
|
+
type: "error"
|
|
10557
|
+
},
|
|
10558
|
+
{
|
|
10559
|
+
inputs: [],
|
|
10560
|
+
name: "V2TooMuchRequested",
|
|
10561
|
+
type: "error"
|
|
10562
|
+
},
|
|
10563
|
+
{
|
|
10564
|
+
inputs: [],
|
|
10565
|
+
name: "V3InvalidAmountOut",
|
|
10566
|
+
type: "error"
|
|
10567
|
+
},
|
|
10568
|
+
{
|
|
10569
|
+
inputs: [],
|
|
10570
|
+
name: "V3InvalidCaller",
|
|
10571
|
+
type: "error"
|
|
10572
|
+
},
|
|
10573
|
+
{
|
|
10574
|
+
inputs: [],
|
|
10575
|
+
name: "V3InvalidSwap",
|
|
10576
|
+
type: "error"
|
|
10577
|
+
},
|
|
10578
|
+
{
|
|
10579
|
+
inputs: [],
|
|
10580
|
+
name: "V3TooLittleReceived",
|
|
10581
|
+
type: "error"
|
|
10582
|
+
},
|
|
10583
|
+
{
|
|
10584
|
+
inputs: [],
|
|
10585
|
+
name: "V3TooMuchRequested",
|
|
10586
|
+
type: "error"
|
|
10587
|
+
},
|
|
10588
|
+
{
|
|
10589
|
+
inputs: [
|
|
11382
10590
|
{
|
|
11383
10591
|
internalType: "uint256",
|
|
11384
|
-
name: "
|
|
10592
|
+
name: "minAmountOutReceived",
|
|
11385
10593
|
type: "uint256"
|
|
11386
10594
|
},
|
|
11387
|
-
{
|
|
11388
|
-
internalType: "uint160[]",
|
|
11389
|
-
name: "sqrtPriceX96AfterList",
|
|
11390
|
-
type: "uint160[]"
|
|
11391
|
-
},
|
|
11392
|
-
{
|
|
11393
|
-
internalType: "uint32[]",
|
|
11394
|
-
name: "initializedTicksCrossedList",
|
|
11395
|
-
type: "uint32[]"
|
|
11396
|
-
},
|
|
11397
10595
|
{
|
|
11398
10596
|
internalType: "uint256",
|
|
11399
|
-
name: "
|
|
10597
|
+
name: "amountReceived",
|
|
11400
10598
|
type: "uint256"
|
|
11401
10599
|
}
|
|
11402
10600
|
],
|
|
11403
|
-
|
|
11404
|
-
type: "
|
|
10601
|
+
name: "V4TooLittleReceived",
|
|
10602
|
+
type: "error"
|
|
11405
10603
|
},
|
|
11406
10604
|
{
|
|
11407
10605
|
inputs: [
|
|
11408
|
-
{
|
|
11409
|
-
components: [
|
|
11410
|
-
{
|
|
11411
|
-
internalType: "address",
|
|
11412
|
-
name: "tokenIn",
|
|
11413
|
-
type: "address"
|
|
11414
|
-
},
|
|
11415
|
-
{
|
|
11416
|
-
internalType: "address",
|
|
11417
|
-
name: "tokenOut",
|
|
11418
|
-
type: "address"
|
|
11419
|
-
},
|
|
11420
|
-
{
|
|
11421
|
-
internalType: "uint256",
|
|
11422
|
-
name: "amount",
|
|
11423
|
-
type: "uint256"
|
|
11424
|
-
},
|
|
11425
|
-
{
|
|
11426
|
-
internalType: "uint24",
|
|
11427
|
-
name: "fee",
|
|
11428
|
-
type: "uint24"
|
|
11429
|
-
},
|
|
11430
|
-
{
|
|
11431
|
-
internalType: "uint160",
|
|
11432
|
-
name: "sqrtPriceLimitX96",
|
|
11433
|
-
type: "uint160"
|
|
11434
|
-
}
|
|
11435
|
-
],
|
|
11436
|
-
internalType: "struct IQuoterV2.QuoteExactOutputSingleParams",
|
|
11437
|
-
name: "params",
|
|
11438
|
-
type: "tuple"
|
|
11439
|
-
}
|
|
11440
|
-
],
|
|
11441
|
-
name: "quoteExactOutputSingle",
|
|
11442
|
-
outputs: [
|
|
11443
10606
|
{
|
|
11444
10607
|
internalType: "uint256",
|
|
11445
|
-
name: "
|
|
10608
|
+
name: "maxAmountInRequested",
|
|
11446
10609
|
type: "uint256"
|
|
11447
10610
|
},
|
|
11448
|
-
{
|
|
11449
|
-
internalType: "uint160",
|
|
11450
|
-
name: "sqrtPriceX96After",
|
|
11451
|
-
type: "uint160"
|
|
11452
|
-
},
|
|
11453
|
-
{
|
|
11454
|
-
internalType: "uint32",
|
|
11455
|
-
name: "initializedTicksCrossed",
|
|
11456
|
-
type: "uint32"
|
|
11457
|
-
},
|
|
11458
10611
|
{
|
|
11459
10612
|
internalType: "uint256",
|
|
11460
|
-
name: "
|
|
10613
|
+
name: "amountRequested",
|
|
11461
10614
|
type: "uint256"
|
|
11462
10615
|
}
|
|
11463
10616
|
],
|
|
11464
|
-
|
|
11465
|
-
type: "
|
|
11466
|
-
}
|
|
11467
|
-
];
|
|
11468
|
-
var uniswapV3Quoter_default = { ABI: ABI8 };
|
|
11469
|
-
|
|
11470
|
-
// src/abis/uniswapV4Quoter.ts
|
|
11471
|
-
var UNISWAP_V4_QUOTER_ABI = [
|
|
11472
|
-
{
|
|
11473
|
-
type: "constructor",
|
|
11474
|
-
inputs: [{ name: "_poolManager", type: "address", internalType: "contract IPoolManager" }],
|
|
11475
|
-
stateMutability: "nonpayable"
|
|
10617
|
+
name: "V4TooMuchRequested",
|
|
10618
|
+
type: "error"
|
|
11476
10619
|
},
|
|
11477
10620
|
{
|
|
11478
|
-
|
|
11479
|
-
name: "
|
|
11480
|
-
|
|
10621
|
+
inputs: [],
|
|
10622
|
+
name: "V3_POSITION_MANAGER",
|
|
10623
|
+
outputs: [
|
|
11481
10624
|
{
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
components: [
|
|
11486
|
-
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
11487
|
-
{
|
|
11488
|
-
name: "path",
|
|
11489
|
-
type: "tuple[]",
|
|
11490
|
-
internalType: "struct PathKey[]",
|
|
11491
|
-
components: [
|
|
11492
|
-
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
11493
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11494
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11495
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11496
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11497
|
-
]
|
|
11498
|
-
},
|
|
11499
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11500
|
-
]
|
|
10625
|
+
internalType: "contract INonfungiblePositionManager",
|
|
10626
|
+
name: "",
|
|
10627
|
+
type: "address"
|
|
11501
10628
|
}
|
|
11502
10629
|
],
|
|
11503
|
-
|
|
11504
|
-
|
|
10630
|
+
stateMutability: "view",
|
|
10631
|
+
type: "function"
|
|
11505
10632
|
},
|
|
11506
10633
|
{
|
|
11507
|
-
|
|
11508
|
-
name: "
|
|
11509
|
-
|
|
10634
|
+
inputs: [],
|
|
10635
|
+
name: "V4_POSITION_MANAGER",
|
|
10636
|
+
outputs: [
|
|
11510
10637
|
{
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
components: [
|
|
11515
|
-
{
|
|
11516
|
-
name: "poolKey",
|
|
11517
|
-
type: "tuple",
|
|
11518
|
-
internalType: "struct PoolKey",
|
|
11519
|
-
components: [
|
|
11520
|
-
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
11521
|
-
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
11522
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11523
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11524
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11525
|
-
]
|
|
11526
|
-
},
|
|
11527
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11528
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11529
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11530
|
-
]
|
|
10638
|
+
internalType: "contract IPositionManager",
|
|
10639
|
+
name: "",
|
|
10640
|
+
type: "address"
|
|
11531
10641
|
}
|
|
11532
10642
|
],
|
|
11533
|
-
|
|
11534
|
-
|
|
10643
|
+
stateMutability: "view",
|
|
10644
|
+
type: "function"
|
|
11535
10645
|
},
|
|
11536
10646
|
{
|
|
11537
|
-
type: "function",
|
|
11538
|
-
name: "_quoteExactOutput",
|
|
11539
10647
|
inputs: [
|
|
11540
10648
|
{
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
internalType: "struct PathKey[]",
|
|
11550
|
-
components: [
|
|
11551
|
-
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
11552
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11553
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11554
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11555
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11556
|
-
]
|
|
11557
|
-
},
|
|
11558
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11559
|
-
]
|
|
10649
|
+
internalType: "bytes",
|
|
10650
|
+
name: "commands",
|
|
10651
|
+
type: "bytes"
|
|
10652
|
+
},
|
|
10653
|
+
{
|
|
10654
|
+
internalType: "bytes[]",
|
|
10655
|
+
name: "inputs",
|
|
10656
|
+
type: "bytes[]"
|
|
11560
10657
|
}
|
|
11561
10658
|
],
|
|
11562
|
-
|
|
11563
|
-
|
|
10659
|
+
name: "execute",
|
|
10660
|
+
outputs: [],
|
|
10661
|
+
stateMutability: "payable",
|
|
10662
|
+
type: "function"
|
|
11564
10663
|
},
|
|
11565
10664
|
{
|
|
11566
|
-
type: "function",
|
|
11567
|
-
name: "_quoteExactOutputSingle",
|
|
11568
10665
|
inputs: [
|
|
11569
10666
|
{
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11584
|
-
]
|
|
11585
|
-
},
|
|
11586
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11587
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11588
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11589
|
-
]
|
|
10667
|
+
internalType: "bytes",
|
|
10668
|
+
name: "commands",
|
|
10669
|
+
type: "bytes"
|
|
10670
|
+
},
|
|
10671
|
+
{
|
|
10672
|
+
internalType: "bytes[]",
|
|
10673
|
+
name: "inputs",
|
|
10674
|
+
type: "bytes[]"
|
|
10675
|
+
},
|
|
10676
|
+
{
|
|
10677
|
+
internalType: "uint256",
|
|
10678
|
+
name: "deadline",
|
|
10679
|
+
type: "uint256"
|
|
11590
10680
|
}
|
|
11591
10681
|
],
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
type: "function",
|
|
11597
|
-
name: "msgSender",
|
|
11598
|
-
inputs: [],
|
|
11599
|
-
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
11600
|
-
stateMutability: "view"
|
|
10682
|
+
name: "execute",
|
|
10683
|
+
outputs: [],
|
|
10684
|
+
stateMutability: "payable",
|
|
10685
|
+
type: "function"
|
|
11601
10686
|
},
|
|
11602
10687
|
{
|
|
11603
|
-
type: "function",
|
|
11604
|
-
name: "poolManager",
|
|
11605
10688
|
inputs: [],
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
},
|
|
11609
|
-
{
|
|
11610
|
-
type: "function",
|
|
11611
|
-
name: "quoteExactInput",
|
|
11612
|
-
inputs: [
|
|
10689
|
+
name: "msgSender",
|
|
10690
|
+
outputs: [
|
|
11613
10691
|
{
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
components: [
|
|
11618
|
-
{ name: "exactCurrency", type: "address", internalType: "Currency" },
|
|
11619
|
-
{
|
|
11620
|
-
name: "path",
|
|
11621
|
-
type: "tuple[]",
|
|
11622
|
-
internalType: "struct PathKey[]",
|
|
11623
|
-
components: [
|
|
11624
|
-
{ name: "intermediateCurrency", type: "address", internalType: "Currency" },
|
|
11625
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11626
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11627
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11628
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11629
|
-
]
|
|
11630
|
-
},
|
|
11631
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11632
|
-
]
|
|
10692
|
+
internalType: "address",
|
|
10693
|
+
name: "",
|
|
10694
|
+
type: "address"
|
|
11633
10695
|
}
|
|
11634
10696
|
],
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
11638
|
-
],
|
|
11639
|
-
stateMutability: "nonpayable"
|
|
10697
|
+
stateMutability: "view",
|
|
10698
|
+
type: "function"
|
|
11640
10699
|
},
|
|
11641
10700
|
{
|
|
11642
|
-
|
|
11643
|
-
name: "
|
|
11644
|
-
|
|
10701
|
+
inputs: [],
|
|
10702
|
+
name: "poolManager",
|
|
10703
|
+
outputs: [
|
|
11645
10704
|
{
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
components: [
|
|
11650
|
-
{
|
|
11651
|
-
name: "poolKey",
|
|
11652
|
-
type: "tuple",
|
|
11653
|
-
internalType: "struct PoolKey",
|
|
11654
|
-
components: [
|
|
11655
|
-
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
11656
|
-
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
11657
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11658
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11659
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11660
|
-
]
|
|
11661
|
-
},
|
|
11662
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11663
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11664
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11665
|
-
]
|
|
10705
|
+
internalType: "contract IPoolManager",
|
|
10706
|
+
name: "",
|
|
10707
|
+
type: "address"
|
|
11666
10708
|
}
|
|
11667
10709
|
],
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
{ name: "gasEstimate", type: "uint256", internalType: "uint256" }
|
|
11671
|
-
],
|
|
11672
|
-
stateMutability: "nonpayable"
|
|
10710
|
+
stateMutability: "view",
|
|
10711
|
+
type: "function"
|
|
11673
10712
|
},
|
|
11674
10713
|
{
|
|
11675
|
-
type: "function",
|
|
11676
|
-
name: "quoteExactOutput",
|
|
11677
10714
|
inputs: [
|
|
11678
10715
|
{
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" },
|
|
11693
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11694
|
-
]
|
|
11695
|
-
},
|
|
11696
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" }
|
|
11697
|
-
]
|
|
10716
|
+
internalType: "int256",
|
|
10717
|
+
name: "amount0Delta",
|
|
10718
|
+
type: "int256"
|
|
10719
|
+
},
|
|
10720
|
+
{
|
|
10721
|
+
internalType: "int256",
|
|
10722
|
+
name: "amount1Delta",
|
|
10723
|
+
type: "int256"
|
|
10724
|
+
},
|
|
10725
|
+
{
|
|
10726
|
+
internalType: "bytes",
|
|
10727
|
+
name: "data",
|
|
10728
|
+
type: "bytes"
|
|
11698
10729
|
}
|
|
11699
10730
|
],
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
stateMutability: "nonpayable"
|
|
10731
|
+
name: "uniswapV3SwapCallback",
|
|
10732
|
+
outputs: [],
|
|
10733
|
+
stateMutability: "nonpayable",
|
|
10734
|
+
type: "function"
|
|
11705
10735
|
},
|
|
11706
10736
|
{
|
|
11707
|
-
type: "function",
|
|
11708
|
-
name: "quoteExactOutputSingle",
|
|
11709
10737
|
inputs: [
|
|
11710
10738
|
{
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
components: [
|
|
11715
|
-
{
|
|
11716
|
-
name: "poolKey",
|
|
11717
|
-
type: "tuple",
|
|
11718
|
-
internalType: "struct PoolKey",
|
|
11719
|
-
components: [
|
|
11720
|
-
{ name: "currency0", type: "address", internalType: "Currency" },
|
|
11721
|
-
{ name: "currency1", type: "address", internalType: "Currency" },
|
|
11722
|
-
{ name: "fee", type: "uint24", internalType: "uint24" },
|
|
11723
|
-
{ name: "tickSpacing", type: "int24", internalType: "int24" },
|
|
11724
|
-
{ name: "hooks", type: "address", internalType: "contract IHooks" }
|
|
11725
|
-
]
|
|
11726
|
-
},
|
|
11727
|
-
{ name: "zeroForOne", type: "bool", internalType: "bool" },
|
|
11728
|
-
{ name: "exactAmount", type: "uint128", internalType: "uint128" },
|
|
11729
|
-
{ name: "hookData", type: "bytes", internalType: "bytes" }
|
|
11730
|
-
]
|
|
10739
|
+
internalType: "bytes",
|
|
10740
|
+
name: "data",
|
|
10741
|
+
type: "bytes"
|
|
11731
10742
|
}
|
|
11732
10743
|
],
|
|
10744
|
+
name: "unlockCallback",
|
|
11733
10745
|
outputs: [
|
|
11734
|
-
{
|
|
11735
|
-
|
|
10746
|
+
{
|
|
10747
|
+
internalType: "bytes",
|
|
10748
|
+
name: "",
|
|
10749
|
+
type: "bytes"
|
|
10750
|
+
}
|
|
11736
10751
|
],
|
|
11737
|
-
stateMutability: "nonpayable"
|
|
11738
|
-
|
|
11739
|
-
{
|
|
11740
|
-
type: "function",
|
|
11741
|
-
name: "unlockCallback",
|
|
11742
|
-
inputs: [{ name: "data", type: "bytes", internalType: "bytes" }],
|
|
11743
|
-
outputs: [{ name: "", type: "bytes", internalType: "bytes" }],
|
|
11744
|
-
stateMutability: "nonpayable"
|
|
11745
|
-
},
|
|
11746
|
-
{
|
|
11747
|
-
type: "error",
|
|
11748
|
-
name: "NotEnoughLiquidity",
|
|
11749
|
-
inputs: [{ name: "poolId", type: "bytes32", internalType: "PoolId" }]
|
|
11750
|
-
},
|
|
11751
|
-
{ type: "error", name: "NotPoolManager", inputs: [] },
|
|
11752
|
-
{ type: "error", name: "NotSelf", inputs: [] },
|
|
11753
|
-
{
|
|
11754
|
-
type: "error",
|
|
11755
|
-
name: "QuoteSwap",
|
|
11756
|
-
inputs: [{ name: "amount", type: "uint256", internalType: "uint256" }]
|
|
10752
|
+
stateMutability: "nonpayable",
|
|
10753
|
+
type: "function"
|
|
11757
10754
|
},
|
|
11758
|
-
{ type: "error", name: "UnexpectedCallSuccess", inputs: [] },
|
|
11759
10755
|
{
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
inputs: [{ name: "revertData", type: "bytes", internalType: "bytes" }]
|
|
10756
|
+
stateMutability: "payable",
|
|
10757
|
+
type: "receive"
|
|
11763
10758
|
}
|
|
11764
10759
|
];
|
|
10760
|
+
var universalRouter_default = { ABI: ABI6 };
|
|
10761
|
+
|
|
10762
|
+
// src/protocols/intents.ts
|
|
11765
10763
|
var IntentGateway = class {
|
|
11766
10764
|
/**
|
|
11767
10765
|
* Creates a new IntentGateway instance for cross-chain operations.
|
|
@@ -11952,7 +10950,7 @@ var IntentGateway = class {
|
|
|
11952
10950
|
wethAsset,
|
|
11953
10951
|
feeTokenAmount,
|
|
11954
10952
|
evmChainID,
|
|
11955
|
-
"v2"
|
|
10953
|
+
{ selectedProtocol: "v2" }
|
|
11956
10954
|
);
|
|
11957
10955
|
if (amountOut === 0n) {
|
|
11958
10956
|
throw new Error();
|
|
@@ -11990,7 +10988,7 @@ var IntentGateway = class {
|
|
|
11990
10988
|
feeToken.address,
|
|
11991
10989
|
gasCostInWei,
|
|
11992
10990
|
evmChainID,
|
|
11993
|
-
"v2"
|
|
10991
|
+
{ selectedProtocol: "v2" }
|
|
11994
10992
|
);
|
|
11995
10993
|
if (amountOut === 0n) {
|
|
11996
10994
|
console.log("Amount out not found");
|
|
@@ -12033,102 +11031,185 @@ var IntentGateway = class {
|
|
|
12033
11031
|
return quoteNative;
|
|
12034
11032
|
}
|
|
12035
11033
|
/**
|
|
12036
|
-
*
|
|
12037
|
-
* Compares liquidity and pricing across different protocols and fee tiers.
|
|
12038
|
-
*
|
|
12039
|
-
* @param getQuoteIn - Whether to use "source" or "dest" chain for the swap
|
|
12040
|
-
* @param tokenIn - The address of the input token
|
|
12041
|
-
* @param tokenOut - The address of the output token
|
|
12042
|
-
* @param amountOut - The desired output amount
|
|
12043
|
-
* @returns Object containing the best protocol, required input amount, and fee tier (for V3/V4)
|
|
11034
|
+
* Gets V2 quote for exact output swap.
|
|
12044
11035
|
*/
|
|
12045
|
-
async
|
|
11036
|
+
async getV2QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID) {
|
|
12046
11037
|
const client = this[getQuoteIn].client;
|
|
12047
|
-
let amountInV2 = maxUint256;
|
|
12048
|
-
let amountInV3 = maxUint256;
|
|
12049
|
-
let amountInV4 = maxUint256;
|
|
12050
|
-
let bestV3Fee = 0;
|
|
12051
|
-
let bestV4Fee = 0;
|
|
12052
|
-
const commonFees = [100, 500, 3e3, 1e4];
|
|
12053
11038
|
const v2Router = this[getQuoteIn].config.getUniswapRouterV2Address(evmChainID);
|
|
12054
|
-
const v2Factory = this[getQuoteIn].config.getUniswapV2FactoryAddress(evmChainID);
|
|
12055
|
-
const v3Factory = this[getQuoteIn].config.getUniswapV3FactoryAddress(evmChainID);
|
|
12056
|
-
const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
|
|
12057
|
-
const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
|
|
12058
11039
|
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
12059
11040
|
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
12060
11041
|
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
12061
11042
|
try {
|
|
12062
|
-
const
|
|
12063
|
-
address:
|
|
12064
|
-
abi:
|
|
12065
|
-
|
|
12066
|
-
|
|
11043
|
+
const v2AmountIn = await client.simulateContract({
|
|
11044
|
+
address: v2Router,
|
|
11045
|
+
abi: uniswapRouterV2_default.ABI,
|
|
11046
|
+
// @ts-ignore
|
|
11047
|
+
functionName: "getAmountsIn",
|
|
11048
|
+
// @ts-ignore
|
|
11049
|
+
args: [amountOut, [tokenInForQuote, tokenOutForQuote]]
|
|
12067
11050
|
});
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
11051
|
+
return v2AmountIn.result[0];
|
|
11052
|
+
} catch (error) {
|
|
11053
|
+
console.warn("V2 quote failed:", error);
|
|
11054
|
+
return maxUint256;
|
|
11055
|
+
}
|
|
11056
|
+
}
|
|
11057
|
+
/**
|
|
11058
|
+
* Gets V2 quote for exact input swap.
|
|
11059
|
+
*/
|
|
11060
|
+
async getV2QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID) {
|
|
11061
|
+
const client = this[getQuoteIn].client;
|
|
11062
|
+
const v2Router = this[getQuoteIn].config.getUniswapRouterV2Address(evmChainID);
|
|
11063
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11064
|
+
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
11065
|
+
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
11066
|
+
try {
|
|
11067
|
+
const v2AmountOut = await client.simulateContract({
|
|
11068
|
+
address: v2Router,
|
|
11069
|
+
abi: uniswapRouterV2_default.ABI,
|
|
11070
|
+
// @ts-ignore
|
|
11071
|
+
functionName: "getAmountsOut",
|
|
11072
|
+
// @ts-ignore
|
|
11073
|
+
args: [amountIn, [tokenInForQuote, tokenOutForQuote]]
|
|
11074
|
+
});
|
|
11075
|
+
return v2AmountOut.result[1];
|
|
12083
11076
|
} catch (error) {
|
|
12084
11077
|
console.warn("V2 quote failed:", error);
|
|
11078
|
+
return BigInt(0);
|
|
11079
|
+
}
|
|
11080
|
+
}
|
|
11081
|
+
/**
|
|
11082
|
+
* Gets V3 quote for exact output swap.
|
|
11083
|
+
*/
|
|
11084
|
+
async getV3QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID) {
|
|
11085
|
+
const client = this[getQuoteIn].client;
|
|
11086
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11087
|
+
let bestAmountIn = maxUint256;
|
|
11088
|
+
let bestFee = 0;
|
|
11089
|
+
const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
|
|
11090
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11091
|
+
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
11092
|
+
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
11093
|
+
for (const fee of commonFees) {
|
|
11094
|
+
try {
|
|
11095
|
+
const quoteResult = (await client.simulateContract({
|
|
11096
|
+
address: v3Quoter,
|
|
11097
|
+
abi: uniswapV3Quoter_default.ABI,
|
|
11098
|
+
functionName: "quoteExactOutputSingle",
|
|
11099
|
+
args: [
|
|
11100
|
+
{
|
|
11101
|
+
tokenIn: tokenInForQuote,
|
|
11102
|
+
tokenOut: tokenOutForQuote,
|
|
11103
|
+
fee,
|
|
11104
|
+
amount: amountOut,
|
|
11105
|
+
sqrtPriceLimitX96: BigInt(0)
|
|
11106
|
+
}
|
|
11107
|
+
]
|
|
11108
|
+
})).result;
|
|
11109
|
+
const amountIn = quoteResult[0];
|
|
11110
|
+
if (amountIn < bestAmountIn) {
|
|
11111
|
+
bestAmountIn = amountIn;
|
|
11112
|
+
bestFee = fee;
|
|
11113
|
+
}
|
|
11114
|
+
} catch (error) {
|
|
11115
|
+
console.warn(`V3 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
11116
|
+
}
|
|
12085
11117
|
}
|
|
12086
|
-
|
|
11118
|
+
return { amountIn: bestAmountIn, fee: bestFee };
|
|
11119
|
+
}
|
|
11120
|
+
/**
|
|
11121
|
+
* Gets V3 quote for exact input swap.
|
|
11122
|
+
*/
|
|
11123
|
+
async getV3QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID) {
|
|
11124
|
+
const client = this[getQuoteIn].client;
|
|
11125
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11126
|
+
let bestAmountOut = BigInt(0);
|
|
11127
|
+
let bestFee = 0;
|
|
11128
|
+
const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
|
|
11129
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11130
|
+
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
11131
|
+
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
12087
11132
|
for (const fee of commonFees) {
|
|
12088
11133
|
try {
|
|
12089
|
-
const
|
|
12090
|
-
address:
|
|
12091
|
-
abi:
|
|
12092
|
-
functionName: "
|
|
12093
|
-
args: [
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
11134
|
+
const quoteResult = (await client.simulateContract({
|
|
11135
|
+
address: v3Quoter,
|
|
11136
|
+
abi: uniswapV3Quoter_default.ABI,
|
|
11137
|
+
functionName: "quoteExactInputSingle",
|
|
11138
|
+
args: [
|
|
11139
|
+
{
|
|
11140
|
+
tokenIn: tokenInForQuote,
|
|
11141
|
+
tokenOut: tokenOutForQuote,
|
|
11142
|
+
fee,
|
|
11143
|
+
amountIn,
|
|
11144
|
+
sqrtPriceLimitX96: BigInt(0)
|
|
11145
|
+
}
|
|
11146
|
+
]
|
|
11147
|
+
})).result;
|
|
11148
|
+
const amountOut = quoteResult[0];
|
|
11149
|
+
if (amountOut > bestAmountOut) {
|
|
11150
|
+
bestAmountOut = amountOut;
|
|
11151
|
+
bestFee = fee;
|
|
11152
|
+
}
|
|
11153
|
+
} catch (error) {
|
|
11154
|
+
console.warn(`V3 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
11155
|
+
}
|
|
11156
|
+
}
|
|
11157
|
+
return { amountOut: bestAmountOut, fee: bestFee };
|
|
11158
|
+
}
|
|
11159
|
+
/**
|
|
11160
|
+
* Gets V4 quote for exact output swap.
|
|
11161
|
+
*/
|
|
11162
|
+
async getV4QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID) {
|
|
11163
|
+
const client = this[getQuoteIn].client;
|
|
11164
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11165
|
+
let bestAmountIn = maxUint256;
|
|
11166
|
+
let bestFee = 0;
|
|
11167
|
+
const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
|
|
11168
|
+
for (const fee of commonFees) {
|
|
11169
|
+
try {
|
|
11170
|
+
const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
|
|
11171
|
+
const currency1 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenOut : tokenIn;
|
|
11172
|
+
const zeroForOne = tokenIn.toLowerCase() === currency0.toLowerCase();
|
|
11173
|
+
const poolKey = {
|
|
11174
|
+
currency0,
|
|
11175
|
+
currency1,
|
|
11176
|
+
fee,
|
|
11177
|
+
tickSpacing: this.getTickSpacing(fee),
|
|
11178
|
+
hooks: ADDRESS_ZERO
|
|
11179
|
+
};
|
|
11180
|
+
const quoteResult = (await client.simulateContract({
|
|
11181
|
+
address: v4Quoter,
|
|
11182
|
+
abi: UNISWAP_V4_QUOTER_ABI,
|
|
11183
|
+
functionName: "quoteExactOutputSingle",
|
|
11184
|
+
args: [
|
|
11185
|
+
{
|
|
11186
|
+
poolKey,
|
|
11187
|
+
zeroForOne,
|
|
11188
|
+
exactAmount: amountOut,
|
|
11189
|
+
hookData: "0x"
|
|
12120
11190
|
}
|
|
12121
|
-
|
|
11191
|
+
]
|
|
11192
|
+
})).result;
|
|
11193
|
+
const amountIn = quoteResult[0];
|
|
11194
|
+
if (amountIn < bestAmountIn) {
|
|
11195
|
+
bestAmountIn = amountIn;
|
|
11196
|
+
bestFee = fee;
|
|
12122
11197
|
}
|
|
12123
11198
|
} catch (error) {
|
|
12124
|
-
console.warn(`
|
|
11199
|
+
console.warn(`V4 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
12125
11200
|
}
|
|
12126
11201
|
}
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
11202
|
+
return { amountIn: bestAmountIn, fee: bestFee };
|
|
11203
|
+
}
|
|
11204
|
+
/**
|
|
11205
|
+
* Gets V4 quote for exact input swap.
|
|
11206
|
+
*/
|
|
11207
|
+
async getV4QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID) {
|
|
11208
|
+
const client = this[getQuoteIn].client;
|
|
11209
|
+
const commonFees = [100, 500, 3e3, 1e4];
|
|
11210
|
+
let bestAmountOut = BigInt(0);
|
|
11211
|
+
let bestFee = 0;
|
|
11212
|
+
const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
|
|
12132
11213
|
for (const fee of commonFees) {
|
|
12133
11214
|
try {
|
|
12134
11215
|
const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
|
|
@@ -12140,35 +11221,606 @@ var IntentGateway = class {
|
|
|
12140
11221
|
fee,
|
|
12141
11222
|
tickSpacing: this.getTickSpacing(fee),
|
|
12142
11223
|
hooks: ADDRESS_ZERO
|
|
12143
|
-
// No hooks
|
|
12144
11224
|
};
|
|
12145
11225
|
const quoteResult = (await client.simulateContract({
|
|
12146
11226
|
address: v4Quoter,
|
|
12147
11227
|
abi: UNISWAP_V4_QUOTER_ABI,
|
|
12148
|
-
functionName: "
|
|
11228
|
+
functionName: "quoteExactInputSingle",
|
|
12149
11229
|
args: [
|
|
12150
11230
|
{
|
|
12151
11231
|
poolKey,
|
|
12152
11232
|
zeroForOne,
|
|
12153
|
-
exactAmount:
|
|
11233
|
+
exactAmount: amountIn,
|
|
12154
11234
|
hookData: "0x"
|
|
12155
|
-
// Empty hook data
|
|
12156
11235
|
}
|
|
12157
11236
|
]
|
|
12158
11237
|
})).result;
|
|
12159
|
-
const
|
|
12160
|
-
if (
|
|
12161
|
-
|
|
12162
|
-
|
|
11238
|
+
const amountOut = quoteResult[0];
|
|
11239
|
+
if (amountOut > bestAmountOut) {
|
|
11240
|
+
bestAmountOut = amountOut;
|
|
11241
|
+
bestFee = fee;
|
|
12163
11242
|
}
|
|
12164
11243
|
} catch (error) {
|
|
12165
11244
|
console.warn(`V4 quote failed for fee ${fee}, continuing to next fee tier`);
|
|
12166
11245
|
}
|
|
12167
11246
|
}
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
11247
|
+
return { amountOut: bestAmountOut, fee: bestFee };
|
|
11248
|
+
}
|
|
11249
|
+
/**
|
|
11250
|
+
* Creates transaction structure for V2 exact input swap, including ERC20 transfer if needed.
|
|
11251
|
+
*/
|
|
11252
|
+
createV2SwapCalldataExactIn(sourceTokenAddress, targetTokenAddress, amountIn, amountOutMinimum, recipient, evmChainID, getQuoteIn) {
|
|
11253
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11254
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11255
|
+
}
|
|
11256
|
+
const isPermit2 = false;
|
|
11257
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11258
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11259
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11260
|
+
const path = [swapSourceAddress, swapTargetAddress];
|
|
11261
|
+
const commands = [];
|
|
11262
|
+
const inputs = [];
|
|
11263
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11264
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11265
|
+
inputs.push(
|
|
11266
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11267
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11268
|
+
amountIn
|
|
11269
|
+
])
|
|
11270
|
+
);
|
|
11271
|
+
}
|
|
11272
|
+
commands.push(8 /* V2_SWAP_EXACT_IN */);
|
|
11273
|
+
inputs.push(
|
|
11274
|
+
encodeAbiParameters(
|
|
11275
|
+
parseAbiParameters(
|
|
11276
|
+
"address recipient, uint256 amountIn, uint256 amountOutMinimum, address[] path, bool isPermit2"
|
|
11277
|
+
),
|
|
11278
|
+
[
|
|
11279
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11280
|
+
amountIn,
|
|
11281
|
+
amountOutMinimum,
|
|
11282
|
+
path,
|
|
11283
|
+
isPermit2
|
|
11284
|
+
]
|
|
11285
|
+
)
|
|
11286
|
+
);
|
|
11287
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11288
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11289
|
+
inputs.push(
|
|
11290
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11291
|
+
recipient,
|
|
11292
|
+
amountOutMinimum
|
|
11293
|
+
])
|
|
11294
|
+
);
|
|
11295
|
+
}
|
|
11296
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11297
|
+
const executeData = encodeFunctionData({
|
|
11298
|
+
abi: universalRouter_default.ABI,
|
|
11299
|
+
functionName: "execute",
|
|
11300
|
+
args: [commandsEncoded, inputs]
|
|
11301
|
+
});
|
|
11302
|
+
const transactions = [];
|
|
11303
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11304
|
+
const transferData = encodeFunctionData({
|
|
11305
|
+
abi: erc20Abi,
|
|
11306
|
+
functionName: "transfer",
|
|
11307
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountIn]
|
|
11308
|
+
});
|
|
11309
|
+
transactions.push({
|
|
11310
|
+
to: sourceTokenAddress,
|
|
11311
|
+
value: 0n,
|
|
11312
|
+
data: transferData
|
|
11313
|
+
});
|
|
11314
|
+
}
|
|
11315
|
+
transactions.push({
|
|
11316
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11317
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
|
|
11318
|
+
data: executeData
|
|
11319
|
+
});
|
|
11320
|
+
return transactions;
|
|
11321
|
+
}
|
|
11322
|
+
/**
|
|
11323
|
+
* Creates transaction structure for V2 exact output swap, including ERC20 transfer if needed.
|
|
11324
|
+
*/
|
|
11325
|
+
createV2SwapCalldataExactOut(sourceTokenAddress, targetTokenAddress, amountOut, amountInMax, recipient, evmChainID, getQuoteIn) {
|
|
11326
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11327
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11328
|
+
}
|
|
11329
|
+
const isPermit2 = false;
|
|
11330
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11331
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11332
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11333
|
+
const path = [swapSourceAddress, swapTargetAddress];
|
|
11334
|
+
const commands = [];
|
|
11335
|
+
const inputs = [];
|
|
11336
|
+
const transactions = [];
|
|
11337
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11338
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11339
|
+
inputs.push(
|
|
11340
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11341
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11342
|
+
amountInMax
|
|
11343
|
+
])
|
|
11344
|
+
);
|
|
11345
|
+
}
|
|
11346
|
+
commands.push(9 /* V2_SWAP_EXACT_OUT */);
|
|
11347
|
+
inputs.push(
|
|
11348
|
+
encodeAbiParameters(
|
|
11349
|
+
parseAbiParameters(
|
|
11350
|
+
"address recipient, uint256 amountOut, uint256 amountInMax, address[] path, bool isPermit2"
|
|
11351
|
+
),
|
|
11352
|
+
[
|
|
11353
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11354
|
+
amountOut,
|
|
11355
|
+
amountInMax,
|
|
11356
|
+
path,
|
|
11357
|
+
isPermit2
|
|
11358
|
+
]
|
|
11359
|
+
)
|
|
11360
|
+
);
|
|
11361
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11362
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11363
|
+
inputs.push(
|
|
11364
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [recipient, amountOut])
|
|
11365
|
+
);
|
|
11366
|
+
}
|
|
11367
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11368
|
+
const executeData = encodeFunctionData({
|
|
11369
|
+
abi: universalRouter_default.ABI,
|
|
11370
|
+
functionName: "execute",
|
|
11371
|
+
args: [commandsEncoded, inputs]
|
|
11372
|
+
});
|
|
11373
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11374
|
+
const transferData = encodeFunctionData({
|
|
11375
|
+
abi: erc20Abi,
|
|
11376
|
+
functionName: "transfer",
|
|
11377
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountInMax]
|
|
11378
|
+
});
|
|
11379
|
+
transactions.push({
|
|
11380
|
+
to: sourceTokenAddress,
|
|
11381
|
+
value: 0n,
|
|
11382
|
+
data: transferData
|
|
11383
|
+
});
|
|
11384
|
+
}
|
|
11385
|
+
transactions.push({
|
|
11386
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11387
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
|
|
11388
|
+
data: executeData
|
|
11389
|
+
});
|
|
11390
|
+
return transactions;
|
|
11391
|
+
}
|
|
11392
|
+
/**
|
|
11393
|
+
* Creates transaction structure for V3 exact input swap, including ERC20 transfer if needed.
|
|
11394
|
+
*/
|
|
11395
|
+
createV3SwapCalldataExactIn(sourceTokenAddress, targetTokenAddress, amountIn, amountOutMinimum, fee, recipient, evmChainID, getQuoteIn) {
|
|
11396
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11397
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11398
|
+
}
|
|
11399
|
+
const isPermit2 = false;
|
|
11400
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11401
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11402
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11403
|
+
const pathV3 = encodePacked(["address", "uint24", "address"], [swapSourceAddress, fee, swapTargetAddress]);
|
|
11404
|
+
const commands = [];
|
|
11405
|
+
const inputs = [];
|
|
11406
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11407
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11408
|
+
inputs.push(
|
|
11409
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11410
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11411
|
+
amountIn
|
|
11412
|
+
])
|
|
11413
|
+
);
|
|
11414
|
+
}
|
|
11415
|
+
commands.push(0 /* V3_SWAP_EXACT_IN */);
|
|
11416
|
+
inputs.push(
|
|
11417
|
+
encodeAbiParameters(
|
|
11418
|
+
parseAbiParameters(
|
|
11419
|
+
"address recipient, uint256 amountIn, uint256 amountOutMinimum, bytes path, bool isPermit2"
|
|
11420
|
+
),
|
|
11421
|
+
[
|
|
11422
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11423
|
+
amountIn,
|
|
11424
|
+
amountOutMinimum,
|
|
11425
|
+
pathV3,
|
|
11426
|
+
isPermit2
|
|
11427
|
+
]
|
|
11428
|
+
)
|
|
11429
|
+
);
|
|
11430
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11431
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11432
|
+
inputs.push(
|
|
11433
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11434
|
+
recipient,
|
|
11435
|
+
amountOutMinimum
|
|
11436
|
+
])
|
|
11437
|
+
);
|
|
11438
|
+
}
|
|
11439
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11440
|
+
const executeData = encodeFunctionData({
|
|
11441
|
+
abi: universalRouter_default.ABI,
|
|
11442
|
+
functionName: "execute",
|
|
11443
|
+
args: [commandsEncoded, inputs]
|
|
11444
|
+
});
|
|
11445
|
+
const transactions = [];
|
|
11446
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11447
|
+
const transferData = encodeFunctionData({
|
|
11448
|
+
abi: erc20Abi,
|
|
11449
|
+
functionName: "transfer",
|
|
11450
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountIn]
|
|
11451
|
+
});
|
|
11452
|
+
transactions.push({
|
|
11453
|
+
to: sourceTokenAddress,
|
|
11454
|
+
value: 0n,
|
|
11455
|
+
data: transferData
|
|
11456
|
+
});
|
|
11457
|
+
}
|
|
11458
|
+
transactions.push({
|
|
11459
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11460
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
|
|
11461
|
+
data: executeData
|
|
11462
|
+
});
|
|
11463
|
+
return transactions;
|
|
11464
|
+
}
|
|
11465
|
+
/**
|
|
11466
|
+
* Creates transaction structure for V3 exact output swap, including ERC20 transfer if needed.
|
|
11467
|
+
*/
|
|
11468
|
+
createV3SwapCalldataExactOut(sourceTokenAddress, targetTokenAddress, amountOut, amountInMax, fee, recipient, evmChainID, getQuoteIn) {
|
|
11469
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11470
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11471
|
+
}
|
|
11472
|
+
const isPermit2 = false;
|
|
11473
|
+
const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
11474
|
+
const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
|
|
11475
|
+
const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
|
|
11476
|
+
const pathV3 = encodePacked(["address", "uint24", "address"], [swapTargetAddress, fee, swapSourceAddress]);
|
|
11477
|
+
const commands = [];
|
|
11478
|
+
const inputs = [];
|
|
11479
|
+
if (sourceTokenAddress === ADDRESS_ZERO) {
|
|
11480
|
+
commands.push(11 /* WRAP_ETH */);
|
|
11481
|
+
inputs.push(
|
|
11482
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
|
|
11483
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11484
|
+
amountInMax
|
|
11485
|
+
])
|
|
11486
|
+
);
|
|
11487
|
+
}
|
|
11488
|
+
commands.push(1 /* V3_SWAP_EXACT_OUT */);
|
|
11489
|
+
inputs.push(
|
|
11490
|
+
encodeAbiParameters(
|
|
11491
|
+
parseAbiParameters(
|
|
11492
|
+
"address recipient, uint256 amountOut, uint256 amountInMax, bytes path, bool isPermit2"
|
|
11493
|
+
),
|
|
11494
|
+
[
|
|
11495
|
+
targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
|
|
11496
|
+
amountOut,
|
|
11497
|
+
amountInMax,
|
|
11498
|
+
pathV3,
|
|
11499
|
+
isPermit2
|
|
11500
|
+
]
|
|
11501
|
+
)
|
|
11502
|
+
);
|
|
11503
|
+
if (targetTokenAddress === ADDRESS_ZERO) {
|
|
11504
|
+
commands.push(12 /* UNWRAP_WETH */);
|
|
11505
|
+
inputs.push(
|
|
11506
|
+
encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [recipient, amountOut])
|
|
11507
|
+
);
|
|
11508
|
+
}
|
|
11509
|
+
const commandsEncoded = this.encodeCommands(commands);
|
|
11510
|
+
const executeData = encodeFunctionData({
|
|
11511
|
+
abi: universalRouter_default.ABI,
|
|
11512
|
+
functionName: "execute",
|
|
11513
|
+
args: [commandsEncoded, inputs]
|
|
11514
|
+
});
|
|
11515
|
+
const transactions = [];
|
|
11516
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11517
|
+
const transferData = encodeFunctionData({
|
|
11518
|
+
abi: erc20Abi,
|
|
11519
|
+
functionName: "transfer",
|
|
11520
|
+
args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountInMax]
|
|
11521
|
+
});
|
|
11522
|
+
transactions.push({
|
|
11523
|
+
to: sourceTokenAddress,
|
|
11524
|
+
value: 0n,
|
|
11525
|
+
data: transferData
|
|
11526
|
+
});
|
|
11527
|
+
}
|
|
11528
|
+
transactions.push({
|
|
11529
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11530
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
|
|
11531
|
+
data: executeData
|
|
11532
|
+
});
|
|
11533
|
+
return transactions;
|
|
11534
|
+
}
|
|
11535
|
+
/**
|
|
11536
|
+
* Creates transaction structure for V4 exact input swap, including Permit2 approvals for ERC20 tokens.
|
|
11537
|
+
*/
|
|
11538
|
+
createV4SwapCalldataExactIn(sourceTokenAddress, targetTokenAddress, amountIn, amountOutMinimum, fee, evmChainID, getQuoteIn) {
|
|
11539
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11540
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11541
|
+
}
|
|
11542
|
+
const currency0 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? sourceTokenAddress : targetTokenAddress;
|
|
11543
|
+
const currency1 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? targetTokenAddress : sourceTokenAddress;
|
|
11544
|
+
const zeroForOne = sourceTokenAddress.toLowerCase() === currency0.toLowerCase();
|
|
11545
|
+
const poolKey = {
|
|
11546
|
+
currency0,
|
|
11547
|
+
currency1,
|
|
11548
|
+
fee,
|
|
11549
|
+
tickSpacing: this.getTickSpacing(fee),
|
|
11550
|
+
hooks: ADDRESS_ZERO
|
|
11551
|
+
};
|
|
11552
|
+
const actions = encodePacked(
|
|
11553
|
+
["uint8", "uint8", "uint8"],
|
|
11554
|
+
[
|
|
11555
|
+
6 /* V4_SWAP_EXACT_IN_SINGLE */,
|
|
11556
|
+
12 /* SETTLE_ALL */,
|
|
11557
|
+
15 /* TAKE_ALL */
|
|
11558
|
+
]
|
|
11559
|
+
);
|
|
11560
|
+
const swapParams = encodeAbiParameters(
|
|
11561
|
+
parseAbiParameters(
|
|
11562
|
+
"((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, bool zeroForOne, uint128 amountIn, uint128 amountOutMinimum, bytes hookData)"
|
|
11563
|
+
),
|
|
11564
|
+
[
|
|
11565
|
+
{
|
|
11566
|
+
poolKey,
|
|
11567
|
+
zeroForOne,
|
|
11568
|
+
amountIn,
|
|
11569
|
+
amountOutMinimum,
|
|
11570
|
+
hookData: "0x"
|
|
11571
|
+
}
|
|
11572
|
+
]
|
|
11573
|
+
);
|
|
11574
|
+
const settleParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11575
|
+
sourceTokenAddress,
|
|
11576
|
+
amountIn
|
|
11577
|
+
]);
|
|
11578
|
+
const takeParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11579
|
+
targetTokenAddress,
|
|
11580
|
+
amountOutMinimum
|
|
11581
|
+
]);
|
|
11582
|
+
const params = [swapParams, settleParams, takeParams];
|
|
11583
|
+
const commands = encodePacked(["uint8"], [16 /* V4_SWAP */]);
|
|
11584
|
+
const inputs = [encodeAbiParameters(parseAbiParameters("bytes actions, bytes[] params"), [actions, params])];
|
|
11585
|
+
const executeData = encodeFunctionData({
|
|
11586
|
+
abi: universalRouter_default.ABI,
|
|
11587
|
+
functionName: "execute",
|
|
11588
|
+
args: [commands, inputs]
|
|
11589
|
+
});
|
|
11590
|
+
const transactions = [];
|
|
11591
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11592
|
+
const approveToPermit2Data = encodeFunctionData({
|
|
11593
|
+
abi: erc20Abi,
|
|
11594
|
+
functionName: "approve",
|
|
11595
|
+
args: [this[getQuoteIn].config.getPermit2Address(evmChainID), amountIn]
|
|
11596
|
+
});
|
|
11597
|
+
transactions.push({
|
|
11598
|
+
to: sourceTokenAddress,
|
|
11599
|
+
value: 0n,
|
|
11600
|
+
data: approveToPermit2Data
|
|
11601
|
+
});
|
|
11602
|
+
const permit2ApprovalData = encodeFunctionData({
|
|
11603
|
+
abi: PERMIT2_ABI,
|
|
11604
|
+
functionName: "approve",
|
|
11605
|
+
args: [
|
|
11606
|
+
sourceTokenAddress,
|
|
11607
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11608
|
+
amountIn,
|
|
11609
|
+
281474976710655
|
|
11610
|
+
// Max expiration
|
|
11611
|
+
]
|
|
11612
|
+
});
|
|
11613
|
+
transactions.push({
|
|
11614
|
+
to: this[getQuoteIn].config.getPermit2Address(evmChainID),
|
|
11615
|
+
value: 0n,
|
|
11616
|
+
data: permit2ApprovalData
|
|
11617
|
+
});
|
|
11618
|
+
}
|
|
11619
|
+
transactions.push({
|
|
11620
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11621
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
|
|
11622
|
+
data: executeData
|
|
11623
|
+
});
|
|
11624
|
+
return transactions;
|
|
11625
|
+
}
|
|
11626
|
+
/**
|
|
11627
|
+
* Creates transaction structure for V4 exact output swap, including Permit2 approvals for ERC20 tokens.
|
|
11628
|
+
*/
|
|
11629
|
+
createV4SwapCalldataExactOut(sourceTokenAddress, targetTokenAddress, amountOut, amountInMax, fee, evmChainID, getQuoteIn) {
|
|
11630
|
+
if (sourceTokenAddress.toLowerCase() === targetTokenAddress.toLowerCase()) {
|
|
11631
|
+
throw new Error("Source and target tokens cannot be the same");
|
|
11632
|
+
}
|
|
11633
|
+
const currency0 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? sourceTokenAddress : targetTokenAddress;
|
|
11634
|
+
const currency1 = sourceTokenAddress.toLowerCase() < targetTokenAddress.toLowerCase() ? targetTokenAddress : sourceTokenAddress;
|
|
11635
|
+
const zeroForOne = sourceTokenAddress.toLowerCase() === currency0.toLowerCase();
|
|
11636
|
+
const poolKey = {
|
|
11637
|
+
currency0,
|
|
11638
|
+
currency1,
|
|
11639
|
+
fee,
|
|
11640
|
+
tickSpacing: this.getTickSpacing(fee),
|
|
11641
|
+
hooks: ADDRESS_ZERO
|
|
11642
|
+
};
|
|
11643
|
+
const actions = encodePacked(
|
|
11644
|
+
["uint8", "uint8", "uint8"],
|
|
11645
|
+
[
|
|
11646
|
+
8 /* V4_SWAP_EXACT_OUT_SINGLE */,
|
|
11647
|
+
12 /* SETTLE_ALL */,
|
|
11648
|
+
15 /* TAKE_ALL */
|
|
11649
|
+
]
|
|
11650
|
+
);
|
|
11651
|
+
const swapParams = encodeAbiParameters(
|
|
11652
|
+
parseAbiParameters(
|
|
11653
|
+
"((address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) poolKey, bool zeroForOne, uint128 amountOut, uint128 amountInMaximum, bytes hookData)"
|
|
11654
|
+
),
|
|
11655
|
+
[
|
|
11656
|
+
{
|
|
11657
|
+
poolKey,
|
|
11658
|
+
zeroForOne,
|
|
11659
|
+
amountOut,
|
|
11660
|
+
amountInMaximum: amountInMax,
|
|
11661
|
+
hookData: "0x"
|
|
11662
|
+
}
|
|
11663
|
+
]
|
|
11664
|
+
);
|
|
11665
|
+
const settleParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11666
|
+
sourceTokenAddress,
|
|
11667
|
+
amountInMax
|
|
11668
|
+
]);
|
|
11669
|
+
const takeParams = encodeAbiParameters(parseAbiParameters("address currency, uint128 amount"), [
|
|
11670
|
+
targetTokenAddress,
|
|
11671
|
+
amountOut
|
|
11672
|
+
]);
|
|
11673
|
+
const params = [swapParams, settleParams, takeParams];
|
|
11674
|
+
const commands = encodePacked(["uint8"], [16 /* V4_SWAP */]);
|
|
11675
|
+
const inputs = [encodeAbiParameters(parseAbiParameters("bytes actions, bytes[] params"), [actions, params])];
|
|
11676
|
+
const executeData = encodeFunctionData({
|
|
11677
|
+
abi: universalRouter_default.ABI,
|
|
11678
|
+
functionName: "execute",
|
|
11679
|
+
args: [commands, inputs]
|
|
11680
|
+
});
|
|
11681
|
+
const transactions = [];
|
|
11682
|
+
if (sourceTokenAddress !== ADDRESS_ZERO) {
|
|
11683
|
+
const approveToPermit2Data = encodeFunctionData({
|
|
11684
|
+
abi: erc20Abi,
|
|
11685
|
+
functionName: "approve",
|
|
11686
|
+
args: [this[getQuoteIn].config.getPermit2Address(evmChainID), amountInMax]
|
|
11687
|
+
});
|
|
11688
|
+
transactions.push({
|
|
11689
|
+
to: sourceTokenAddress,
|
|
11690
|
+
value: 0n,
|
|
11691
|
+
data: approveToPermit2Data
|
|
11692
|
+
});
|
|
11693
|
+
const permit2ApprovalData = encodeFunctionData({
|
|
11694
|
+
abi: PERMIT2_ABI,
|
|
11695
|
+
functionName: "approve",
|
|
11696
|
+
args: [
|
|
11697
|
+
sourceTokenAddress,
|
|
11698
|
+
this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11699
|
+
amountInMax,
|
|
11700
|
+
281474976710655
|
|
11701
|
+
// Max expiration
|
|
11702
|
+
]
|
|
11703
|
+
});
|
|
11704
|
+
transactions.push({
|
|
11705
|
+
to: this[getQuoteIn].config.getPermit2Address(evmChainID),
|
|
11706
|
+
value: 0n,
|
|
11707
|
+
data: permit2ApprovalData
|
|
11708
|
+
});
|
|
11709
|
+
}
|
|
11710
|
+
transactions.push({
|
|
11711
|
+
to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
|
|
11712
|
+
value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
|
|
11713
|
+
data: executeData
|
|
11714
|
+
});
|
|
11715
|
+
return transactions;
|
|
11716
|
+
}
|
|
11717
|
+
/**
|
|
11718
|
+
* Finds the best Uniswap protocol (V2, V3, or V4) for swapping tokens given a desired output amount.
|
|
11719
|
+
* Compares liquidity and pricing across different protocols and fee tiers.
|
|
11720
|
+
*
|
|
11721
|
+
* @param getQuoteIn - Whether to use "source" or "dest" chain for the swap
|
|
11722
|
+
* @param tokenIn - The address of the input token
|
|
11723
|
+
* @param tokenOut - The address of the output token
|
|
11724
|
+
* @param amountOut - The desired output amount
|
|
11725
|
+
* @returns Object containing the best protocol, required input amount, fee tier (for V3/V4), and transaction structure
|
|
11726
|
+
*/
|
|
11727
|
+
async findBestProtocolWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID, options) {
|
|
11728
|
+
if (options?.generateCalldata && !options?.recipient) {
|
|
11729
|
+
throw new Error("Recipient address is required when generating calldata");
|
|
11730
|
+
}
|
|
11731
|
+
if (options?.selectedProtocol) {
|
|
11732
|
+
if (options.selectedProtocol === "v2") {
|
|
11733
|
+
const amountInV22 = await this.getV2QuoteWithAmountOut(
|
|
11734
|
+
getQuoteIn,
|
|
11735
|
+
tokenIn,
|
|
11736
|
+
tokenOut,
|
|
11737
|
+
amountOut,
|
|
11738
|
+
evmChainID
|
|
11739
|
+
);
|
|
11740
|
+
if (amountInV22 === maxUint256) {
|
|
11741
|
+
return { protocol: null, amountIn: maxUint256 };
|
|
11742
|
+
}
|
|
11743
|
+
let transactions2;
|
|
11744
|
+
if (options?.generateCalldata) {
|
|
11745
|
+
transactions2 = this.createV2SwapCalldataExactOut(
|
|
11746
|
+
tokenIn,
|
|
11747
|
+
tokenOut,
|
|
11748
|
+
amountOut,
|
|
11749
|
+
amountInV22,
|
|
11750
|
+
options.recipient,
|
|
11751
|
+
evmChainID,
|
|
11752
|
+
getQuoteIn
|
|
11753
|
+
);
|
|
11754
|
+
}
|
|
11755
|
+
return { protocol: "v2", amountIn: amountInV22, transactions: transactions2 };
|
|
11756
|
+
}
|
|
11757
|
+
if (options.selectedProtocol === "v3") {
|
|
11758
|
+
const { amountIn: amountInV32, fee: bestV3Fee2 } = await this.getV3QuoteWithAmountOut(
|
|
11759
|
+
getQuoteIn,
|
|
11760
|
+
tokenIn,
|
|
11761
|
+
tokenOut,
|
|
11762
|
+
amountOut,
|
|
11763
|
+
evmChainID
|
|
11764
|
+
);
|
|
11765
|
+
if (amountInV32 === maxUint256) {
|
|
11766
|
+
return { protocol: null, amountIn: maxUint256 };
|
|
11767
|
+
}
|
|
11768
|
+
let transactions2;
|
|
11769
|
+
if (options?.generateCalldata) {
|
|
11770
|
+
transactions2 = this.createV3SwapCalldataExactOut(
|
|
11771
|
+
tokenIn,
|
|
11772
|
+
tokenOut,
|
|
11773
|
+
amountOut,
|
|
11774
|
+
amountInV32,
|
|
11775
|
+
bestV3Fee2,
|
|
11776
|
+
options.recipient,
|
|
11777
|
+
evmChainID,
|
|
11778
|
+
getQuoteIn
|
|
11779
|
+
);
|
|
11780
|
+
}
|
|
11781
|
+
return { protocol: "v3", amountIn: amountInV32, fee: bestV3Fee2, transactions: transactions2 };
|
|
11782
|
+
}
|
|
11783
|
+
if (options.selectedProtocol === "v4") {
|
|
11784
|
+
const { amountIn: amountInV42, fee: bestV4Fee2 } = await this.getV4QuoteWithAmountOut(
|
|
11785
|
+
getQuoteIn,
|
|
11786
|
+
tokenIn,
|
|
11787
|
+
tokenOut,
|
|
11788
|
+
amountOut,
|
|
11789
|
+
evmChainID
|
|
11790
|
+
);
|
|
11791
|
+
if (amountInV42 === maxUint256) {
|
|
11792
|
+
return { protocol: null, amountIn: maxUint256 };
|
|
11793
|
+
}
|
|
11794
|
+
let transactions2;
|
|
11795
|
+
if (options?.generateCalldata) {
|
|
11796
|
+
transactions2 = this.createV4SwapCalldataExactOut(
|
|
11797
|
+
tokenIn,
|
|
11798
|
+
tokenOut,
|
|
11799
|
+
amountOut,
|
|
11800
|
+
amountInV42,
|
|
11801
|
+
bestV4Fee2,
|
|
11802
|
+
evmChainID,
|
|
11803
|
+
getQuoteIn
|
|
11804
|
+
);
|
|
11805
|
+
}
|
|
11806
|
+
return { protocol: "v4", amountIn: amountInV42, fee: bestV4Fee2, transactions: transactions2 };
|
|
11807
|
+
}
|
|
12171
11808
|
}
|
|
11809
|
+
const amountInV2 = await this.getV2QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID);
|
|
11810
|
+
const { amountIn: amountInV3, fee: bestV3Fee } = await this.getV3QuoteWithAmountOut(
|
|
11811
|
+
getQuoteIn,
|
|
11812
|
+
tokenIn,
|
|
11813
|
+
tokenOut,
|
|
11814
|
+
amountOut,
|
|
11815
|
+
evmChainID
|
|
11816
|
+
);
|
|
11817
|
+
const { amountIn: amountInV4, fee: bestV4Fee } = await this.getV4QuoteWithAmountOut(
|
|
11818
|
+
getQuoteIn,
|
|
11819
|
+
tokenIn,
|
|
11820
|
+
tokenOut,
|
|
11821
|
+
amountOut,
|
|
11822
|
+
evmChainID
|
|
11823
|
+
);
|
|
12172
11824
|
if (amountInV2 === maxUint256 && amountInV3 === maxUint256 && amountInV4 === maxUint256) {
|
|
12173
11825
|
return {
|
|
12174
11826
|
protocol: null,
|
|
@@ -12178,10 +11830,34 @@ var IntentGateway = class {
|
|
|
12178
11830
|
if (amountInV4 !== maxUint256) {
|
|
12179
11831
|
const thresholdBps = 100n;
|
|
12180
11832
|
if (amountInV3 !== maxUint256 && this.isWithinThreshold(amountInV4, amountInV3, thresholdBps)) {
|
|
12181
|
-
|
|
11833
|
+
let transactions2;
|
|
11834
|
+
if (options?.generateCalldata) {
|
|
11835
|
+
transactions2 = this.createV4SwapCalldataExactOut(
|
|
11836
|
+
tokenIn,
|
|
11837
|
+
tokenOut,
|
|
11838
|
+
amountOut,
|
|
11839
|
+
amountInV4,
|
|
11840
|
+
bestV4Fee,
|
|
11841
|
+
evmChainID,
|
|
11842
|
+
getQuoteIn
|
|
11843
|
+
);
|
|
11844
|
+
}
|
|
11845
|
+
return { protocol: "v4", amountIn: amountInV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12182
11846
|
}
|
|
12183
11847
|
if (amountInV2 !== maxUint256 && this.isWithinThreshold(amountInV4, amountInV2, thresholdBps)) {
|
|
12184
|
-
|
|
11848
|
+
let transactions2;
|
|
11849
|
+
if (options?.generateCalldata) {
|
|
11850
|
+
transactions2 = this.createV4SwapCalldataExactOut(
|
|
11851
|
+
tokenIn,
|
|
11852
|
+
tokenOut,
|
|
11853
|
+
amountOut,
|
|
11854
|
+
amountInV4,
|
|
11855
|
+
bestV4Fee,
|
|
11856
|
+
evmChainID,
|
|
11857
|
+
getQuoteIn
|
|
11858
|
+
);
|
|
11859
|
+
}
|
|
11860
|
+
return { protocol: "v4", amountIn: amountInV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12185
11861
|
}
|
|
12186
11862
|
}
|
|
12187
11863
|
const minAmount = [
|
|
@@ -12189,22 +11865,60 @@ var IntentGateway = class {
|
|
|
12189
11865
|
{ protocol: "v3", amountIn: amountInV3, fee: bestV3Fee },
|
|
12190
11866
|
{ protocol: "v4", amountIn: amountInV4, fee: bestV4Fee }
|
|
12191
11867
|
].reduce((best, current) => current.amountIn < best.amountIn ? current : best);
|
|
11868
|
+
let transactions;
|
|
11869
|
+
if (options?.generateCalldata) {
|
|
11870
|
+
if (minAmount.protocol === "v2") {
|
|
11871
|
+
transactions = this.createV2SwapCalldataExactOut(
|
|
11872
|
+
tokenIn,
|
|
11873
|
+
tokenOut,
|
|
11874
|
+
amountOut,
|
|
11875
|
+
amountInV2,
|
|
11876
|
+
options.recipient,
|
|
11877
|
+
evmChainID,
|
|
11878
|
+
getQuoteIn
|
|
11879
|
+
);
|
|
11880
|
+
} else if (minAmount.protocol === "v3") {
|
|
11881
|
+
transactions = this.createV3SwapCalldataExactOut(
|
|
11882
|
+
tokenIn,
|
|
11883
|
+
tokenOut,
|
|
11884
|
+
amountOut,
|
|
11885
|
+
amountInV3,
|
|
11886
|
+
bestV3Fee,
|
|
11887
|
+
options.recipient,
|
|
11888
|
+
evmChainID,
|
|
11889
|
+
getQuoteIn
|
|
11890
|
+
);
|
|
11891
|
+
} else {
|
|
11892
|
+
transactions = this.createV4SwapCalldataExactOut(
|
|
11893
|
+
tokenIn,
|
|
11894
|
+
tokenOut,
|
|
11895
|
+
amountOut,
|
|
11896
|
+
amountInV4,
|
|
11897
|
+
bestV4Fee,
|
|
11898
|
+
evmChainID,
|
|
11899
|
+
getQuoteIn
|
|
11900
|
+
);
|
|
11901
|
+
}
|
|
11902
|
+
}
|
|
12192
11903
|
if (minAmount.protocol === "v2") {
|
|
12193
11904
|
return {
|
|
12194
11905
|
protocol: "v2",
|
|
12195
|
-
amountIn: amountInV2
|
|
11906
|
+
amountIn: amountInV2,
|
|
11907
|
+
transactions
|
|
12196
11908
|
};
|
|
12197
11909
|
} else if (minAmount.protocol === "v3") {
|
|
12198
11910
|
return {
|
|
12199
11911
|
protocol: "v3",
|
|
12200
11912
|
amountIn: amountInV3,
|
|
12201
|
-
fee: bestV3Fee
|
|
11913
|
+
fee: bestV3Fee,
|
|
11914
|
+
transactions
|
|
12202
11915
|
};
|
|
12203
11916
|
} else {
|
|
12204
11917
|
return {
|
|
12205
11918
|
protocol: "v4",
|
|
12206
11919
|
amountIn: amountInV4,
|
|
12207
|
-
fee: bestV4Fee
|
|
11920
|
+
fee: bestV4Fee,
|
|
11921
|
+
transactions
|
|
12208
11922
|
};
|
|
12209
11923
|
}
|
|
12210
11924
|
}
|
|
@@ -12218,126 +11932,105 @@ var IntentGateway = class {
|
|
|
12218
11932
|
* @param amountIn - The input amount to swap
|
|
12219
11933
|
* @param evmChainID - The EVM chain ID in format "EVM-{id}"
|
|
12220
11934
|
* @param selectedProtocol - Optional specific protocol to use ("v2", "v3", or "v4")
|
|
12221
|
-
* @returns Object containing the best protocol, expected output amount,
|
|
11935
|
+
* @returns Object containing the best protocol, expected output amount, fee tier (for V3/V4), and transaction structure
|
|
12222
11936
|
*/
|
|
12223
|
-
async findBestProtocolWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID,
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
let amountOutV3 = BigInt(0);
|
|
12227
|
-
let amountOutV4 = BigInt(0);
|
|
12228
|
-
let bestV3Fee = 0;
|
|
12229
|
-
let bestV4Fee = 0;
|
|
12230
|
-
const commonFees = [100, 500, 3e3, 1e4];
|
|
12231
|
-
const v2Router = this.source.config.getUniswapRouterV2Address(evmChainID);
|
|
12232
|
-
this.source.config.getUniswapV2FactoryAddress(evmChainID);
|
|
12233
|
-
const v3Factory = this.source.config.getUniswapV3FactoryAddress(evmChainID);
|
|
12234
|
-
const v3Quoter = this.source.config.getUniswapV3QuoterAddress(evmChainID);
|
|
12235
|
-
const v4Quoter = this.source.config.getUniswapV4QuoterAddress(evmChainID);
|
|
12236
|
-
const wethAsset = this.source.config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
|
|
12237
|
-
const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
|
|
12238
|
-
const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
|
|
12239
|
-
try {
|
|
12240
|
-
const v2AmountOut = await client.simulateContract({
|
|
12241
|
-
address: v2Router,
|
|
12242
|
-
abi: uniswapRouterV2_default.ABI,
|
|
12243
|
-
// @ts-ignore
|
|
12244
|
-
functionName: "getAmountsOut",
|
|
12245
|
-
// @ts-ignore
|
|
12246
|
-
args: [amountIn, [tokenInForQuote, tokenOutForQuote]]
|
|
12247
|
-
});
|
|
12248
|
-
amountOutV2 = v2AmountOut.result[1];
|
|
12249
|
-
if (selectedProtocol === "v2") {
|
|
12250
|
-
return { protocol: "v2", amountOut: amountOutV2 };
|
|
12251
|
-
}
|
|
12252
|
-
} catch (error) {
|
|
12253
|
-
console.warn("V2 quote failed:", error);
|
|
11937
|
+
async findBestProtocolWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID, options) {
|
|
11938
|
+
if (options?.generateCalldata && !options?.recipient) {
|
|
11939
|
+
throw new Error("Recipient address is required when generating calldata");
|
|
12254
11940
|
}
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
if (
|
|
12265
|
-
|
|
12266
|
-
address: pool,
|
|
12267
|
-
abi: uniswapV3Pool_default.ABI,
|
|
12268
|
-
functionName: "liquidity"
|
|
12269
|
-
});
|
|
12270
|
-
if (liquidity > BigInt(0)) {
|
|
12271
|
-
const quoteResult = (await client.simulateContract({
|
|
12272
|
-
address: v3Quoter,
|
|
12273
|
-
abi: uniswapV3Quoter_default.ABI,
|
|
12274
|
-
functionName: "quoteExactInputSingle",
|
|
12275
|
-
args: [
|
|
12276
|
-
{
|
|
12277
|
-
tokenIn: tokenInForQuote,
|
|
12278
|
-
tokenOut: tokenOutForQuote,
|
|
12279
|
-
fee,
|
|
12280
|
-
amountIn,
|
|
12281
|
-
sqrtPriceLimitX96: BigInt(0)
|
|
12282
|
-
}
|
|
12283
|
-
]
|
|
12284
|
-
})).result;
|
|
12285
|
-
const amountOut = quoteResult[0];
|
|
12286
|
-
if (amountOut > bestV3AmountOut) {
|
|
12287
|
-
bestV3AmountOut = amountOut;
|
|
12288
|
-
bestV3Fee = fee;
|
|
12289
|
-
}
|
|
12290
|
-
}
|
|
11941
|
+
if (options?.selectedProtocol) {
|
|
11942
|
+
if (options.selectedProtocol === "v2") {
|
|
11943
|
+
const amountOutV22 = await this.getV2QuoteWithAmountIn(
|
|
11944
|
+
getQuoteIn,
|
|
11945
|
+
tokenIn,
|
|
11946
|
+
tokenOut,
|
|
11947
|
+
amountIn,
|
|
11948
|
+
evmChainID
|
|
11949
|
+
);
|
|
11950
|
+
if (amountOutV22 === BigInt(0)) {
|
|
11951
|
+
return { protocol: null, amountOut: BigInt(0) };
|
|
12291
11952
|
}
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
|
|
12304
|
-
const currency1 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenOut : tokenIn;
|
|
12305
|
-
const zeroForOne = tokenIn.toLowerCase() === currency0.toLowerCase();
|
|
12306
|
-
const poolKey = {
|
|
12307
|
-
currency0,
|
|
12308
|
-
currency1,
|
|
12309
|
-
fee,
|
|
12310
|
-
tickSpacing: this.getTickSpacing(fee),
|
|
12311
|
-
hooks: ADDRESS_ZERO
|
|
12312
|
-
// No hooks
|
|
12313
|
-
};
|
|
12314
|
-
const quoteResult = (await client.simulateContract({
|
|
12315
|
-
address: v4Quoter,
|
|
12316
|
-
abi: UNISWAP_V4_QUOTER_ABI,
|
|
12317
|
-
functionName: "quoteExactInputSingle",
|
|
12318
|
-
args: [
|
|
12319
|
-
{
|
|
12320
|
-
poolKey,
|
|
12321
|
-
zeroForOne,
|
|
12322
|
-
exactAmount: amountIn,
|
|
12323
|
-
hookData: "0x"
|
|
12324
|
-
// Empty hook data
|
|
12325
|
-
}
|
|
12326
|
-
]
|
|
12327
|
-
})).result;
|
|
12328
|
-
const amountOut = quoteResult[0];
|
|
12329
|
-
if (amountOut > bestV4AmountOut) {
|
|
12330
|
-
bestV4AmountOut = amountOut;
|
|
12331
|
-
bestV4Fee = fee;
|
|
11953
|
+
let transactions2;
|
|
11954
|
+
if (options?.generateCalldata) {
|
|
11955
|
+
transactions2 = this.createV2SwapCalldataExactIn(
|
|
11956
|
+
tokenIn,
|
|
11957
|
+
tokenOut,
|
|
11958
|
+
amountIn,
|
|
11959
|
+
amountOutV22,
|
|
11960
|
+
options.recipient,
|
|
11961
|
+
evmChainID,
|
|
11962
|
+
getQuoteIn
|
|
11963
|
+
);
|
|
12332
11964
|
}
|
|
12333
|
-
|
|
12334
|
-
|
|
11965
|
+
return { protocol: "v2", amountOut: amountOutV22, transactions: transactions2 };
|
|
11966
|
+
}
|
|
11967
|
+
if (options.selectedProtocol === "v3") {
|
|
11968
|
+
const { amountOut: amountOutV32, fee: bestV3Fee2 } = await this.getV3QuoteWithAmountIn(
|
|
11969
|
+
getQuoteIn,
|
|
11970
|
+
tokenIn,
|
|
11971
|
+
tokenOut,
|
|
11972
|
+
amountIn,
|
|
11973
|
+
evmChainID
|
|
11974
|
+
);
|
|
11975
|
+
if (amountOutV32 === BigInt(0)) {
|
|
11976
|
+
return { protocol: null, amountOut: BigInt(0) };
|
|
11977
|
+
}
|
|
11978
|
+
let transactions2;
|
|
11979
|
+
if (options?.generateCalldata) {
|
|
11980
|
+
transactions2 = this.createV3SwapCalldataExactIn(
|
|
11981
|
+
tokenIn,
|
|
11982
|
+
tokenOut,
|
|
11983
|
+
amountIn,
|
|
11984
|
+
amountOutV32,
|
|
11985
|
+
bestV3Fee2,
|
|
11986
|
+
options.recipient,
|
|
11987
|
+
evmChainID,
|
|
11988
|
+
getQuoteIn
|
|
11989
|
+
);
|
|
11990
|
+
}
|
|
11991
|
+
return { protocol: "v3", amountOut: amountOutV32, fee: bestV3Fee2, transactions: transactions2 };
|
|
11992
|
+
}
|
|
11993
|
+
if (options.selectedProtocol === "v4") {
|
|
11994
|
+
const { amountOut: amountOutV42, fee: bestV4Fee2 } = await this.getV4QuoteWithAmountIn(
|
|
11995
|
+
getQuoteIn,
|
|
11996
|
+
tokenIn,
|
|
11997
|
+
tokenOut,
|
|
11998
|
+
amountIn,
|
|
11999
|
+
evmChainID
|
|
12000
|
+
);
|
|
12001
|
+
if (amountOutV42 === BigInt(0)) {
|
|
12002
|
+
return { protocol: null, amountOut: BigInt(0) };
|
|
12003
|
+
}
|
|
12004
|
+
let transactions2;
|
|
12005
|
+
if (options?.generateCalldata) {
|
|
12006
|
+
transactions2 = this.createV4SwapCalldataExactIn(
|
|
12007
|
+
tokenIn,
|
|
12008
|
+
tokenOut,
|
|
12009
|
+
amountIn,
|
|
12010
|
+
amountOutV42,
|
|
12011
|
+
bestV4Fee2,
|
|
12012
|
+
evmChainID,
|
|
12013
|
+
getQuoteIn
|
|
12014
|
+
);
|
|
12015
|
+
}
|
|
12016
|
+
return { protocol: "v4", amountOut: amountOutV42, fee: bestV4Fee2, transactions: transactions2 };
|
|
12335
12017
|
}
|
|
12336
12018
|
}
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12019
|
+
const amountOutV2 = await this.getV2QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID);
|
|
12020
|
+
const { amountOut: amountOutV3, fee: bestV3Fee } = await this.getV3QuoteWithAmountIn(
|
|
12021
|
+
getQuoteIn,
|
|
12022
|
+
tokenIn,
|
|
12023
|
+
tokenOut,
|
|
12024
|
+
amountIn,
|
|
12025
|
+
evmChainID
|
|
12026
|
+
);
|
|
12027
|
+
const { amountOut: amountOutV4, fee: bestV4Fee } = await this.getV4QuoteWithAmountIn(
|
|
12028
|
+
getQuoteIn,
|
|
12029
|
+
tokenIn,
|
|
12030
|
+
tokenOut,
|
|
12031
|
+
amountIn,
|
|
12032
|
+
evmChainID
|
|
12033
|
+
);
|
|
12341
12034
|
if (amountOutV2 === BigInt(0) && amountOutV3 === BigInt(0) && amountOutV4 === BigInt(0)) {
|
|
12342
12035
|
return {
|
|
12343
12036
|
protocol: null,
|
|
@@ -12347,10 +12040,34 @@ var IntentGateway = class {
|
|
|
12347
12040
|
if (amountOutV4 !== BigInt(0)) {
|
|
12348
12041
|
const thresholdBps = 100n;
|
|
12349
12042
|
if (amountOutV3 !== BigInt(0) && this.isWithinThreshold(amountOutV4, amountOutV3, thresholdBps)) {
|
|
12350
|
-
|
|
12043
|
+
let transactions2;
|
|
12044
|
+
if (options?.generateCalldata) {
|
|
12045
|
+
transactions2 = this.createV4SwapCalldataExactIn(
|
|
12046
|
+
tokenIn,
|
|
12047
|
+
tokenOut,
|
|
12048
|
+
amountIn,
|
|
12049
|
+
amountOutV4,
|
|
12050
|
+
bestV4Fee,
|
|
12051
|
+
evmChainID,
|
|
12052
|
+
getQuoteIn
|
|
12053
|
+
);
|
|
12054
|
+
}
|
|
12055
|
+
return { protocol: "v4", amountOut: amountOutV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12351
12056
|
}
|
|
12352
12057
|
if (amountOutV2 !== BigInt(0) && this.isWithinThreshold(amountOutV4, amountOutV2, thresholdBps)) {
|
|
12353
|
-
|
|
12058
|
+
let transactions2;
|
|
12059
|
+
if (options?.generateCalldata) {
|
|
12060
|
+
transactions2 = this.createV4SwapCalldataExactIn(
|
|
12061
|
+
tokenIn,
|
|
12062
|
+
tokenOut,
|
|
12063
|
+
amountIn,
|
|
12064
|
+
amountOutV4,
|
|
12065
|
+
bestV4Fee,
|
|
12066
|
+
evmChainID,
|
|
12067
|
+
getQuoteIn
|
|
12068
|
+
);
|
|
12069
|
+
}
|
|
12070
|
+
return { protocol: "v4", amountOut: amountOutV4, fee: bestV4Fee, transactions: transactions2 };
|
|
12354
12071
|
}
|
|
12355
12072
|
}
|
|
12356
12073
|
const maxAmount = [
|
|
@@ -12358,22 +12075,60 @@ var IntentGateway = class {
|
|
|
12358
12075
|
{ protocol: "v3", amountOut: amountOutV3, fee: bestV3Fee },
|
|
12359
12076
|
{ protocol: "v4", amountOut: amountOutV4, fee: bestV4Fee }
|
|
12360
12077
|
].reduce((best, current) => current.amountOut > best.amountOut ? current : best);
|
|
12078
|
+
let transactions;
|
|
12079
|
+
if (options?.generateCalldata) {
|
|
12080
|
+
if (maxAmount.protocol === "v2") {
|
|
12081
|
+
transactions = this.createV2SwapCalldataExactIn(
|
|
12082
|
+
tokenIn,
|
|
12083
|
+
tokenOut,
|
|
12084
|
+
amountIn,
|
|
12085
|
+
amountOutV2,
|
|
12086
|
+
options.recipient,
|
|
12087
|
+
evmChainID,
|
|
12088
|
+
getQuoteIn
|
|
12089
|
+
);
|
|
12090
|
+
} else if (maxAmount.protocol === "v3") {
|
|
12091
|
+
transactions = this.createV3SwapCalldataExactIn(
|
|
12092
|
+
tokenIn,
|
|
12093
|
+
tokenOut,
|
|
12094
|
+
amountIn,
|
|
12095
|
+
amountOutV3,
|
|
12096
|
+
bestV3Fee,
|
|
12097
|
+
options.recipient,
|
|
12098
|
+
evmChainID,
|
|
12099
|
+
getQuoteIn
|
|
12100
|
+
);
|
|
12101
|
+
} else {
|
|
12102
|
+
transactions = this.createV4SwapCalldataExactIn(
|
|
12103
|
+
tokenIn,
|
|
12104
|
+
tokenOut,
|
|
12105
|
+
amountIn,
|
|
12106
|
+
amountOutV4,
|
|
12107
|
+
bestV4Fee,
|
|
12108
|
+
evmChainID,
|
|
12109
|
+
getQuoteIn
|
|
12110
|
+
);
|
|
12111
|
+
}
|
|
12112
|
+
}
|
|
12361
12113
|
if (maxAmount.protocol === "v2") {
|
|
12362
12114
|
return {
|
|
12363
12115
|
protocol: "v2",
|
|
12364
|
-
amountOut: amountOutV2
|
|
12116
|
+
amountOut: amountOutV2,
|
|
12117
|
+
transactions
|
|
12365
12118
|
};
|
|
12366
12119
|
} else if (maxAmount.protocol === "v3") {
|
|
12367
12120
|
return {
|
|
12368
12121
|
protocol: "v3",
|
|
12369
12122
|
amountOut: amountOutV3,
|
|
12370
|
-
fee: bestV3Fee
|
|
12123
|
+
fee: bestV3Fee,
|
|
12124
|
+
transactions
|
|
12371
12125
|
};
|
|
12372
12126
|
} else {
|
|
12373
12127
|
return {
|
|
12374
12128
|
protocol: "v4",
|
|
12375
12129
|
amountOut: amountOutV4,
|
|
12376
|
-
fee: bestV4Fee
|
|
12130
|
+
fee: bestV4Fee,
|
|
12131
|
+
transactions
|
|
12377
12132
|
};
|
|
12378
12133
|
}
|
|
12379
12134
|
}
|
|
@@ -12590,6 +12345,17 @@ var IntentGateway = class {
|
|
|
12590
12345
|
const basisPoints = 10000n;
|
|
12591
12346
|
return candidate * basisPoints <= reference * (basisPoints + thresholdBps);
|
|
12592
12347
|
}
|
|
12348
|
+
/**
|
|
12349
|
+
* Encodes multiple command bytes into packed format
|
|
12350
|
+
* @private
|
|
12351
|
+
*/
|
|
12352
|
+
encodeCommands(commands) {
|
|
12353
|
+
if (commands.length === 0) {
|
|
12354
|
+
throw new Error("Commands array cannot be empty");
|
|
12355
|
+
}
|
|
12356
|
+
const types = Array(commands.length).fill("uint8");
|
|
12357
|
+
return encodePacked(types, commands);
|
|
12358
|
+
}
|
|
12593
12359
|
};
|
|
12594
12360
|
function transformOrderForContract(order) {
|
|
12595
12361
|
return {
|