@paraswap/dex-lib 3.5.4-v6.2.2 → 3.5.4

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.
Files changed (45) hide show
  1. package/build/config.js +36 -36
  2. package/build/constants.d.ts +0 -2
  3. package/build/constants.js +1 -3
  4. package/build/constants.js.map +1 -1
  5. package/build/dex/balancer-v2/balancer-v2.d.ts +2 -2
  6. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  7. package/build/dex/curve-v1/curve-v1.d.ts +2 -2
  8. package/build/dex/curve-v1/curve-v1.js.map +1 -1
  9. package/build/dex/curve-v1-factory/curve-v1-factory.d.ts +2 -2
  10. package/build/dex/curve-v1-factory/curve-v1-factory.js.map +1 -1
  11. package/build/dex/curve-v2/curve-v2.d.ts +2 -2
  12. package/build/dex/curve-v2/curve-v2.js.map +1 -1
  13. package/build/dex/generic-rfq/generic-rfq.d.ts +1 -1
  14. package/build/dex/generic-rfq/generic-rfq.js.map +1 -1
  15. package/build/dex/idex.d.ts +2 -2
  16. package/build/dex/maker-psm/maker-psm.d.ts +3 -12
  17. package/build/dex/maker-psm/maker-psm.js +0 -66
  18. package/build/dex/maker-psm/maker-psm.js.map +1 -1
  19. package/build/dex/maker-psm/types.d.ts +1 -15
  20. package/build/dex/uniswap-v2/uniswap-v2.d.ts +2 -2
  21. package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
  22. package/build/dex/uniswap-v3/uniswap-v3.d.ts +2 -2
  23. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  24. package/build/dex/zerox/index.d.ts +1 -1
  25. package/build/dex/zerox/index.js.map +1 -1
  26. package/build/generic-swap-transaction-builder.d.ts +3 -5
  27. package/build/generic-swap-transaction-builder.js +7 -22
  28. package/build/generic-swap-transaction-builder.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/config.ts +36 -36
  31. package/src/constants.ts +0 -2
  32. package/src/dex/balancer-v2/balancer-v2.ts +2 -2
  33. package/src/dex/curve-v1/curve-v1.ts +2 -2
  34. package/src/dex/curve-v1-factory/curve-v1-factory.ts +2 -2
  35. package/src/dex/curve-v2/curve-v2.ts +2 -2
  36. package/src/dex/generic-rfq/generic-rfq.ts +1 -1
  37. package/src/dex/idex.ts +2 -2
  38. package/src/dex/maker-psm/maker-psm-e2e.test.ts +33 -8
  39. package/src/dex/maker-psm/maker-psm.ts +5 -136
  40. package/src/dex/maker-psm/types.ts +1 -17
  41. package/src/dex/uniswap-v2/uniswap-v2.ts +2 -2
  42. package/src/dex/uniswap-v3/uniswap-v3.ts +2 -2
  43. package/src/dex/zerox/index.ts +1 -1
  44. package/src/generic-swap-transaction-builder.ts +0 -40
  45. package/tests/constants-e2e.ts +1 -1
package/src/config.ts CHANGED
@@ -50,11 +50,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
50
50
  tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
51
51
  multicallV2Address: '0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696',
52
52
  privateHttpProvider: process.env.HTTP_PROVIDER_1,
53
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
53
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
54
54
  executorsAddresses: {
55
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
56
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
57
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
55
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
56
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
57
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
58
58
  },
