@paraswap/dex-lib 3.5.1 → 3.5.3-v6.2-params
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/build/abi/Redstone.json +739 -0
- package/build/abi/angle-transmuter/MorphoOracle.json +193 -0
- package/build/abi/angle-transmuter/MorphoVault.json +2506 -0
- package/build/abi/angle-transmuter/Pyth.json +1534 -0
- package/build/abi/angle-transmuter/Transmuter.json +1711 -0
- package/build/abi/angle-transmuter/TransmuterSidechain.json +1798 -0
- package/build/abi/idle-dao/idle-cdo-factory.json +38 -0
- package/build/abi/idle-dao/idle-cdo.json +1245 -0
- package/build/abi/pharaoh/PharaohPool.abi.json +1582 -0
- package/build/abi/smardex/smardex-factory.json +185 -0
- package/build/abi/smardex/smardex-pool.json +578 -0
- package/build/abi/smardex/smardex-router.json +648 -0
- package/build/abi/trader-joe-v2_1/FactoryABI.json +1208 -0
- package/build/abi/trader-joe-v2_1/PairABI.json +1493 -0
- package/build/abi/trader-joe-v2_1/RouterABI.json +1489 -0
- package/build/abi/trader-joe-v2_1/StateMulticall.json +193 -0
- package/build/config.js +1 -1
- package/build/constants.d.ts +2 -0
- package/build/constants.js +3 -1
- package/build/constants.js.map +1 -1
- package/build/dex/aave-v1/aave-v1.js +0 -1
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/angle-transmuter/angle-transmuter-pool.d.ts +61 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.js +424 -0
- package/build/dex/angle-transmuter/angle-transmuter-pool.js.map +1 -0
- package/build/dex/angle-transmuter/angle-transmuter.d.ts +60 -0
- package/build/dex/angle-transmuter/angle-transmuter.js +281 -0
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -0
- package/build/dex/angle-transmuter/backedOracle.d.ts +19 -0
- package/build/dex/angle-transmuter/backedOracle.js +56 -0
- package/build/dex/angle-transmuter/backedOracle.js.map +1 -0
- package/build/dex/angle-transmuter/config.d.ts +4 -0
- package/build/dex/angle-transmuter/config.js +50 -0
- package/build/dex/angle-transmuter/config.js.map +1 -0
- package/build/dex/angle-transmuter/constants.d.ts +10 -0
- package/build/dex/angle-transmuter/constants.js +137 -0
- package/build/dex/angle-transmuter/constants.js.map +1 -0
- package/build/dex/angle-transmuter/morphoOracle.d.ts +42 -0
- package/build/dex/angle-transmuter/morphoOracle.js +179 -0
- package/build/dex/angle-transmuter/morphoOracle.js.map +1 -0
- package/build/dex/angle-transmuter/morphoVault.d.ts +20 -0
- package/build/dex/angle-transmuter/morphoVault.js +84 -0
- package/build/dex/angle-transmuter/morphoVault.js.map +1 -0
- package/build/dex/angle-transmuter/pyth.d.ts +19 -0
- package/build/dex/angle-transmuter/pyth.js +70 -0
- package/build/dex/angle-transmuter/pyth.js.map +1 -0
- package/build/dex/angle-transmuter/redstone.d.ts +20 -0
- package/build/dex/angle-transmuter/redstone.js +73 -0
- package/build/dex/angle-transmuter/redstone.js.map +1 -0
- package/build/dex/angle-transmuter/transmuter.d.ts +55 -0
- package/build/dex/angle-transmuter/transmuter.js +412 -0
- package/build/dex/angle-transmuter/transmuter.js.map +1 -0
- package/build/dex/angle-transmuter/types.d.ts +189 -0
- package/build/dex/angle-transmuter/types.js +33 -0
- package/build/dex/angle-transmuter/types.js.map +1 -0
- package/build/dex/angle-transmuter/utils.d.ts +9 -0
- package/build/dex/angle-transmuter/utils.js +257 -0
- package/build/dex/angle-transmuter/utils.js.map +1 -0
- package/build/dex/balancer-v1/balancer-v1.js.map +1 -1
- package/build/dex/balancer-v2/balancer-v2.d.ts +1 -1
- package/build/dex/balancer-v2/balancer-v2.js +19 -6
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/idle-dao/config.d.ts +7 -0
- package/build/dex/idle-dao/config.js +571 -0
- package/build/dex/idle-dao/config.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
- package/build/dex/idle-dao/idle-dao-pool.js +176 -0
- package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao.d.ts +52 -0
- package/build/dex/idle-dao/idle-dao.js +321 -0
- package/build/dex/idle-dao/idle-dao.js.map +1 -0
- package/build/dex/idle-dao/tokens.d.ts +16 -0
- package/build/dex/idle-dao/tokens.js +87 -0
- package/build/dex/idle-dao/tokens.js.map +1 -0
- package/build/dex/idle-dao/types.d.ts +37 -0
- package/build/dex/idle-dao/types.js +11 -0
- package/build/dex/idle-dao/types.js.map +1 -0
- package/build/dex/idle-dao/utils.d.ts +8 -0
- package/build/dex/idle-dao/utils.js +147 -0
- package/build/dex/idle-dao/utils.js.map +1 -0
- package/build/dex/platypus/platypus.js +3 -17
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/smardex/subgraph-queries.d.ts +1 -0
- package/build/dex/smardex/subgraph-queries.js +17 -0
- package/build/dex/smardex/subgraph-queries.js.map +1 -0
- package/build/dex/smardex/usd-reserves.d.ts +23 -0
- package/build/dex/smardex/usd-reserves.js +86 -0
- package/build/dex/smardex/usd-reserves.js.map +1 -0
- package/build/dex/stable-pool.js +8 -1
- package/build/dex/stable-pool.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.js +0 -4
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2-1-2/config.d.ts +4 -0
- package/build/dex/trader-joe-v2-1-2/config.js +47 -0
- package/build/dex/trader-joe-v2-1-2/config.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/constants.d.ts +20 -0
- package/build/dex/trader-joe-v2-1-2/constants.js +22 -0
- package/build/dex/trader-joe-v2-1-2/constants.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/math/index.d.ts +37 -0
- package/build/dex/trader-joe-v2-1-2/math/index.js +291 -0
- package/build/dex/trader-joe-v2-1-2/math/index.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.d.ts +60 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js +248 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.d.ts +53 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js +307 -0
- package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js.map +1 -0
- package/build/dex/trader-joe-v2-1-2/types.d.ts +82 -0
- package/build/dex/trader-joe-v2-1-2/types.js +9 -0
- package/build/dex/trader-joe-v2-1-2/types.js.map +1 -0
- package/build/dex/trader-joe-v2_1/config.d.ts +4 -0
- package/build/dex/trader-joe-v2_1/config.js +47 -0
- package/build/dex/trader-joe-v2_1/config.js.map +1 -0
- package/build/dex/trader-joe-v2_1/constants.d.ts +20 -0
- package/build/dex/trader-joe-v2_1/constants.js +22 -0
- package/build/dex/trader-joe-v2_1/constants.js.map +1 -0
- package/build/dex/trader-joe-v2_1/math/index.d.ts +37 -0
- package/build/dex/trader-joe-v2_1/math/index.js +291 -0
- package/build/dex/trader-joe-v2_1/math/index.js.map +1 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.d.ts +0 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js +384 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js.map +1 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.d.ts +60 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js +247 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js.map +1 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.d.ts +53 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js +307 -0
- package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js.map +1 -0
- package/build/dex/trader-joe-v2_1/types.d.ts +82 -0
- package/build/dex/trader-joe-v2_1/types.js +9 -0
- package/build/dex/trader-joe-v2_1/types.js.map +1 -0
- package/build/dex/uniswap-v2/config.js +4 -3
- package/build/dex/uniswap-v2/config.js.map +1 -1
- package/build/dex/weth/config.js +3 -0
- package/build/dex/weth/config.js.map +1 -1
- package/build/dex/wombat/wombat-pool-poller.d.ts +22 -0
- package/build/dex/wombat/wombat-pool-poller.js +164 -0
- package/build/dex/wombat/wombat-pool-poller.js.map +1 -0
- package/build/dex-helper/Cache.d.ts +31 -0
- package/build/dex-helper/Cache.js +106 -0
- package/build/dex-helper/Cache.js.map +1 -0
- package/build/dex-helper/RedisBatcher.d.ts +20 -0
- package/build/dex-helper/RedisBatcher.js +75 -0
- package/build/dex-helper/RedisBatcher.js.map +1 -0
- package/build/dex-helper/RedisWrapper.d.ts +37 -0
- package/build/dex-helper/RedisWrapper.js +165 -0
- package/build/dex-helper/RedisWrapper.js.map +1 -0
- package/build/dex-helper/dummy-dex-helper.d.ts +1 -2
- package/build/dex-helper/dummy-dex-helper.js +1 -2
- package/build/dex-helper/dummy-dex-helper.js.map +1 -1
- package/build/dex-helper/irequest-wrapper.d.ts +1 -2
- package/build/generic-swap-transaction-builder.d.ts +5 -3
- package/build/generic-swap-transaction-builder.js +22 -7
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/build/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/config.ts +1 -1
- package/src/constants.ts +2 -0
- package/src/dex/balancer-v1/balancer-v1.ts +12 -8
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +2 -2
- package/src/dex/balancer-v2/balancer-v2.ts +48 -14
- package/src/dex/uniswap-v2/config.ts +4 -4
- package/src/dex/weth/config.ts +3 -0
- package/src/dex-helper/dummy-dex-helper.ts +2 -3
- package/src/dex-helper/irequest-wrapper.ts +1 -1
- package/src/generic-swap-transaction-builder.ts +40 -0
- package/tests/constants-e2e.ts +1 -1
- package/.vscode/launch.json +0 -53
- package/.vscode/settings.json +0 -2
- package/.vscode/tasks.json +0 -15
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +0 -1
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
ETHER_ADDRESS,
|
|
21
21
|
MAX_INT,
|
|
22
|
-
MAX_UINT,
|
|
23
22
|
Network,
|
|
24
23
|
NULL_ADDRESS,
|
|
25
24
|
SUBGRAPH_TIMEOUT,
|
|
@@ -81,9 +80,10 @@ import {
|
|
|
81
80
|
import { NumberAsString, OptimalSwapExchange } from '@paraswap/core';
|
|
82
81
|
import { hexConcat, hexlify, hexZeroPad, solidityPack } from 'ethers/lib/utils';
|
|
83
82
|
import BalancerVaultABI from '../../abi/balancer-v2/vault.json';
|
|
84
|
-
import { BigNumber
|
|
85
|
-
import {
|
|
83
|
+
import { BigNumber } from 'ethers';
|
|
84
|
+
import { SpecialDex } from '../../executor/types';
|
|
86
85
|
import { S } from '@bgd-labs/aave-address-book/dist/AaveV2Ethereum-timF4kft';
|
|
86
|
+
import { extractReturnAmountPosition } from '../../executor/utils';
|
|
87
87
|
|
|
88
88
|
// If you disable some pool, don't forget to clear the cache, otherwise changes won't be applied immediately
|
|
89
89
|
const enabledPoolTypes = [
|
|
@@ -1548,26 +1548,58 @@ export class BalancerV2
|
|
|
1548
1548
|
data: OptimizedBalancerV2Data,
|
|
1549
1549
|
side: SwapSide,
|
|
1550
1550
|
context: Context,
|
|
1551
|
+
executor: Address,
|
|
1551
1552
|
): DexExchangeParam {
|
|
1552
|
-
const
|
|
1553
|
+
const balancerBatchSwapParam = this.getBalancerV2BatchSwapParam(
|
|
1553
1554
|
srcToken,
|
|
1554
1555
|
destToken,
|
|
1555
1556
|
data,
|
|
1556
1557
|
side,
|
|
1557
1558
|
recipient,
|
|
1558
|
-
side === SwapSide.
|
|
1559
|
-
? this.dexHelper.config.data.executorsAddresses![Executors.THREE]
|
|
1560
|
-
: NULL_ADDRESS,
|
|
1559
|
+
side === SwapSide.SELL ? NULL_ADDRESS : executor,
|
|
1561
1560
|
);
|
|
1562
1561
|
|
|
1562
|
+
const [, swaps] = balancerBatchSwapParam;
|
|
1563
|
+
const isSingleSwap = swaps.length === 1;
|
|
1564
|
+
|
|
1565
|
+
if (isSingleSwap) {
|
|
1566
|
+
const balancerSwapParam = this.getBalancerV2SwapParam(
|
|
1567
|
+
srcToken,
|
|
1568
|
+
destToken,
|
|
1569
|
+
data,
|
|
1570
|
+
side,
|
|
1571
|
+
recipient,
|
|
1572
|
+
executor,
|
|
1573
|
+
);
|
|
1574
|
+
|
|
1575
|
+
const exchangeData = this.eventPools.vaultInterface.encodeFunctionData(
|
|
1576
|
+
'swap',
|
|
1577
|
+
balancerSwapParam,
|
|
1578
|
+
);
|
|
1579
|
+
|
|
1580
|
+
return {
|
|
1581
|
+
needWrapNative: this.needWrapNative,
|
|
1582
|
+
dexFuncHasRecipient: true,
|
|
1583
|
+
exchangeData,
|
|
1584
|
+
targetExchange: this.vaultAddress,
|
|
1585
|
+
returnAmountPos:
|
|
1586
|
+
side === SwapSide.SELL
|
|
1587
|
+
? extractReturnAmountPosition(
|
|
1588
|
+
this.balancerVaultInterface,
|
|
1589
|
+
'swap',
|
|
1590
|
+
'amountCalculated',
|
|
1591
|
+
)
|
|
1592
|
+
: undefined,
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1563
1596
|
let exchangeData = this.eventPools.vaultInterface.encodeFunctionData(
|
|
1564
1597
|
'batchSwap',
|
|
1565
|
-
|
|
1598
|
+
balancerBatchSwapParam,
|
|
1566
1599
|
);
|
|
1567
1600
|
let specialDexFlag = SpecialDex.DEFAULT;
|
|
1568
1601
|
|
|
1569
1602
|
if (side === SwapSide.SELL) {
|
|
1570
|
-
const swaps = params[1];
|
|
1571
1603
|
const totalAmount = swaps.reduce<BigNumber>((acc, swap) => {
|
|
1572
1604
|
return acc.add(swap.amount);
|
|
1573
1605
|
}, BigNumber.from(0));
|
|
@@ -1622,11 +1654,13 @@ export class BalancerV2
|
|
|
1622
1654
|
}
|
|
1623
1655
|
}`;
|
|
1624
1656
|
const { data } = await this.dexHelper.httpRequest.querySubgraph<{
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1657
|
+
data: {
|
|
1658
|
+
pools: {
|
|
1659
|
+
address: string;
|
|
1660
|
+
totalLiquidity: string;
|
|
1661
|
+
tokens: { address: string; decimals: number }[];
|
|
1662
|
+
}[];
|
|
1663
|
+
};
|
|
1630
1664
|
}>(
|
|
1631
1665
|
this.subgraphURL,
|
|
1632
1666
|
{
|
|
@@ -348,7 +348,7 @@ export const UniswapV2Config: DexConfigMap<DexParams> = {
|
|
|
348
348
|
},
|
|
349
349
|
PancakeSwapV2: {
|
|
350
350
|
[Network.BSC]: {
|
|
351
|
-
subgraphURL: 'AD7yfts4Uzeav8eXQ6yxZ64VXjzDrJ1b76Gvka2VSnhd',
|
|
351
|
+
// subgraphURL: 'AD7yfts4Uzeav8eXQ6yxZ64VXjzDrJ1b76Gvka2VSnhd',
|
|
352
352
|
factoryAddress: '0xca143ce32fe78f1f7019d7d551a6402fc5350c73',
|
|
353
353
|
initCode:
|
|
354
354
|
'0xa0e5696e64d8512d41c1887d32c208c1f427abd6a077148d760fc07ccbe12470',
|
|
@@ -374,8 +374,8 @@ export const UniswapV2Config: DexConfigMap<DexParams> = {
|
|
|
374
374
|
},
|
|
375
375
|
PaintSwap: {
|
|
376
376
|
[Network.FANTOM]: {
|
|
377
|
-
subgraphURL:
|
|
378
|
-
|
|
377
|
+
// subgraphURL:
|
|
378
|
+
// 'https://api.thegraph.com/subgraphs/name/paint-swap-finance/exchange',
|
|
379
379
|
factoryAddress: '0x733a9d1585f2d14c77b49d39bc7d7dd14cda4aa5',
|
|
380
380
|
initCode:
|
|
381
381
|
'0x52178a9131f5551c2e56bf7cbf02aed8be8130e6493915a6b0c7602ac2125e54',
|
|
@@ -465,7 +465,7 @@ export const UniswapV2Config: DexConfigMap<DexParams> = {
|
|
|
465
465
|
},
|
|
466
466
|
ShibaSwap: {
|
|
467
467
|
[Network.MAINNET]: {
|
|
468
|
-
subgraphURL: 'FvP7tK71rX51wsb663j5GRx2YTtDRa1Adq8QSCi5akLS',
|
|
468
|
+
// subgraphURL: 'FvP7tK71rX51wsb663j5GRx2YTtDRa1Adq8QSCi5akLS',
|
|
469
469
|
factoryAddress: '0x115934131916C8b277DD010Ee02de363c09d037c',
|
|
470
470
|
initCode:
|
|
471
471
|
'0x65d1a3b1e46c6e4f1be1ad5f99ef14dc488ae0549dc97db9b30afe2241ce1c7a',
|
package/src/dex/weth/config.ts
CHANGED
|
@@ -244,7 +244,7 @@ export class DummyRequestWrapper implements IRequestWrapper {
|
|
|
244
244
|
subgraph: string,
|
|
245
245
|
data: { query: string; variables?: Record<string, any> },
|
|
246
246
|
{ timeout = SUBGRAPH_TIMEOUT, type = 'subgraphs' },
|
|
247
|
-
): Promise<
|
|
247
|
+
): Promise<T> {
|
|
248
248
|
if (!subgraph || !data.query || !this.apiKeyTheGraph)
|
|
249
249
|
throw new Error('Invalid TheGraph params');
|
|
250
250
|
|
|
@@ -256,7 +256,7 @@ export class DummyRequestWrapper implements IRequestWrapper {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
const response = await axios.post<T>(url, data, { timeout });
|
|
259
|
-
return response;
|
|
259
|
+
return response.data;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -303,7 +303,6 @@ export class DummyDexHelper implements IDexHelper {
|
|
|
303
303
|
constructor(network: number, rpcUrl?: string) {
|
|
304
304
|
this.config = new ConfigHelper(false, generateConfig(network), 'is');
|
|
305
305
|
this.cache = new DummyCache();
|
|
306
|
-
// @ts-ignore
|
|
307
306
|
this.httpRequest = new DummyRequestWrapper(this.config.data.apiKeyTheGraph);
|
|
308
307
|
this.provider = new StaticJsonRpcProvider(
|
|
309
308
|
rpcUrl ? rpcUrl : this.config.data.privateHttpProvider,
|
|
@@ -12,9 +12,11 @@ import {
|
|
|
12
12
|
ETHER_ADDRESS,
|
|
13
13
|
FEE_PERCENT_IN_BASIS_POINTS_MASK,
|
|
14
14
|
IS_CAP_SURPLUS_MASK,
|
|
15
|
+
IS_DIRECT_TRANSFER_MASK,
|
|
15
16
|
IS_REFERRAL_MASK,
|
|
16
17
|
IS_SKIP_BLACKLIST_MASK,
|
|
17
18
|
IS_TAKE_SURPLUS_MASK,
|
|
19
|
+
IS_USER_SURPLUS_MASK,
|
|
18
20
|
NULL_ADDRESS,
|
|
19
21
|
SwapSide,
|
|
20
22
|
} from './constants';
|
|
@@ -43,6 +45,8 @@ interface FeeParams {
|
|
|
43
45
|
feePercent: string;
|
|
44
46
|
isTakeSurplus: boolean;
|
|
45
47
|
isCapSurplus: boolean;
|
|
48
|
+
isSurplusToUser: boolean;
|
|
49
|
+
isDirectFeeTransfer: boolean;
|
|
46
50
|
isReferral: boolean;
|
|
47
51
|
isSkipBlacklist: boolean;
|
|
48
52
|
}
|
|
@@ -209,6 +213,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
209
213
|
partnerFeePercent: string,
|
|
210
214
|
takeSurplus: boolean,
|
|
211
215
|
isCapSurplus: boolean,
|
|
216
|
+
isSurplusToUser: boolean,
|
|
217
|
+
isDirectFeeTransfer: boolean,
|
|
212
218
|
beneficiary: Address,
|
|
213
219
|
permit: string,
|
|
214
220
|
deadline: string,
|
|
@@ -237,6 +243,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
237
243
|
partnerFeePercent,
|
|
238
244
|
takeSurplus,
|
|
239
245
|
isCapSurplus,
|
|
246
|
+
isSurplusToUser,
|
|
247
|
+
isDirectFeeTransfer,
|
|
240
248
|
priceRoute,
|
|
241
249
|
});
|
|
242
250
|
|
|
@@ -280,6 +288,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
280
288
|
partnerFeePercent: string,
|
|
281
289
|
takeSurplus: boolean,
|
|
282
290
|
isCapSurplus: boolean,
|
|
291
|
+
isSurplusToUser: boolean,
|
|
292
|
+
isDirectFeeTransfer: boolean,
|
|
283
293
|
permit: string,
|
|
284
294
|
uuid: string,
|
|
285
295
|
beneficiary: Address,
|
|
@@ -324,6 +334,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
324
334
|
partnerFeePercent,
|
|
325
335
|
takeSurplus,
|
|
326
336
|
isCapSurplus,
|
|
337
|
+
isSurplusToUser,
|
|
338
|
+
isDirectFeeTransfer,
|
|
327
339
|
priceRoute,
|
|
328
340
|
});
|
|
329
341
|
|
|
@@ -349,6 +361,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
349
361
|
priceRoute,
|
|
350
362
|
takeSurplus,
|
|
351
363
|
isCapSurplus,
|
|
364
|
+
isSurplusToUser,
|
|
365
|
+
isDirectFeeTransfer,
|
|
352
366
|
partnerAddress,
|
|
353
367
|
partnerFeePercent,
|
|
354
368
|
skipBlacklist = false,
|
|
@@ -358,6 +372,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
358
372
|
partnerFeePercent: string;
|
|
359
373
|
takeSurplus: boolean;
|
|
360
374
|
isCapSurplus: boolean;
|
|
375
|
+
isSurplusToUser: boolean;
|
|
376
|
+
isDirectFeeTransfer: boolean;
|
|
361
377
|
priceRoute: OptimalRate;
|
|
362
378
|
skipBlacklist?: boolean;
|
|
363
379
|
}) {
|
|
@@ -367,6 +383,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
367
383
|
feePercent: '0',
|
|
368
384
|
isTakeSurplus: takeSurplus,
|
|
369
385
|
isCapSurplus,
|
|
386
|
+
isSurplusToUser,
|
|
387
|
+
isDirectFeeTransfer,
|
|
370
388
|
isReferral: true,
|
|
371
389
|
isSkipBlacklist: skipBlacklist,
|
|
372
390
|
})
|
|
@@ -375,6 +393,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
375
393
|
feePercent: partnerFeePercent,
|
|
376
394
|
isTakeSurplus: takeSurplus,
|
|
377
395
|
isCapSurplus,
|
|
396
|
+
isSurplusToUser,
|
|
397
|
+
isDirectFeeTransfer,
|
|
378
398
|
isSkipBlacklist: skipBlacklist,
|
|
379
399
|
isReferral: false,
|
|
380
400
|
});
|
|
@@ -391,6 +411,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
391
411
|
partnerFeePercent,
|
|
392
412
|
takeSurplus,
|
|
393
413
|
isCapSurplus,
|
|
414
|
+
isSurplusToUser,
|
|
415
|
+
isDirectFeeTransfer,
|
|
394
416
|
gasPrice,
|
|
395
417
|
maxFeePerGas,
|
|
396
418
|
maxPriorityFeePerGas,
|
|
@@ -408,6 +430,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
408
430
|
partnerFeePercent: string;
|
|
409
431
|
takeSurplus?: boolean;
|
|
410
432
|
isCapSurplus?: boolean;
|
|
433
|
+
isSurplusToUser?: boolean;
|
|
434
|
+
isDirectFeeTransfer?: boolean;
|
|
411
435
|
gasPrice?: string;
|
|
412
436
|
maxFeePerGas?: string;
|
|
413
437
|
maxPriorityFeePerGas?: string;
|
|
@@ -438,6 +462,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
438
462
|
partnerFeePercent,
|
|
439
463
|
takeSurplus ?? false,
|
|
440
464
|
isCapSurplus ?? true,
|
|
465
|
+
isSurplusToUser ?? false,
|
|
466
|
+
isDirectFeeTransfer ?? false,
|
|
441
467
|
permit || '0x',
|
|
442
468
|
uuid,
|
|
443
469
|
_beneficiary,
|
|
@@ -452,6 +478,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
452
478
|
partnerFeePercent,
|
|
453
479
|
takeSurplus ?? false,
|
|
454
480
|
isCapSurplus ?? true,
|
|
481
|
+
isSurplusToUser ?? false,
|
|
482
|
+
isDirectFeeTransfer ?? false,
|
|
455
483
|
_beneficiary,
|
|
456
484
|
permit || '0x',
|
|
457
485
|
deadline,
|
|
@@ -485,6 +513,8 @@ export class GenericSwapTransactionBuilder {
|
|
|
485
513
|
feePercent,
|
|
486
514
|
isTakeSurplus,
|
|
487
515
|
isCapSurplus,
|
|
516
|
+
isSurplusToUser,
|
|
517
|
+
isDirectFeeTransfer,
|
|
488
518
|
isReferral,
|
|
489
519
|
isSkipBlacklist,
|
|
490
520
|
}: FeeParams): string {
|
|
@@ -522,6 +552,16 @@ export class GenericSwapTransactionBuilder {
|
|
|
522
552
|
partialFeeCodeWithBitFlags.or(IS_CAP_SURPLUS_MASK);
|
|
523
553
|
}
|
|
524
554
|
|
|
555
|
+
if (isSurplusToUser) {
|
|
556
|
+
partialFeeCodeWithBitFlags =
|
|
557
|
+
partialFeeCodeWithBitFlags.or(IS_USER_SURPLUS_MASK);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (isDirectFeeTransfer) {
|
|
561
|
+
partialFeeCodeWithBitFlags = partialFeeCodeWithBitFlags.or(
|
|
562
|
+
IS_DIRECT_TRANSFER_MASK,
|
|
563
|
+
);
|
|
564
|
+
}
|
|
525
565
|
// Combine partnerBigInt and feePercentBigInt
|
|
526
566
|
const feeCode = partialFeeCodeWithPartnerAddress.or(
|
|
527
567
|
partialFeeCodeWithBitFlags,
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -1400,7 +1400,7 @@ export const Holders: {
|
|
|
1400
1400
|
RADIO: '0x60531b9c3645546d864604ee0fc5b7d6adc81cc2',
|
|
1401
1401
|
HANZO: '0x8a151b6ec99c7b90b342ab401d511b480309b220',
|
|
1402
1402
|
RVLT: '0x815f87ca3db2b9491115a7769aeacb140361c5a9',
|
|
1403
|
-
stMATIC: '
|
|
1403
|
+
stMATIC: '0x7C8963BddC17095aDbc9387Cc6cdcCaA798feA52',
|
|
1404
1404
|
axlUSDC: '0x9298F93ee0393a823C242D80F1a4aDf4c8a3Feef',
|
|
1405
1405
|
deUSDC: '0x94d5ead1f80cf0b4d3480ab59dff16d47c93e9fe',
|
|
1406
1406
|
amUSDT: '0x832b11846a27b3ba25d68ae80c39fab155d18c49',
|
package/.vscode/launch.json
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2.0",
|
|
3
|
-
"configurations": [
|
|
4
|
-
{
|
|
5
|
-
"type": "node",
|
|
6
|
-
"request": "launch",
|
|
7
|
-
"name": "Current",
|
|
8
|
-
"program": "${file}",
|
|
9
|
-
"preLaunchTask": "npm: build",
|
|
10
|
-
"sourceMaps": true,
|
|
11
|
-
"smartStep": true,
|
|
12
|
-
"internalConsoleOptions": "openOnSessionStart",
|
|
13
|
-
"outFiles": ["${workspaceFolder}/build/**/*.js"]
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"type": "node",
|
|
17
|
-
"request": "launch",
|
|
18
|
-
"name": "Debug dex integration",
|
|
19
|
-
"program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
|
|
20
|
-
"args": [
|
|
21
|
-
"--project",
|
|
22
|
-
"tsconfig.json",
|
|
23
|
-
// "${workspaceFolder}/src/dex/algebra/scripts/validate-state.ts",
|
|
24
|
-
"${workspaceFolder}/src/dex/camelot/camelot-pool-discovery.test.ts",
|
|
25
|
-
// "${workspaceFolder}/src/dex/solidly-v3/scripts/check-event-pool-event.ts",
|
|
26
|
-
// "${workspaceFolder}/scripts/dex-integration.ts",
|
|
27
|
-
"test",
|
|
28
|
-
"wombat"
|
|
29
|
-
],
|
|
30
|
-
"console": "integratedTerminal",
|
|
31
|
-
"internalConsoleOptions": "neverOpen",
|
|
32
|
-
"runtimeArgs": ["--nolazy"],
|
|
33
|
-
"sourceMaps": true,
|
|
34
|
-
"smartStep": true,
|
|
35
|
-
"skipFiles": ["<node_internals>/**"],
|
|
36
|
-
"cwd": "${workspaceFolder}"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"type": "node",
|
|
40
|
-
"name": "Jest file",
|
|
41
|
-
"request": "launch",
|
|
42
|
-
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
|
|
43
|
-
// "program": "${workspaceFolder}/src/dex/camelot/scripts/validate-state.ts",
|
|
44
|
-
// "args": ["src/dex/balancer-v1/balancer-v1-e2e.test.ts"],
|
|
45
|
-
// "args": ["${relativeFile}"],
|
|
46
|
-
"args": ["${file}"],
|
|
47
|
-
"cwd": "${workspaceRoot}",
|
|
48
|
-
"console": "integratedTerminal",
|
|
49
|
-
"internalConsoleOptions": "neverOpen",
|
|
50
|
-
"sourceMaps": true
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
}
|
package/.vscode/settings.json
DELETED
package/.vscode/tasks.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [
|
|
4
|
-
{
|
|
5
|
-
"components": [
|
|
6
|
-
{ "internalType": "bytes", "name": "path", "type": "bytes" },
|
|
7
|
-
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
8
|
-
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
|
9
|
-
{
|
|
10
|
-
"internalType": "uint256",
|
|
11
|
-
"name": "amountOutMinimum",
|
|
12
|
-
"type": "uint256"
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"internalType": "struct ISwapRouter.ExactInputParams",
|
|
16
|
-
"name": "params",
|
|
17
|
-
"type": "tuple"
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"name": "exactInput",
|
|
21
|
-
"outputs": [
|
|
22
|
-
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }
|
|
23
|
-
],
|
|
24
|
-
"stateMutability": "payable",
|
|
25
|
-
"type": "function"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"inputs": [
|
|
29
|
-
{
|
|
30
|
-
"components": [
|
|
31
|
-
{ "internalType": "bytes", "name": "path", "type": "bytes" },
|
|
32
|
-
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
33
|
-
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
34
|
-
{
|
|
35
|
-
"internalType": "uint256",
|
|
36
|
-
"name": "amountInMaximum",
|
|
37
|
-
"type": "uint256"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"internalType": "struct ISwapRouter.ExactOutputParams",
|
|
41
|
-
"name": "params",
|
|
42
|
-
"type": "tuple"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"name": "exactOutput",
|
|
46
|
-
"outputs": [
|
|
47
|
-
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }
|
|
48
|
-
],
|
|
49
|
-
"stateMutability": "payable",
|
|
50
|
-
"type": "function"
|
|
51
|
-
}
|
|
52
|
-
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/* eslint-disable no-console */
|
|
7
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
-
dotenv_1.default.config();
|
|
9
|
-
const constants_1 = require("../../../constants");
|
|
10
|
-
const dex_helper_1 = require("../../../dex-helper");
|
|
11
|
-
const config_1 = require("./../config");
|
|
12
|
-
const solidly_v3_1 = require("../solidly-v3");
|
|
13
|
-
const dex = 'SolidlyV3';
|
|
14
|
-
const factory = config_1.SolidlyV3Config[dex][constants_1.Network.MAINNET].factory;
|
|
15
|
-
const blockHeaders = {};
|
|
16
|
-
async function checkForPoolEvents(startBlockNumber, endBlockNumber) {
|
|
17
|
-
const network = constants_1.Network.MAINNET;
|
|
18
|
-
const dexHelper = new dex_helper_1.DummyDexHelper(network);
|
|
19
|
-
const solidlyV3 = new solidly_v3_1.SolidlyV3(network, dex, dexHelper);
|
|
20
|
-
await solidlyV3.initializePricing(startBlockNumber);
|
|
21
|
-
const logsToDispatch = await dexHelper.provider.getLogs({
|
|
22
|
-
fromBlock: startBlockNumber,
|
|
23
|
-
toBlock: endBlockNumber,
|
|
24
|
-
address: factory,
|
|
25
|
-
});
|
|
26
|
-
const logsByBlockNumber = {};
|
|
27
|
-
for (let log of logsToDispatch) {
|
|
28
|
-
if (!logsByBlockNumber[log.blockNumber]) {
|
|
29
|
-
logsByBlockNumber[log.blockNumber] = [];
|
|
30
|
-
}
|
|
31
|
-
logsByBlockNumber[log.blockNumber].push(log);
|
|
32
|
-
}
|
|
33
|
-
const sortedBlocks = Object.keys(logsByBlockNumber)
|
|
34
|
-
.map(Number)
|
|
35
|
-
.sort((a, b) => Number(a) - Number(b));
|
|
36
|
-
for (let blockNumber of sortedBlocks) {
|
|
37
|
-
if (!blockHeaders[blockNumber]) {
|
|
38
|
-
blockHeaders[blockNumber] = await dexHelper.web3Provider.eth.getBlock(blockNumber);
|
|
39
|
-
}
|
|
40
|
-
await solidlyV3.factory?.update(logsByBlockNumber[blockNumber], {
|
|
41
|
-
[blockNumber]: blockHeaders[blockNumber],
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
async function main() {
|
|
47
|
-
// event for https://etherscan.io/tx/0x2bef7c17f3f775525f076aeb20567ee25eb820e92aa8422fbfe4bed652fd2bd3
|
|
48
|
-
checkForPoolEvents(18758010, 18758019);
|
|
49
|
-
}
|
|
50
|
-
main()
|
|
51
|
-
.then(() => console.log('Done'))
|
|
52
|
-
.catch(e => console.error(e));
|
|
53
|
-
//# sourceMappingURL=check-event-pool-event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-event-pool-event.js","sourceRoot":"","sources":["../../../../src/dex/solidly-v3/scripts/check-event-pool-event.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAC;AAIhB,kDAA6C;AAC7C,oDAAqD;AACrD,wCAA8C;AAC9C,8CAA0C;AAE1C,MAAM,GAAG,GAAG,WAAW,CAAC;AACxB,MAAM,OAAO,GAAG,wBAAe,CAAC,GAAG,CAAC,CAAC,mBAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;AAC9D,MAAM,YAAY,GAAgC,EAAE,CAAC;AAErD,KAAK,UAAU,kBAAkB,CAC/B,gBAAwB,EACxB,cAAsB;IAEtB,MAAM,OAAO,GAAG,mBAAO,CAAC,OAAO,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,2BAAc,CAAC,OAAO,CAAC,CAAC;IAE9C,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,SAAS,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEpD,MAAM,cAAc,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;QACtD,SAAS,EAAE,gBAAgB;QAC3B,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAA0B,EAAE,CAAC;IACpD,KAAK,IAAI,GAAG,IAAI,cAAc,EAAE;QAC9B,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;YACvC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;SACzC;QACD,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC9C;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC;SAChD,GAAG,CAAC,MAAM,CAAC;SACX,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzC,KAAK,IAAI,WAAW,IAAI,YAAY,EAAE;QACpC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YAC9B,YAAY,CAAC,WAAW,CAAC,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CACnE,WAAW,CACZ,CAAC;SACH;QAED,MAAM,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE;YAC9D,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC;SACzC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,uGAAuG;IACvG,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,IAAI,EAAE;KACH,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KAC/B,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Network, SwapSide } from '../../../../constants';
|
|
2
|
-
import { IDexHelper } from '../../../../dex-helper';
|
|
3
|
-
import { DexConfigMap, SimpleExchangeParam } from '../../../../types';
|
|
4
|
-
import { DexParams, UniswapV3Data } from '../../types';
|
|
5
|
-
import { UniswapV3 } from '../../uniswap-v3';
|
|
6
|
-
export declare const AlienBaseV3Config: DexConfigMap<DexParams>;
|
|
7
|
-
export declare class AlienBaseV3 extends UniswapV3 {
|
|
8
|
-
protected network: Network;
|
|
9
|
-
protected dexHelper: IDexHelper;
|
|
10
|
-
static dexKeysWithNetwork: {
|
|
11
|
-
key: string;
|
|
12
|
-
networks: Network[];
|
|
13
|
-
}[];
|
|
14
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
15
|
-
static getDirectFunctionName(): string[];
|
|
16
|
-
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UniswapV3Data, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
17
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AlienBaseV3 = exports.AlienBaseV3Config = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const constants_1 = require("../../../../constants");
|
|
9
|
-
const utils_1 = require("../../../../utils");
|
|
10
|
-
const types_1 = require("../../types");
|
|
11
|
-
const uniswap_v3_1 = require("../../uniswap-v3");
|
|
12
|
-
const AlienBaseV3Router_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v3/AlienBaseV3Router.abi.json"));
|
|
13
|
-
exports.AlienBaseV3Config = {
|
|
14
|
-
AlienBaseV3: {
|
|
15
|
-
[constants_1.Network.BASE]: {
|
|
16
|
-
factory: '0x0Fd83557b2be93617c9C1C1B6fd549401C74558C',
|
|
17
|
-
quoter: '0x4fDBD73aD4B1DDde594BF05497C15f76308eFfb9',
|
|
18
|
-
router: '0xB20C411FC84FBB27e78608C24d0056D974ea9411',
|
|
19
|
-
supportedFees: [10000n, 3000n, 750n, 200n],
|
|
20
|
-
stateMulticall: '0x7160f736c52e1e78e92FD4eE4D73e21A7Cf4F950',
|
|
21
|
-
uniswapMulticall: '0x091e99cb1C49331a94dD62755D168E941AbD0693',
|
|
22
|
-
chunksCount: 10,
|
|
23
|
-
initRetryFrequency: 10,
|
|
24
|
-
initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
|
|
25
|
-
subgraphURL: 'https://api.studio.thegraph.com/query/59130/v3alb/0.3',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
class AlienBaseV3 extends uniswap_v3_1.UniswapV3 {
|
|
30
|
-
constructor(network, dexKey, dexHelper) {
|
|
31
|
-
super(network, dexKey, dexHelper, {}, new abi_1.Interface(AlienBaseV3Router_abi_json_1.default), undefined, exports.AlienBaseV3Config[dexKey][network]);
|
|
32
|
-
this.network = network;
|
|
33
|
-
this.dexHelper = dexHelper;
|
|
34
|
-
}
|
|
35
|
-
static getDirectFunctionName() {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
39
|
-
const swapFunction = side === constants_1.SwapSide.SELL
|
|
40
|
-
? types_1.UniswapV3Functions.exactInput
|
|
41
|
-
: types_1.UniswapV3Functions.exactOutput;
|
|
42
|
-
const path = this._encodePath(data.path, side);
|
|
43
|
-
const swapFunctionParams = side === constants_1.SwapSide.SELL
|
|
44
|
-
? {
|
|
45
|
-
recipient: this.augustusAddress,
|
|
46
|
-
amountIn: srcAmount,
|
|
47
|
-
amountOutMinimum: destAmount,
|
|
48
|
-
path,
|
|
49
|
-
}
|
|
50
|
-
: {
|
|
51
|
-
recipient: this.augustusAddress,
|
|
52
|
-
amountOut: destAmount,
|
|
53
|
-
amountInMaximum: srcAmount,
|
|
54
|
-
path,
|
|
55
|
-
};
|
|
56
|
-
const swapData = this.routerIface.encodeFunctionData(swapFunction, [
|
|
57
|
-
swapFunctionParams,
|
|
58
|
-
]);
|
|
59
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.config.router);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.AlienBaseV3 = AlienBaseV3;
|
|
63
|
-
AlienBaseV3.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(exports.AlienBaseV3Config);
|
|
64
|
-
//# sourceMappingURL=alien-base-v3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alien-base-v3.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAC/C,qDAA0D;AAG1D,6CAA0D;AAC1D,uCAMqB;AACrB,iDAA6C;AAC7C,uHAAyF;AAE5E,QAAA,iBAAiB,GAA4B;IACxD,WAAW,EAAE;QACX,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;YACd,OAAO,EAAE,4CAA4C;YACrD,MAAM,EAAE,4CAA4C;YACpD,MAAM,EAAE,4CAA4C;YACpD,aAAa,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;YAC1C,cAAc,EAAE,4CAA4C;YAC5D,gBAAgB,EAAE,4CAA4C;YAC9D,WAAW,EAAE,EAAE;YACf,kBAAkB,EAAE,EAAE;YACtB,QAAQ,EAAE,oEAAoE;YAC9E,WAAW,EAAE,uDAAuD;SACrE;KACF;CACF,CAAC;AAMF,MAAa,WAAY,SAAQ,sBAAS;IAIxC,YACY,OAAgB,EAC1B,MAAc,EACJ,SAAqB;QAE/B,KAAK,CACH,OAAO,EACP,MAAM,EACN,SAAS,EACT,EAAE,EACF,IAAI,eAAS,CAAC,oCAAoB,CAAC,EACnC,SAAS,EACT,yBAAiB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CACnC,CAAC;QAZQ,YAAO,GAAP,OAAO,CAAS;QAEhB,cAAS,GAAT,SAAS,CAAY;IAWjC,CAAC;IAED,MAAM,CAAC,qBAAqB;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,MAAM,YAAY,GAChB,IAAI,KAAK,oBAAQ,CAAC,IAAI;YACpB,CAAC,CAAC,0BAAkB,CAAC,UAAU;YAC/B,CAAC,CAAC,0BAAkB,CAAC,WAAW,CAAC;QAErC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,kBAAkB,GACtB,IAAI,KAAK,oBAAQ,CAAC,IAAI;YACpB,CAAC,CAAC;gBACE,SAAS,EAAE,IAAI,CAAC,eAAe;gBAC/B,QAAQ,EAAE,SAAS;gBACnB,gBAAgB,EAAE,UAAU;gBAC5B,IAAI;aACL;YACH,CAAC,CAAC;gBACE,SAAS,EAAE,IAAI,CAAC,eAAe;gBAC/B,SAAS,EAAE,UAAU;gBACrB,eAAe,EAAE,SAAS;gBAC1B,IAAI;aACL,CAAC;QAER,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,YAAY,EAAE;YACjE,kBAAkB;SACnB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,CAAC,MAAM,CAAC,MAAM,CACnB,CAAC;IACJ,CAAC;;AAjEH,kCAkEC;AAjEe,8BAAkB,GAC9B,IAAA,6BAAqB,EAAC,yBAAiB,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Network, SwapSide } from '../../../../constants';
|
|
2
|
-
import { IDexHelper } from '../../../../dex-helper';
|
|
3
|
-
import { DexConfigMap, SimpleExchangeParam } from '../../../../types';
|
|
4
|
-
import { DexParams, UniswapV3Data } from '../../types';
|
|
5
|
-
import { UniswapV3 } from '../../uniswap-v3';
|
|
6
|
-
export declare const AlienBaseV3Config: DexConfigMap<DexParams>;
|
|
7
|
-
export declare class AlienV3 extends UniswapV3 {
|
|
8
|
-
protected network: Network;
|
|
9
|
-
protected dexHelper: IDexHelper;
|
|
10
|
-
static dexKeysWithNetwork: {
|
|
11
|
-
key: string;
|
|
12
|
-
networks: Network[];
|
|
13
|
-
}[];
|
|
14
|
-
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
15
|
-
static getDirectFunctionName(): string[];
|
|
16
|
-
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UniswapV3Data, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
17
|
-
}
|