@paraswap/dex-lib 2.13.0 → 2.14.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.
Files changed (74) hide show
  1. package/build/config.js +5 -23
  2. package/build/config.js.map +1 -1
  3. package/build/dex/curve-v1/config.js +0 -2
  4. package/build/dex/curve-v1/config.js.map +1 -1
  5. package/build/dex/curve-v1/curve-v1.js +0 -2
  6. package/build/dex/curve-v1/curve-v1.js.map +1 -1
  7. package/build/dex/curve-v1/types.d.ts +0 -1
  8. package/build/dex/curve-v1/types.js.map +1 -1
  9. package/build/dex/index.js +2 -2
  10. package/build/dex/index.js.map +1 -1
  11. package/build/dex/simple-exchange.d.ts +0 -1
  12. package/build/dex/simple-exchange.js +1 -3
  13. package/build/dex/simple-exchange.js.map +1 -1
  14. package/build/lib/decoders.d.ts +1 -2
  15. package/build/lib/decoders.js +1 -8
  16. package/build/lib/decoders.js.map +1 -1
  17. package/build/lib/multi-wrapper.d.ts +1 -2
  18. package/build/lib/multi-wrapper.js.map +1 -1
  19. package/build/lib/tokens/balancer-fetcher.js +5 -4
  20. package/build/lib/tokens/balancer-fetcher.js.map +1 -1
  21. package/build/lib/tokens/utils.d.ts +2 -2
  22. package/build/lib/tokens/utils.js +1 -1
  23. package/build/lib/tokens/utils.js.map +1 -1
  24. package/build/types.d.ts +0 -3
  25. package/dex-template/__DexName__-e2e.test.ts.template +0 -1
  26. package/dex-template/__DexName__-events.test.ts.template +0 -1
  27. package/dex-template/__DexName__-integration.test.ts.template +0 -1
  28. package/dex-template/__DexName__-pool.ts.template +5 -8
  29. package/package.json +1 -1
  30. package/scripts/generate-bytecode.ts +0 -2
  31. package/src/abi/woo-fi/WooFeeManager.abi.json +318 -0
  32. package/src/abi/{woo-fi-v2/WooPPV2.abi.json → woo-fi/WooPP.abi.json} +169 -201
  33. package/src/abi/{woo-fi-v2/WooOracleV2.abi.json → woo-fi/Wooracle.abi.json} +50 -148
  34. package/src/config.ts +5 -27
  35. package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +1 -0
  36. package/src/dex/curve-v1/config.ts +0 -2
  37. package/src/dex/curve-v1/curve-v1-e2e.test.ts +37 -18
  38. package/src/dex/curve-v1/curve-v1.ts +0 -2
  39. package/src/dex/curve-v1/types.ts +0 -1
  40. package/src/dex/index.ts +2 -2
  41. package/src/dex/simple-exchange.ts +1 -4
  42. package/src/dex/woo-fi/config.ts +141 -0
  43. package/src/dex/woo-fi/constants.ts +21 -0
  44. package/src/dex/woo-fi/types.ts +55 -0
  45. package/src/dex/woo-fi/woo-fi-decimal-math.ts +45 -0
  46. package/src/dex/woo-fi/woo-fi-e2e.test.ts +183 -0
  47. package/src/dex/woo-fi/woo-fi-integration.test.ts +416 -0
  48. package/src/dex/woo-fi/woo-fi-math.ts +527 -0
  49. package/src/dex/woo-fi/woo-fi.ts +693 -0
  50. package/src/lib/decoders.ts +1 -12
  51. package/src/lib/multi-wrapper.ts +1 -2
  52. package/src/lib/tokens/balancer-fetcher.ts +6 -5
  53. package/src/lib/tokens/utils.ts +3 -5
  54. package/src/types.ts +0 -4
  55. package/tests/constants-e2e.ts +9 -9
  56. package/tests/tenderly-simulation.ts +1 -1
  57. package/tests/utils-e2e.ts +0 -2
  58. package/tests/utils.ts +0 -2
  59. package/src/abi/woo-fi-v2/IntegrationHelper.abi.json +0 -116
  60. package/src/dex/woo-fi-v2/config.ts +0 -87
  61. package/src/dex/woo-fi-v2/constants.ts +0 -22
  62. package/src/dex/woo-fi-v2/decoders.ts +0 -45
  63. package/src/dex/woo-fi-v2/types.ts +0 -63
  64. package/src/dex/woo-fi-v2/utils.ts +0 -19
  65. package/src/dex/woo-fi-v2/woo-fi-v2-e2e.test.ts +0 -216
  66. package/src/dex/woo-fi-v2/woo-fi-v2-integration.test.ts +0 -495
  67. package/src/dex/woo-fi-v2/woo-fi-v2-math.ts +0 -195
  68. package/src/dex/woo-fi-v2/woo-fi-v2-pool.ts +0 -112
  69. package/src/dex/woo-fi-v2/woo-fi-v2.ts +0 -487
  70. package/src/lib/log-messages-suppressor.ts +0 -173
  71. package/src/lib/stateful-rpc-poller/state-polling-manager.ts +0 -320
  72. package/src/lib/stateful-rpc-poller/stateful-rpc-poller.ts +0 -604
  73. package/src/lib/stateful-rpc-poller/types.ts +0 -66
  74. package/src/lib/stateful-rpc-poller/utils.ts +0 -23
