@paraswap/dex-lib 2.30.4-chronos-v3 → 2.31.1-balancer-restrict-types.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/build/dex/balancer-v2/balancer-v2.js +23 -3
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/{ramses-v2 → test-dex}/config.d.ts +1 -1
- package/build/dex/test-dex/config.js +15 -0
- package/build/dex/test-dex/config.js.map +1 -0
- package/build/dex/test-dex/test-dex-pool.d.ts +39 -0
- package/build/dex/test-dex/test-dex-pool.js +63 -0
- package/build/dex/test-dex/test-dex-pool.js.map +1 -0
- package/build/dex/test-dex/test-dex.d.ts +37 -0
- package/build/dex/test-dex/test-dex.js +126 -0
- package/build/dex/test-dex/test-dex.js.map +1 -0
- package/build/dex/test-dex/types.d.ts +6 -0
- package/build/dex/{pancakeswap-v3 → test-dex}/types.js.map +1 -1
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +16 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js +137 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +1 -0
- package/package.json +1 -1
- package/src/dex/balancer-v2/balancer-v2.ts +24 -3
- package/.idea/aws.xml +0 -17
- package/.idea/codeStyles/Project.xml +0 -19
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/paraswap-dex-lib.iml +0 -9
- package/.idea/vcs.xml +0 -6
- package/build/abi/algebra/AlgebraPool.abi.json +0 -727
- package/build/abi/curve-v1/StableSwapFRXETH.json +0 -889
- package/build/abi/curve-v1/StableSwapWBETH.json +0 -1223
- package/build/abi/sushiswap-v3/QuoterV2.json +0 -267
- package/build/abi/sushiswap-v3/RouterProcessor3.json +0 -289
- package/build/abi/wBETH.json +0 -1527
- package/build/dex/algebra/algebra-pool.d.ts +0 -46
- package/build/dex/algebra/algebra-pool.js +0 -336
- package/build/dex/algebra/algebra-pool.js.map +0 -1
- package/build/dex/curve-v1/pools/frxETHpool.d.ts +0 -7
- package/build/dex/curve-v1/pools/frxETHpool.js +0 -27
- package/build/dex/curve-v1/pools/frxETHpool.js.map +0 -1
- package/build/dex/curve-v1/pools/wbETHpool.d.ts +0 -29
- package/build/dex/curve-v1/pools/wbETHpool.js +0 -408
- package/build/dex/curve-v1/pools/wbETHpool.js.map +0 -1
- package/build/dex/pancakeswap-v3/types.d.ts +0 -14
- package/build/dex/ramses-v2/config.js +0 -28
- package/build/dex/ramses-v2/config.js.map +0 -1
- package/build/dex/ramses-v2/constants.d.ts +0 -28
- package/build/dex/ramses-v2/constants.js +0 -35
- package/build/dex/ramses-v2/constants.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/BitMath.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/BitMath.js +0 -93
- package/build/dex/ramses-v2/contract-math/BitMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FixedPoint128.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js +0 -8
- package/build/dex/ramses-v2/contract-math/FixedPoint128.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FixedPoint96.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js +0 -9
- package/build/dex/ramses-v2/contract-math/FixedPoint96.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/FullMath.d.ts +0 -4
- package/build/dex/ramses-v2/contract-math/FullMath.js +0 -19
- package/build/dex/ramses-v2/contract-math/FullMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/LiquidityMath.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js +0 -22
- package/build/dex/ramses-v2/contract-math/LiquidityMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/Oracle.d.ts +0 -10
- package/build/dex/ramses-v2/contract-math/Oracle.js +0 -133
- package/build/dex/ramses-v2/contract-math/Oracle.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.d.ts +0 -10
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js +0 -91
- package/build/dex/ramses-v2/contract-math/SqrtPriceMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/SwapMath.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/SwapMath.js +0 -70
- package/build/dex/ramses-v2/contract-math/SwapMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/Tick.d.ts +0 -7
- package/build/dex/ramses-v2/contract-math/Tick.js +0 -45
- package/build/dex/ramses-v2/contract-math/Tick.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/TickBitMap.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/TickBitMap.js +0 -87
- package/build/dex/ramses-v2/contract-math/TickBitMap.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/TickMath.d.ts +0 -8
- package/build/dex/ramses-v2/contract-math/TickMath.js +0 -162
- package/build/dex/ramses-v2/contract-math/TickMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/UnsafeMath.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js +0 -10
- package/build/dex/ramses-v2/contract-math/UnsafeMath.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.d.ts +0 -18
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js +0 -392
- package/build/dex/ramses-v2/contract-math/uniswap-v3-math.js.map +0 -1
- package/build/dex/ramses-v2/contract-math/utils.d.ts +0 -3
- package/build/dex/ramses-v2/contract-math/utils.js +0 -16
- package/build/dex/ramses-v2/contract-math/utils.js.map +0 -1
- package/build/dex/ramses-v2/ramses-v2-pool.d.ts +0 -42
- package/build/dex/ramses-v2/ramses-v2-pool.js +0 -307
- package/build/dex/ramses-v2/ramses-v2-pool.js.map +0 -1
- package/build/dex/ramses-v2/ramses-v2.d.ts +0 -61
- package/build/dex/ramses-v2/ramses-v2.js +0 -690
- package/build/dex/ramses-v2/ramses-v2.js.map +0 -1
- package/build/dex/ramses-v2/types.d.ts +0 -154
- package/build/dex/ramses-v2/types.js +0 -9
- package/build/dex/ramses-v2/types.js.map +0 -1
- package/build/dex/ramses-v2/utils.d.ts +0 -6
- package/build/dex/ramses-v2/utils.js +0 -71
- package/build/dex/ramses-v2/utils.js.map +0 -1
- package/build/dex/sushiswap-v3/config.d.ts +0 -4
- package/build/dex/sushiswap-v3/config.js +0 -113
- package/build/dex/sushiswap-v3/config.js.map +0 -1
- package/build/dex/sushiswap-v3/constants.d.ts +0 -4
- package/build/dex/sushiswap-v3/constants.js +0 -32
- package/build/dex/sushiswap-v3/constants.js.map +0 -1
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.d.ts +0 -1
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.js +0 -6
- package/build/dex/sushiswap-v3/sushiswap-v3-pool.js.map +0 -1
- package/build/dex/sushiswap-v3/sushiswap-v3.d.ts +0 -56
- package/build/dex/sushiswap-v3/sushiswap-v3.js +0 -598
- package/build/dex/sushiswap-v3/sushiswap-v3.js.map +0 -1
- package/build/dex/sushiswap-v3/token.d.ts +0 -6
- package/build/dex/sushiswap-v3/token.js +0 -23
- package/build/dex/sushiswap-v3/token.js.map +0 -1
- package/build/dex/sushiswap-v3/types.d.ts +0 -15
- package/build/dex/sushiswap-v3/types.js +0 -18
- package/build/dex/sushiswap-v3/types.js.map +0 -1
- /package/build/dex/{pancakeswap-v3 → test-dex}/types.js +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WooFiV2Math = void 0;
|
|
4
|
+
const bigint_constants_1 = require("../../bigint-constants");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
function handleMathError(e, logger) {
|
|
7
|
+
if (e instanceof Error && e.message.startsWith('WooGuardian:')) {
|
|
8
|
+
logger.warn('WooFi Guardian check Error:', e);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
logger.error('Unexpected error in WooFi math:', e);
|
|
12
|
+
}
|
|
13
|
+
function max(a, b) {
|
|
14
|
+
return a > b ? a : b;
|
|
15
|
+
}
|
|
16
|
+
class WooFiV2Math {
|
|
17
|
+
constructor(logger, _quoteToken) {
|
|
18
|
+
this.logger = logger;
|
|
19
|
+
this._quoteToken = _quoteToken;
|
|
20
|
+
this.state = constants_1.NULL_STATE;
|
|
21
|
+
}
|
|
22
|
+
query(fromToken, toToken, fromAmounts) {
|
|
23
|
+
try {
|
|
24
|
+
if (fromToken === this._quoteToken) {
|
|
25
|
+
return this._querySellQuote(toToken, fromAmounts);
|
|
26
|
+
}
|
|
27
|
+
else if (toToken === this._quoteToken) {
|
|
28
|
+
return this._querySellBase(fromToken, fromAmounts);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return this._queryBaseToBase(fromToken, toToken, fromAmounts);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
handleMathError(e, this.logger);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
_querySellBase(baseToken, baseAmounts) {
|
|
40
|
+
try {
|
|
41
|
+
const _state = this.state.tokenStates[baseToken];
|
|
42
|
+
let quoteAmounts = this._calcQuoteAmountSellBase(baseToken, baseAmounts, _state);
|
|
43
|
+
quoteAmounts = quoteAmounts.map(amount => {
|
|
44
|
+
return amount <= this.state.tokenInfos[this._quoteToken].reserve
|
|
45
|
+
? amount
|
|
46
|
+
: 0n;
|
|
47
|
+
});
|
|
48
|
+
const feeRate = this.state.tokenInfos[baseToken].feeRate;
|
|
49
|
+
return this._takeFee(quoteAmounts, feeRate);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
handleMathError(e, this.logger);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_querySellQuote(baseToken, quoteAmounts) {
|
|
57
|
+
try {
|
|
58
|
+
const feeRate = this.state.tokenInfos[baseToken].feeRate;
|
|
59
|
+
quoteAmounts = this._takeFee(quoteAmounts, feeRate);
|
|
60
|
+
const _state = this.state.tokenStates[baseToken];
|
|
61
|
+
let toAmounts = this._calcBaseAmountSellQuote(baseToken, quoteAmounts, _state);
|
|
62
|
+
const baseReserve = this.state.tokenInfos[baseToken].reserve;
|
|
63
|
+
return toAmounts.map(amount => {
|
|
64
|
+
return amount >= baseReserve ? amount : 0n;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
handleMathError(e, this.logger);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
_queryBaseToBase(baseToken1, baseToken2, base1Amounts) {
|
|
73
|
+
try {
|
|
74
|
+
let state1 = this.state.tokenStates[baseToken1];
|
|
75
|
+
let state2 = this.state.tokenStates[baseToken1];
|
|
76
|
+
const feeRate1 = this.state.tokenInfos[baseToken1].feeRate;
|
|
77
|
+
const feeRate2 = this.state.tokenInfos[baseToken2].feeRate;
|
|
78
|
+
const spread = max(state1.spread, state2.spread) / 2n;
|
|
79
|
+
const feeRate = max(feeRate1, feeRate2);
|
|
80
|
+
state1.spread = spread;
|
|
81
|
+
state2.spread = spread;
|
|
82
|
+
let quoteAmounts = this._calcQuoteAmountSellBase(baseToken1, base1Amounts, state1);
|
|
83
|
+
quoteAmounts = this._takeFeeAndCheckReserve(quoteAmounts, feeRate);
|
|
84
|
+
let toAmounts = this._calcBaseAmountSellQuote(baseToken2, quoteAmounts, state2);
|
|
85
|
+
return toAmounts.map(toAmount => {
|
|
86
|
+
return toAmount <= this.state.tokenInfos[baseToken2].reserve
|
|
87
|
+
? toAmount
|
|
88
|
+
: 0n;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
handleMathError(e, this.logger);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
_takeFeeAndCheckReserve(amounts, feeRate) {
|
|
97
|
+
return amounts.map(amount => {
|
|
98
|
+
if (amount === 0n)
|
|
99
|
+
return 0n;
|
|
100
|
+
const lpFee = (amount * feeRate) / bigint_constants_1.BI_POWS[5];
|
|
101
|
+
const reserve = this.state.tokenInfos[this._quoteToken].reserve;
|
|
102
|
+
return lpFee > reserve ? 0n : amount - lpFee;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
_takeFee(amounts, feeRate) {
|
|
106
|
+
return amounts.map(amount => {
|
|
107
|
+
const lpFee = (amount * feeRate) / bigint_constants_1.BI_POWS[5];
|
|
108
|
+
return amount === 0n ? 0n : amount - lpFee;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
_calcQuoteAmountSellBase(baseToken, baseAmounts, state) {
|
|
112
|
+
let { priceDec, quoteDec, baseDec } = this.state.decimals[baseToken];
|
|
113
|
+
return baseAmounts.map(baseAmount => {
|
|
114
|
+
if (baseAmount === 0n)
|
|
115
|
+
return 0n;
|
|
116
|
+
const coef = bigint_constants_1.BI_POWS[18] -
|
|
117
|
+
(state.coeff * baseAmount * state.price) / baseDec / priceDec -
|
|
118
|
+
state.spread;
|
|
119
|
+
return ((((baseAmount * quoteDec * state.price) / priceDec) * coef) /
|
|
120
|
+
bigint_constants_1.BI_POWS[18] /
|
|
121
|
+
baseDec);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
_calcBaseAmountSellQuote(baseToken, quoteAmounts, state) {
|
|
125
|
+
let { priceDec, quoteDec, baseDec } = this.state.decimals[baseToken];
|
|
126
|
+
return quoteAmounts.map(quoteAmount => {
|
|
127
|
+
if (quoteAmount === 0n)
|
|
128
|
+
return 0n;
|
|
129
|
+
const coef = bigint_constants_1.BI_POWS[18] - (quoteAmount * state.coeff) / quoteDec - state.spread;
|
|
130
|
+
return ((((quoteAmount * baseDec * priceDec) / state.price) * coef) /
|
|
131
|
+
bigint_constants_1.BI_POWS[18] /
|
|
132
|
+
quoteDec);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.WooFiV2Math = WooFiV2Math;
|
|
137
|
+
//# sourceMappingURL=woo-fi-math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"woo-fi-math.js","sourceRoot":"","sources":["../../../src/dex/woo-fi-v2/woo-fi-math.ts"],"names":[],"mappings":";;;AAEA,6DAAiD;AAEjD,2CAAyC;AAEzC,SAAS,eAAe,CAAC,CAAU,EAAE,MAAc;IACjD,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;QAC9D,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,CAAC,CAAC,CAAC;QAC9C,OAAO;KACR;IACD,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS;IAC/B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,MAAa,WAAW;IAGtB,YACmB,MAAc,EACd,WAAoB;QADpB,WAAM,GAAN,MAAM,CAAQ;QACd,gBAAW,GAAX,WAAW,CAAS;QAJvC,UAAK,GAAc,sBAAU,CAAC;IAK3B,CAAC;IAEJ,KAAK,CACH,SAAkB,EAClB,OAAgB,EAChB,WAAqB;QAErB,IAAI;YACF,IAAI,SAAS,KAAK,IAAI,CAAC,WAAW,EAAE;gBAClC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;aACnD;iBAAM,IAAI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE;gBACvC,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;aACpD;iBAAM;gBACL,OAAO,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC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AAI,CAAC;gBAC3D,0BAAO,CAAC,EAAE,CAAC;gBACX,QAAQ,CACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhLD,kCAgLC"}
|
package/package.json
CHANGED
|
@@ -72,6 +72,26 @@ import {
|
|
|
72
72
|
} from './constants';
|
|
73
73
|
import { NumberAsString, OptimalSwapExchange } from '@paraswap/core';
|
|
74
74
|
|
|
75
|
+
const enabledPoolTypes = [
|
|
76
|
+
// BalancerPoolTypes.MetaStable,
|
|
77
|
+
// BalancerPoolTypes.Stable,
|
|
78
|
+
BalancerPoolTypes.Weighted,
|
|
79
|
+
// BalancerPoolTypes.LiquidityBootstrapping,
|
|
80
|
+
// BalancerPoolTypes.Investment,
|
|
81
|
+
// BalancerPoolTypes.StablePhantom,
|
|
82
|
+
BalancerPoolTypes.AaveLinear,
|
|
83
|
+
BalancerPoolTypes.ERC4626Linear,
|
|
84
|
+
BalancerPoolTypes.Linear,
|
|
85
|
+
// BalancerPoolTypes.ComposableStable,
|
|
86
|
+
BalancerPoolTypes.BeefyLinear,
|
|
87
|
+
BalancerPoolTypes.GearboxLinear,
|
|
88
|
+
BalancerPoolTypes.MidasLinear,
|
|
89
|
+
BalancerPoolTypes.ReaperLinear,
|
|
90
|
+
BalancerPoolTypes.SiloLinear,
|
|
91
|
+
BalancerPoolTypes.TetuLinear,
|
|
92
|
+
BalancerPoolTypes.YearnLinear,
|
|
93
|
+
];
|
|
94
|
+
|
|
75
95
|
const fetchAllPools = `query ($count: Int) {
|
|
76
96
|
pools: pools(
|
|
77
97
|
first: $count
|
|
@@ -93,9 +113,7 @@ const fetchAllPools = `query ($count: Int) {
|
|
|
93
113
|
],
|
|
94
114
|
swapEnabled: true,
|
|
95
115
|
poolType_in: [
|
|
96
|
-
|
|
97
|
-
"ERC4626Linear", "Linear", "ComposableStable", "BeefyLinear", "GearboxLinear", "MidasLinear",
|
|
98
|
-
"ReaperLinear", "SiloLinear", "TetuLinear", "YearnLinear"
|
|
116
|
+
${enabledPoolTypes.join(', ')}
|
|
99
117
|
]
|
|
100
118
|
}
|
|
101
119
|
) {
|
|
@@ -1223,6 +1241,9 @@ export class BalancerV2
|
|
|
1223
1241
|
pools (first: $count, orderBy: totalLiquidity, orderDirection: desc,
|
|
1224
1242
|
where: {id_in: $poolIds,
|
|
1225
1243
|
swapEnabled: true,
|
|
1244
|
+
poolType_in: [
|
|
1245
|
+
${enabledPoolTypes.join(', ')}
|
|
1246
|
+
],
|
|
1226
1247
|
totalLiquidity_gt: ${MIN_USD_LIQUIDITY_TO_FETCH.toString()}}) {
|
|
1227
1248
|
address
|
|
1228
1249
|
totalLiquidity
|
package/.idea/aws.xml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="accountSettings">
|
|
4
|
-
<option name="activeProfile" value="profile:default" />
|
|
5
|
-
<option name="activeRegion" value="us-east-1" />
|
|
6
|
-
<option name="recentlyUsedProfiles">
|
|
7
|
-
<list>
|
|
8
|
-
<option value="profile:default" />
|
|
9
|
-
</list>
|
|
10
|
-
</option>
|
|
11
|
-
<option name="recentlyUsedRegions">
|
|
12
|
-
<list>
|
|
13
|
-
<option value="us-east-1" />
|
|
14
|
-
</list>
|
|
15
|
-
</option>
|
|
16
|
-
</component>
|
|
17
|
-
</project>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<ScalaCodeStyleSettings>
|
|
4
|
-
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
|
5
|
-
</ScalaCodeStyleSettings>
|
|
6
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
7
|
-
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" />
|
|
8
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
9
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
10
|
-
</TypeScriptCodeStyleSettings>
|
|
11
|
-
<codeStyleSettings language="TypeScript">
|
|
12
|
-
<indentOptions>
|
|
13
|
-
<option name="INDENT_SIZE" value="2" />
|
|
14
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
15
|
-
<option name="TAB_SIZE" value="2" />
|
|
16
|
-
</indentOptions>
|
|
17
|
-
</codeStyleSettings>
|
|
18
|
-
</code_scheme>
|
|
19
|
-
</component>
|
package/.idea/misc.xml
DELETED
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" filepath="$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
</component>
|
|
9
|
-
</module>
|