59
59
  adapterAddresses: {
60
60
  Adapter01: '0x9bE264469eF954c139Da4A45Cf76CbCC5e3A6A73',
@@ -142,11 +142,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
142
142
  tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
143
143
  multicallV2Address: '0xC50F4c1E81c873B2204D7eFf7069Ffec6Fbe136D',
144
144
  privateHttpProvider: process.env.HTTP_PROVIDER_56,
145
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
145
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
146
146
  executorsAddresses: {
147
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
148
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
149
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
147
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
148
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
149
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
150
150
  },
151
151
  hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
152
152
  swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
@@ -177,11 +177,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
177
177
  tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
178
178
  multicallV2Address: '0x275617327c958bD06b5D6b871E7f491D76113dd8',
179
179
  privateHttpProvider: process.env.HTTP_PROVIDER_137,
180
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
180
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
181
181
  executorsAddresses: {
182
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
183
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
184
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
182
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
183
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
184
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
185
185
  },
186
186
  hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
187
187
  hashFlowDisabledMMs:
@@ -217,11 +217,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
217
217
  hashFlowDisabledMMs:
218
218
  process.env[`HASHFLOW_DISABLED_MMS_43114`]?.split(',') || [],
219
219
  dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
220
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
220
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
221
221
  executorsAddresses: {
222
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
223
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
224
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
222
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
223
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
224
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
225
225
  },
226
226
  adapterAddresses: {
227
227
  AvalancheAdapter01: '0x745Ec73855CeC7249E5fF4c9DD81cc65b4D297a9',
@@ -251,11 +251,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
251
251
  hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
252
252
  hashFlowDisabledMMs:
253
253
  process.env[`HASHFLOW_DISABLED_MMS_250`]?.split(',') || [],
254
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
254
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
255
255
  executorsAddresses: {
256
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
257
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
258
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
256
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
257
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
258
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
259
259
  },
260
260
  adapterAddresses: {
261
261
  FantomAdapter01: '0x654dE10890f8B2C5bF54E50Af169a7E93165C416',
@@ -286,11 +286,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
286
286
  swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
287
287
  hashFlowDisabledMMs:
288
288
  process.env[`HASHFLOW_DISABLED_MMS_42161`]?.split(',') || [],
289
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
289
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
290
290
  executorsAddresses: {
291
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
292
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
293
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
291
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
292
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
293
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
294
294
  },
295
295
  dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
296
296
  adapterAddresses: {
@@ -320,11 +320,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
320
320
  tokenTransferProxyAddress: '0x216b4b4ba9f3e719726886d34a177484278bfcae',
321
321
  multicallV2Address: '0x2DC0E2aa608532Da689e89e237dF582B783E552C',
322
322
  privateHttpProvider: process.env.HTTP_PROVIDER_10,
323
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
323
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
324
324
  executorsAddresses: {
325
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
326
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
327
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
325
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
326
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
327
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
328
328
  },
329
329
  hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
330
330
  swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
@@ -356,11 +356,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
356
356
  tokenTransferProxyAddress: '0xc8a21fcd5a100c3ecc037c97e2f9c53a8d3a02a1',
357
357
  multicallV2Address: '0x6cA478C852DfA8941FC819fDf248606eA04780B6',
358
358
  privateHttpProvider: process.env.HTTP_PROVIDER_1101,
359
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
359
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
360
360
  executorsAddresses: {
361
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
362
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
363
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
361
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
362
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
363
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
364
364
  },
365
365
  adapterAddresses: {
366
366
  PolygonZkEvmAdapter01: '0xd63B7691dD98fa89A2ea5e1604700489c585aa7B',
@@ -394,11 +394,11 @@ const baseConfigs: { [network: number]: BaseConfig } = {
394
394
  hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
395
395
  swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
396
396
  hashFlowDisabledMMs: [],
397
- augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
397
+ augustusV6Address: '0x000dB803A70511E09dA650D4C0506d0000100000',
398
398
  executorsAddresses: {
399
- Executor01: '0x5f0000d4780a00d2dce0a00004000800cb0e5041',
400
- Executor02: '0xd08d0006f00040b400180f9500b00c5026ac0900',
401
- Executor03: '0x5006860a0906b0d8c9c050200947000030081006',
399
+ Executor01: '0x9000D0c03F00f002C440030024042c02E2e0E0d0',
400
+ Executor02: '0xb0DE0000b80000520aCf020C52D006500017055f',
401
+ Executor03: '0xBa0200000D0903dC0c1000801B0573090078E09E',
402
402
  },
403
403
  adapterAddresses: {
404
404
  BaseAdapter01: '0xe53d24CD81cC81bbf271AD7B02D0d67f851D727c',
package/src/constants.ts CHANGED
@@ -61,8 +61,6 @@ export const DEST_TOKEN_DEX_TRANSFERS = 1;
61
61
  export const BPS_MAX_VALUE = 10000n;
62
62
 
63
63
  export const FEE_PERCENT_IN_BASIS_POINTS_MASK = BigNumber.from('0x3FFF');
64
- export const IS_USER_SURPLUS_MASK = BigNumber.from('1').shl(90);
65
- export const IS_DIRECT_TRANSFER_MASK = BigNumber.from('1').shl(91);
66
64
  export const IS_CAP_SURPLUS_MASK = BigNumber.from('1').shl(92);
67
65
  export const IS_SKIP_BLACKLIST_MASK = BigNumber.from('1').shl(93);
68
66
  export const IS_REFERRAL_MASK = BigNumber.from('1').shl(94);
@@ -1326,7 +1326,7 @@ export class BalancerV2
1326
1326
  deadline: NumberAsString,
1327
1327
  partner: string,
1328
1328
  beneficiary: string,
1329
- contractMethod: string,
1329
+ contractMethod?: string,
1330
1330
  ): TxInfo<BalancerV2DirectParam> {
1331
1331
  if (
1332
1332
  contractMethod !== DirectMethods.directSell &&
@@ -1397,7 +1397,7 @@ export class BalancerV2
1397
1397
  partnerAndFee: string,
1398
1398
  beneficiary: string,
1399
1399
  blockNumber: number,
1400
- contractMethod: string,
1400
+ contractMethod?: string,
1401
1401
  ) {
1402
1402
  if (!contractMethod) throw new Error(`contractMethod need to be passed`);
1403
1403
 
@@ -937,7 +937,7 @@ export class CurveV1
937
937
  deadline: NumberAsString,
938
938
  partner: string,
939
939
  beneficiary: string,
940
- contractMethod: string,
940
+ contractMethod?: string,
941
941
  ): TxInfo<DirectCurveV1Param> {
942
942
  if (contractMethod !== DIRECT_METHOD_NAME) {
943
943
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -997,7 +997,7 @@ export class CurveV1
997
997
  partnerAndFee: string,
998
998
  beneficiary: string,
999
999
  blockNumber: number,
1000
- contractMethod: string,
1000
+ contractMethod?: string,
1001
1001
  ) {
1002
1002
  if (contractMethod !== DIRECT_METHOD_NAME_V6) {
1003
1003
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -999,7 +999,7 @@ export class CurveV1Factory
999
999
  deadline: NumberAsString,
1000
1000
  partner: string,
1001
1001
  beneficiary: string,
1002
- contractMethod: string,
1002
+ contractMethod?: string,
1003
1003
  ): TxInfo<DirectCurveV1Param> {
1004
1004
  if (contractMethod !== DIRECT_METHOD_NAME) {
1005
1005
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -1059,7 +1059,7 @@ export class CurveV1Factory
1059
1059
  partnerAndFee: string,
1060
1060
  beneficiary: string,
1061
1061
  blockNumber: number,
1062
- contractMethod: string,
1062
+ contractMethod?: string,
1063
1063
  ) {
1064
1064
  if (contractMethod !== DIRECT_METHOD_NAME_V6) {
1065
1065
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -213,7 +213,7 @@ export class CurveV2
213
213
  _0: NumberAsString,
214
214
  partner: string,
215
215
  beneficiary: string,
216
- contractMethod: string,
216
+ contractMethod?: string,
217
217
  ): TxInfo<DirectCurveV2Param> {
218
218
  if (contractMethod !== DIRECT_METHOD_NAME) {
219
219
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -272,7 +272,7 @@ export class CurveV2
272
272
  partnerAndFee: string,
273
273
  beneficiary: string,
274
274
  blockNumber: number,
275
- contractMethod: string,
275
+ contractMethod?: string,
276
276
  ) {
277
277
  if (contractMethod !== DIRECT_METHOD_NAME_V6) {
278
278
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -221,7 +221,7 @@ export class GenericRFQ extends ParaSwapLimitOrders {
221
221
  partnerAndFee: string,
222
222
  beneficiary: string,
223
223
  blockNumber: number,
224
- contractMethod: string,
224
+ contractMethod?: string,
225
225
  ) {
226
226
  if (!contractMethod) throw new Error(`contractMethod need to be passed`);
227
227
  if (!GenericRFQ.getDirectFunctionNameV6().includes(contractMethod!)) {
package/src/dex/idex.ts CHANGED
@@ -106,7 +106,7 @@ export interface IDexTxBuilder<ExchangeData, DirectParam = null> {
106
106
  deadline: NumberAsString,
107
107
  partner: string,
108
108
  beneficiary: string,
109
- contractMethod: string,
109
+ contractMethod?: string,
110
110
  ): TxInfo<DirectParam>;
111
111
 
112
112
  // Same as above but for V6
@@ -123,7 +123,7 @@ export interface IDexTxBuilder<ExchangeData, DirectParam = null> {
123
123
  partnerAndFee: string,
124
124
  beneficiary: string,
125
125
  blockNumber: number,
126
- contractMethod: string,
126
+ contractMethod?: string,
127
127
  ): TxInfo<DirectParam>;
128
128
  }
129
129
 
@@ -25,25 +25,24 @@ describe('MakerPsm E2E', () => {
25
25
 
26
26
  const tokenASymbol: string = 'USDC';
27
27
  const tokenBSymbol: string = 'DAI';
28
+ const nativeTokenSymbol = 'ETH';
28
29
 
29
30
  const tokenAAmount: string = '10000000';
30
31
  const tokenBAmount: string = '10000000000000000';
32
+ const nativeTokenAmount: string = '10000000000000000';
31
33
 
32
34
  const sideToContractMethods = new Map([
33
35
  [
34
36
  SwapSide.SELL,
35
37
  [
36
38
  ContractMethod.swapExactAmountIn,
37
- ContractMethod.swapExactAmountInOutOnMakerPSM,
38
- ],
39
- ],
40
- [
41
- SwapSide.BUY,
42
- [
43
- ContractMethod.swapExactAmountOut,
44
- ContractMethod.swapExactAmountInOutOnMakerPSM,
39
+ // ContractMethod.simpleSwap,
40
+ // ContractMethod.multiSwap,
41
+ // ContractMethod.megaSwap,
45
42
  ],
46
43
  ],
44
+ // [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
45
+ [SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
47
46
  ]);
48
47
 
49
48
  sideToContractMethods.forEach((contractMethods, side) =>
@@ -76,6 +75,32 @@ describe('MakerPsm E2E', () => {
76
75
  provider,
77
76
  );
78
77
  });
78
+ // it(`${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
79
+ // await testE2E(
80
+ // tokens[nativeTokenSymbol],
81
+ // tokens[tokenASymbol],
82
+ // holders[nativeTokenSymbol],
83
+ // side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
84
+ // side,
85
+ // dexKey,
86
+ // contractMethod,
87
+ // network,
88
+ // provider,
89
+ // );
90
+ // });
91
+ // it(`${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
92
+ // await testE2E(
93
+ // tokens[tokenASymbol],
94
+ // tokens[nativeTokenSymbol],
95
+ // holders[tokenASymbol],
96
+ // side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
97
+ // side,
98
+ // dexKey,
99
+ // contractMethod,
100
+ // network,
101
+ // provider,
102
+ // );
103
+ // });
79
104
  });
80
105
  }),
81
106
  );
@@ -13,26 +13,14 @@ import {
13
13
  Logger,
14
14
  NumberAsString,
15
15
  DexExchangeParam,
16
- ExchangeTxInfo,
17
- PreprocessTransactionOptions,
18
16
  } from '../../types';
19
- import { SwapSide, Network, NULL_ADDRESS } from '../../constants';
17
+ import { SwapSide, Network } from '../../constants';
20
18
  import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
21
19
  import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
22
- import {
23
- getDexKeysWithNetwork,
24
- getBigIntPow,
25
- uuidToBytes16,
26
- } from '../../utils';
20
+ import { getDexKeysWithNetwork, getBigIntPow } from '../../utils';
27
21
  import { IDex } from '../../dex/idex';
28
22
  import { IDexHelper } from '../../dex-helper/idex-helper';
29
- import {
30
- MakerPsmData,
31
- PoolState,
32
- PoolConfig,
33
- MakerPsmParams,
34
- MakerPsmDirectPayload,
35
- } from './types';
23
+ import { MakerPsmData, PoolState, PoolConfig } from './types';
36
24
  import { SimpleExchange } from '../simple-exchange';
37
25
  import { MakerPsmConfig, Adapters } from './config';
38
26
  import PsmABI from '../../abi/maker-psm/psm.json';
@@ -40,12 +28,7 @@ import VatABI from '../../abi/maker-psm/vat.json';
40
28
  import { BI_POWS } from '../../bigint-constants';
41
29
  import { SpecialDex } from '../../executor/types';
42
30
  import { hexConcat, hexZeroPad, hexlify } from '@ethersproject/bytes';
43
- import {
44
- ContractMethodV6,
45
- OptimalSwapExchange,
46
- ParaSwapVersion,
47
- } from '@paraswap/core';
48
- import { BigNumber } from 'ethers';
31
+ import { ZEROS_12_BYTES } from '../../executor/constants';
49
32
 
50
33
  const vatInterface = new Interface(VatABI);
51
34
  const psmInterface = new Interface(PsmABI);
@@ -208,10 +191,7 @@ export class MakerPsmEventPool extends StatefulEventSubscriber<PoolState> {
208
191
  }
209
192
  }
210
193
 
211
- export class MakerPsm
212
- extends SimpleExchange
213
- implements IDex<MakerPsmData, MakerPsmDirectPayload>
214
- {
194
+ export class MakerPsm extends SimpleExchange implements IDex<MakerPsmData> {
215
195
  protected eventPools: { [gemAddress: string]: MakerPsmEventPool };
216
196
 
217
197
  // warning: There is limit on swap
@@ -248,10 +228,6 @@ export class MakerPsm
248
228
  );
249
229
  }
250
230
 
251
- static getDirectFunctionNameV6(): string[] {
252
- return [ContractMethodV6.swapExactAmountInOutOnMakerPSM];
253
- }
254
-
255
231
  async initializePricing(blockNumber: number) {
256
232
  const poolStates = await getOnChainState(
257
233
  this.dexHelper.multiContract,
@@ -520,46 +496,6 @@ export class MakerPsm
520
496
  );
521
497
  }
522
498
 
523
- getTokenFromAddress(address: Address): Token {
524
- return { address, decimals: 0 };
525
- }
526
-
527
- async preProcessTransaction?(
528
- optimalSwapExchange: OptimalSwapExchange<MakerPsmData>,
529
- srcToken: Token,
530
- destToken: Token,
531
- side: SwapSide,
532
- options: PreprocessTransactionOptions,
533
- ): Promise<[OptimalSwapExchange<MakerPsmData>, ExchangeTxInfo]> {
534
- if (!optimalSwapExchange.data) {
535
- throw new Error(
536
- `Error_${this.dexKey}_preProcessTransaction payload is not received`,
537
- );
538
- }
539
-
540
- let isApproved = false;
541
-
542
- // isApproved is only used in direct method and available only for v6, then no need to check approve for v5
543
- // because it's either done in getSimpleParam or approve call in the adapter smart contract
544
- if (options.version === ParaSwapVersion.V6 && options.isDirectMethod) {
545
- isApproved = await this.dexHelper.augustusApprovals.hasApproval(
546
- options.executionContractAddress,
547
- srcToken.address,
548
- srcToken.address.toLowerCase() === this.dai.address.toLowerCase()
549
- ? optimalSwapExchange.data.psmAddress
550
- : optimalSwapExchange.data.gemJoinAddress,
551
- );
552
- }
553
-
554
- return [
555
- {
556
- ...optimalSwapExchange,
557
- data: { ...optimalSwapExchange.data, isApproved },
558
- },
559
- {},
560
- ];
561
- }
562
-
563
499
  getDexParam(
564
500
  srcToken: Address,
565
501
  destToken: Address,
@@ -608,73 +544,6 @@ export class MakerPsm
608
544
  returnAmountPos: undefined,
609
545
  };
610
546
  }
611
-
612
- getDirectParamV6(
613
- srcToken: Address,
614
- destToken: Address,
615
- fromAmount: NumberAsString,
616
- toAmount: NumberAsString,
617
- quotedAmount: NumberAsString,
618
- data: MakerPsmData,
619
- side: SwapSide,
620
- permit: string,
621
- uuid: string,
622
- partnerAndFee: string,
623
- beneficiary: string,
624
- blockNumber: number,
625
- contractMethod: string,
626
- ) {
627
- if (!contractMethod) throw new Error(`contractMethod need to be passed`);
628
- if (!MakerPsm.getDirectFunctionNameV6().includes(contractMethod!)) {
629
- throw new Error(`Invalid contract method ${contractMethod}`);
630
- }
631
-
632
- const beneficiaryParam = BigNumber.from(
633
- '0x96a18a51d8e8320cba1e4ae45c69fbec0146a14f',
634
- );
635
- const approveParam = !data.isApproved
636
- ? BigNumber.from(1).shl(255)
637
- : BigNumber.from(0);
638
- const directionParam =
639
- side === SwapSide.SELL ? BigNumber.from(0) : BigNumber.from(1).shl(254);
640
-
641
- const beneficiaryDirectionApproveFlag = beneficiaryParam
642
- .or(directionParam)
643
- .or(approveParam);
644
-
645
- const to18ConversionFactor = getBigIntPow(18 - data.gemDecimals);
646
-
647
- const metadata = hexConcat([
648
- hexZeroPad(uuidToBytes16(uuid), 16),
649
- hexZeroPad(hexlify(blockNumber), 16),
650
- ]);
651
-
652
- const params: MakerPsmParams = [
653
- srcToken,
654
- // dest token is not used on the contract
655
- NULL_ADDRESS,
656
- fromAmount,
657
- toAmount,
658
- data.toll,
659
- to18ConversionFactor.toString(),
660
- data.psmAddress,
661
- data.gemJoinAddress,
662
- metadata,
663
- beneficiaryDirectionApproveFlag.toString(),
664
- ];
665
-
666
- const payload: MakerPsmDirectPayload = [params, permit];
667
-
668
- const encoder = (...params: (string | MakerPsmDirectPayload)[]) => {
669
- return this.augustusV6Interface.encodeFunctionData(
670
- ContractMethodV6.swapExactAmountInOutOnMakerPSM,
671
- [...params],
672
- );
673
- };
674
-
675
- return { params: payload, encoder, networkFee: '0' };
676
- }
677
-
678
547
  // Returns list of top pools based on liquidity. Max
679
548
  // limit number pools should be returned.
680
549
  async getTopPoolsForToken(
@@ -1,4 +1,4 @@
1
- import { Address, NumberAsString, Token } from '../../types';
1
+ import { Address, Token } from '../../types';
2
2
 
3
3
  export type PoolState = {
4
4
  tin: bigint; // toll in
@@ -13,7 +13,6 @@ export type MakerPsmData = {
13
13
  gemJoinAddress: Address;
14
14
  gemDecimals: number;
15
15
  toll: string;
16
- isApproved?: boolean;
17
16
  };
18
17
 
19
18
  export type PoolConfig = {
@@ -28,18 +27,3 @@ export type DexParams = {
28
27
  vatAddress: Address;
29
28
  pools: PoolConfig[];
30
29
  };
31
-
32
- export type MakerPsmParams = [
33
- srcToken: Address,
34
- destToken: Address,
35
- fromAmount: NumberAsString,
36
- toAmount: NumberAsString,
37
- toll: NumberAsString,
38
- to18ConversionFactor: NumberAsString,
39
- exchange: Address,
40
- gemJoinAddress: Address,
41
- metadata: string,
42
- beneficiaryDirectionApproveFlag: NumberAsString,
43
- ];
44
-
45
- export type MakerPsmDirectPayload = [params: MakerPsmParams, permit: string];
@@ -938,7 +938,7 @@ export class UniswapV2
938
938
  deadline: NumberAsString,
939
939
  partner: string,
940
940
  beneficiary: string,
941
- contractMethod: string,
941
+ contractMethod?: string,
942
942
  ): TxInfo<UniswapParam> {
943
943
  if (!contractMethod) throw new Error(`contractMethod need to be passed`);
944
944
  if (permit !== '0x') contractMethod += 'WithPermit';
@@ -1014,7 +1014,7 @@ export class UniswapV2
1014
1014
  partnerAndFee: string,
1015
1015
  beneficiary: string,
1016
1016
  blockNumber: number,
1017
- contractMethod: string,
1017
+ contractMethod?: string,
1018
1018
  ) {
1019
1019
  if (!contractMethod) throw new Error(`contractMethod need to be passed`);
1020
1020
  if (!UniswapV2.getDirectFunctionNameV6().includes(contractMethod!)) {
@@ -960,7 +960,7 @@ export class UniswapV3
960
960
  deadline: NumberAsString,
961
961
  partner: string,
962
962
  beneficiary: string,
963
- contractMethod: string,
963
+ contractMethod?: string,
964
964
  ): TxInfo<UniswapV3Param> {
965
965
  if (!UniswapV3.getDirectFunctionName().includes(contractMethod!)) {
966
966
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -1023,7 +1023,7 @@ export class UniswapV3
1023
1023
  partnerAndFee: string,
1024
1024
  beneficiary: string,
1025
1025
  blockNumber: number,
1026
- contractMethod: string,
1026
+ contractMethod?: string,
1027
1027
  ) {
1028
1028
  if (!UniswapV3.getDirectFunctionNameV6().includes(contractMethod!)) {
1029
1029
  throw new Error(`Invalid contract method ${contractMethod}`);
@@ -275,7 +275,7 @@ export class ZeroX
275
275
  deadline: NumberAsString,
276
276
  partner: string,
277
277
  beneficiary: string,
278
- contractMethod: string,
278
+ contractMethod?: string,
279
279
  ): TxInfo<ZeroXParam> {
280
280
  const usePermit = permit !== '0x';
281
281
  const encoder = (...params: ZeroXParam) => {