@@ -1,4 +1,3 @@
1
- import { BytesLike } from 'ethers';
2
1
  import _ from 'lodash';
3
2
  import { Logger } from 'log4js';
4
3
  import { Contract } from 'web3-eth-contract';
@@ -11,7 +10,7 @@ export type MultiResult<T> = {
11
10
  export type MultiCallParams<T> = {
12
11
  target: string;
13
12
  callData: string;
14
- decodeFunction: (str: MultiResult<BytesLike> | BytesLike) => T;
13
+ decodeFunction: (str: MultiResult<string> | string) => T;
15
14
  cb?: (data: T) => void;
16
15
  };
17
16
 
@@ -59,6 +59,7 @@ export const getBalanceCallParams = (
59
59
  }));
60
60
  default:
61
61
  throw new Error(`missing case for assetType ${req.assetType}`);
62
+ return [];
62
63
  }
63
64
  };
64
65
 
@@ -263,21 +264,21 @@ export const getBalances = async (
263
264
  blockNumber,
264
265
  );
265
266
 
266
- const chunks = [];
267
+ const chuncks = [];
267
268
  let j = 0;
268
269
  for (let i = 0; i < results.length; ) {
269
270
  const batchSize = decodingInfo[j].length;
270
- const chunk = results.slice(i, i + batchSize);
271
- chunks.push(chunk);
271
+ const chunck = results.slice(i, i + batchSize);
272
+ chuncks.push(chunck);
272
273
  j++;
273
274
  i += batchSize;
274
275
  }
275
276
 
276
- return chunks.map((chunk, index) =>
277
+ return chuncks.map((chunck, index) =>
277
278
  decodeBalanceAndAllowanceMultiResult(
278
279
  reqs[index],
279
280
  decodingInfo[index].spenders,
280
- chunk,
281
+ chunck,
281
282
  ),
282
283
  );
283
284
  };
@@ -53,7 +53,7 @@ export const uint256ArrayDecode = (
53
53
  };
54
54
 
