@apex_labs/sdk 0.1.1 → 0.2.0
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/README.md +12 -14
- package/dist/index.cjs +27 -1158
- package/dist/index.d.cts +629 -7905
- package/dist/index.d.ts +629 -7905
- package/dist/index.js +23 -1058
- package/package.json +3 -4
- package/vendor/pancake-v3-sdk/README.md +0 -5
- package/vendor/pancake-v3-sdk/package.json +0 -19
package/dist/index.cjs
CHANGED
|
@@ -30,169 +30,73 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
ADDRESS_ZERO: () => ADDRESS_ZERO,
|
|
34
33
|
APEX_CLASSIC_FEE_DENOMINATOR: () => APEX_CLASSIC_FEE_DENOMINATOR,
|
|
35
34
|
APEX_CLASSIC_PAIR_INIT_CODE_HASH: () => APEX_CLASSIC_PAIR_INIT_CODE_HASH,
|
|
36
35
|
APEX_CL_POOL_INIT_CODE_HASH: () => APEX_CL_POOL_INIT_CODE_HASH,
|
|
37
36
|
APEX_CL_PROTOCOL_FEE_DENOMINATOR: () => APEX_CL_PROTOCOL_FEE_DENOMINATOR,
|
|
38
37
|
APEX_CL_PROTOCOL_FEE_SPACING: () => APEX_CL_PROTOCOL_FEE_SPACING,
|
|
39
|
-
|
|
40
|
-
APEX_MAX_UINT128: () => APEX_MAX_UINT128,
|
|
38
|
+
APEX_MIXED_ROUTE_CLASSIC_PLACEHOLDER: () => APEX_MIXED_ROUTE_CLASSIC_PLACEHOLDER,
|
|
41
39
|
APEX_MIXED_ROUTE_CLASSIC_STABLE: () => APEX_MIXED_ROUTE_CLASSIC_STABLE,
|
|
42
40
|
APEX_MIXED_ROUTE_CLASSIC_VOLATILE: () => APEX_MIXED_ROUTE_CLASSIC_VOLATILE,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
APEX_MIXED_ROUTE_PANCAKE_VOLATILE_FLAG: () => APEX_MIXED_ROUTE_PANCAKE_VOLATILE_FLAG,
|
|
41
|
+
APEX_MIXED_ROUTE_STABLE_FLAG: () => APEX_MIXED_ROUTE_STABLE_FLAG,
|
|
42
|
+
APEX_MIXED_ROUTE_VOLATILE_FLAG: () => APEX_MIXED_ROUTE_VOLATILE_FLAG,
|
|
46
43
|
APEX_VAULT_BPS: () => APEX_VAULT_BPS,
|
|
47
|
-
ApexCLFarm: () => ApexCLFarm,
|
|
48
|
-
ApexClassicFarm: () => ApexClassicFarm,
|
|
49
|
-
ApexFeeAmount: () => CLFeeAmount,
|
|
50
|
-
ApexSmartRouter: () => ApexSmartRouter,
|
|
51
44
|
ApexVault: () => ApexVault,
|
|
52
|
-
ApexVaultPosition: () => ApexVaultPosition,
|
|
53
45
|
CLFeeAmount: () => CLFeeAmount,
|
|
54
46
|
CLMasterChef: () => CLMasterChef,
|
|
55
47
|
CL_TICK_SPACINGS: () => CL_TICK_SPACINGS,
|
|
56
48
|
ClassicChef: () => ClassicChef,
|
|
57
|
-
DEPLOYER_ADDRESSES: () => DEPLOYER_ADDRESSES,
|
|
58
|
-
FACTORY_ADDRESSES: () => FACTORY_ADDRESSES,
|
|
59
|
-
FeeAmount: () => FeeAmount,
|
|
60
|
-
FeeCalculator: () => FeeCalculator,
|
|
61
|
-
FullMath: () => FullMath,
|
|
62
|
-
LiquidityMath: () => LiquidityMath,
|
|
63
49
|
MAX_UINT128: () => MAX_UINT128,
|
|
64
|
-
MasterChefV3: () => MasterChefV3,
|
|
65
|
-
MaxUint128: () => MaxUint128,
|
|
66
|
-
Multicall: () => Multicall,
|
|
67
|
-
NFT_POSITION_MANAGER_ADDRESSES: () => NFT_POSITION_MANAGER_ADDRESSES,
|
|
68
|
-
NoTickDataProvider: () => NoTickDataProvider,
|
|
69
50
|
NonfungiblePositionManager: () => NonfungiblePositionManager,
|
|
70
|
-
POOL_INIT_CODE_HASHES: () => POOL_INIT_CODE_HASHES,
|
|
71
|
-
Payments: () => Payments,
|
|
72
51
|
Pool: () => Pool,
|
|
73
52
|
Position: () => Position,
|
|
74
|
-
PositionLibrary: () => PositionLibrary,
|
|
75
|
-
PositionMath: () => PositionMath,
|
|
76
53
|
Route: () => Route,
|
|
77
|
-
SelfPermit: () => SelfPermit,
|
|
78
54
|
SmartRouter: () => SmartRouter,
|
|
79
|
-
SqrtPriceMath: () => SqrtPriceMath,
|
|
80
|
-
Staker: () => Staker,
|
|
81
|
-
SwapMath: () => SwapMath,
|
|
82
55
|
SwapQuoter: () => SwapQuoter,
|
|
83
56
|
SwapRouter: () => SwapRouter,
|
|
84
|
-
TICK_SPACINGS: () => TICK_SPACINGS,
|
|
85
57
|
Tick: () => Tick,
|
|
86
|
-
TickLibrary: () => TickLibrary,
|
|
87
|
-
TickList: () => TickList,
|
|
88
|
-
TickListDataProvider: () => TickListDataProvider,
|
|
89
58
|
TickMath: () => TickMath,
|
|
90
59
|
Trade: () => Trade,
|
|
91
60
|
apexControllerAbi: () => apexControllerAbi,
|
|
92
61
|
apexTokenAbi: () => apexTokenAbi,
|
|
93
62
|
apexVaultAbi: () => apexVaultAbi,
|
|
94
|
-
apexVaultCompoundBucket: () => apexVaultCompoundBucket,
|
|
95
|
-
asPancakeFeeAmount: () => asPancakeFeeAmount,
|
|
96
63
|
clFactoryAbi: () => clFactoryAbi,
|
|
97
64
|
clMasterChefAbi: () => clMasterChefAbi,
|
|
98
65
|
clPoolAbi: () => clPoolAbi,
|
|
99
66
|
classicChefAbi: () => classicChefAbi,
|
|
100
67
|
classicFactoryAbi: () => classicFactoryAbi,
|
|
101
68
|
classicPoolAbi: () => classicPoolAbi,
|
|
102
|
-
computeApexCLPoolAddress: () => computeApexCLPoolAddress,
|
|
103
|
-
computeApexClassicPairAddress: () => computeApexClassicPairAddress,
|
|
104
69
|
computeCLPoolAddress: () => computeCLPoolAddress,
|
|
105
70
|
computeClassicPoolAddress: () => computeClassicPoolAddress,
|
|
106
71
|
computeCreate2Address: () => computeCreate2Address,
|
|
107
|
-
computePoolAddress: () => computePoolAddress,
|
|
108
|
-
createApexPool: () => createApexPool,
|
|
109
72
|
createCLPool: () => createCLPool,
|
|
110
|
-
decodeApexMixedRoutePath: () => decodeApexMixedRoutePath,
|
|
111
73
|
decodeMixedRoutePath: () => decodeMixedRoutePath,
|
|
112
|
-
encodeApexMixedRouteToPancakeQuoteParams: () => encodeApexMixedRouteToPancakeQuoteParams,
|
|
113
|
-
encodeApexMixedRouteToPath: () => encodeApexMixedRouteToPath,
|
|
114
|
-
encodeMixedRouteToPancakeQuoteParams: () => encodeMixedRouteToPancakeQuoteParams,
|
|
115
74
|
encodeMixedRouteToPath: () => encodeMixedRouteToPath,
|
|
116
|
-
|
|
75
|
+
encodeMixedRouteToQuoteParams: () => encodeMixedRouteToQuoteParams,
|
|
117
76
|
encodeSqrtRatioX96: () => encodeSqrtRatioX96,
|
|
118
77
|
feeCenterAbi: () => feeCenterAbi,
|
|
119
78
|
feeReceiverAbi: () => feeReceiverAbi,
|
|
120
79
|
feeSwapperAbi: () => feeSwapperAbi,
|
|
121
80
|
formatVaultConfig: () => formatVaultConfig,
|
|
122
|
-
getAmountsAtNewPrice: () => getAmountsAtNewPrice,
|
|
123
|
-
getAmountsByLiquidityAndPrice: () => getAmountsByLiquidityAndPrice,
|
|
124
|
-
getApexTickSpacing: () => getApexTickSpacing,
|
|
125
81
|
getApexVaultCompoundBucket: () => getApexVaultCompoundBucket,
|
|
126
|
-
getAverageLiquidity: () => getAverageLiquidity,
|
|
127
82
|
getCLTickSpacing: () => getCLTickSpacing,
|
|
128
|
-
getCurrency0Price: () => getCurrency0Price,
|
|
129
|
-
getCurrency1Price: () => getCurrency1Price,
|
|
130
|
-
getDependentAmount: () => getDependentAmount,
|
|
131
|
-
getEstimatedLPFee: () => getEstimatedLPFee,
|
|
132
|
-
getEstimatedLPFeeByAmounts: () => getEstimatedLPFeeByAmounts,
|
|
133
|
-
getEstimatedLPFeeByAmountsWithProtocolFee: () => getEstimatedLPFeeByAmountsWithProtocolFee,
|
|
134
|
-
getEstimatedLPFeeWithProtocolFee: () => getEstimatedLPFeeWithProtocolFee,
|
|
135
|
-
getInputAmount: () => getInputAmount,
|
|
136
|
-
getLiquidityByAmountsAndPrice: () => getLiquidityByAmountsAndPrice,
|
|
137
|
-
getLiquidityBySingleAmount: () => getLiquidityBySingleAmount,
|
|
138
|
-
getLiquidityFromSqrtRatioX96: () => getLiquidityFromSqrtRatioX96,
|
|
139
|
-
getLiquidityFromTick: () => getLiquidityFromTick,
|
|
140
|
-
getOutputAmount: () => getOutputAmount,
|
|
141
|
-
getPool: () => getPool,
|
|
142
|
-
getPriceOfCurrency: () => getPriceOfCurrency,
|
|
143
|
-
getPriceOfCurrency0: () => getPriceOfCurrency0,
|
|
144
|
-
getPriceOfCurrency1: () => getPriceOfCurrency1,
|
|
145
|
-
hasInvolvedCurrency: () => hasInvolvedCurrency,
|
|
146
|
-
installApexFeeTiers: () => installApexFeeTiers,
|
|
147
83
|
installCLFeeTiers: () => installCLFeeTiers,
|
|
148
84
|
interfaceMulticallAbi: () => interfaceMulticallAbi,
|
|
149
|
-
isApexCLFeeAmount: () => isApexCLFeeAmount,
|
|
150
85
|
isCLFeeAmount: () => isCLFeeAmount,
|
|
151
|
-
isMint: () => isMint,
|
|
152
|
-
isPoolTickInRange: () => isPoolTickInRange,
|
|
153
|
-
isSorted: () => isSorted,
|
|
154
|
-
masterChefV3ABI: () => masterChefV3ABI,
|
|
155
|
-
maxLiquidityForAmount0Imprecise: () => maxLiquidityForAmount0Imprecise,
|
|
156
|
-
maxLiquidityForAmount0Precise: () => maxLiquidityForAmount0Precise,
|
|
157
|
-
maxLiquidityForAmount1: () => maxLiquidityForAmount1,
|
|
158
|
-
maxLiquidityForAmounts: () => maxLiquidityForAmounts,
|
|
159
86
|
mixedQuoterAbi: () => mixedQuoterAbi,
|
|
160
|
-
mostSignificantBit: () => mostSignificantBit,
|
|
161
87
|
nearestUsableTick: () => nearestUsableTick,
|
|
162
|
-
nonfungiblePositionManagerABI: () => nonfungiblePositionManagerABI,
|
|
163
88
|
nonfungiblePositionManagerAbi: () => nonfungiblePositionManagerAbi,
|
|
164
89
|
normalizeAddress: () => normalizeAddress,
|
|
165
|
-
packApexProtocolFees: () => packApexProtocolFees,
|
|
166
90
|
packProtocolFees: () => packProtocolFees,
|
|
167
|
-
pancakeV3PoolABI: () => pancakeV3PoolABI,
|
|
168
|
-
parseApexProtocolFeePacked: () => parseApexProtocolFeePacked,
|
|
169
91
|
parseProtocolFeePacked: () => parseProtocolFeePacked,
|
|
170
|
-
parseProtocolFees: () => parseProtocolFees,
|
|
171
|
-
peripheryPaymentsWithFeeABI: () => peripheryPaymentsWithFeeABI,
|
|
172
|
-
priceToClosestTick: () => priceToClosestTick,
|
|
173
|
-
quoteApexClassicExactInput: () => quoteApexClassicExactInput,
|
|
174
92
|
quoteClassicExactInput: () => quoteClassicExactInput,
|
|
175
|
-
quoterABI: () => quoterABI,
|
|
176
93
|
quoterAbi: () => quoterAbi,
|
|
177
|
-
quoterV2ABI: () => quoterV2ABI,
|
|
178
94
|
quoterV2Abi: () => quoterV2Abi,
|
|
179
|
-
selfPermitABI: () => selfPermitABI,
|
|
180
95
|
smartRouterAbi: () => smartRouterAbi,
|
|
181
96
|
sortAddresses: () => sortAddresses,
|
|
182
|
-
sqrtRatioX96ToPrice: () => sqrtRatioX96ToPrice,
|
|
183
|
-
subIn256: () => subIn256,
|
|
184
|
-
swap: () => swap,
|
|
185
|
-
swapRouterABI: () => swapRouterABI,
|
|
186
97
|
swapRouterAbi: () => swapRouterAbi,
|
|
187
98
|
tickLensAbi: () => tickLensAbi,
|
|
188
|
-
tickToPrice: () => tickToPrice,
|
|
189
|
-
tickToPriceV2: () => tickToPriceV2,
|
|
190
|
-
toApexFeeAmount: () => toApexFeeAmount,
|
|
191
99
|
toCLFeeAmount: () => toCLFeeAmount,
|
|
192
|
-
toHex: () => toHex,
|
|
193
|
-
tradeComparator: () => tradeComparator,
|
|
194
|
-
v3PoolAbi: () => v3PoolAbi,
|
|
195
|
-
v3StakerABI: () => v3StakerABI,
|
|
196
100
|
validateApexVaultUserConfig: () => validateApexVaultUserConfig,
|
|
197
101
|
veApexTokenAbi: () => veApexTokenAbi
|
|
198
102
|
});
|
|
@@ -297,13 +201,6 @@ var NFT_POSITION_MANAGER_ADDRESSES = {
|
|
|
297
201
|
[import_chains.ChainId.MONAD_MAINNET]: NFT_POSITION_MANAGER_ADDRESS,
|
|
298
202
|
[import_chains.ChainId.MONAD_TESTNET]: "0x075A0Ba7bc4cdFBBdc9d8De5f228C834246e5AFc"
|
|
299
203
|
};
|
|
300
|
-
var FeeAmount = /* @__PURE__ */ ((FeeAmount4) => {
|
|
301
|
-
FeeAmount4[FeeAmount4["LOWEST"] = 100] = "LOWEST";
|
|
302
|
-
FeeAmount4[FeeAmount4["LOW"] = 500] = "LOW";
|
|
303
|
-
FeeAmount4[FeeAmount4["MEDIUM"] = 2500] = "MEDIUM";
|
|
304
|
-
FeeAmount4[FeeAmount4["HIGH"] = 1e4] = "HIGH";
|
|
305
|
-
return FeeAmount4;
|
|
306
|
-
})(FeeAmount || {});
|
|
307
204
|
var TICK_SPACINGS = {
|
|
308
205
|
[
|
|
309
206
|
100
|
|
@@ -1026,25 +923,6 @@ function tickToPrice(baseToken, quoteToken, tick) {
|
|
|
1026
923
|
const ratioX192 = sqrtRatioX96 * sqrtRatioX96;
|
|
1027
924
|
return (0, import_swap_sdk_core.isCurrencySorted)(baseToken, quoteToken) ? new import_swap_sdk_core.Price(baseToken, quoteToken, Q192, ratioX192) : new import_swap_sdk_core.Price(baseToken, quoteToken, ratioX192, Q192);
|
|
1028
925
|
}
|
|
1029
|
-
function tickToPriceV2(baseToken, quoteToken, tick) {
|
|
1030
|
-
const sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick);
|
|
1031
|
-
const ratioX192 = sqrtRatioX96 * sqrtRatioX96;
|
|
1032
|
-
return (0, import_swap_sdk_core.sortCurrencies)([baseToken, quoteToken])[0] === baseToken ? new import_swap_sdk_core.Price(baseToken, quoteToken, Q192, ratioX192) : new import_swap_sdk_core.Price(baseToken, quoteToken, ratioX192, Q192);
|
|
1033
|
-
}
|
|
1034
|
-
function priceToClosestTick(price) {
|
|
1035
|
-
const sorted = (0, import_swap_sdk_core.isCurrencySorted)(price.baseCurrency, price.quoteCurrency);
|
|
1036
|
-
const sqrtRatioX96 = sorted ? encodeSqrtRatioX96(price.numerator, price.denominator) : encodeSqrtRatioX96(price.denominator, price.numerator);
|
|
1037
|
-
let tick = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
|
|
1038
|
-
const nextTickPrice = tickToPrice(price.baseCurrency, price.quoteCurrency, tick + 1);
|
|
1039
|
-
if (sorted) {
|
|
1040
|
-
if (!price.lessThan(nextTickPrice)) {
|
|
1041
|
-
tick++;
|
|
1042
|
-
}
|
|
1043
|
-
} else if (!price.greaterThan(nextTickPrice)) {
|
|
1044
|
-
tick++;
|
|
1045
|
-
}
|
|
1046
|
-
return tick;
|
|
1047
|
-
}
|
|
1048
926
|
function getToken0Amount(tickCurrent, tickLower, tickUpper, sqrtRatioX96, liquidity) {
|
|
1049
927
|
if (tickCurrent < tickLower) {
|
|
1050
928
|
return SqrtPriceMath.getAmount0Delta(
|
|
@@ -1857,54 +1735,7 @@ var Trade = class {
|
|
|
1857
1735
|
return bestTrades;
|
|
1858
1736
|
}
|
|
1859
1737
|
};
|
|
1860
|
-
var getCurrency0Price = ([currency0, currency1], currentSqrtRatioX96) => {
|
|
1861
|
-
const ratio192 = BigInt(currentSqrtRatioX96) * BigInt(currentSqrtRatioX96);
|
|
1862
|
-
return new import_sdk.Price(currency0, currency1, Q192, ratio192);
|
|
1863
|
-
};
|
|
1864
|
-
var getCurrency1Price = ([currency0, currency1], currentSqrtRatioX96) => {
|
|
1865
|
-
const ratio192 = BigInt(currentSqrtRatioX96) * BigInt(currentSqrtRatioX96);
|
|
1866
|
-
return new import_sdk.Price(currency1, currency0, Q192, ratio192);
|
|
1867
|
-
};
|
|
1868
1738
|
var NO_TICK_DATA_PROVIDER_DEFAULT2 = new NoTickDataProvider();
|
|
1869
|
-
var MAX_FEE_AMOUNT = 1000000n;
|
|
1870
|
-
var getPool = ({
|
|
1871
|
-
currencyA,
|
|
1872
|
-
currencyB,
|
|
1873
|
-
fee,
|
|
1874
|
-
sqrtRatioX96,
|
|
1875
|
-
liquidity,
|
|
1876
|
-
tickCurrent,
|
|
1877
|
-
tickSpacing,
|
|
1878
|
-
ticks = NO_TICK_DATA_PROVIDER_DEFAULT2
|
|
1879
|
-
}) => {
|
|
1880
|
-
(0, import_tiny_invariant.default)(Number.isInteger(fee) && BigInt(fee) < MAX_FEE_AMOUNT, "FEE");
|
|
1881
|
-
const [currency0, currency1] = (0, import_swap_sdk_core.sortCurrencies)([currencyA, currencyB]);
|
|
1882
|
-
return {
|
|
1883
|
-
currency0,
|
|
1884
|
-
currency1,
|
|
1885
|
-
fee,
|
|
1886
|
-
tickCurrent,
|
|
1887
|
-
tickSpacing,
|
|
1888
|
-
sqrtRatioX96: BigInt(sqrtRatioX96),
|
|
1889
|
-
liquidity: BigInt(liquidity),
|
|
1890
|
-
tickDataProvider: Array.isArray(ticks) ? new TickListDataProvider(ticks) : ticks
|
|
1891
|
-
};
|
|
1892
|
-
};
|
|
1893
|
-
var getPriceOfCurrency = (pool, currency) => {
|
|
1894
|
-
if (currency.isNative) {
|
|
1895
|
-
(0, import_tiny_invariant.default)(pool.currency0.isNative, "CURRENCY");
|
|
1896
|
-
return getCurrency0Price([pool.currency0, pool.currency1], pool.sqrtRatioX96);
|
|
1897
|
-
}
|
|
1898
|
-
(0, import_tiny_invariant.default)(pool.currency0.equals(currency) || pool.currency1.equals(currency), "CURRENCY");
|
|
1899
|
-
return pool.currency0.equals(currency) ? getCurrency0Price([pool.currency0, pool.currency1], pool.sqrtRatioX96) : getCurrency1Price([pool.currency0, pool.currency1], pool.sqrtRatioX96);
|
|
1900
|
-
};
|
|
1901
|
-
var getPriceOfCurrency0 = (pool) => getCurrency0Price([pool.currency0, pool.currency1], pool.sqrtRatioX96);
|
|
1902
|
-
var getPriceOfCurrency1 = (pool) => getCurrency1Price([pool.currency0, pool.currency1], pool.sqrtRatioX96);
|
|
1903
|
-
var hasInvolvedCurrency = (pool, currency) => {
|
|
1904
|
-
if (currency.isNative)
|
|
1905
|
-
return pool.currency0.isNative && pool.currency1.chainId === currency.chainId;
|
|
1906
|
-
return pool.currency0.equals(currency) || pool.currency1.equals(currency);
|
|
1907
|
-
};
|
|
1908
1739
|
function toHex(bigintIsh) {
|
|
1909
1740
|
const bigInt = BigInt(bigintIsh);
|
|
1910
1741
|
let hex = bigInt.toString(16);
|
|
@@ -1948,403 +1779,8 @@ function nearestUsableTick(tick, tickSpacing) {
|
|
|
1948
1779
|
return rounded - tickSpacing;
|
|
1949
1780
|
return rounded;
|
|
1950
1781
|
}
|
|
1951
|
-
var PositionLibrary = class {
|
|
1952
|
-
/**
|
|
1953
|
-
* Cannot be constructed.
|
|
1954
|
-
*/
|
|
1955
|
-
constructor() {
|
|
1956
|
-
}
|
|
1957
|
-
// replicates the portions of Position#update required to compute unaccounted fees
|
|
1958
|
-
static getTokensOwed(feeGrowthInside0LastX128, feeGrowthInside1LastX128, liquidity, feeGrowthInside0X128, feeGrowthInside1X128) {
|
|
1959
|
-
const tokensOwed0 = subIn256(feeGrowthInside0X128, feeGrowthInside0LastX128) * liquidity / Q128;
|
|
1960
|
-
const tokensOwed1 = subIn256(feeGrowthInside1X128, feeGrowthInside1LastX128) * liquidity / Q128;
|
|
1961
|
-
return [tokensOwed0, tokensOwed1];
|
|
1962
|
-
}
|
|
1963
|
-
};
|
|
1964
1782
|
var Q256 = 2n ** 256n;
|
|
1965
|
-
function subIn256(x, y) {
|
|
1966
|
-
const difference = x - y;
|
|
1967
|
-
if (difference < ZERO) {
|
|
1968
|
-
return Q256 + difference;
|
|
1969
|
-
}
|
|
1970
|
-
return difference;
|
|
1971
|
-
}
|
|
1972
|
-
var TickLibrary = class {
|
|
1973
|
-
/**
|
|
1974
|
-
* Cannot be constructed.
|
|
1975
|
-
*/
|
|
1976
|
-
constructor() {
|
|
1977
|
-
}
|
|
1978
|
-
static getFeeGrowthInside(feeGrowthOutsideLower, feeGrowthOutsideUpper, tickLower, tickUpper, tickCurrent, feeGrowthGlobal0X128, feeGrowthGlobal1X128) {
|
|
1979
|
-
let feeGrowthBelow0X128;
|
|
1980
|
-
let feeGrowthBelow1X128;
|
|
1981
|
-
if (tickCurrent >= tickLower) {
|
|
1982
|
-
feeGrowthBelow0X128 = feeGrowthOutsideLower.feeGrowthOutside0X128;
|
|
1983
|
-
feeGrowthBelow1X128 = feeGrowthOutsideLower.feeGrowthOutside1X128;
|
|
1984
|
-
} else {
|
|
1985
|
-
feeGrowthBelow0X128 = subIn256(feeGrowthGlobal0X128, feeGrowthOutsideLower.feeGrowthOutside0X128);
|
|
1986
|
-
feeGrowthBelow1X128 = subIn256(feeGrowthGlobal1X128, feeGrowthOutsideLower.feeGrowthOutside1X128);
|
|
1987
|
-
}
|
|
1988
|
-
let feeGrowthAbove0X128;
|
|
1989
|
-
let feeGrowthAbove1X128;
|
|
1990
|
-
if (tickCurrent < tickUpper) {
|
|
1991
|
-
feeGrowthAbove0X128 = feeGrowthOutsideUpper.feeGrowthOutside0X128;
|
|
1992
|
-
feeGrowthAbove1X128 = feeGrowthOutsideUpper.feeGrowthOutside1X128;
|
|
1993
|
-
} else {
|
|
1994
|
-
feeGrowthAbove0X128 = subIn256(feeGrowthGlobal0X128, feeGrowthOutsideUpper.feeGrowthOutside0X128);
|
|
1995
|
-
feeGrowthAbove1X128 = subIn256(feeGrowthGlobal1X128, feeGrowthOutsideUpper.feeGrowthOutside1X128);
|
|
1996
|
-
}
|
|
1997
|
-
return [
|
|
1998
|
-
subIn256(subIn256(feeGrowthGlobal0X128, feeGrowthBelow0X128), feeGrowthAbove0X128),
|
|
1999
|
-
subIn256(subIn256(feeGrowthGlobal1X128, feeGrowthBelow1X128), feeGrowthAbove1X128)
|
|
2000
|
-
];
|
|
2001
|
-
}
|
|
2002
|
-
};
|
|
2003
|
-
function parseNumberToFraction(num, precision = 6) {
|
|
2004
|
-
if (Number.isNaN(num) || !Number.isFinite(num)) {
|
|
2005
|
-
return void 0;
|
|
2006
|
-
}
|
|
2007
|
-
const scalar = 10 ** precision;
|
|
2008
|
-
const scaledNum = num * scalar;
|
|
2009
|
-
if (Number.isNaN(scaledNum) || !Number.isFinite(scaledNum)) {
|
|
2010
|
-
return void 0;
|
|
2011
|
-
}
|
|
2012
|
-
return new import_swap_sdk_core.Fraction(BigInt(Math.floor(scaledNum)), BigInt(scalar));
|
|
2013
|
-
}
|
|
2014
|
-
var FeeCalculator = {
|
|
2015
|
-
getEstimatedLPFee,
|
|
2016
|
-
getEstimatedLPFeeByAmounts,
|
|
2017
|
-
getLiquidityFromTick,
|
|
2018
|
-
getLiquidityFromSqrtRatioX96,
|
|
2019
|
-
getAverageLiquidity,
|
|
2020
|
-
getLiquidityBySingleAmount,
|
|
2021
|
-
getDependentAmount,
|
|
2022
|
-
getLiquidityByAmountsAndPrice,
|
|
2023
|
-
getAmountsByLiquidityAndPrice,
|
|
2024
|
-
getAmountsAtNewPrice
|
|
2025
|
-
};
|
|
2026
|
-
function getEstimatedLPFeeWithProtocolFee({ amount, currency, ...rest }) {
|
|
2027
|
-
return getEstimatedLPFeeByAmountsWithProtocolFee({
|
|
2028
|
-
...rest,
|
|
2029
|
-
amountA: amount,
|
|
2030
|
-
amountB: import_swap_sdk_core.CurrencyAmount.fromRawAmount(currency, import_swap_sdk_core.MaxUint256)
|
|
2031
|
-
});
|
|
2032
|
-
}
|
|
2033
|
-
function getEstimatedLPFee({ amount, currency, ...rest }) {
|
|
2034
|
-
return getEstimatedLPFeeByAmounts({
|
|
2035
|
-
...rest,
|
|
2036
|
-
amountA: amount,
|
|
2037
|
-
amountB: import_swap_sdk_core.CurrencyAmount.fromRawAmount(currency, import_swap_sdk_core.MaxUint256)
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
function getEstimatedLPFeeByAmountsWithProtocolFee(options) {
|
|
2041
|
-
try {
|
|
2042
|
-
return tryGetEstimatedLPFeeByAmounts(options);
|
|
2043
|
-
} catch (e) {
|
|
2044
|
-
console.error(e);
|
|
2045
|
-
return new import_swap_sdk_core.Fraction(import_swap_sdk_core.ZERO);
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
function getEstimatedLPFeeByAmounts({ protocolFee = ZERO_PERCENT, ...rest }) {
|
|
2049
|
-
try {
|
|
2050
|
-
const fee = tryGetEstimatedLPFeeByAmounts(rest);
|
|
2051
|
-
return ONE_HUNDRED_PERCENT.subtract(protocolFee).multiply(fee).asFraction;
|
|
2052
|
-
} catch (e) {
|
|
2053
|
-
console.error(e);
|
|
2054
|
-
return new import_swap_sdk_core.Fraction(import_swap_sdk_core.ZERO);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
function tryGetEstimatedLPFeeByAmounts({
|
|
2058
|
-
amountA,
|
|
2059
|
-
amountB,
|
|
2060
|
-
volume24H,
|
|
2061
|
-
sqrtRatioX96,
|
|
2062
|
-
tickLower,
|
|
2063
|
-
tickUpper,
|
|
2064
|
-
mostActiveLiquidity,
|
|
2065
|
-
fee,
|
|
2066
|
-
insidePercentage = ONE_HUNDRED_PERCENT
|
|
2067
|
-
}) {
|
|
2068
|
-
(0, import_tiny_invariant.default)(!Number.isNaN(fee) && fee >= 0, "INVALID_FEE");
|
|
2069
|
-
const tickCurrent = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
|
|
2070
|
-
if (tickCurrent < tickLower || tickCurrent >= tickUpper) {
|
|
2071
|
-
return new import_swap_sdk_core.Fraction(import_swap_sdk_core.ZERO);
|
|
2072
|
-
}
|
|
2073
|
-
const liquidity = FeeCalculator.getLiquidityByAmountsAndPrice({
|
|
2074
|
-
amountA,
|
|
2075
|
-
amountB,
|
|
2076
|
-
tickUpper,
|
|
2077
|
-
tickLower,
|
|
2078
|
-
sqrtRatioX96
|
|
2079
|
-
});
|
|
2080
|
-
if (!liquidity) {
|
|
2081
|
-
return new import_swap_sdk_core.Fraction(import_swap_sdk_core.ZERO);
|
|
2082
|
-
}
|
|
2083
|
-
const volumeInFraction = parseNumberToFraction(volume24H) || new import_swap_sdk_core.Fraction(import_swap_sdk_core.ZERO);
|
|
2084
|
-
return insidePercentage.multiply(volumeInFraction.multiply(BigInt(fee)).multiply(liquidity)).divide(MAX_FEE * (liquidity + mostActiveLiquidity)).asFraction;
|
|
2085
|
-
}
|
|
2086
|
-
function getDependentAmount(options) {
|
|
2087
|
-
const { currency, amount, sqrtRatioX96, tickLower, tickUpper } = options;
|
|
2088
|
-
const currentTick = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
|
|
2089
|
-
const liquidity = FeeCalculator.getLiquidityBySingleAmount(options);
|
|
2090
|
-
const isToken0 = currency.wrapped.sortsBefore(amount.currency.wrapped);
|
|
2091
|
-
const getTokenAmount = isToken0 ? PositionMath.getToken0Amount : PositionMath.getToken1Amount;
|
|
2092
|
-
if (!liquidity) {
|
|
2093
|
-
return void 0;
|
|
2094
|
-
}
|
|
2095
|
-
return import_swap_sdk_core.CurrencyAmount.fromRawAmount(
|
|
2096
|
-
currency,
|
|
2097
|
-
getTokenAmount(currentTick, tickLower, tickUpper, sqrtRatioX96, liquidity)
|
|
2098
|
-
);
|
|
2099
|
-
}
|
|
2100
|
-
function getLiquidityBySingleAmount({ amount, currency, ...rest }) {
|
|
2101
|
-
return getLiquidityByAmountsAndPrice({
|
|
2102
|
-
amountA: amount,
|
|
2103
|
-
amountB: import_swap_sdk_core.CurrencyAmount.fromRawAmount(currency, import_swap_sdk_core.MaxUint256),
|
|
2104
|
-
...rest
|
|
2105
|
-
});
|
|
2106
|
-
}
|
|
2107
|
-
function getLiquidityByAmountsAndPrice({
|
|
2108
|
-
amountA,
|
|
2109
|
-
amountB,
|
|
2110
|
-
tickUpper,
|
|
2111
|
-
tickLower,
|
|
2112
|
-
sqrtRatioX96
|
|
2113
|
-
}) {
|
|
2114
|
-
const isToken0 = amountA.currency.wrapped.address !== amountB.currency.wrapped.address ? amountA.currency.wrapped.sortsBefore(amountB.currency.wrapped) : true;
|
|
2115
|
-
const [inputAmount0, inputAmount1] = isToken0 ? [amountA.quotient, amountB.quotient] : [amountB.quotient, amountA.quotient];
|
|
2116
|
-
const sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);
|
|
2117
|
-
const sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);
|
|
2118
|
-
try {
|
|
2119
|
-
return maxLiquidityForAmounts(sqrtRatioX96, sqrtRatioAX96, sqrtRatioBX96, inputAmount0, inputAmount1, true);
|
|
2120
|
-
} catch (e) {
|
|
2121
|
-
console.error(e);
|
|
2122
|
-
return void 0;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
function getAmountsByLiquidityAndPrice(options) {
|
|
2126
|
-
const { currencyA, currencyB, liquidity, sqrtRatioX96, tickLower, tickUpper } = options;
|
|
2127
|
-
const currentTick = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
|
|
2128
|
-
const isToken0 = currencyA.wrapped.sortsBefore(currencyB.wrapped);
|
|
2129
|
-
const adjustedAmount0 = PositionMath.getToken0Amount(currentTick, tickLower, tickUpper, sqrtRatioX96, liquidity);
|
|
2130
|
-
const adjustedAmount1 = PositionMath.getToken1Amount(currentTick, tickLower, tickUpper, sqrtRatioX96, liquidity);
|
|
2131
|
-
return [
|
|
2132
|
-
import_swap_sdk_core.CurrencyAmount.fromRawAmount(currencyA, isToken0 ? adjustedAmount0 : adjustedAmount1),
|
|
2133
|
-
import_swap_sdk_core.CurrencyAmount.fromRawAmount(currencyB, isToken0 ? adjustedAmount1 : adjustedAmount0)
|
|
2134
|
-
];
|
|
2135
|
-
}
|
|
2136
|
-
function getAmountsAtNewPrice({ newSqrtRatioX96, ...rest }) {
|
|
2137
|
-
const { tickLower, tickUpper, amountA, amountB } = rest;
|
|
2138
|
-
const liquidity = FeeCalculator.getLiquidityByAmountsAndPrice(rest);
|
|
2139
|
-
if (!liquidity) {
|
|
2140
|
-
return void 0;
|
|
2141
|
-
}
|
|
2142
|
-
return FeeCalculator.getAmountsByLiquidityAndPrice({
|
|
2143
|
-
liquidity,
|
|
2144
|
-
currencyA: amountA.currency,
|
|
2145
|
-
currencyB: amountB.currency,
|
|
2146
|
-
tickLower,
|
|
2147
|
-
tickUpper,
|
|
2148
|
-
sqrtRatioX96: newSqrtRatioX96
|
|
2149
|
-
});
|
|
2150
|
-
}
|
|
2151
|
-
function getAverageLiquidity(ticks, tickSpacing, tickLower, tickUpper) {
|
|
2152
|
-
(0, import_tiny_invariant.default)(tickLower <= tickUpper, "INVALID_TICK_RANGE");
|
|
2153
|
-
TickList.validateList(ticks, tickSpacing);
|
|
2154
|
-
if (tickLower === tickUpper) {
|
|
2155
|
-
return FeeCalculator.getLiquidityFromTick(ticks, tickLower);
|
|
2156
|
-
}
|
|
2157
|
-
const lowerOutOfBound = tickLower < ticks[0].index;
|
|
2158
|
-
let lastTick = lowerOutOfBound ? new Tick({ index: TickMath.MIN_TICK, liquidityNet: import_swap_sdk_core.ZERO, liquidityGross: import_swap_sdk_core.ZERO }) : TickList.nextInitializedTick(ticks, tickLower, true);
|
|
2159
|
-
let currentTick = TickList.nextInitializedTick(ticks, tickLower, false);
|
|
2160
|
-
let currentL = lowerOutOfBound ? import_swap_sdk_core.ZERO : FeeCalculator.getLiquidityFromTick(ticks, currentTick.index);
|
|
2161
|
-
let weightedL = import_swap_sdk_core.ZERO;
|
|
2162
|
-
const getWeightedLFromLastTickTo = (toTick) => currentL * BigInt(toTick - Math.max(lastTick.index, tickLower));
|
|
2163
|
-
while (currentTick.index < tickUpper) {
|
|
2164
|
-
weightedL += getWeightedLFromLastTickTo(currentTick.index);
|
|
2165
|
-
currentL += currentTick.liquidityNet;
|
|
2166
|
-
lastTick = currentTick;
|
|
2167
|
-
if (currentTick.index === ticks[ticks.length - 1].index) {
|
|
2168
|
-
break;
|
|
2169
|
-
}
|
|
2170
|
-
currentTick = TickList.nextInitializedTick(ticks, currentTick.index, false);
|
|
2171
|
-
}
|
|
2172
|
-
weightedL += getWeightedLFromLastTickTo(tickUpper);
|
|
2173
|
-
return weightedL / BigInt(tickUpper - tickLower);
|
|
2174
|
-
}
|
|
2175
|
-
function getLiquidityFromSqrtRatioX96(ticks, sqrtRatioX96) {
|
|
2176
|
-
const tick = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
|
|
2177
|
-
return FeeCalculator.getLiquidityFromTick(ticks, tick);
|
|
2178
|
-
}
|
|
2179
|
-
function getLiquidityFromTick(ticks, tick) {
|
|
2180
|
-
let liquidity = import_swap_sdk_core.ZERO;
|
|
2181
|
-
if (!ticks?.length)
|
|
2182
|
-
return liquidity;
|
|
2183
|
-
if (tick < ticks[0].index || tick > ticks[ticks.length - 1].index) {
|
|
2184
|
-
return liquidity;
|
|
2185
|
-
}
|
|
2186
|
-
for (let i = 0; i < ticks.length - 1; ++i) {
|
|
2187
|
-
liquidity += ticks[i].liquidityNet;
|
|
2188
|
-
const lowerTick = ticks[i].index;
|
|
2189
|
-
const upperTick = ticks[i + 1]?.index;
|
|
2190
|
-
if (lowerTick <= tick && tick <= upperTick) {
|
|
2191
|
-
break;
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
return liquidity;
|
|
2195
|
-
}
|
|
2196
1783
|
var FEE_BASE = 10n ** 4n;
|
|
2197
|
-
function parseProtocolFees(feeProtocol) {
|
|
2198
|
-
const packed = Number(feeProtocol);
|
|
2199
|
-
if (Number.isNaN(packed)) {
|
|
2200
|
-
throw new Error(`Invalid fee protocol ${feeProtocol}`);
|
|
2201
|
-
}
|
|
2202
|
-
const token0ProtocolFee = packed % 2 ** 16;
|
|
2203
|
-
const token1ProtocolFee = packed >> 16;
|
|
2204
|
-
return [new import_swap_sdk_core.Percent(token0ProtocolFee, FEE_BASE), new import_swap_sdk_core.Percent(token1ProtocolFee, FEE_BASE)];
|
|
2205
|
-
}
|
|
2206
|
-
function sqrtRatioX96ToPrice(sqrtRatioX96, currencyA, currencyB) {
|
|
2207
|
-
const ratioX192 = sqrtRatioX96 * sqrtRatioX96;
|
|
2208
|
-
return currencyA.wrapped.sortsBefore(currencyB.wrapped) ? new import_swap_sdk_core.Price(currencyA.wrapped, currencyB.wrapped, Q192, ratioX192) : new import_swap_sdk_core.Price(currencyA.wrapped, currencyB.wrapped, ratioX192, Q192);
|
|
2209
|
-
}
|
|
2210
|
-
var isPoolTickInRange = (pool, tickLower, tickUpper) => {
|
|
2211
|
-
if (!pool)
|
|
2212
|
-
return false;
|
|
2213
|
-
const below = typeof tickLower === "number" ? pool.tickCurrent < tickLower : void 0;
|
|
2214
|
-
const above = typeof tickUpper === "number" ? pool.tickCurrent >= tickUpper : void 0;
|
|
2215
|
-
return typeof below === "boolean" && typeof above === "boolean" ? !below && !above : false;
|
|
2216
|
-
};
|
|
2217
|
-
var swap = async ({
|
|
2218
|
-
pool,
|
|
2219
|
-
zeroForOne,
|
|
2220
|
-
amountSpecified,
|
|
2221
|
-
sqrtPriceLimitX96
|
|
2222
|
-
}) => {
|
|
2223
|
-
if (!sqrtPriceLimitX96)
|
|
2224
|
-
sqrtPriceLimitX96 = zeroForOne ? TickMath.MIN_SQRT_RATIO + ONE : TickMath.MAX_SQRT_RATIO - ONE;
|
|
2225
|
-
if (zeroForOne) {
|
|
2226
|
-
(0, import_tiny_invariant.default)(sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO, "RATIO_MIN");
|
|
2227
|
-
(0, import_tiny_invariant.default)(sqrtPriceLimitX96 < pool.sqrtRatioX96, "RATIO_CURRENT");
|
|
2228
|
-
} else {
|
|
2229
|
-
(0, import_tiny_invariant.default)(sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO, "RATIO_MAX");
|
|
2230
|
-
(0, import_tiny_invariant.default)(sqrtPriceLimitX96 > pool.sqrtRatioX96, "RATIO_CURRENT");
|
|
2231
|
-
}
|
|
2232
|
-
const exactInput = amountSpecified >= ZERO;
|
|
2233
|
-
const state = {
|
|
2234
|
-
amountSpecifiedRemaining: amountSpecified,
|
|
2235
|
-
amountCalculated: ZERO,
|
|
2236
|
-
sqrtPriceX96: pool.sqrtRatioX96,
|
|
2237
|
-
tick: pool.tickCurrent,
|
|
2238
|
-
liquidity: pool.liquidity
|
|
2239
|
-
};
|
|
2240
|
-
while (state.amountSpecifiedRemaining !== ZERO && state.sqrtPriceX96 != sqrtPriceLimitX96) {
|
|
2241
|
-
const step = {};
|
|
2242
|
-
step.sqrtPriceStartX96 = state.sqrtPriceX96;
|
|
2243
|
-
[step.tickNext, step.initialized] = await pool.tickDataProvider.nextInitializedTickWithinOneWord(
|
|
2244
|
-
state.tick,
|
|
2245
|
-
zeroForOne,
|
|
2246
|
-
pool.tickSpacing
|
|
2247
|
-
);
|
|
2248
|
-
if (step.tickNext < TickMath.MIN_TICK) {
|
|
2249
|
-
step.tickNext = TickMath.MIN_TICK;
|
|
2250
|
-
} else if (step.tickNext > TickMath.MAX_TICK) {
|
|
2251
|
-
step.tickNext = TickMath.MAX_TICK;
|
|
2252
|
-
}
|
|
2253
|
-
step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext);
|
|
2254
|
-
[state.sqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount] = SwapMath.computeSwapStep(
|
|
2255
|
-
state.sqrtPriceX96,
|
|
2256
|
-
(zeroForOne ? step.sqrtPriceNextX96 < sqrtPriceLimitX96 : step.sqrtPriceNextX96 > sqrtPriceLimitX96) ? sqrtPriceLimitX96 : step.sqrtPriceNextX96,
|
|
2257
|
-
state.liquidity,
|
|
2258
|
-
state.amountSpecifiedRemaining,
|
|
2259
|
-
pool.fee
|
|
2260
|
-
);
|
|
2261
|
-
if (exactInput) {
|
|
2262
|
-
state.amountSpecifiedRemaining -= step.amountIn + step.feeAmount;
|
|
2263
|
-
state.amountCalculated = state.amountCalculated - step.amountOut;
|
|
2264
|
-
} else {
|
|
2265
|
-
state.amountSpecifiedRemaining = state.amountSpecifiedRemaining + step.amountOut;
|
|
2266
|
-
state.amountCalculated = state.amountCalculated + (step.amountIn + step.feeAmount);
|
|
2267
|
-
}
|
|
2268
|
-
if (state.sqrtPriceX96 === step.sqrtPriceNextX96) {
|
|
2269
|
-
if (step.initialized) {
|
|
2270
|
-
let liquidityNet = BigInt((await pool.tickDataProvider.getTick(step.tickNext)).liquidityNet);
|
|
2271
|
-
if (zeroForOne)
|
|
2272
|
-
liquidityNet *= NEGATIVE_ONE;
|
|
2273
|
-
state.liquidity = LiquidityMath.addDelta(state.liquidity, liquidityNet);
|
|
2274
|
-
}
|
|
2275
|
-
state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;
|
|
2276
|
-
} else if (state.sqrtPriceX96 !== step.sqrtPriceStartX96) {
|
|
2277
|
-
state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96);
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
return {
|
|
2281
|
-
amountSpecifiedRemaining: state.amountSpecifiedRemaining,
|
|
2282
|
-
amountCalculated: state.amountCalculated,
|
|
2283
|
-
sqrtRatioX96: state.sqrtPriceX96,
|
|
2284
|
-
liquidity: state.liquidity,
|
|
2285
|
-
tickCurrent: state.tick
|
|
2286
|
-
};
|
|
2287
|
-
};
|
|
2288
|
-
var getOutputAmount = async (pool, inputAmount, options) => {
|
|
2289
|
-
(0, import_tiny_invariant.default)(hasInvolvedCurrency(pool, inputAmount.currency), "CURRENCY");
|
|
2290
|
-
const zeroForOne = inputAmount.currency.equals(pool.currency0);
|
|
2291
|
-
const { sqrtPriceLimitX96, exact } = options || {};
|
|
2292
|
-
const {
|
|
2293
|
-
amountCalculated: outputAmount,
|
|
2294
|
-
sqrtRatioX96,
|
|
2295
|
-
liquidity,
|
|
2296
|
-
tickCurrent,
|
|
2297
|
-
amountSpecifiedRemaining
|
|
2298
|
-
} = await swap({
|
|
2299
|
-
pool,
|
|
2300
|
-
zeroForOne,
|
|
2301
|
-
amountSpecified: inputAmount.quotient,
|
|
2302
|
-
sqrtPriceLimitX96
|
|
2303
|
-
});
|
|
2304
|
-
const outputToken = zeroForOne ? pool.currency1 : pool.currency0;
|
|
2305
|
-
if (exact) {
|
|
2306
|
-
(0, import_tiny_invariant.default)(amountSpecifiedRemaining === ZERO, "INSUFFICIENT_LIQUIDITY");
|
|
2307
|
-
}
|
|
2308
|
-
return [
|
|
2309
|
-
import_sdk.CurrencyAmount.fromRawAmount(outputToken, outputAmount * NEGATIVE_ONE),
|
|
2310
|
-
{
|
|
2311
|
-
...pool,
|
|
2312
|
-
sqrtRatioX96,
|
|
2313
|
-
liquidity,
|
|
2314
|
-
tickCurrent
|
|
2315
|
-
}
|
|
2316
|
-
];
|
|
2317
|
-
};
|
|
2318
|
-
var getInputAmount = async (pool, outputAmount, options) => {
|
|
2319
|
-
(0, import_tiny_invariant.default)(hasInvolvedCurrency(pool, outputAmount.currency), "CURRENCY");
|
|
2320
|
-
const zeroForOne = outputAmount.currency.equals(pool.currency1);
|
|
2321
|
-
const { sqrtPriceLimitX96, exact } = options || {};
|
|
2322
|
-
const {
|
|
2323
|
-
amountCalculated: inputAmount,
|
|
2324
|
-
sqrtRatioX96,
|
|
2325
|
-
liquidity,
|
|
2326
|
-
tickCurrent,
|
|
2327
|
-
amountSpecifiedRemaining
|
|
2328
|
-
} = await swap({
|
|
2329
|
-
pool,
|
|
2330
|
-
zeroForOne,
|
|
2331
|
-
amountSpecified: outputAmount.quotient * NEGATIVE_ONE,
|
|
2332
|
-
sqrtPriceLimitX96
|
|
2333
|
-
});
|
|
2334
|
-
if (exact) {
|
|
2335
|
-
(0, import_tiny_invariant.default)(amountSpecifiedRemaining === ZERO, "INSUFFICIENT_LIQUIDITY");
|
|
2336
|
-
}
|
|
2337
|
-
const inputCurrency = zeroForOne ? pool.currency0 : pool.currency1;
|
|
2338
|
-
return [
|
|
2339
|
-
import_sdk.CurrencyAmount.fromRawAmount(inputCurrency, inputAmount),
|
|
2340
|
-
{
|
|
2341
|
-
...pool,
|
|
2342
|
-
sqrtRatioX96,
|
|
2343
|
-
liquidity,
|
|
2344
|
-
tickCurrent
|
|
2345
|
-
}
|
|
2346
|
-
];
|
|
2347
|
-
};
|
|
2348
1784
|
var IMulticall = [
|
|
2349
1785
|
{
|
|
2350
1786
|
inputs: [
|
|
@@ -6459,462 +5895,6 @@ var _SwapRouter = class {
|
|
|
6459
5895
|
};
|
|
6460
5896
|
var SwapRouter = _SwapRouter;
|
|
6461
5897
|
SwapRouter.ABI = swapRouterABI;
|
|
6462
|
-
var pancakeV3PoolABI = [
|
|
6463
|
-
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
6464
|
-
{
|
|
6465
|
-
anonymous: false,
|
|
6466
|
-
inputs: [
|
|
6467
|
-
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
6468
|
-
{ indexed: true, internalType: "int24", name: "tickLower", type: "int24" },
|
|
6469
|
-
{ indexed: true, internalType: "int24", name: "tickUpper", type: "int24" },
|
|
6470
|
-
{ indexed: false, internalType: "uint128", name: "amount", type: "uint128" },
|
|
6471
|
-
{ indexed: false, internalType: "uint256", name: "amount0", type: "uint256" },
|
|
6472
|
-
{ indexed: false, internalType: "uint256", name: "amount1", type: "uint256" }
|
|
6473
|
-
],
|
|
6474
|
-
name: "Burn",
|
|
6475
|
-
type: "event"
|
|
6476
|
-
},
|
|
6477
|
-
{
|
|
6478
|
-
anonymous: false,
|
|
6479
|
-
inputs: [
|
|
6480
|
-
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
6481
|
-
{ indexed: false, internalType: "address", name: "recipient", type: "address" },
|
|
6482
|
-
{ indexed: true, internalType: "int24", name: "tickLower", type: "int24" },
|
|
6483
|
-
{ indexed: true, internalType: "int24", name: "tickUpper", type: "int24" },
|
|
6484
|
-
{ indexed: false, internalType: "uint128", name: "amount0", type: "uint128" },
|
|
6485
|
-
{ indexed: false, internalType: "uint128", name: "amount1", type: "uint128" }
|
|
6486
|
-
],
|
|
6487
|
-
name: "Collect",
|
|
6488
|
-
type: "event"
|
|
6489
|
-
},
|
|
6490
|
-
{
|
|
6491
|
-
anonymous: false,
|
|
6492
|
-
inputs: [
|
|
6493
|
-
{ indexed: true, internalType: "address", name: "sender", type: "address" },
|
|
6494
|
-
{ indexed: true, internalType: "address", name: "recipient", type: "address" },
|
|
6495
|
-
{ indexed: false, internalType: "uint128", name: "amount0", type: "uint128" },
|
|
6496
|
-
{ indexed: false, internalType: "uint128", name: "amount1", type: "uint128" }
|
|
6497
|
-
],
|
|
6498
|
-
name: "CollectProtocol",
|
|
6499
|
-
type: "event"
|
|
6500
|
-
},
|
|
6501
|
-
{
|
|
6502
|
-
anonymous: false,
|
|
6503
|
-
inputs: [
|
|
6504
|
-
{ indexed: true, internalType: "address", name: "sender", type: "address" },
|
|
6505
|
-
{ indexed: true, internalType: "address", name: "recipient", type: "address" },
|
|
6506
|
-
{ indexed: false, internalType: "uint256", name: "amount0", type: "uint256" },
|
|
6507
|
-
{ indexed: false, internalType: "uint256", name: "amount1", type: "uint256" },
|
|
6508
|
-
{ indexed: false, internalType: "uint256", name: "paid0", type: "uint256" },
|
|
6509
|
-
{ indexed: false, internalType: "uint256", name: "paid1", type: "uint256" }
|
|
6510
|
-
],
|
|
6511
|
-
name: "Flash",
|
|
6512
|
-
type: "event"
|
|
6513
|
-
},
|
|
6514
|
-
{
|
|
6515
|
-
anonymous: false,
|
|
6516
|
-
inputs: [
|
|
6517
|
-
{ indexed: false, internalType: "uint16", name: "observationCardinalityNextOld", type: "uint16" },
|
|
6518
|
-
{ indexed: false, internalType: "uint16", name: "observationCardinalityNextNew", type: "uint16" }
|
|
6519
|
-
],
|
|
6520
|
-
name: "IncreaseObservationCardinalityNext",
|
|
6521
|
-
type: "event"
|
|
6522
|
-
},
|
|
6523
|
-
{
|
|
6524
|
-
anonymous: false,
|
|
6525
|
-
inputs: [
|
|
6526
|
-
{ indexed: false, internalType: "uint160", name: "sqrtPriceX96", type: "uint160" },
|
|
6527
|
-
{ indexed: false, internalType: "int24", name: "tick", type: "int24" }
|
|
6528
|
-
],
|
|
6529
|
-
name: "Initialize",
|
|
6530
|
-
type: "event"
|
|
6531
|
-
},
|
|
6532
|
-
{
|
|
6533
|
-
anonymous: false,
|
|
6534
|
-
inputs: [
|
|
6535
|
-
{ indexed: false, internalType: "address", name: "sender", type: "address" },
|
|
6536
|
-
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
6537
|
-
{ indexed: true, internalType: "int24", name: "tickLower", type: "int24" },
|
|
6538
|
-
{ indexed: true, internalType: "int24", name: "tickUpper", type: "int24" },
|
|
6539
|
-
{ indexed: false, internalType: "uint128", name: "amount", type: "uint128" },
|
|
6540
|
-
{ indexed: false, internalType: "uint256", name: "amount0", type: "uint256" },
|
|
6541
|
-
{ indexed: false, internalType: "uint256", name: "amount1", type: "uint256" }
|
|
6542
|
-
],
|
|
6543
|
-
name: "Mint",
|
|
6544
|
-
type: "event"
|
|
6545
|
-
},
|
|
6546
|
-
{
|
|
6547
|
-
anonymous: false,
|
|
6548
|
-
inputs: [
|
|
6549
|
-
{ indexed: false, internalType: "uint32", name: "feeProtocol0Old", type: "uint32" },
|
|
6550
|
-
{ indexed: false, internalType: "uint32", name: "feeProtocol1Old", type: "uint32" },
|
|
6551
|
-
{ indexed: false, internalType: "uint32", name: "feeProtocol0New", type: "uint32" },
|
|
6552
|
-
{ indexed: false, internalType: "uint32", name: "feeProtocol1New", type: "uint32" }
|
|
6553
|
-
],
|
|
6554
|
-
name: "SetFeeProtocol",
|
|
6555
|
-
type: "event"
|
|
6556
|
-
},
|
|
6557
|
-
{
|
|
6558
|
-
anonymous: false,
|
|
6559
|
-
inputs: [{ indexed: false, internalType: "address", name: "addr", type: "address" }],
|
|
6560
|
-
name: "SetLmPoolEvent",
|
|
6561
|
-
type: "event"
|
|
6562
|
-
},
|
|
6563
|
-
{
|
|
6564
|
-
anonymous: false,
|
|
6565
|
-
inputs: [
|
|
6566
|
-
{ indexed: true, internalType: "address", name: "sender", type: "address" },
|
|
6567
|
-
{ indexed: true, internalType: "address", name: "recipient", type: "address" },
|
|
6568
|
-
{ indexed: false, internalType: "int256", name: "amount0", type: "int256" },
|
|
6569
|
-
{ indexed: false, internalType: "int256", name: "amount1", type: "int256" },
|
|
6570
|
-
{ indexed: false, internalType: "uint160", name: "sqrtPriceX96", type: "uint160" },
|
|
6571
|
-
{ indexed: false, internalType: "uint128", name: "liquidity", type: "uint128" },
|
|
6572
|
-
{ indexed: false, internalType: "int24", name: "tick", type: "int24" },
|
|
6573
|
-
{ indexed: false, internalType: "uint128", name: "protocolFeesToken0", type: "uint128" },
|
|
6574
|
-
{ indexed: false, internalType: "uint128", name: "protocolFeesToken1", type: "uint128" }
|
|
6575
|
-
],
|
|
6576
|
-
name: "Swap",
|
|
6577
|
-
type: "event"
|
|
6578
|
-
},
|
|
6579
|
-
{
|
|
6580
|
-
inputs: [
|
|
6581
|
-
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
6582
|
-
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
6583
|
-
{ internalType: "uint128", name: "amount", type: "uint128" }
|
|
6584
|
-
],
|
|
6585
|
-
name: "burn",
|
|
6586
|
-
outputs: [
|
|
6587
|
-
{ internalType: "uint256", name: "amount0", type: "uint256" },
|
|
6588
|
-
{ internalType: "uint256", name: "amount1", type: "uint256" }
|
|
6589
|
-
],
|
|
6590
|
-
stateMutability: "nonpayable",
|
|
6591
|
-
type: "function"
|
|
6592
|
-
},
|
|
6593
|
-
{
|
|
6594
|
-
inputs: [
|
|
6595
|
-
{ internalType: "address", name: "recipient", type: "address" },
|
|
6596
|
-
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
6597
|
-
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
6598
|
-
{ internalType: "uint128", name: "amount0Requested", type: "uint128" },
|
|
6599
|
-
{ internalType: "uint128", name: "amount1Requested", type: "uint128" }
|
|
6600
|
-
],
|
|
6601
|
-
name: "collect",
|
|
6602
|
-
outputs: [
|
|
6603
|
-
{ internalType: "uint128", name: "amount0", type: "uint128" },
|
|
6604
|
-
{ internalType: "uint128", name: "amount1", type: "uint128" }
|
|
6605
|
-
],
|
|
6606
|
-
stateMutability: "nonpayable",
|
|
6607
|
-
type: "function"
|
|
6608
|
-
},
|
|
6609
|
-
{
|
|
6610
|
-
inputs: [
|
|
6611
|
-
{ internalType: "address", name: "recipient", type: "address" },
|
|
6612
|
-
{ internalType: "uint128", name: "amount0Requested", type: "uint128" },
|
|
6613
|
-
{ internalType: "uint128", name: "amount1Requested", type: "uint128" }
|
|
6614
|
-
],
|
|
6615
|
-
name: "collectProtocol",
|
|
6616
|
-
outputs: [
|
|
6617
|
-
{ internalType: "uint128", name: "amount0", type: "uint128" },
|
|
6618
|
-
{ internalType: "uint128", name: "amount1", type: "uint128" }
|
|
6619
|
-
],
|
|
6620
|
-
stateMutability: "nonpayable",
|
|
6621
|
-
type: "function"
|
|
6622
|
-
},
|
|
6623
|
-
{
|
|
6624
|
-
inputs: [],
|
|
6625
|
-
name: "factory",
|
|
6626
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6627
|
-
stateMutability: "view",
|
|
6628
|
-
type: "function"
|
|
6629
|
-
},
|
|
6630
|
-
{
|
|
6631
|
-
inputs: [],
|
|
6632
|
-
name: "fee",
|
|
6633
|
-
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
6634
|
-
stateMutability: "view",
|
|
6635
|
-
type: "function"
|
|
6636
|
-
},
|
|
6637
|
-
{
|
|
6638
|
-
inputs: [],
|
|
6639
|
-
name: "feeGrowthGlobal0X128",
|
|
6640
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
6641
|
-
stateMutability: "view",
|
|
6642
|
-
type: "function"
|
|
6643
|
-
},
|
|
6644
|
-
{
|
|
6645
|
-
inputs: [],
|
|
6646
|
-
name: "feeGrowthGlobal1X128",
|
|
6647
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
6648
|
-
stateMutability: "view",
|
|
6649
|
-
type: "function"
|
|
6650
|
-
},
|
|
6651
|
-
{
|
|
6652
|
-
inputs: [
|
|
6653
|
-
{ internalType: "address", name: "recipient", type: "address" },
|
|
6654
|
-
{ internalType: "uint256", name: "amount0", type: "uint256" },
|
|
6655
|
-
{ internalType: "uint256", name: "amount1", type: "uint256" },
|
|
6656
|
-
{ internalType: "bytes", name: "data", type: "bytes" }
|
|
6657
|
-
],
|
|
6658
|
-
name: "flash",
|
|
6659
|
-
outputs: [],
|
|
6660
|
-
stateMutability: "nonpayable",
|
|
6661
|
-
type: "function"
|
|
6662
|
-
},
|
|
6663
|
-
{
|
|
6664
|
-
inputs: [{ internalType: "uint16", name: "observationCardinalityNext", type: "uint16" }],
|
|
6665
|
-
name: "increaseObservationCardinalityNext",
|
|
6666
|
-
outputs: [],
|
|
6667
|
-
stateMutability: "nonpayable",
|
|
6668
|
-
type: "function"
|
|
6669
|
-
},
|
|
6670
|
-
{
|
|
6671
|
-
inputs: [{ internalType: "uint160", name: "sqrtPriceX96", type: "uint160" }],
|
|
6672
|
-
name: "initialize",
|
|
6673
|
-
outputs: [],
|
|
6674
|
-
stateMutability: "nonpayable",
|
|
6675
|
-
type: "function"
|
|
6676
|
-
},
|
|
6677
|
-
{
|
|
6678
|
-
inputs: [],
|
|
6679
|
-
name: "liquidity",
|
|
6680
|
-
outputs: [{ internalType: "uint128", name: "", type: "uint128" }],
|
|
6681
|
-
stateMutability: "view",
|
|
6682
|
-
type: "function"
|
|
6683
|
-
},
|
|
6684
|
-
{
|
|
6685
|
-
inputs: [],
|
|
6686
|
-
name: "lmPool",
|
|
6687
|
-
outputs: [{ internalType: "contract IPancakeV3LmPool", name: "", type: "address" }],
|
|
6688
|
-
stateMutability: "view",
|
|
6689
|
-
type: "function"
|
|
6690
|
-
},
|
|
6691
|
-
{
|
|
6692
|
-
inputs: [],
|
|
6693
|
-
name: "maxLiquidityPerTick",
|
|
6694
|
-
outputs: [{ internalType: "uint128", name: "", type: "uint128" }],
|
|
6695
|
-
stateMutability: "view",
|
|
6696
|
-
type: "function"
|
|
6697
|
-
},
|
|
6698
|
-
{
|
|
6699
|
-
inputs: [
|
|
6700
|
-
{ internalType: "address", name: "recipient", type: "address" },
|
|
6701
|
-
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
6702
|
-
{ internalType: "int24", name: "tickUpper", type: "int24" },
|
|
6703
|
-
{ internalType: "uint128", name: "amount", type: "uint128" },
|
|
6704
|
-
{ internalType: "bytes", name: "data", type: "bytes" }
|
|
6705
|
-
],
|
|
6706
|
-
name: "mint",
|
|
6707
|
-
outputs: [
|
|
6708
|
-
{ internalType: "uint256", name: "amount0", type: "uint256" },
|
|
6709
|
-
{ internalType: "uint256", name: "amount1", type: "uint256" }
|
|
6710
|
-
],
|
|
6711
|
-
stateMutability: "nonpayable",
|
|
6712
|
-
type: "function"
|
|
6713
|
-
},
|
|
6714
|
-
{
|
|
6715
|
-
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
6716
|
-
name: "observations",
|
|
6717
|
-
outputs: [
|
|
6718
|
-
{ internalType: "uint32", name: "blockTimestamp", type: "uint32" },
|
|
6719
|
-
{ internalType: "int56", name: "tickCumulative", type: "int56" },
|
|
6720
|
-
{ internalType: "uint160", name: "secondsPerLiquidityCumulativeX128", type: "uint160" },
|
|
6721
|
-
{ internalType: "bool", name: "initialized", type: "bool" }
|
|
6722
|
-
],
|
|
6723
|
-
stateMutability: "view",
|
|
6724
|
-
type: "function"
|
|
6725
|
-
},
|
|
6726
|
-
{
|
|
6727
|
-
inputs: [{ internalType: "uint32[]", name: "secondsAgos", type: "uint32[]" }],
|
|
6728
|
-
name: "observe",
|
|
6729
|
-
outputs: [
|
|
6730
|
-
{ internalType: "int56[]", name: "tickCumulatives", type: "int56[]" },
|
|
6731
|
-
{ internalType: "uint160[]", name: "secondsPerLiquidityCumulativeX128s", type: "uint160[]" }
|
|
6732
|
-
],
|
|
6733
|
-
stateMutability: "view",
|
|
6734
|
-
type: "function"
|
|
6735
|
-
},
|
|
6736
|
-
{
|
|
6737
|
-
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6738
|
-
name: "positions",
|
|
6739
|
-
outputs: [
|
|
6740
|
-
{ internalType: "uint128", name: "liquidity", type: "uint128" },
|
|
6741
|
-
{ internalType: "uint256", name: "feeGrowthInside0LastX128", type: "uint256" },
|
|
6742
|
-
{ internalType: "uint256", name: "feeGrowthInside1LastX128", type: "uint256" },
|
|
6743
|
-
{ internalType: "uint128", name: "tokensOwed0", type: "uint128" },
|
|
6744
|
-
{ internalType: "uint128", name: "tokensOwed1", type: "uint128" }
|
|
6745
|
-
],
|
|
6746
|
-
stateMutability: "view",
|
|
6747
|
-
type: "function"
|
|
6748
|
-
},
|
|
6749
|
-
{
|
|
6750
|
-
inputs: [],
|
|
6751
|
-
name: "protocolFees",
|
|
6752
|
-
outputs: [
|
|
6753
|
-
{ internalType: "uint128", name: "token0", type: "uint128" },
|
|
6754
|
-
{ internalType: "uint128", name: "token1", type: "uint128" }
|
|
6755
|
-
],
|
|
6756
|
-
stateMutability: "view",
|
|
6757
|
-
type: "function"
|
|
6758
|
-
},
|
|
6759
|
-
{
|
|
6760
|
-
inputs: [
|
|
6761
|
-
{ internalType: "uint32", name: "feeProtocol0", type: "uint32" },
|
|
6762
|
-
{ internalType: "uint32", name: "feeProtocol1", type: "uint32" }
|
|
6763
|
-
],
|
|
6764
|
-
name: "setFeeProtocol",
|
|
6765
|
-
outputs: [],
|
|
6766
|
-
stateMutability: "nonpayable",
|
|
6767
|
-
type: "function"
|
|
6768
|
-
},
|
|
6769
|
-
{
|
|
6770
|
-
inputs: [{ internalType: "address", name: "_lmPool", type: "address" }],
|
|
6771
|
-
name: "setLmPool",
|
|
6772
|
-
outputs: [],
|
|
6773
|
-
stateMutability: "nonpayable",
|
|
6774
|
-
type: "function"
|
|
6775
|
-
},
|
|
6776
|
-
{
|
|
6777
|
-
inputs: [],
|
|
6778
|
-
name: "slot0",
|
|
6779
|
-
outputs: [
|
|
6780
|
-
{ internalType: "uint160", name: "sqrtPriceX96", type: "uint160" },
|
|
6781
|
-
{ internalType: "int24", name: "tick", type: "int24" },
|
|
6782
|
-
{ internalType: "uint16", name: "observationIndex", type: "uint16" },
|
|
6783
|
-
{ internalType: "uint16", name: "observationCardinality", type: "uint16" },
|
|
6784
|
-
{ internalType: "uint16", name: "observationCardinalityNext", type: "uint16" },
|
|
6785
|
-
{ internalType: "uint32", name: "feeProtocol", type: "uint32" },
|
|
6786
|
-
{ internalType: "bool", name: "unlocked", type: "bool" }
|
|
6787
|
-
],
|
|
6788
|
-
stateMutability: "view",
|
|
6789
|
-
type: "function"
|
|
6790
|
-
},
|
|
6791
|
-
{
|
|
6792
|
-
inputs: [
|
|
6793
|
-
{ internalType: "int24", name: "tickLower", type: "int24" },
|
|
6794
|
-
{ internalType: "int24", name: "tickUpper", type: "int24" }
|
|
6795
|
-
],
|
|
6796
|
-
name: "snapshotCumulativesInside",
|
|
6797
|
-
outputs: [
|
|
6798
|
-
{ internalType: "int56", name: "tickCumulativeInside", type: "int56" },
|
|
6799
|
-
{ internalType: "uint160", name: "secondsPerLiquidityInsideX128", type: "uint160" },
|
|
6800
|
-
{ internalType: "uint32", name: "secondsInside", type: "uint32" }
|
|
6801
|
-
],
|
|
6802
|
-
stateMutability: "view",
|
|
6803
|
-
type: "function"
|
|
6804
|
-
},
|
|
6805
|
-
{
|
|
6806
|
-
inputs: [
|
|
6807
|
-
{ internalType: "address", name: "recipient", type: "address" },
|
|
6808
|
-
{ internalType: "bool", name: "zeroForOne", type: "bool" },
|
|
6809
|
-
{ internalType: "int256", name: "amountSpecified", type: "int256" },
|
|
6810
|
-
{ internalType: "uint160", name: "sqrtPriceLimitX96", type: "uint160" },
|
|
6811
|
-
{ internalType: "bytes", name: "data", type: "bytes" }
|
|
6812
|
-
],
|
|
6813
|
-
name: "swap",
|
|
6814
|
-
outputs: [
|
|
6815
|
-
{ internalType: "int256", name: "amount0", type: "int256" },
|
|
6816
|
-
{ internalType: "int256", name: "amount1", type: "int256" }
|
|
6817
|
-
],
|
|
6818
|
-
stateMutability: "nonpayable",
|
|
6819
|
-
type: "function"
|
|
6820
|
-
},
|
|
6821
|
-
{
|
|
6822
|
-
inputs: [{ internalType: "int16", name: "", type: "int16" }],
|
|
6823
|
-
name: "tickBitmap",
|
|
6824
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
6825
|
-
stateMutability: "view",
|
|
6826
|
-
type: "function"
|
|
6827
|
-
},
|
|
6828
|
-
{
|
|
6829
|
-
inputs: [],
|
|
6830
|
-
name: "tickSpacing",
|
|
6831
|
-
outputs: [{ internalType: "int24", name: "", type: "int24" }],
|
|
6832
|
-
stateMutability: "view",
|
|
6833
|
-
type: "function"
|
|
6834
|
-
},
|
|
6835
|
-
{
|
|
6836
|
-
inputs: [{ internalType: "int24", name: "", type: "int24" }],
|
|
6837
|
-
name: "ticks",
|
|
6838
|
-
outputs: [
|
|
6839
|
-
{ internalType: "uint128", name: "liquidityGross", type: "uint128" },
|
|
6840
|
-
{ internalType: "int128", name: "liquidityNet", type: "int128" },
|
|
6841
|
-
{ internalType: "uint256", name: "feeGrowthOutside0X128", type: "uint256" },
|
|
6842
|
-
{ internalType: "uint256", name: "feeGrowthOutside1X128", type: "uint256" },
|
|
6843
|
-
{ internalType: "int56", name: "tickCumulativeOutside", type: "int56" },
|
|
6844
|
-
{ internalType: "uint160", name: "secondsPerLiquidityOutsideX128", type: "uint160" },
|
|
6845
|
-
{ internalType: "uint32", name: "secondsOutside", type: "uint32" },
|
|
6846
|
-
{ internalType: "bool", name: "initialized", type: "bool" }
|
|
6847
|
-
],
|
|
6848
|
-
stateMutability: "view",
|
|
6849
|
-
type: "function"
|
|
6850
|
-
},
|
|
6851
|
-
{
|
|
6852
|
-
inputs: [],
|
|
6853
|
-
name: "token0",
|
|
6854
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6855
|
-
stateMutability: "view",
|
|
6856
|
-
type: "function"
|
|
6857
|
-
},
|
|
6858
|
-
{
|
|
6859
|
-
inputs: [],
|
|
6860
|
-
name: "token1",
|
|
6861
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6862
|
-
stateMutability: "view",
|
|
6863
|
-
type: "function"
|
|
6864
|
-
}
|
|
6865
|
-
];
|
|
6866
|
-
var v3PoolAbi = [
|
|
6867
|
-
{
|
|
6868
|
-
inputs: [],
|
|
6869
|
-
name: "liquidity",
|
|
6870
|
-
outputs: [{ internalType: "uint128", name: "", type: "uint128" }],
|
|
6871
|
-
stateMutability: "view",
|
|
6872
|
-
type: "function"
|
|
6873
|
-
},
|
|
6874
|
-
{
|
|
6875
|
-
inputs: [],
|
|
6876
|
-
name: "slot0",
|
|
6877
|
-
outputs: [
|
|
6878
|
-
{
|
|
6879
|
-
internalType: "uint160",
|
|
6880
|
-
name: "sqrtPriceX96",
|
|
6881
|
-
type: "uint160"
|
|
6882
|
-
},
|
|
6883
|
-
{
|
|
6884
|
-
internalType: "int24",
|
|
6885
|
-
name: "tick",
|
|
6886
|
-
type: "int24"
|
|
6887
|
-
},
|
|
6888
|
-
{
|
|
6889
|
-
internalType: "uint16",
|
|
6890
|
-
name: "observationIndex",
|
|
6891
|
-
type: "uint16"
|
|
6892
|
-
},
|
|
6893
|
-
{
|
|
6894
|
-
internalType: "uint16",
|
|
6895
|
-
name: "observationCardinality",
|
|
6896
|
-
type: "uint16"
|
|
6897
|
-
},
|
|
6898
|
-
{
|
|
6899
|
-
internalType: "uint16",
|
|
6900
|
-
name: "observationCardinalityNext",
|
|
6901
|
-
type: "uint16"
|
|
6902
|
-
},
|
|
6903
|
-
{
|
|
6904
|
-
internalType: "uint32",
|
|
6905
|
-
name: "feeProtocol",
|
|
6906
|
-
type: "uint32"
|
|
6907
|
-
},
|
|
6908
|
-
{
|
|
6909
|
-
internalType: "bool",
|
|
6910
|
-
name: "unlocked",
|
|
6911
|
-
type: "bool"
|
|
6912
|
-
}
|
|
6913
|
-
],
|
|
6914
|
-
stateMutability: "view",
|
|
6915
|
-
type: "function"
|
|
6916
|
-
}
|
|
6917
|
-
];
|
|
6918
5898
|
|
|
6919
5899
|
// src/abi/ClassicFactory.json
|
|
6920
5900
|
var ClassicFactory_default = [
|
|
@@ -21910,7 +20890,7 @@ function toCLFeeAmount(_fee) {
|
|
|
21910
20890
|
(0, import_tiny_invariant2.default)(isCLFeeAmount(_fee), `unsupported CL fee tier: ${_fee}`);
|
|
21911
20891
|
return _fee;
|
|
21912
20892
|
}
|
|
21913
|
-
function
|
|
20893
|
+
function toPoolFeeAmount(_fee) {
|
|
21914
20894
|
return toCLFeeAmount(_fee);
|
|
21915
20895
|
}
|
|
21916
20896
|
function getCLTickSpacing(_fee) {
|
|
@@ -21921,7 +20901,7 @@ function createCLPool(_params) {
|
|
|
21921
20901
|
return new Pool(
|
|
21922
20902
|
_params.tokenA,
|
|
21923
20903
|
_params.tokenB,
|
|
21924
|
-
|
|
20904
|
+
toPoolFeeAmount(_params.fee),
|
|
21925
20905
|
_params.sqrtRatioX96,
|
|
21926
20906
|
_params.liquidity,
|
|
21927
20907
|
_params.tickCurrent,
|
|
@@ -21933,17 +20913,10 @@ function computeCLPoolAddress(_params) {
|
|
|
21933
20913
|
deployerAddress: _params.config.clPoolDeployer,
|
|
21934
20914
|
tokenA: _params.tokenA,
|
|
21935
20915
|
tokenB: _params.tokenB,
|
|
21936
|
-
fee:
|
|
20916
|
+
fee: toPoolFeeAmount(_params.fee),
|
|
21937
20917
|
initCodeHashManualOverride: _params.config.clInitCodeHash ?? APEX_CL_POOL_INIT_CODE_HASH
|
|
21938
20918
|
});
|
|
21939
20919
|
}
|
|
21940
|
-
var APEX_CL_TICK_SPACINGS = CL_TICK_SPACINGS;
|
|
21941
|
-
var installApexFeeTiers = installCLFeeTiers;
|
|
21942
|
-
var isApexCLFeeAmount = isCLFeeAmount;
|
|
21943
|
-
var toApexFeeAmount = toCLFeeAmount;
|
|
21944
|
-
var getApexTickSpacing = getCLTickSpacing;
|
|
21945
|
-
var createApexPool = createCLPool;
|
|
21946
|
-
var computeApexCLPoolAddress = computeCLPoolAddress;
|
|
21947
20920
|
|
|
21948
20921
|
// src/classic.ts
|
|
21949
20922
|
var import_tiny_invariant3 = __toESM(require("tiny-invariant"), 1);
|
|
@@ -21974,7 +20947,6 @@ function computeClassicPoolAddress(_params) {
|
|
|
21974
20947
|
_params.config.classicPairInitCodeHash ?? APEX_CLASSIC_PAIR_INIT_CODE_HASH
|
|
21975
20948
|
);
|
|
21976
20949
|
}
|
|
21977
|
-
var computeApexClassicPairAddress = computeClassicPoolAddress;
|
|
21978
20950
|
function quoteClassicExactInput(_params) {
|
|
21979
20951
|
const tokenIn = normalizeAddress(_params.tokenIn);
|
|
21980
20952
|
const token0 = normalizeAddress(_params.token0);
|
|
@@ -22002,7 +20974,6 @@ function quoteClassicExactInput(_params) {
|
|
|
22002
20974
|
(0, import_tiny_invariant3.default)(amountOut > 0n, "INSUFFICIENT_OUTPUT_AMOUNT");
|
|
22003
20975
|
return amountOut - 1n;
|
|
22004
20976
|
}
|
|
22005
|
-
var quoteApexClassicExactInput = quoteClassicExactInput;
|
|
22006
20977
|
function getVolatileAmountOut(_params) {
|
|
22007
20978
|
const reserveA = _params.tokenIn === _params.token0 ? _params.reserve0 : _params.reserve1;
|
|
22008
20979
|
const reserveB = _params.tokenIn === _params.token0 ? _params.reserve1 : _params.reserve0;
|
|
@@ -22293,9 +21264,6 @@ var CLMasterChef = class _CLMasterChef {
|
|
|
22293
21264
|
});
|
|
22294
21265
|
}
|
|
22295
21266
|
};
|
|
22296
|
-
var APEX_MAX_UINT128 = MAX_UINT128;
|
|
22297
|
-
var ApexClassicFarm = ClassicChef;
|
|
22298
|
-
var ApexCLFarm = CLMasterChef;
|
|
22299
21267
|
function formatMintParams(_params) {
|
|
22300
21268
|
return {
|
|
22301
21269
|
token0: normalizeAddress2(_params.token0),
|
|
@@ -22362,9 +21330,9 @@ var import_tiny_invariant5 = __toESM(require("tiny-invariant"), 1);
|
|
|
22362
21330
|
var import_viem4 = require("viem");
|
|
22363
21331
|
var APEX_MIXED_ROUTE_CLASSIC_STABLE = 8388608;
|
|
22364
21332
|
var APEX_MIXED_ROUTE_CLASSIC_VOLATILE = 8388609;
|
|
22365
|
-
var
|
|
22366
|
-
var
|
|
22367
|
-
var
|
|
21333
|
+
var APEX_MIXED_ROUTE_CLASSIC_PLACEHOLDER = APEX_MIXED_ROUTE_CLASSIC_STABLE;
|
|
21334
|
+
var APEX_MIXED_ROUTE_VOLATILE_FLAG = 1;
|
|
21335
|
+
var APEX_MIXED_ROUTE_STABLE_FLAG = 2;
|
|
22368
21336
|
function encodeMixedRouteToPath(_hops, _exactOutput = false) {
|
|
22369
21337
|
(0, import_tiny_invariant5.default)(_hops.length > 0, "empty route");
|
|
22370
21338
|
assertContinuousRoute(_hops);
|
|
@@ -22377,7 +21345,7 @@ function encodeMixedRouteToPath(_hops, _exactOutput = false) {
|
|
|
22377
21345
|
}
|
|
22378
21346
|
return (0, import_viem4.encodePacked)(types, values);
|
|
22379
21347
|
}
|
|
22380
|
-
function
|
|
21348
|
+
function encodeMixedRouteToQuoteParams(_hops, _exactOutput = false) {
|
|
22381
21349
|
(0, import_tiny_invariant5.default)(_hops.length > 0, "empty route");
|
|
22382
21350
|
assertContinuousRoute(_hops);
|
|
22383
21351
|
const hops = _exactOutput ? reverseRoute(_hops) : [..._hops];
|
|
@@ -22386,9 +21354,9 @@ function encodeMixedRouteToPancakeQuoteParams(_hops, _exactOutput = false) {
|
|
|
22386
21354
|
const flags = [];
|
|
22387
21355
|
for (const hop of hops) {
|
|
22388
21356
|
types.push("uint24", "address");
|
|
22389
|
-
values.push(
|
|
22390
|
-
if (hop.kind === "CLASSIC_STABLE") flags.push(
|
|
22391
|
-
if (hop.kind === "CLASSIC_VOLATILE") flags.push(
|
|
21357
|
+
values.push(quoteRouteCode(hop), normalizeAddress3(hop.tokenOut));
|
|
21358
|
+
if (hop.kind === "CLASSIC_STABLE") flags.push(APEX_MIXED_ROUTE_STABLE_FLAG);
|
|
21359
|
+
if (hop.kind === "CLASSIC_VOLATILE") flags.push(APEX_MIXED_ROUTE_VOLATILE_FLAG);
|
|
22392
21360
|
}
|
|
22393
21361
|
return { path: (0, import_viem4.encodePacked)(types, values), flags };
|
|
22394
21362
|
}
|
|
@@ -22436,16 +21404,13 @@ function routeCode(_hop) {
|
|
|
22436
21404
|
(0, import_tiny_invariant5.default)(Number.isInteger(_hop.fee) && _hop.fee >= 0 && _hop.fee <= 8388607, "invalid CL fee");
|
|
22437
21405
|
return _hop.fee;
|
|
22438
21406
|
}
|
|
22439
|
-
function
|
|
21407
|
+
function quoteRouteCode(_hop) {
|
|
22440
21408
|
if (_hop.kind === "CL") {
|
|
22441
21409
|
(0, import_tiny_invariant5.default)(Number.isInteger(_hop.fee) && _hop.fee >= 0 && _hop.fee <= 8388607, "invalid CL fee");
|
|
22442
21410
|
return _hop.fee;
|
|
22443
21411
|
}
|
|
22444
|
-
return
|
|
21412
|
+
return APEX_MIXED_ROUTE_CLASSIC_PLACEHOLDER;
|
|
22445
21413
|
}
|
|
22446
|
-
var encodeApexMixedRouteToPath = encodeMixedRouteToPath;
|
|
22447
|
-
var encodeApexMixedRouteToPancakeQuoteParams = encodeMixedRouteToPancakeQuoteParams;
|
|
22448
|
-
var decodeApexMixedRoutePath = decodeMixedRoutePath;
|
|
22449
21414
|
function normalizeAddress3(_address) {
|
|
22450
21415
|
(0, import_tiny_invariant5.default)((0, import_viem4.isAddress)(_address), `invalid address: ${_address}`);
|
|
22451
21416
|
return (0, import_viem4.getAddress)(_address);
|
|
@@ -22466,8 +21431,6 @@ function parseProtocolFeePacked(_feeProtocol) {
|
|
|
22466
21431
|
token1ProtocolFee: packed / APEX_CL_PROTOCOL_FEE_SPACING
|
|
22467
21432
|
};
|
|
22468
21433
|
}
|
|
22469
|
-
var packApexProtocolFees = packProtocolFees;
|
|
22470
|
-
var parseApexProtocolFeePacked = parseProtocolFeePacked;
|
|
22471
21434
|
|
|
22472
21435
|
// src/smartRouter.ts
|
|
22473
21436
|
var import_tiny_invariant6 = __toESM(require("tiny-invariant"), 1);
|
|
@@ -22629,12 +21592,16 @@ var SmartRouter = class _SmartRouter {
|
|
|
22629
21592
|
});
|
|
22630
21593
|
}
|
|
22631
21594
|
};
|
|
22632
|
-
var ApexSmartRouter = SmartRouter;
|
|
22633
21595
|
function callParameters(_calldatas, _options) {
|
|
22634
|
-
|
|
21596
|
+
const value = toBigInt3(_options.value ?? 0n);
|
|
21597
|
+
const payments = [..._options.payments ?? []];
|
|
21598
|
+
if (value > 0n && !payments.some((payment) => payment.kind === "REFUND_ETH")) {
|
|
21599
|
+
payments.push({ kind: "REFUND_ETH" });
|
|
21600
|
+
}
|
|
21601
|
+
for (const payment of payments) _calldatas.push(encodePayment(payment));
|
|
22635
21602
|
return {
|
|
22636
21603
|
calldata: SmartRouter.encodeMulticall(_calldatas, _options.deadlineOrPreviousBlockhash),
|
|
22637
|
-
value: toHexValue2(
|
|
21604
|
+
value: toHexValue2(value)
|
|
22638
21605
|
};
|
|
22639
21606
|
}
|
|
22640
21607
|
function encodePayment(_payment) {
|
|
@@ -22668,7 +21635,6 @@ var APEX_VAULT_BPS = 1e4;
|
|
|
22668
21635
|
function getApexVaultCompoundBucket(_veNFT) {
|
|
22669
21636
|
return normalizeAddress5(_veNFT);
|
|
22670
21637
|
}
|
|
22671
|
-
var apexVaultCompoundBucket = getApexVaultCompoundBucket;
|
|
22672
21638
|
var ApexVault = class _ApexVault {
|
|
22673
21639
|
constructor() {
|
|
22674
21640
|
}
|
|
@@ -22770,7 +21736,6 @@ var ApexVault = class _ApexVault {
|
|
|
22770
21736
|
});
|
|
22771
21737
|
}
|
|
22772
21738
|
};
|
|
22773
|
-
var ApexVaultPosition = ApexVault;
|
|
22774
21739
|
function validateApexVaultUserConfig(_config) {
|
|
22775
21740
|
formatVaultConfig(_config);
|
|
22776
21741
|
}
|
|
@@ -22825,169 +21790,73 @@ function selectFunctionAbi(_abi, _name, _inputCount) {
|
|
|
22825
21790
|
}
|
|
22826
21791
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22827
21792
|
0 && (module.exports = {
|
|
22828
|
-
ADDRESS_ZERO,
|
|
22829
21793
|
APEX_CLASSIC_FEE_DENOMINATOR,
|
|
22830
21794
|
APEX_CLASSIC_PAIR_INIT_CODE_HASH,
|
|
22831
21795
|
APEX_CL_POOL_INIT_CODE_HASH,
|
|
22832
21796
|
APEX_CL_PROTOCOL_FEE_DENOMINATOR,
|
|
22833
21797
|
APEX_CL_PROTOCOL_FEE_SPACING,
|
|
22834
|
-
|
|
22835
|
-
APEX_MAX_UINT128,
|
|
21798
|
+
APEX_MIXED_ROUTE_CLASSIC_PLACEHOLDER,
|
|
22836
21799
|
APEX_MIXED_ROUTE_CLASSIC_STABLE,
|
|
22837
21800
|
APEX_MIXED_ROUTE_CLASSIC_VOLATILE,
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
APEX_MIXED_ROUTE_PANCAKE_VOLATILE_FLAG,
|
|
21801
|
+
APEX_MIXED_ROUTE_STABLE_FLAG,
|
|
21802
|
+
APEX_MIXED_ROUTE_VOLATILE_FLAG,
|
|
22841
21803
|
APEX_VAULT_BPS,
|
|
22842
|
-
ApexCLFarm,
|
|
22843
|
-
ApexClassicFarm,
|
|
22844
|
-
ApexFeeAmount,
|
|
22845
|
-
ApexSmartRouter,
|
|
22846
21804
|
ApexVault,
|
|
22847
|
-
ApexVaultPosition,
|
|
22848
21805
|
CLFeeAmount,
|
|
22849
21806
|
CLMasterChef,
|
|
22850
21807
|
CL_TICK_SPACINGS,
|
|
22851
21808
|
ClassicChef,
|
|
22852
|
-
DEPLOYER_ADDRESSES,
|
|
22853
|
-
FACTORY_ADDRESSES,
|
|
22854
|
-
FeeAmount,
|
|
22855
|
-
FeeCalculator,
|
|
22856
|
-
FullMath,
|
|
22857
|
-
LiquidityMath,
|
|
22858
21809
|
MAX_UINT128,
|
|
22859
|
-
MasterChefV3,
|
|
22860
|
-
MaxUint128,
|
|
22861
|
-
Multicall,
|
|
22862
|
-
NFT_POSITION_MANAGER_ADDRESSES,
|
|
22863
|
-
NoTickDataProvider,
|
|
22864
21810
|
NonfungiblePositionManager,
|
|
22865
|
-
POOL_INIT_CODE_HASHES,
|
|
22866
|
-
Payments,
|
|
22867
21811
|
Pool,
|
|
22868
21812
|
Position,
|
|
22869
|
-
PositionLibrary,
|
|
22870
|
-
PositionMath,
|
|
22871
21813
|
Route,
|
|
22872
|
-
SelfPermit,
|
|
22873
21814
|
SmartRouter,
|
|
22874
|
-
SqrtPriceMath,
|
|
22875
|
-
Staker,
|
|
22876
|
-
SwapMath,
|
|
22877
21815
|
SwapQuoter,
|
|
22878
21816
|
SwapRouter,
|
|
22879
|
-
TICK_SPACINGS,
|
|
22880
21817
|
Tick,
|
|
22881
|
-
TickLibrary,
|
|
22882
|
-
TickList,
|
|
22883
|
-
TickListDataProvider,
|
|
22884
21818
|
TickMath,
|
|
22885
21819
|
Trade,
|
|
22886
21820
|
apexControllerAbi,
|
|
22887
21821
|
apexTokenAbi,
|
|
22888
21822
|
apexVaultAbi,
|
|
22889
|
-
apexVaultCompoundBucket,
|
|
22890
|
-
asPancakeFeeAmount,
|
|
22891
21823
|
clFactoryAbi,
|
|
22892
21824
|
clMasterChefAbi,
|
|
22893
21825
|
clPoolAbi,
|
|
22894
21826
|
classicChefAbi,
|
|
22895
21827
|
classicFactoryAbi,
|
|
22896
21828
|
classicPoolAbi,
|
|
22897
|
-
computeApexCLPoolAddress,
|
|
22898
|
-
computeApexClassicPairAddress,
|
|
22899
21829
|
computeCLPoolAddress,
|
|
22900
21830
|
computeClassicPoolAddress,
|
|
22901
21831
|
computeCreate2Address,
|
|
22902
|
-
computePoolAddress,
|
|
22903
|
-
createApexPool,
|
|
22904
21832
|
createCLPool,
|
|
22905
|
-
decodeApexMixedRoutePath,
|
|
22906
21833
|
decodeMixedRoutePath,
|
|
22907
|
-
encodeApexMixedRouteToPancakeQuoteParams,
|
|
22908
|
-
encodeApexMixedRouteToPath,
|
|
22909
|
-
encodeMixedRouteToPancakeQuoteParams,
|
|
22910
21834
|
encodeMixedRouteToPath,
|
|
22911
|
-
|
|
21835
|
+
encodeMixedRouteToQuoteParams,
|
|
22912
21836
|
encodeSqrtRatioX96,
|
|
22913
21837
|
feeCenterAbi,
|
|
22914
21838
|
feeReceiverAbi,
|
|
22915
21839
|
feeSwapperAbi,
|
|
22916
21840
|
formatVaultConfig,
|
|
22917
|
-
getAmountsAtNewPrice,
|
|
22918
|
-
getAmountsByLiquidityAndPrice,
|
|
22919
|
-
getApexTickSpacing,
|
|
22920
21841
|
getApexVaultCompoundBucket,
|
|
22921
|
-
getAverageLiquidity,
|
|
22922
21842
|
getCLTickSpacing,
|
|
22923
|
-
getCurrency0Price,
|
|
22924
|
-
getCurrency1Price,
|
|
22925
|
-
getDependentAmount,
|
|
22926
|
-
getEstimatedLPFee,
|
|
22927
|
-
getEstimatedLPFeeByAmounts,
|
|
22928
|
-
getEstimatedLPFeeByAmountsWithProtocolFee,
|
|
22929
|
-
getEstimatedLPFeeWithProtocolFee,
|
|
22930
|
-
getInputAmount,
|
|
22931
|
-
getLiquidityByAmountsAndPrice,
|
|
22932
|
-
getLiquidityBySingleAmount,
|
|
22933
|
-
getLiquidityFromSqrtRatioX96,
|
|
22934
|
-
getLiquidityFromTick,
|
|
22935
|
-
getOutputAmount,
|
|
22936
|
-
getPool,
|
|
22937
|
-
getPriceOfCurrency,
|
|
22938
|
-
getPriceOfCurrency0,
|
|
22939
|
-
getPriceOfCurrency1,
|
|
22940
|
-
hasInvolvedCurrency,
|
|
22941
|
-
installApexFeeTiers,
|
|
22942
21843
|
installCLFeeTiers,
|
|
22943
21844
|
interfaceMulticallAbi,
|
|
22944
|
-
isApexCLFeeAmount,
|
|
22945
21845
|
isCLFeeAmount,
|
|
22946
|
-
isMint,
|
|
22947
|
-
isPoolTickInRange,
|
|
22948
|
-
isSorted,
|
|
22949
|
-
masterChefV3ABI,
|
|
22950
|
-
maxLiquidityForAmount0Imprecise,
|
|
22951
|
-
maxLiquidityForAmount0Precise,
|
|
22952
|
-
maxLiquidityForAmount1,
|
|
22953
|
-
maxLiquidityForAmounts,
|
|
22954
21846
|
mixedQuoterAbi,
|
|
22955
|
-
mostSignificantBit,
|
|
22956
21847
|
nearestUsableTick,
|
|
22957
|
-
nonfungiblePositionManagerABI,
|
|
22958
21848
|
nonfungiblePositionManagerAbi,
|
|
22959
21849
|
normalizeAddress,
|
|
22960
|
-
packApexProtocolFees,
|
|
22961
21850
|
packProtocolFees,
|
|
22962
|
-
pancakeV3PoolABI,
|
|
22963
|
-
parseApexProtocolFeePacked,
|
|
22964
21851
|
parseProtocolFeePacked,
|
|
22965
|
-
parseProtocolFees,
|
|
22966
|
-
peripheryPaymentsWithFeeABI,
|
|
22967
|
-
priceToClosestTick,
|
|
22968
|
-
quoteApexClassicExactInput,
|
|
22969
21852
|
quoteClassicExactInput,
|
|
22970
|
-
quoterABI,
|
|
22971
21853
|
quoterAbi,
|
|
22972
|
-
quoterV2ABI,
|
|
22973
21854
|
quoterV2Abi,
|
|
22974
|
-
selfPermitABI,
|
|
22975
21855
|
smartRouterAbi,
|
|
22976
21856
|
sortAddresses,
|
|
22977
|
-
sqrtRatioX96ToPrice,
|
|
22978
|
-
subIn256,
|
|
22979
|
-
swap,
|
|
22980
|
-
swapRouterABI,
|
|
22981
21857
|
swapRouterAbi,
|
|
22982
21858
|
tickLensAbi,
|
|
22983
|
-
tickToPrice,
|
|
22984
|
-
tickToPriceV2,
|
|
22985
|
-
toApexFeeAmount,
|
|
22986
21859
|
toCLFeeAmount,
|
|
22987
|
-
toHex,
|
|
22988
|
-
tradeComparator,
|
|
22989
|
-
v3PoolAbi,
|
|
22990
|
-
v3StakerABI,
|
|
22991
21860
|
validateApexVaultUserConfig,
|
|
22992
21861
|
veApexTokenAbi
|
|
22993
21862
|
});
|