@paraswap/dex-lib 3.10.0 → 3.10.2
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/fluid-dex/dexFactory.abi.json +506 -0
- package/build/abi/fluid-dex/fluid-dex.abi.json +922 -0
- package/build/abi/fluid-dex/liquidityUserModule.abi.json +145 -0
- package/build/abi/fluid-dex/resolver.abi.json +999 -0
- package/build/dex/fluid-dex/config.d.ts +4 -0
- package/build/dex/fluid-dex/config.js +20 -0
- package/build/dex/fluid-dex/config.js.map +1 -0
- package/build/dex/fluid-dex/fluid-dex-factory.d.ts +49 -0
- package/build/dex/fluid-dex/fluid-dex-factory.js +104 -0
- package/build/dex/fluid-dex/fluid-dex-factory.js.map +1 -0
- package/build/dex/fluid-dex/fluid-dex-pool.d.ts +47 -0
- package/build/dex/fluid-dex/fluid-dex-pool.js +119 -0
- package/build/dex/fluid-dex/fluid-dex-pool.js.map +1 -0
- package/build/dex/fluid-dex/fluid-dex.d.ts +127 -0
- package/build/dex/fluid-dex/fluid-dex.js +502 -0
- package/build/dex/fluid-dex/fluid-dex.js.map +1 -0
- package/build/dex/fluid-dex/types.d.ts +52 -0
- package/build/dex/fluid-dex/types.js +3 -0
- package/build/dex/fluid-dex/types.js.map +1 -0
- package/build/dex/fluid-dex/utils.d.ts +2 -0
- package/build/dex/fluid-dex/utils.js +18 -0
- package/build/dex/fluid-dex/utils.js.map +1 -0
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/paraswap-limit-orders/paraswap-limit-orders.js +1 -1
- package/build/dex/paraswap-limit-orders/paraswap-limit-orders.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/fluid-dex/dexFactory.abi.json +506 -0
- package/src/abi/fluid-dex/fluid-dex.abi.json +922 -0
- package/src/abi/fluid-dex/liquidityUserModule.abi.json +145 -0
- package/src/abi/fluid-dex/resolver.abi.json +999 -0
- package/src/dex/fluid-dex/config.ts +20 -0
- package/src/dex/fluid-dex/fluid-dex-e2e.test.ts +153 -0
- package/src/dex/fluid-dex/fluid-dex-events.test.ts +293 -0
- package/src/dex/fluid-dex/fluid-dex-factory.ts +143 -0
- package/src/dex/fluid-dex/fluid-dex-integration.test.ts +299 -0
- package/src/dex/fluid-dex/fluid-dex-pool.ts +178 -0
- package/src/dex/fluid-dex/fluid-dex.ts +790 -0
- package/src/dex/fluid-dex/types.ts +62 -0
- package/src/dex/fluid-dex/utils.ts +15 -0
- package/src/dex/index.ts +2 -0
- package/src/dex/paraswap-limit-orders/paraswap-limit-orders.ts +1 -1
- package/tests/constants-e2e.ts +2 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Address } from '../../types';
|
|
2
|
+
|
|
3
|
+
export type FluidDexPoolState = {
|
|
4
|
+
collateralReserves: CollateralReserves;
|
|
5
|
+
debtReserves: DebtReserves;
|
|
6
|
+
fee: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type CollateralReserves = {
|
|
10
|
+
token0RealReserves: bigint;
|
|
11
|
+
token1RealReserves: bigint;
|
|
12
|
+
token0ImaginaryReserves: bigint;
|
|
13
|
+
token1ImaginaryReserves: bigint;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type DebtReserves = {
|
|
17
|
+
token0Debt: bigint;
|
|
18
|
+
token1Debt: bigint;
|
|
19
|
+
token0RealReserves: bigint;
|
|
20
|
+
token1RealReserves: bigint;
|
|
21
|
+
token0ImaginaryReserves: bigint;
|
|
22
|
+
token1ImaginaryReserves: bigint;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface PoolWithReserves {
|
|
26
|
+
pool: string;
|
|
27
|
+
token0: string;
|
|
28
|
+
token1: string;
|
|
29
|
+
fee: number;
|
|
30
|
+
collateralReserves: CollateralReserves;
|
|
31
|
+
debtReserves: DebtReserves;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type FluidDexData = {
|
|
35
|
+
colReserves: CollateralReserves;
|
|
36
|
+
debtReserves: DebtReserves;
|
|
37
|
+
exchange: Address;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Each pool has a contract address and token pairs.
|
|
41
|
+
export type FluidDexPool = {
|
|
42
|
+
id: string;
|
|
43
|
+
address: Address;
|
|
44
|
+
token0: Address;
|
|
45
|
+
token1: Address;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type DexParams = {
|
|
49
|
+
commonAddresses: CommonAddresses;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type CommonAddresses = {
|
|
53
|
+
liquidityProxy: Address;
|
|
54
|
+
resolver: Address;
|
|
55
|
+
dexFactory: Address;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type Pool = {
|
|
59
|
+
address: Address;
|
|
60
|
+
token0: Address;
|
|
61
|
+
token1: Address;
|
|
62
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
|
|
3
|
+
const ONE = BigNumber.from(1);
|
|
4
|
+
const TWO = BigNumber.from(2);
|
|
5
|
+
|
|
6
|
+
export function sqrt(value: BigNumber) {
|
|
7
|
+
let x = value;
|
|
8
|
+
let z = x.add(ONE).div(TWO);
|
|
9
|
+
let y = x;
|
|
10
|
+
while (z.sub(y).isNegative()) {
|
|
11
|
+
y = z;
|
|
12
|
+
z = x.div(z).add(z).div(TWO);
|
|
13
|
+
}
|
|
14
|
+
return y;
|
|
15
|
+
}
|
package/src/dex/index.ts
CHANGED
|
@@ -86,6 +86,7 @@ import { Spark } from './spark/spark';
|
|
|
86
86
|
import { VelodromeSlipstream } from './uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream';
|
|
87
87
|
import { AaveV3Stata } from './aave-v3-stata/aave-v3-stata';
|
|
88
88
|
import { OSwap } from './oswap/oswap';
|
|
89
|
+
import { FluidDex } from './fluid-dex/fluid-dex';
|
|
89
90
|
import { ConcentratorArusd } from './concentrator-arusd/concentrator-arusd';
|
|
90
91
|
import { FxProtocolRusd } from './fx-protocol-rusd/fx-protocol-rusd';
|
|
91
92
|
import { AaveGsm } from './aave-gsm/aave-gsm';
|
|
@@ -181,6 +182,7 @@ const Dexes = [
|
|
|
181
182
|
UsualBond,
|
|
182
183
|
StkGHO,
|
|
183
184
|
SkyConverter,
|
|
185
|
+
FluidDex,
|
|
184
186
|
];
|
|
185
187
|
|
|
186
188
|
export type LegacyDexConstructor = new (dexHelper: IDexHelper) => IDexTxBuilder<
|
|
@@ -67,7 +67,7 @@ export class ParaSwapLimitOrders
|
|
|
67
67
|
super(dexHelper, dexKey);
|
|
68
68
|
this.augustusRFQAddress =
|
|
69
69
|
dexHelper.config.data.augustusRFQAddress.toLowerCase();
|
|
70
|
-
this.logger = dexHelper.getLogger(dexKey);
|
|
70
|
+
this.logger = dexHelper.getLogger(`${dexKey}-${network}`);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
get limitOrderProviderName() {
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -1651,7 +1651,7 @@ export const Holders: {
|
|
|
1651
1651
|
BADGER: '0x34e2741a3f8483dbe5231f61c005110ff4b9f50a',
|
|
1652
1652
|
STETH: '0x6663613FbD927cE78abBF7F5Ca7e2c3FE0d96d18',
|
|
1653
1653
|
SUSHI: '0x8a108e4761386c94b8d2f98A5fFe13E472cFE76a',
|
|
1654
|
-
wstETH: '
|
|
1654
|
+
wstETH: '0x3c22ec75ea5D745c78fc84762F7F1E6D82a2c5BF',
|
|
1655
1655
|
WETH: '0x6B44ba0a126a2A1a8aa6cD1AdeeD002e141Bcd44',
|
|
1656
1656
|
USDT: '0xAf64555DDD61FcF7D094824dd9B4eBea165aFc5b',
|
|
1657
1657
|
XAUT: '0xc4e161e8d8a4bc4ac762ab33a28bbac5474203d7',
|
|
@@ -1903,7 +1903,7 @@ export const Holders: {
|
|
|
1903
1903
|
LINK: '0x7f1fa204bb700853d36994da19f830b6ad18455c',
|
|
1904
1904
|
DMT: '0x40414f138eb2ef938e6c3629897ef99d4464d4e8',
|
|
1905
1905
|
PENDLE: '0x5bdf85216ec1e38d6458c870992a69e38e03f7ef',
|
|
1906
|
-
wstETH: '
|
|
1906
|
+
wstETH: '0x3c22ec75ea5D745c78fc84762F7F1E6D82a2c5BF',
|
|
1907
1907
|
EURA: '0x6dd7b830896b56812aa667bdd14b71c8b3252f8e',
|
|
1908
1908
|
stEUR: '0xE588611e7A2392507879E3be80531654b85C16aA',
|
|
1909
1909
|
USDA: '0xa86ff337db9107b54862d30d1a598f8be847b05e',
|