55
55
  export const booleanDecode = (
56
- result: MultiResult<BytesLike> | BytesLike,
56
+ result: MultiResult<string> | string,
57
57
  ): boolean => {
58
58
  const [isSuccess, toDecode] = extractSuccessAndValue(result);
59
59
 
@@ -63,12 +63,10 @@ export const booleanDecode = (
63
63
  return defaultAbiCoder.decode(['bool'], toDecode)[0];
64
64
  };
65
65
 
66
- export const addressDecode = (
67
- result: MultiResult<BytesLike> | BytesLike,
68
- ): string => {
66
+ export const addressDecode = (result: MultiResult<string> | string): string => {
69
67
  const [isSuccess, toDecode] = extractSuccessAndValue(result);
70
68
 
71
- if (!isSuccess) {
69
+ if (isSuccess) {
72
70
  return '';
73
71
  }
74
72
  return defaultAbiCoder.decode(['address'], toDecode)[0].toLowerCase();
package/src/types.ts CHANGED
@@ -270,8 +270,6 @@ export type Config = {
270
270
  adapterAddresses: { [name: string]: Address };
271
271
  uniswapV2ExchangeRouterAddress: Address;
272
272
  rfqConfigs: Record<string, RFQConfig>;
273
- rpcPollingMaxAllowedStateDelayInBlocks: number;
274
- rpcPollingBlocksBackToTriggerUpdate: number;
275
273
  hashFlowAuthToken?: string;
276
274
  hashFlowDisabledMMs: string[];
277
275
  uniswapV3EventLoggingSampleRate?: number;
@@ -296,5 +294,3 @@ export type TransferFeeParams = {
296
294
  srcDexFee: number;
297
295
  destDexFee: number;
298
296
  };
299
-
300
- export type LogLevels = 'info' | 'warn' | 'error' | 'trace' | 'debug';
@@ -33,6 +33,10 @@ export const Tokens: {
33
33
  addBalance: balancesFn,
34
34
  addAllowance: allowedFn,
35
35
  },
36
+ CUSDC: {
37
+ address: '0x39AA39c021dfbaE8faC545936693aC917d5E7563',
38
+ decimals: 8,
39
+ },
36
40
  WBTC: {
37
41
  address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
38
42
  decimals: 8,
@@ -466,10 +470,6 @@ export const Tokens: {
466
470
  address: '0x841fad6eae12c286d1fd18d1d525dffa75c7effe',
467
471
  decimals: 18,
468
472
  },
469
- ETH: {
470
- address: '0x74b23882a30290451A17c44f4F05243b6b58C76d',
471
- decimals: 18,
472
- },
473
473
  },
474
474
  [Network.BSC]: {
475
475
  POPS: {
@@ -805,7 +805,7 @@ export const Holders: {
805
805
  CVX: '0x0aCA67Fa70B142A3b9bF2eD89A81B40ff85dACdC',
806
806
  MIM: '0xa046a8660e66d178ee07ec97c585eeb6aa18c26c',
807
807
  AnkETH: '0xF7260D4ADc48fEefd5a19a9Eb23f9747CeE15C92',
808
- DAI: '0x4943b0c9959dcf58871a799dfb71bece0d97c9f4',
808
+ DAI: '0x60FaAe176336dAb62e284Fe19B885B095d29fB7F',
809
809
  oldFRAX: '0x183d0dc5867c01bfb1dbbc41d6a9d3de6e044626',
810
810
  newFRAX: '0x183d0dc5867c01bfb1dbbc41d6a9d3de6e044626',
811
811
  FEI: '0x19c549357034d10db8d75ed812b45be1dd8a7218',
@@ -827,6 +827,7 @@ export const Holders: {
827
827
  ADAIv1: '0x3021026e4ff227571a5a563ad19ea657c7027e59',
828
828
  CETH: '0x712d0f306956a6a4b4f9319ad9b9de48c5345996',
829
829
  CDAI: '0xab4ce310054a11328685ece1043211b68ba5d082',
830
+ CUSDC: '0xC2F61a6eEEC48d686901D325CDE9233b81c793F3',
830
831
  EURS: '0xC1056Adeb61a01964Ea265cA95EffB7016f9Ed78',
831
832
  EURT: '0x6914FC70fAC4caB20a8922E900C4BA57fEECf8E1',
832
833
  CRV: '0x7a16fF8270133F063aAb6C9977183D9e72835428',
@@ -886,7 +887,7 @@ export const Holders: {
886
887
  DAI: '0x370f4b2dcf75c94d8d4450b493661a9c6170d0b5',
887
888
  FTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354',
888
889
  WFTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354',
889
- USDC: '0xe48793b1533b351ae184e1c3119d0955dde7b330',
890
+ USDC: '0xd1e4a32679216f4a4dd38e45dab9bc4b8a45e592',
890
891
  FUSDT: '0x9ade1c17d25246c405604344f89E8F23F8c1c632',
891
892
  POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591',
892
893
  aFanUSDT: '0x8EBc96fF91A30059E447bFC7C0a7394f8A5793E6',
@@ -899,7 +900,6 @@ export const Holders: {
899
900
  wBOMB: '0x28aa4f9ffe21365473b64c161b566c3cdead0108',
900
901
  TOR: '0x70de4b5ed310fd93da3c0bae824fb99cb4d44dd8',
901
902
  BOO: '0xf778f4d7a14a8cb73d5261f9c61970ef4e7d7842',
902
- ETH: '0xf48883940b4056801de30f12b934dcea90133ee6',
903
903
  },
904
904
  [Network.BSC]: {
905
905
  DAI: '0xf68a4b64162906eff0ff6ae34e2bb1cd42fef62d',
@@ -919,10 +919,10 @@ export const Holders: {
919
919
  [Network.AVALANCHE]: {
920
920
  AVAX: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c',
921
921
  avWAVAX: '0xc5ed2333f8a2C351fCA35E5EBAdb2A82F5d254C3',
922
- WAVAX: '0xbbff2a8ec8d702e61faaccf7cf705968bb6a5bab',
922
+ WAVAX: '0xAc1F5F1eDBcAE771be00d0eC044deC5BEdbFd816',
923
923
  sAVAX: '0xC73DF1e68FC203F6E4b6270240D6f82A850e8D38',
924
924
  USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66',
925
- USDC: '0xbf14db80d9275fb721383a77c00ae180fc40ae98',
925
+ USDC: '0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8',
926
926
  USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83',
927
927
  USDT: '0x715f3c533Cf264215Ba8BE00838a053284351086',
928
928
  WETHe: '0xD291B51f7a1a1F4917D085F2a7731A447E4aF82D',
@@ -12,7 +12,7 @@ const TENDERLY_FORK_LAST_TX_ID = process.env.TENDERLY_FORK_LAST_TX_ID;
12
12
  export class TenderlySimulation {
13
13
  lastTx: string = '';
14
14
  forkId: string = '';
15
- maxGasLimit = 80000000;
15
+ maxGasLimit = 8000000;
16
16
 
17
17
  constructor(private network: Number = 1) {}
18
18
 
@@ -45,7 +45,6 @@ const DEPLOYER_ADDRESS: { [nid: number]: string } = {
45
45
  [Network.FANTOM]: '0x05182E579FDfCf69E4390c3411D8FeA1fb6467cf',
46
46
  [Network.AVALANCHE]: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c',
47
47
  [Network.OPTIMISM]: '0xf01121e808F782d7F34E857c27dA31AD1f151b39',
48
- [Network.ARBITRUM]: '0xb38e8c17e38363af6ebdcb3dae12e0243582891d',
49
48
  };
50
49
 
51
50
  const MULTISIG: { [nid: number]: string } = {
@@ -55,7 +54,6 @@ const MULTISIG: { [nid: number]: string } = {
55
54
  [Network.FANTOM]: '0xECaB2dac955b94e49Ec09D6d68672d3B397BbdAd',
56
55
  [Network.AVALANCHE]: '0x1e2ECA5e812D08D2A7F8664D69035163ff5BfEC2',
57
56
  [Network.OPTIMISM]: '0xf01121e808F782d7F34E857c27dA31AD1f151b39',
58
- [Network.ARBITRUM]: '0x90DfD8a6454CFE19be39EaB42ac93CD850c7f339',
59
57
  };
60
58
 
61
59
  class APIParaswapSDK implements IParaSwapSDK {
package/tests/utils.ts CHANGED
@@ -57,8 +57,6 @@ export function checkPoolsLiquidity(
57
57
  tokenAddress: Address,
58
58
  dexKey: string,
59
59
  ) {
60
- expect(poolsLiquidity.length).toBeGreaterThan(0);
61
-
62
60
  poolsLiquidity.forEach(p => {
63
61
  expect(p.exchange).toEqual(dexKey);
64
62
  expect(p.liquidityUSD).toBeGreaterThanOrEqual(0);
@@ -1,116 +0,0 @@
1
- [
2
- {
3
- "inputs": [
4
- { "internalType": "address", "name": "_quoteToken", "type": "address" },
5
- {
6
- "internalType": "address[]",
7
- "name": "_baseTokens",
8
- "type": "address[]"
9
- }
10
- ],
11
- "stateMutability": "nonpayable",
12
- "type": "constructor"
13
- },
14
- {
15
- "anonymous": false,
16
- "inputs": [
17
- {
18
- "indexed": true,
19
- "internalType": "address",
20
- "name": "previousOwner",
21
- "type": "address"
22
- },
23
- {
24
- "indexed": true,
25
- "internalType": "address",
26
- "name": "newOwner",
27
- "type": "address"
28
- }
29
- ],
30
- "name": "OwnershipTransferred",
31
- "type": "event"
32
- },
33
- {
34
- "inputs": [
35
- { "internalType": "address", "name": "token", "type": "address" }
36
- ],
37
- "name": "addBaseToken",
38
- "outputs": [],
39
- "stateMutability": "nonpayable",
40
- "type": "function"
41
- },
42
- {
43
- "inputs": [],
44
- "name": "allBaseTokens",
45
- "outputs": [
46
- { "internalType": "address[]", "name": "", "type": "address[]" }
47
- ],
48
- "stateMutability": "view",
49
- "type": "function"
50
- },
51
- {
52
- "inputs": [],
53
- "name": "allBaseTokensLength",
54
- "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
55
- "stateMutability": "view",
56
- "type": "function"
57
- },
58
- {
59
- "inputs": [],
60
- "name": "getSupportTokens",
61
- "outputs": [
62
- { "internalType": "address", "name": "", "type": "address" },
63
- { "internalType": "address[]", "name": "", "type": "address[]" }
64
- ],
65
- "stateMutability": "view",
66
- "type": "function"
67
- },
68
- {
69
- "inputs": [],
70
- "name": "owner",
71
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
72
- "stateMutability": "view",
73
- "type": "function"
74
- },
75
- {
76
- "inputs": [],
77
- "name": "quoteToken",
78
- "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
79
- "stateMutability": "view",
80
- "type": "function"
81
- },
82
- {
83
- "inputs": [
84
- { "internalType": "address", "name": "token", "type": "address" }
85
- ],
86
- "name": "removeBaseToken",
87
- "outputs": [],
88
- "stateMutability": "nonpayable",
89
- "type": "function"
90
- },
91
- {
92
- "inputs": [],
93
- "name": "renounceOwnership",
94
- "outputs": [],
95
- "stateMutability": "nonpayable",
96
- "type": "function"
97
- },
98
- {
99
- "inputs": [
100
- { "internalType": "address", "name": "_quoteToken", "type": "address" }
101
- ],
102
- "name": "setQutoeToken",
103
- "outputs": [],
104
- "stateMutability": "nonpayable",
105
- "type": "function"
106
- },
107
- {
108
- "inputs": [
109
- { "internalType": "address", "name": "newOwner", "type": "address" }
110
- ],
111
- "name": "transferOwnership",
112
- "outputs": [],
113
- "stateMutability": "nonpayable",
114
- "type": "function"
115
- }
116
- ]
@@ -1,87 +0,0 @@
1
- import { DexParams } from './types';
2
- import { DexConfigMap, AdapterMappings } from '../../types';
3
- import { Network, SwapSide } from '../../constants';
4
-
5
- export const WooFiV2Config: DexConfigMap<DexParams> = {
6
- WooFiV2: {
7
- [Network.OPTIMISM]: {
8
- wooPPV2Address: '0xd1778F9DF3eee5473A9640f13682e3846f61fEbC',
9
- wooOracleV2Address: '0x464959aD46e64046B891F562cFF202a465D522F3',
10
- integrationHelperAddress: '0x96329d66074EB8386Ae8bFD6698B2E3FDA87e15E',
11
- // USDC
12
- quoteToken: {
13
- address: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607',
14
- decimals: 6,
15
- },
16
- },
17
- [Network.BSC]: {
18
- wooPPV2Address: '0xEc054126922a9a1918435c9072c32f1B60cB2B90',
19
- wooOracleV2Address: '0x747f99D619D5612399010Ec5706F13e3345c4a9E',
20
- integrationHelperAddress: '0xe12dC1F01ccB71ef00ADd1D8A5116b905261D879',
21
- // BUSD
22
- quoteToken: {
23
- address: '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56',
24
- decimals: 18,
25
- },
26
- },
27
- [Network.POLYGON]: {
28
- wooPPV2Address: '0x7081A38158BD050Ae4a86e38E0225Bc281887d7E',
29
- wooOracleV2Address: '0xeFF23B4bE1091b53205E35f3AfCD9C7182bf3062',
30
- integrationHelperAddress: '0x7Ba560eB735AbDCf9a3a5692272652A0cc81850d',
31
- // USDC
32
- quoteToken: {
33
- address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
34
- decimals: 6,
35
- },
36
- },
37
- [Network.FANTOM]: {
38
- wooPPV2Address: '0x286ab107c5E9083dBed35A2B5fb0242538F4f9bf',
39
- wooOracleV2Address: '0x8840e26e0ebf7D100A0644DD8576DC62B03cbf04',
40
- integrationHelperAddress: '0x6641959FE5EED7166F2254cF04b0d20c96776D9A',
41
- // USDC
42
- quoteToken: {
43
- address: '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75',
44
- decimals: 6,
45
- },
46
- },
47
- [Network.ARBITRUM]: {
48
- wooPPV2Address: '0xeFF23B4bE1091b53205E35f3AfCD9C7182bf3062',
49
- wooOracleV2Address: '0x37a9dE70b6734dFCA54395D8061d9411D9910739',
50
- integrationHelperAddress: '0x28D2B949024FE50627f1EbC5f0Ca3Ca721148E40',
51
- // USDC
52
- quoteToken: {
53
- address: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8',
54
- decimals: 6,
55
- },
56
- },
57
- [Network.AVALANCHE]: {
58
- wooPPV2Address: '0x3b3E4b4741e91aF52d0e9ad8660573E951c88524',
59
- wooOracleV2Address: '0x9ACA557590F5020BDA4Ba63065Fc3A1253Bf8000',
60
- integrationHelperAddress: '0x020630613E296c3E9b06186f630D1bF97A2B6Ad1',
61
- // USDC
62
- quoteToken: {
63
- address: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
64
- decimals: 6,
65
- },
66
- },
67
- },
68
- };
69
-
70
- export const Adapters: Record<number, AdapterMappings> = {
71
- [Network.OPTIMISM]: {
72
- [SwapSide.SELL]: [{ name: 'OptimismAdapter01', index: 11 }],
73
- },
74
- [Network.BSC]: { [SwapSide.SELL]: [{ name: 'BscAdapter01', index: 13 }] },
75
- [Network.POLYGON]: {
76
- [SwapSide.SELL]: [{ name: 'PolygonAdapter02', index: 4 }],
77
- },
78
- [Network.FANTOM]: {
79
- [SwapSide.SELL]: [{ name: 'FantomAdapter01', index: 8 }],
80
- },
81
- [Network.ARBITRUM]: {
82
- [SwapSide.SELL]: [{ name: 'ArbitrumAdapter02', index: 3 }],
83
- },
84
- [Network.AVALANCHE]: {
85
- [SwapSide.SELL]: [{ name: 'AvalancheAdapter01', index: 12 }],
86
- },
87
- };
@@ -1,22 +0,0 @@
1
- import { PoolState } from './types';
2
-
3
- export const WOO_FI_V2_GAS_COST = {
4
- // https://dashboard.tenderly.co/paraswap/paraswap/fork/f5a6da2f-fec7-4d00-ac2c-b9c50f5c9554/simulation/25f3b378-632f-4beb-ba37-e21dd3722b5c/gas-usage
5
- sellQuote: 145_000,
6
- // https://dashboard.tenderly.co/paraswap/paraswap/fork/92f13a98-465d-409e-867d-e255e9f86cf1/simulation/09d5d06a-dd90-40fe-8ae6-a65097e804d4/gas-usage
7
- sellBase: 159_000,
8
- // https://dashboard.tenderly.co/paraswap/paraswap/fork/d5964ad1-f64f-42b7-8fac-976ad216f05f/simulation/49df18de-8046-463e-a904-5c9f621406d4/gas-usage
9
- baseToBase: 204_000,
10
- };
11
-
12
- export const USD_PRECISION = 2;
13
-
14
- export const MIN_CONVERSION_RATE = 1;
15
-
16
- export const NULL_STATE: PoolState = {
17
- tokenInfos: {},
18
- tokenStates: {},
19
- decimals: {},
20
- oracleTimestamp: 0n,
21
- isPaused: false,
22
- };
@@ -1,45 +0,0 @@
1
- import { BytesLike } from 'ethers';
2
- import { defaultAbiCoder } from 'ethers/lib/utils';
3
- import { extractSuccessAndValue, generalDecoder } from '../../lib/decoders';
4
- import { MultiResult } from '../../lib/multi-wrapper';
5
- import { DecimalInfo, TokenInfo, TokenState } from './types';
6
-
7
- export function tokenInfoDecoder(
8
- result: MultiResult<BytesLike> | BytesLike,
9
- ): TokenInfo {
10
- return generalDecoder(result, ['uint192', 'uint16'], undefined, value => ({
11
- reserve: value[0].toBigInt(),
12
- feeRate: BigInt(value[1].toString()),
13
- }));
14
- }
15
-
16
- export function decimalInfoDecoder(
17
- result: MultiResult<BytesLike> | BytesLike,
18
- ): DecimalInfo {
19
- return generalDecoder(
20
- result,
21
- ['tuple(uint64 priceDec, uint64 quoteDec, uint64 baseDec)'],
22
- undefined,
23
- value => ({
24
- priceDec: value[0].priceDec.toBigInt(),
25
- quoteDec: value[0].quoteDec.toBigInt(),
26
- baseDec: value[0].baseDec.toBigInt(),
27
- }),
28
- );
29
- }
30
-
31
- // This is state from WooOracleV2 contract
32
- export function stateDecoder(
33
- result: MultiResult<BytesLike> | BytesLike,
34
- ): TokenState {
35
- return generalDecoder(
36
- result,
37
- ['tuple(uint128 price, uint64 spread, uint64 coeff, bool woFeasible)'],
38
- undefined,
39
- value => ({
40
- price: value[0].price.toBigInt(),
41
- spread: value[0].spread.toBigInt(),
42
- coeff: value[0].coeff.toBigInt(),
43
- }),
44
- );
45
- }
@@ -1,63 +0,0 @@
1
- import { Interface } from 'ethers/lib/utils';
2
- import { Address, Token } from '../../types';
3
-
4
- export type PoolState = {
5
- // fetched from WooPPV2.tokenInfos(address baseToken) :
6
- // https://arbiscan.io/address/0x8693F9701D6DB361Fe9CC15Bc455Ef4366E39AE0
7
- tokenInfos: Record<Address, TokenInfo>;
8
-
9
- // fetched from WooracleV2.state(address baseToken)
10
- // https://arbiscan.io/address/0x962d37fb9d75fe1af9aab323727183e4eae1322d
11
- tokenStates: Record<Address, TokenState>;
12
-
13
- // fetched from WooPPV2.decimalInfo(address baseToken)
14
- // https://arbiscan.io/address/0x8693F9701D6DB361Fe9CC15Bc455Ef4366E39AE0
15
- decimals: Record<Address, DecimalInfo>;
16
- oracleTimestamp: bigint;
17
- isPaused: boolean;
18
- };
19
-
20
- export type WooFiV2Data = {};
21
-
22
- export type DexParams = {
23
- wooPPV2Address: Address;
24
- wooOracleV2Address: Address;
25
- integrationHelperAddress: Address;
26
- quoteToken: Token;
27
- };
28
-
29
- export type TokenInfo = {
30
- reserve: bigint;
31
- feeRate: bigint;
32
- };
33
-
34
- export type TokenState = {
35
- price: bigint;
36
- spread: bigint;
37
- coeff: bigint;
38
- };
39
-
40
- export type DecimalInfo = {
41
- priceDec: bigint;
42
- quoteDec: bigint;
43
- baseDec: bigint;
44
- };
45
-
46
- export type LatestRoundData = {
47
- answer: bigint;
48
- };
49
-
50
- export type MulticallResultOutputs =
51
- | boolean
52
- | bigint
53
- | TokenInfo
54
- | DecimalInfo
55
- | TokenState;
56
-
57
- export type WooFiV2Interfaces = {
58
- PPV2: Interface;
59
- oracleV2: Interface;
60
- integrationHelper: Interface;
61
- chainlink: Interface;
62
- erc20BalanceOf: Interface;
63
- };
@@ -1,19 +0,0 @@
1
- import { Interface } from 'ethers/lib/utils';
2
- import wooPPV2ABI from '../../abi/woo-fi-v2/WooPPV2.abi.json';
3
- import wooOracleV2ABI from '../../abi/woo-fi-v2/WooOracleV2.abi.json';
4
- import wooIntegrationHelper from '../../abi/woo-fi-v2/IntegrationHelper.abi.json';
5
- import { WooFiV2Interfaces } from './types';
6
-
7
- export const ifaces: WooFiV2Interfaces = {
8
- PPV2: new Interface(wooPPV2ABI),
9
- oracleV2: new Interface(wooOracleV2ABI),
10
- integrationHelper: new Interface(wooIntegrationHelper),
11
- chainlink: new Interface([
12
- 'function latestRoundData() view returns (tuple(uint80 roundId, ' +
13
- 'int256 answer, uint256 startedAt, uint256 updatedAt, ' +
14
- 'uint80 answeredInRound))',
15
- ]),
16
- erc20BalanceOf: new Interface([
17
- 'function balanceOf(address) view returns (uint256)',
18
- ]),
19
- };