@paraswap/dex-lib 2.37.6-dexalot → 2.37.6
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/quickPerps/fast-price-events.json +70 -0
- package/build/abi/quickPerps/fast-price-feed.json +748 -0
- package/build/abi/quickPerps/reader.json +313 -0
- package/build/abi/quickPerps/vault-price-feed.json +477 -0
- package/build/abi/quickPerps/vault.json +1953 -0
- package/build/config.js +2 -4
- package/build/config.js.map +1 -1
- package/build/dex/idex.d.ts +1 -1
- package/build/dex/index.js +0 -2
- package/build/dex/index.js.map +1 -1
- package/build/dex/maverick-v1/scripts/event-sequence.d.ts +1 -0
- package/build/dex/maverick-v1/scripts/event-sequence.js +110 -0
- package/build/dex/maverick-v1/scripts/event-sequence.js.map +1 -0
- package/build/dex/{dexalot → 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/build/router/buy.d.ts +1 -1
- package/build/router/buy.js +3 -3
- package/build/router/buy.js.map +1 -1
- package/build/router/directswap.d.ts +1 -1
- package/build/router/directswap.js +3 -3
- package/build/router/directswap.js.map +1 -1
- package/build/router/irouter.d.ts +1 -1
- package/build/router/megaswap.d.ts +1 -1
- package/build/router/megaswap.js +3 -3
- package/build/router/megaswap.js.map +1 -1
- package/build/router/multiswap.d.ts +1 -1
- package/build/router/multiswap.js +3 -3
- package/build/router/multiswap.js.map +1 -1
- package/build/router/payload-encoder.d.ts +3 -3
- package/build/router/payload-encoder.js +6 -6
- package/build/router/payload-encoder.js.map +1 -1
- package/build/router/simpleswap.d.ts +2 -2
- package/build/router/simpleswap.js +3 -3
- package/build/router/simpleswap.js.map +1 -1
- package/build/router/simpleswapnft.d.ts +1 -1
- package/build/router/simpleswapnft.js +3 -3
- package/build/router/simpleswapnft.js.map +1 -1
- package/build/transaction-builder.d.ts +2 -2
- package/build/transaction-builder.js +2 -2
- package/build/transaction-builder.js.map +1 -1
- package/build/types.d.ts +0 -1
- package/build/workers.d.ts +0 -0
- package/build/workers.js +2 -0
- package/build/workers.js.map +1 -0
- package/package.json +1 -1
- package/src/config.ts +2 -5
- package/src/dex/idex.ts +0 -2
- package/src/dex/index.ts +0 -2
- package/src/router/buy.ts +3 -7
- package/src/router/directswap.ts +3 -7
- package/src/router/irouter.ts +1 -1
- package/src/router/megaswap.ts +3 -7
- package/src/router/multiswap.ts +3 -7
- package/src/router/payload-encoder.ts +7 -7
- package/src/router/simpleswap.ts +4 -8
- package/src/router/simpleswapnft.ts +3 -7
- package/src/transaction-builder.ts +3 -3
- package/src/types.ts +0 -1
- package/tests/constants-e2e.ts +2 -2
- 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/dexalot/DexalotMainnetRFQ.json +0 -952
- 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/dexalot/config.js +0 -18
- package/build/dex/dexalot/config.js.map +0 -1
- package/build/dex/dexalot/constants.d.ts +0 -15
- package/build/dex/dexalot/constants.js +0 -22
- package/build/dex/dexalot/constants.js.map +0 -1
- package/build/dex/dexalot/dexalot.d.ts +0 -69
- package/build/dex/dexalot/dexalot.js +0 -642
- package/build/dex/dexalot/dexalot.js.map +0 -1
- package/build/dex/dexalot/rate-fetcher.d.ts +0 -28
- package/build/dex/dexalot/rate-fetcher.js +0 -100
- package/build/dex/dexalot/rate-fetcher.js.map +0 -1
- package/build/dex/dexalot/types.d.ts +0 -114
- package/build/dex/dexalot/types.js +0 -12
- package/build/dex/dexalot/types.js.map +0 -1
- package/build/dex/dexalot/validators.d.ts +0 -5
- package/build/dex/dexalot/validators.js +0 -45
- package/build/dex/dexalot/validators.js.map +0 -1
- package/build/dex/pancakeswap-v3/types.d.ts +0 -14
- package/build/dex/ramses-v2/config.d.ts +0 -4
- 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 -132
- 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-original.d.ts +0 -56
- package/build/dex/sushiswap-v3/sushiswap-v3-original.js +0 -598
- package/build/dex/sushiswap-v3/sushiswap-v3-original.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 -21
- package/build/dex/sushiswap-v3/sushiswap-v3.js +0 -58
- 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/src/abi/dexalot/DexalotMainnetRFQ.json +0 -952
- package/src/dex/dexalot/config.ts +0 -18
- package/src/dex/dexalot/constants.ts +0 -29
- package/src/dex/dexalot/dexalot-e2e.test.ts +0 -192
- package/src/dex/dexalot/dexalot-integration.test.ts +0 -188
- package/src/dex/dexalot/dexalot.ts +0 -998
- package/src/dex/dexalot/rate-fetcher.ts +0 -197
- package/src/dex/dexalot/types.ts +0 -131
- package/src/dex/dexalot/validators.ts +0 -46
- /package/build/dex/{pancakeswap-v3 → test-dex}/types.js +0 -0
package/build/workers.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workers.js","sourceRoot":"","sources":["../src/workers.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -30,7 +30,6 @@ type BaseConfig = {
|
|
|
30
30
|
hashFlowAuthToken?: string;
|
|
31
31
|
hashFlowDisabledMMs: string[];
|
|
32
32
|
swaapV2AuthToken?: string;
|
|
33
|
-
dexalotAuthToken?: string;
|
|
34
33
|
forceRpcFallbackDexs: string[];
|
|
35
34
|
};
|
|
36
35
|
|
|
@@ -220,11 +219,10 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
220
219
|
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
|
|
221
220
|
hashFlowDisabledMMs:
|
|
222
221
|
process.env[`HASHFLOW_DISABLED_MMS_43114`]?.split(',') || [],
|
|
223
|
-
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
|
|
224
222
|
adapterAddresses: {
|
|
225
223
|
AvalancheAdapter01: '0x745Ec73855CeC7249E5fF4c9DD81cc65b4D297a9',
|
|
226
|
-
AvalancheAdapter02: '
|
|
227
|
-
AvalancheBuyAdapter: '
|
|
224
|
+
AvalancheAdapter02: '0xFb8773AA4Fd02e54bbd352061D8Be1911FAa210a',
|
|
225
|
+
AvalancheBuyAdapter: '0x434C1Cca4842629230067674Dd54E21a14D9FD5D',
|
|
228
226
|
},
|
|
229
227
|
uniswapV2ExchangeRouterAddress:
|
|
230
228
|
'0x53e693c6C7FFC4446c53B205Cf513105Bf140D7b',
|
|
@@ -416,7 +414,6 @@ export function generateConfig(network: number): Config {
|
|
|
416
414
|
baseConfig.rpcPollingBlocksBackToTriggerUpdate,
|
|
417
415
|
hashFlowAuthToken: baseConfig.hashFlowAuthToken,
|
|
418
416
|
swaapV2AuthToken: baseConfig.swaapV2AuthToken,
|
|
419
|
-
dexalotAuthToken: baseConfig.dexalotAuthToken,
|
|
420
417
|
hashFlowDisabledMMs: baseConfig.hashFlowDisabledMMs,
|
|
421
418
|
forceRpcFallbackDexs: baseConfig.forceRpcFallbackDexs,
|
|
422
419
|
};
|
package/src/dex/idex.ts
CHANGED
|
@@ -131,11 +131,9 @@ export interface IDexPricing<ExchangeData> {
|
|
|
131
131
|
blockNumber: number,
|
|
132
132
|
// list of pool identifiers to use for pricing, if undefined use all pools
|
|
133
133
|
limitPools?: string[],
|
|
134
|
-
|
|
135
134
|
// I don't like putting this as new params, but in order to not change interface
|
|
136
135
|
// across all integrations, done it like this
|
|
137
136
|
transferFees?: TransferFeeParams,
|
|
138
|
-
isFirstSwap?: boolean,
|
|
139
137
|
): Promise<ExchangePrices<ExchangeData> | null>;
|
|
140
138
|
|
|
141
139
|
// Returns estimated gas cost for calldata for DEX when used in multiSwap.
|
package/src/dex/index.ts
CHANGED
|
@@ -76,7 +76,6 @@ import { PancakeswapV3 } from './pancakeswap-v3/pancakeswap-v3';
|
|
|
76
76
|
import { Algebra } from './algebra/algebra';
|
|
77
77
|
import { QuickPerps } from './quick-perps/quick-perps';
|
|
78
78
|
import { NomiswapV2 } from './uniswap-v2/nomiswap-v2';
|
|
79
|
-
import { Dexalot } from './dexalot/dexalot';
|
|
80
79
|
|
|
81
80
|
const LegacyDexes = [
|
|
82
81
|
CurveV2,
|
|
@@ -103,7 +102,6 @@ const LegacyDexes = [
|
|
|
103
102
|
];
|
|
104
103
|
|
|
105
104
|
const Dexes = [
|
|
106
|
-
Dexalot,
|
|
107
105
|
CurveV1,
|
|
108
106
|
CurveFork,
|
|
109
107
|
Swerve,
|
package/src/router/buy.ts
CHANGED
|
@@ -42,7 +42,7 @@ export class Buy extends PayloadEncoder implements IRouter<BuyParam> {
|
|
|
42
42
|
referrerAddress: Address | undefined,
|
|
43
43
|
partnerAddress: Address,
|
|
44
44
|
partnerFeePercent: string,
|
|
45
|
-
|
|
45
|
+
takeSurplus: boolean,
|
|
46
46
|
beneficiary: Address,
|
|
47
47
|
permit: string,
|
|
48
48
|
deadline: string,
|
|
@@ -69,13 +69,9 @@ export class Buy extends PayloadEncoder implements IRouter<BuyParam> {
|
|
|
69
69
|
encodePartnerAddressForFeeLogic({
|
|
70
70
|
partnerAddress,
|
|
71
71
|
partnerFeePercent,
|
|
72
|
-
|
|
72
|
+
takeSurplus,
|
|
73
73
|
}),
|
|
74
|
-
encodeFeePercent(
|
|
75
|
-
partnerFeePercent,
|
|
76
|
-
positiveSlippageToUser,
|
|
77
|
-
SwapSide.BUY,
|
|
78
|
-
),
|
|
74
|
+
encodeFeePercent(partnerFeePercent, takeSurplus, SwapSide.BUY),
|
|
79
75
|
];
|
|
80
76
|
|
|
81
77
|
const buyData: ContractBuyData = {
|
package/src/router/directswap.ts
CHANGED
|
@@ -29,7 +29,7 @@ export class DirectSwap<DexDirectReturn> implements IRouter<DexDirectReturn> {
|
|
|
29
29
|
referrerAddress: Address | undefined,
|
|
30
30
|
partnerAddress: Address,
|
|
31
31
|
partnerFeePercent: string,
|
|
32
|
-
|
|
32
|
+
takeSurplus: boolean,
|
|
33
33
|
beneficiary: Address,
|
|
34
34
|
permit: string,
|
|
35
35
|
deadline: string,
|
|
@@ -76,13 +76,9 @@ export class DirectSwap<DexDirectReturn> implements IRouter<DexDirectReturn> {
|
|
|
76
76
|
encodePartnerAddressForFeeLogic({
|
|
77
77
|
partnerAddress,
|
|
78
78
|
partnerFeePercent,
|
|
79
|
-
|
|
79
|
+
takeSurplus,
|
|
80
80
|
}),
|
|
81
|
-
encodeFeePercent(
|
|
82
|
-
partnerFeePercent,
|
|
83
|
-
positiveSlippageToUser,
|
|
84
|
-
priceRoute.side,
|
|
85
|
-
),
|
|
81
|
+
encodeFeePercent(partnerFeePercent, takeSurplus, priceRoute.side),
|
|
86
82
|
];
|
|
87
83
|
|
|
88
84
|
return dex.getDirectParam!(
|
package/src/router/irouter.ts
CHANGED
package/src/router/megaswap.ts
CHANGED
|
@@ -42,7 +42,7 @@ export class MegaSwap extends PayloadEncoder implements IRouter<MegaSwapParam> {
|
|
|
42
42
|
referrerAddress: Address | undefined,
|
|
43
43
|
partnerAddress: Address,
|
|
44
44
|
partnerFeePercent: string,
|
|
45
|
-
|
|
45
|
+
takeSurplus: boolean,
|
|
46
46
|
beneficiary: Address,
|
|
47
47
|
permit: string,
|
|
48
48
|
deadline: string,
|
|
@@ -58,13 +58,9 @@ export class MegaSwap extends PayloadEncoder implements IRouter<MegaSwapParam> {
|
|
|
58
58
|
encodePartnerAddressForFeeLogic({
|
|
59
59
|
partnerAddress,
|
|
60
60
|
partnerFeePercent,
|
|
61
|
-
|
|
61
|
+
takeSurplus,
|
|
62
62
|
}),
|
|
63
|
-
encodeFeePercent(
|
|
64
|
-
partnerFeePercent,
|
|
65
|
-
positiveSlippageToUser,
|
|
66
|
-
SwapSide.SELL,
|
|
67
|
-
),
|
|
63
|
+
encodeFeePercent(partnerFeePercent, takeSurplus, SwapSide.SELL),
|
|
68
64
|
];
|
|
69
65
|
|
|
70
66
|
const sellData: ContractMegaSwapSellData = {
|
package/src/router/multiswap.ts
CHANGED
|
@@ -45,7 +45,7 @@ export class MultiSwap
|
|
|
45
45
|
referrerAddress: Address | undefined,
|
|
46
46
|
partnerAddress: Address,
|
|
47
47
|
partnerFeePercent: string,
|
|
48
|
-
|
|
48
|
+
takeSurplus: boolean,
|
|
49
49
|
beneficiary: Address,
|
|
50
50
|
permit: string,
|
|
51
51
|
deadline: string,
|
|
@@ -66,13 +66,9 @@ export class MultiSwap
|
|
|
66
66
|
encodePartnerAddressForFeeLogic({
|
|
67
67
|
partnerAddress,
|
|
68
68
|
partnerFeePercent,
|
|
69
|
-
|
|
69
|
+
takeSurplus,
|
|
70
70
|
}),
|
|
71
|
-
encodeFeePercent(
|
|
72
|
-
partnerFeePercent,
|
|
73
|
-
positiveSlippageToUser,
|
|
74
|
-
SwapSide.SELL,
|
|
75
|
-
),
|
|
71
|
+
encodeFeePercent(partnerFeePercent, takeSurplus, SwapSide.SELL),
|
|
76
72
|
];
|
|
77
73
|
|
|
78
74
|
const sellData: ContractSellData = {
|
|
@@ -29,14 +29,14 @@ const HALF_SPLIT = '5000';
|
|
|
29
29
|
export function encodePartnerAddressForFeeLogic({
|
|
30
30
|
partnerAddress,
|
|
31
31
|
partnerFeePercent,
|
|
32
|
-
|
|
32
|
+
takeSurplus,
|
|
33
33
|
}: {
|
|
34
34
|
partnerAddress: string;
|
|
35
35
|
partnerFeePercent: string;
|
|
36
|
-
|
|
36
|
+
takeSurplus: boolean;
|
|
37
37
|
}): string {
|
|
38
38
|
const isPartnerTakeNoFeeNoPos =
|
|
39
|
-
+partnerFeePercent === 0 &&
|
|
39
|
+
+partnerFeePercent === 0 && takeSurplus == false;
|
|
40
40
|
|
|
41
41
|
// nullify partner address to fallback default circuit contract without partner/referrer (no harm as no fee taken at all)
|
|
42
42
|
const partner = isPartnerTakeNoFeeNoPos ? NULL_ADDRESS : partnerAddress;
|
|
@@ -51,11 +51,11 @@ export function encodePartnerAddressForFeeLogic({
|
|
|
51
51
|
|
|
52
52
|
export function encodeFeePercent(
|
|
53
53
|
partnerFeePercent: string,
|
|
54
|
-
|
|
54
|
+
takeSurplus: boolean,
|
|
55
55
|
side: SwapSide,
|
|
56
56
|
) {
|
|
57
57
|
const isNoFeeAndPositiveSlippageToPartner =
|
|
58
|
-
|
|
58
|
+
takeSurplus === true && BigInt(partnerFeePercent) === 0n;
|
|
59
59
|
|
|
60
60
|
let fee = isNoFeeAndPositiveSlippageToPartner
|
|
61
61
|
? BigInt(HALF_SPLIT)
|
|
@@ -70,9 +70,9 @@ export function encodeFeePercent(
|
|
|
70
70
|
fee |= OneShift17;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
// Set 14th bit if
|
|
73
|
+
// Set 14th bit if takeSurplus is false
|
|
74
74
|
// Upd: not used onchain anymore but better to keep to prevent collisions and ensure continuity of analytics
|
|
75
|
-
if (
|
|
75
|
+
if (!takeSurplus) fee |= OneShift14;
|
|
76
76
|
|
|
77
77
|
// Set 15th bit to take fee from srcToken
|
|
78
78
|
if (side === SwapSide.BUY && !isNoFeeAndPositiveSlippageToPartner)
|
package/src/router/simpleswap.ts
CHANGED
|
@@ -223,7 +223,7 @@ export abstract class SimpleRouterBase<RouterParam>
|
|
|
223
223
|
referrerAddress: Address | undefined,
|
|
224
224
|
partnerAddress: Address,
|
|
225
225
|
partnerFeePercent: string,
|
|
226
|
-
|
|
226
|
+
takeSurplus: boolean,
|
|
227
227
|
beneficiary: Address,
|
|
228
228
|
permit: string,
|
|
229
229
|
deadline: string,
|
|
@@ -272,7 +272,7 @@ export abstract class SimpleRouter extends SimpleRouterBase<SimpleSwapParam> {
|
|
|
272
272
|
referrerAddress: Address | undefined,
|
|
273
273
|
partnerAddress: Address,
|
|
274
274
|
partnerFeePercent: string,
|
|
275
|
-
|
|
275
|
+
takeSurplus: boolean,
|
|
276
276
|
beneficiary: Address,
|
|
277
277
|
permit: string,
|
|
278
278
|
deadline: string,
|
|
@@ -292,13 +292,9 @@ export abstract class SimpleRouter extends SimpleRouterBase<SimpleSwapParam> {
|
|
|
292
292
|
encodePartnerAddressForFeeLogic({
|
|
293
293
|
partnerAddress,
|
|
294
294
|
partnerFeePercent,
|
|
295
|
-
|
|
295
|
+
takeSurplus,
|
|
296
296
|
}),
|
|
297
|
-
encodeFeePercent(
|
|
298
|
-
partnerFeePercent,
|
|
299
|
-
positiveSlippageToUser,
|
|
300
|
-
this.side,
|
|
301
|
-
),
|
|
297
|
+
encodeFeePercent(partnerFeePercent, takeSurplus, this.side),
|
|
302
298
|
];
|
|
303
299
|
|
|
304
300
|
const sellData: ConstractSimpleData = {
|
|
@@ -60,7 +60,7 @@ export class SimpleBuyNFT extends SimpleRouterBase<SimpleBuyNFTParam> {
|
|
|
60
60
|
referrerAddress: Address | undefined,
|
|
61
61
|
partnerAddress: Address,
|
|
62
62
|
partnerFeePercent: string,
|
|
63
|
-
|
|
63
|
+
takeSurplus: boolean,
|
|
64
64
|
beneficiary: Address,
|
|
65
65
|
permit: string,
|
|
66
66
|
deadline: string,
|
|
@@ -102,13 +102,9 @@ export class SimpleBuyNFT extends SimpleRouterBase<SimpleBuyNFTParam> {
|
|
|
102
102
|
encodePartnerAddressForFeeLogic({
|
|
103
103
|
partnerAddress,
|
|
104
104
|
partnerFeePercent,
|
|
105
|
-
|
|
105
|
+
takeSurplus,
|
|
106
106
|
}),
|
|
107
|
-
encodeFeePercent(
|
|
108
|
-
partnerFeePercent,
|
|
109
|
-
positiveSlippageToUser,
|
|
110
|
-
SwapSide.BUY,
|
|
111
|
-
),
|
|
107
|
+
encodeFeePercent(partnerFeePercent, takeSurplus, SwapSide.BUY),
|
|
112
108
|
];
|
|
113
109
|
|
|
114
110
|
const buyData: ContractSimpleBuyNFTData = {
|
|
@@ -17,7 +17,7 @@ export class TransactionBuilder {
|
|
|
17
17
|
referrerAddress,
|
|
18
18
|
partnerAddress,
|
|
19
19
|
partnerFeePercent,
|
|
20
|
-
|
|
20
|
+
takeSurplus,
|
|
21
21
|
gasPrice,
|
|
22
22
|
maxFeePerGas,
|
|
23
23
|
maxPriorityFeePerGas,
|
|
@@ -33,7 +33,7 @@ export class TransactionBuilder {
|
|
|
33
33
|
referrerAddress?: Address;
|
|
34
34
|
partnerAddress: Address;
|
|
35
35
|
partnerFeePercent: string;
|
|
36
|
-
|
|
36
|
+
takeSurplus?: boolean;
|
|
37
37
|
gasPrice?: string; // // @TODO: improve types? so that either gasPrice or ALL of max.*FeePerGas MUST be returned?
|
|
38
38
|
maxFeePerGas?: string;
|
|
39
39
|
maxPriorityFeePerGas?: string;
|
|
@@ -53,7 +53,7 @@ export class TransactionBuilder {
|
|
|
53
53
|
referrerAddress,
|
|
54
54
|
partnerAddress,
|
|
55
55
|
partnerFeePercent,
|
|
56
|
-
|
|
56
|
+
takeSurplus ?? false,
|
|
57
57
|
_beneficiary,
|
|
58
58
|
permit || '0x',
|
|
59
59
|
deadline,
|
package/src/types.ts
CHANGED
package/tests/constants-e2e.ts
CHANGED
|
@@ -1065,7 +1065,7 @@ export const Holders: {
|
|
|
1065
1065
|
BETS: '0x8cc2284c90d05578633418f9cde104f402375a65',
|
|
1066
1066
|
HATCHY: '0x14ec295ec8def851ec6e2959df872dd24e422631',
|
|
1067
1067
|
USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66',
|
|
1068
|
-
USDC: '
|
|
1068
|
+
USDC: '0xbf14db80d9275fb721383a77c00ae180fc40ae98',
|
|
1069
1069
|
USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83',
|
|
1070
1070
|
WETHe: '0xD291B51f7a1a1F4917D085F2a7731A447E4aF82D',
|
|
1071
1071
|
POPS: '0x5268c2331658cb0b2858cfa9db27d8f22f5434bc',
|
|
@@ -1081,7 +1081,7 @@ export const Holders: {
|
|
|
1081
1081
|
TSD: '0x691A89db352B72dDb249bFe16503494eC0D920A4',
|
|
1082
1082
|
THO: '0xc40d16c47394a506d451475c8a7c46c1175c1da1',
|
|
1083
1083
|
aAvaUSDT: '0x50B1Ba98Cf117c9682048D56628B294ebbAA4ec2',
|
|
1084
|
-
USDT: '
|
|
1084
|
+
USDT: '0x4aeFa39caEAdD662aE31ab0CE7c8C2c9c0a013E8',
|
|
1085
1085
|
aAvaWAVAX: '0x1B18Df70863636AEe4BfBAb6F7C70ceBCA9bA404',
|
|
1086
1086
|
oldFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
|
|
1087
1087
|
newFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
|
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>
|