impermax-sdk 1.2.133 → 1.2.135

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 (52) hide show
  1. package/lib/config/amms.d.ts +2 -0
  2. package/lib/config/amms.js +5 -0
  3. package/lib/config/contracts/impermax-factories.js +1 -0
  4. package/lib/config/contracts/routers.js +1 -0
  5. package/lib/config/farms.d.ts +3 -1
  6. package/lib/config/farms.js +3 -0
  7. package/lib/config/subgraphs.js +112 -37
  8. package/lib/offchain/account/lendingPool/offchainAccountBorrowable.js +29 -48
  9. package/lib/offchain/account/lendingPool/offchainAccountCollateral.js +12 -25
  10. package/lib/offchain/account/lendingPool/offchainAccountLendingPool.js +24 -37
  11. package/lib/offchain/account/offchainAccount.js +67 -98
  12. package/lib/offchain/account/offchainAccountLendingVault.js +26 -43
  13. package/lib/offchain/account/offchainAccountPoolToken.js +4 -15
  14. package/lib/offchain/configManager/offchainConfigManager.js +7 -20
  15. package/lib/offchain/configManager/offchainConfigManagerInitializer.js +23 -40
  16. package/lib/offchain/configManager/offchainPairConfig.js +25 -48
  17. package/lib/offchain/configManager/offchainProposal.js +15 -32
  18. package/lib/offchain/lendingPool/offchainBorrowable.js +270 -358
  19. package/lib/offchain/lendingPool/offchainCollateral.js +23 -49
  20. package/lib/offchain/lendingPool/offchainLendingPool.js +120 -169
  21. package/lib/offchain/offchain.js +81 -118
  22. package/lib/offchain/offchainAPRHelper.js +185 -233
  23. package/lib/offchain/offchainEndpointManager.js +40 -50
  24. package/lib/offchain/offchainInitializer.js +594 -661
  25. package/lib/offchain/offchainLendingVault.js +41 -78
  26. package/lib/offchain/offchainPoolToken.js +55 -88
  27. package/lib/offchain/offchainPriceHelper.js +187 -211
  28. package/lib/offchain/offchainSolidexHelper.js +30 -43
  29. package/lib/offchain/queries/apis/thegraph/index.js +1 -2
  30. package/lib/offchain/queries/index.js +4 -1
  31. package/lib/onchain/account/lendingPool/onchainAccountBorrowable.js +85 -116
  32. package/lib/onchain/account/lendingPool/onchainAccountCollateral.js +36 -61
  33. package/lib/onchain/account/lendingPool/onchainAccountLendingPool.js +182 -221
  34. package/lib/onchain/account/onchainAccount.js +80 -111
  35. package/lib/onchain/account/onchainAccountLendingVault.js +6 -19
  36. package/lib/onchain/account/onchainAccountPoolToken.js +37 -60
  37. package/lib/onchain/configManager/onchainPairConfig.js +28 -51
  38. package/lib/onchain/configManager/onchainProposal.js +16 -31
  39. package/lib/onchain/impermaxFactory/lendingPool/onchainBorrowable.js +75 -119
  40. package/lib/onchain/impermaxFactory/lendingPool/onchainCollateral.js +12 -34
  41. package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPool.js +224 -299
  42. package/lib/onchain/interactions/lendingPool/onchainInteractionsBorrowable.js +16 -29
  43. package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateral.js +5 -18
  44. package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPool.js +69 -90
  45. package/lib/onchain/interactions/onchainInteractions.js +51 -70
  46. package/lib/onchain/interactions/onchainInteractionsConfigManager.js +9 -24
  47. package/lib/onchain/interactions/onchainInteractionsPoolToken.js +100 -129
  48. package/lib/onchain/onchainLendingVault.js +18 -39
  49. package/lib/onchain/onchainPoolToken.js +68 -107
  50. package/lib/utils/ether-utils.js +1 -1
  51. package/lib/utils/lliquidity-math.js +4 -4
  52. package/package.json +1 -1
@@ -48,6 +48,7 @@ export declare enum Amms {
48
48
  equalizerStable = "equalizerStable",
49
49
  wigoswap = "wigoswap",
50
50
  velodrome = "velodrome",
51
+ velodromeStable = "velodromeStable",
51
52
  alien = "alien",
52
53
  shadow = "shadow",
53
54
  nile = "nile",
@@ -103,6 +104,7 @@ export declare const hrAmms: {
103
104
  equalizerStable: string;
104
105
  wigoswap: string;
105
106
  velodrome: string;
107
+ velodromeStable: string;
106
108
  alien: string;
107
109
  shadow: string;
108
110
  nile: string;
@@ -52,6 +52,7 @@ var Amms;
52
52
  Amms["equalizerStable"] = "equalizerStable";
53
53
  Amms["wigoswap"] = "wigoswap";
54
54
  Amms["velodrome"] = "velodrome";
55
+ Amms["velodromeStable"] = "velodromeStable";
55
56
  Amms["alien"] = "alien";
56
57
  Amms["shadow"] = "shadow";
57
58
  Amms["nile"] = "nile";
@@ -107,6 +108,7 @@ exports.hrAmms = {
107
108
  [Amms.equalizerStable]: 'Equalizer',
108
109
  [Amms.wigoswap]: 'Wigoswap',
109
110
  [Amms.velodrome]: 'Velodrome',
111
+ [Amms.velodromeStable]: 'Velodrome Stable',
110
112
  [Amms.alien]: 'AlienBase',
111
113
  [Amms.shadow]: 'Shadow',
112
114
  [Amms.nile]: 'Nile',
@@ -198,6 +200,7 @@ exports.AMM_FACTORY = {
198
200
  },
199
201
  [types_1.Networks.Optimism]: {
200
202
  [Amms.velodrome]: '0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a',
203
+ [Amms.velodromeStable]: '0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a',
201
204
  },
202
205
  [types_1.Networks.Real]: {
203
206
  [Amms.pearl]: '0x2B965fDf04f9e9bEEf1659464Ef3A0094A68D923',
@@ -368,6 +371,7 @@ exports.ADD_LIQUIDITY_URLS = {
368
371
  },
369
372
  [types_1.Networks.Optimism]: {
370
373
  [Amms.velodrome]: 'https://velodrome.finance/deposit/',
374
+ [Amms.velodromeStable]: 'https://velodrome.finance/deposit/',
371
375
  },
372
376
  [types_1.Networks.Real]: {
373
377
  [Amms.pearlStable]: 'https://www.pearl.exchange/supply-liquidity/v2/',
@@ -464,6 +468,7 @@ exports.AMM_LP_FEE = {
464
468
  },
465
469
  [types_1.Networks.Optimism]: {
466
470
  [Amms.velodrome]: 0,
471
+ [Amms.velodromeStable]: 0,
467
472
  },
468
473
  [types_1.Networks.Real]: {
469
474
  [Amms.pearlStable]: 0,
@@ -65,6 +65,7 @@ exports.IMPERMAX_FACTORY = {
65
65
  },
66
66
  [types_1.Networks.Optimism]: {
67
67
  [types_1.Factory.SOLV2]: '0xa058Ba91958cD30D44c7B0Cf58A369876Fb70B05',
68
+ [types_1.Factory.SOL_STABLE]: '0x48168439ca4ef9e95975e3e2488bfcbd8fb1a80c',
68
69
  },
69
70
  [types_1.Networks.Sonic]: {
70
71
  [types_1.Factory.SOLV2]: '0x26fca5916c20D252feEF7A58E39886d3d3112b91',
@@ -62,6 +62,7 @@ exports.ROUTER = {
62
62
  },
63
63
  [types_1.Networks.Optimism]: {
64
64
  [types_1.Factory.SOLV2]: '0xb5657FA5ba87CaD11b9150c319069625d423aaD4',
65
+ [types_1.Factory.SOL_STABLE]: '0x6C21983B79d97d7789872CDC08dC90E0153B776a',
65
66
  },
66
67
  [types_1.Networks.Mantle]: {
67
68
  [types_1.Factory.V2V2]: '0xF4A9dda025e65945E7A3F873D6146A12c8110A19'
@@ -53,7 +53,8 @@ export declare enum Farms {
53
53
  nileStable = "nileStable",
54
54
  equalizerStable = "equalizerStable",
55
55
  velodrome = "velodrome",
56
- alien = "alien"
56
+ alien = "alien",
57
+ velodromeStable = "velodromeStable"
57
58
  }
58
59
  export declare const hrFarms: {
59
60
  quickswapOld: string;
@@ -107,6 +108,7 @@ export declare const hrFarms: {
107
108
  nileStable: string;
108
109
  equalizerStable: string;
109
110
  velodrome: string;
111
+ velodromeStable: string;
110
112
  alien: string;
111
113
  };
112
114
  export type FarmIndex = {
@@ -58,6 +58,7 @@ var Farms;
58
58
  Farms["equalizerStable"] = "equalizerStable";
59
59
  Farms["velodrome"] = "velodrome";
60
60
  Farms["alien"] = "alien";
61
+ Farms["velodromeStable"] = "velodromeStable";
61
62
  })(Farms = exports.Farms || (exports.Farms = {}));
62
63
  exports.hrFarms = {
63
64
  [Farms.quickswapOld]: 'QuickSwap',
@@ -111,6 +112,7 @@ exports.hrFarms = {
111
112
  [Farms.nileStable]: 'Nile Stable',
112
113
  [Farms.equalizerStable]: 'Equalizer Stable',
113
114
  [Farms.velodrome]: 'Velodrome',
115
+ [Farms.velodromeStable]: 'Velodrome Stable',
114
116
  [Farms.alien]: 'AlienBase',
115
117
  };
116
118
  exports.STAKED_LP_FACTORY = {
@@ -198,6 +200,7 @@ exports.STAKED_LP_FACTORY = {
198
200
  },
199
201
  [types_1.Networks.Optimism]: {
200
202
  [Farms.velodrome]: '0x47183bB55AD0F891887E099Cec3570d3C667cD00',
203
+ [Farms.velodromeStable]: '0xaea67e5ccc89d69cbabbe9d7811c3c6b36407055',
201
204
  },
202
205
  [types_1.Networks.Real]: {
203
206
  [Farms.pearl]: '0x2B965fDf04f9e9bEEf1659464Ef3A0094A68D923',
@@ -2,97 +2,172 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WHITELIST_SUBGRAPH_URL = exports.CONFIG_MANAGER_SUBGRAPH_URL = exports.XIMX_SUBGRAPH_URL = exports.BLOCKS_SUBGRAPH_URL = exports.LENDING_VAULT_SUBGRAPH_URL = exports.IMPERMAX_CHEF_SUBGRAPH_URL = exports.IMPERMAX_SUBGRAPH_URL = void 0;
4
4
  const types_1 = require("./types");
5
+ // @ts-ignore
5
6
  exports.IMPERMAX_SUBGRAPH_URL = {
6
7
  [types_1.Networks.Ropsten]: {},
7
8
  [types_1.Networks.Mainnet]: {
8
- [types_1.Factory.V2V1]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/Dn5WZv53V1K8LrKqqYn29hhuhpwfuFfmsrsTqMgFjrD3']
9
+ [types_1.Factory.V2V1]: [
10
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/Dn5WZv53V1K8LrKqqYn29hhuhpwfuFfmsrsTqMgFjrD3",
11
+ ],
9
12
  },
10
13
  [types_1.Networks.Polygon]: {
11
- [types_1.Factory.V2V1_1]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/F3BfecWo2by5QKrwhkXwuXjyLZnQqJ1wqoejwe67KuyG'],
12
- [types_1.Factory.V2V2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/5JbuAaWwyRm78yWpRCJJS217hXXft59g9MbsjTTZnYQa'],
13
- [types_1.Factory.SOLV2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/Giwg5N4SCehmUzNwXtAQZnZvUuTjcp7cr3nzUZosRDFU'],
14
- [types_1.Factory.SOL_STABLE]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/EWckMdMiZeDSGHxq2V8gZBDF549Xjr9iKkPvisqckF11'],
14
+ [types_1.Factory.V2V1_1]: [
15
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/F3BfecWo2by5QKrwhkXwuXjyLZnQqJ1wqoejwe67KuyG",
16
+ // Temp fix
17
+ //"https://polygon-factory-production.up.railway.app/"
18
+ ],
19
+ [types_1.Factory.V2V2]: [
20
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/5JbuAaWwyRm78yWpRCJJS217hXXft59g9MbsjTTZnYQa",
21
+ // Temp fix
22
+ //"https://polygon-factory-production.up.railway.app/"
23
+ ],
24
+ [types_1.Factory.SOLV2]: [
25
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/Giwg5N4SCehmUzNwXtAQZnZvUuTjcp7cr3nzUZosRDFU",
26
+ "https://polygon-factory-production.up.railway.app/"
27
+ ],
28
+ [types_1.Factory.SOL_STABLE]: [
29
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/EWckMdMiZeDSGHxq2V8gZBDF549Xjr9iKkPvisqckF11",
30
+ "https://polygon-factory-production.up.railway.app/"
31
+ ],
15
32
  },
16
33
  [types_1.Networks.Arbitrum]: {
17
- [types_1.Factory.V2V1_1]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/3PMyaq269mDMwhJ7E285RYD1r43x996b6xZmJSCGvtkm'],
18
- [types_1.Factory.V2V2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BkMRb8mR5zgCbjFSgau6s27pnANhR6k64RGVKUbWaZdY'],
19
- [types_1.Factory.SOLV2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/AdLbcSfG6JnpZ7RDdHNHq3bJ21waGnRi7AJ5x3YFGYFo'],
34
+ [types_1.Factory.V2V1_1]: [
35
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/3PMyaq269mDMwhJ7E285RYD1r43x996b6xZmJSCGvtkm",
36
+ // Temp fix for arbitrum v1 subgraph
37
+ //"https://arbitrum-factory-production.up.railway.app/"
38
+ ],
39
+ [types_1.Factory.V2V2]: [
40
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/BkMRb8mR5zgCbjFSgau6s27pnANhR6k64RGVKUbWaZdY",
41
+ // Temp fix for arbitrum v2 subgraph
42
+ //"https://arbitrum-factory-production.up.railway.app/"
43
+ ],
44
+ [types_1.Factory.SOLV2]: [
45
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/AdLbcSfG6JnpZ7RDdHNHq3bJ21waGnRi7AJ5x3YFGYFo",
46
+ "https://arbitrum-factory-production.up.railway.app/"
47
+ ],
20
48
  },
21
49
  [types_1.Networks.Avalanche]: {
22
- [types_1.Factory.V2V1_2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/HXhHppWXhFqgLfdmTahFj2x7F5Xq8BwADxGY3nbCUAwr'],
23
- [types_1.Factory.V2V2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/8Gz5ZGyRkSA7WBrSteeyez39AgZQsoEbtXe8GtHD7JMQ'],
24
- [types_1.Factory.SOLV2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/78e6cZp11r2coLx8YYo5y4AqzEhQXYT6sw3Bg5Tiy5XU'],
50
+ [types_1.Factory.V2V1_2]: [
51
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/HXhHppWXhFqgLfdmTahFj2x7F5Xq8BwADxGY3nbCUAwr",
52
+ // Temp fix
53
+ //"https://avalanche-factory-production.up.railway.app/"
54
+ ],
55
+ [types_1.Factory.V2V2]: [
56
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/8Gz5ZGyRkSA7WBrSteeyez39AgZQsoEbtXe8GtHD7JMQ",
57
+ // Temp fix
58
+ //"https://avalanche-factory-production.up.railway.app/"
59
+ ],
60
+ [types_1.Factory.SOLV2]: [
61
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/78e6cZp11r2coLx8YYo5y4AqzEhQXYT6sw3Bg5Tiy5XU",
62
+ "https://avalanche-factory-production.up.railway.app/"
63
+ ],
25
64
  },
26
65
  [types_1.Networks.Mantle]: {
27
- [types_1.Factory.V2V2]: ['https://subgraph-api.mantle.xyz/subgraphs/name/impermax-finance/impermax-mantle-v2']
66
+ [types_1.Factory.V2V2]: [
67
+ "https://subgraph-api.mantle.xyz/subgraphs/name/impermax-finance/impermax-mantle-v2",
68
+ ],
28
69
  },
29
70
  [types_1.Networks.Moonriver]: {
30
- [types_1.Factory.V2V1_2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/6NqkDBwiybbB3BjErF6QGGYJCqzyhVFKpNYHQTN2j8Jn']
71
+ //[Factory.V2V1_2]: [
72
+ // "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/6NqkDBwiybbB3BjErF6QGGYJCqzyhVFKpNYHQTN2j8Jn",
73
+ //],
31
74
  },
32
75
  [types_1.Networks.Aurora]: {},
33
76
  [types_1.Networks.Cronos]: {},
34
77
  [types_1.Networks.Fantom]: {
35
- [types_1.Factory.SOLV1_2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/8vssJypWas5oenzsjjQq1yLqMe7FRt2evcqZdzCNEWt7'],
36
- [types_1.Factory.SOLV2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/DJ2bTPinDji7Kwev3WjyfxRo487tJHiEEMEo8kmTMT8F'],
37
- [types_1.Factory.V2V2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/DPk9E2c9fLKF8N6rN3jcyvSrEq4VEgjdeeJcnaEKAngG']
78
+ [types_1.Factory.SOLV1_2]: [
79
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/8vssJypWas5oenzsjjQq1yLqMe7FRt2evcqZdzCNEWt7",
80
+ ],
81
+ [types_1.Factory.SOLV2]: [
82
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/DJ2bTPinDji7Kwev3WjyfxRo487tJHiEEMEo8kmTMT8F",
83
+ ],
84
+ [types_1.Factory.V2V2]: [
85
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/DPk9E2c9fLKF8N6rN3jcyvSrEq4VEgjdeeJcnaEKAngG",
86
+ ],
38
87
  },
39
88
  [types_1.Networks.Canto]: {
40
- [types_1.Factory.SOLV2]: ['https://api.impermax.finance/subgraphs/name/impermax-finance/impermax-canto-solv2'],
89
+ //[Factory.SOLV2]: [
90
+ // "https://api.impermax.finance/subgraphs/name/impermax-finance/impermax-canto-solv2",
91
+ //],
41
92
  },
42
93
  [types_1.Networks.ZksyncEra]: {
43
- [types_1.Factory.SOLV2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/8YSS88X8ChDw1QvuAMtxjezSXNiYer9k9d3Uu8XFLHzX'],
94
+ [types_1.Factory.SOLV2]: [
95
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/8YSS88X8ChDw1QvuAMtxjezSXNiYer9k9d3Uu8XFLHzX",
96
+ "https://zksync-factory-production.up.railway.app/"
97
+ ],
44
98
  },
45
99
  [types_1.Networks.Harmony]: {},
46
100
  [types_1.Networks.Moonbeam]: {},
47
101
  [types_1.Networks.Sxnetwork]: {},
48
102
  [types_1.Networks.Blast]: {
49
- [types_1.Factory.SOLV2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/4FDikpVjE2XnDJ5QcpQ1YJXWcUDiAgE7x8ErtsHh33UB'],
50
- [types_1.Factory.V2V2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/6xkrXFPJ4wqh9cy9ayP19WGr2wZVSMP3FniMjcW2LUG4'],
51
- [types_1.Factory.SOL_STABLE]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/CfJnk2rt4fUs71dvJJk21dbSS4dshKFWjfLsCceTXNBa']
103
+ [types_1.Factory.SOLV2]: [
104
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/4FDikpVjE2XnDJ5QcpQ1YJXWcUDiAgE7x8ErtsHh33UB",
105
+ "https://blast-factory-production.up.railway.app/"
106
+ ],
107
+ [types_1.Factory.V2V2]: [
108
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/6xkrXFPJ4wqh9cy9ayP19WGr2wZVSMP3FniMjcW2LUG4",
109
+ "https://blast-factory-production.up.railway.app/"
110
+ ],
52
111
  },
53
112
  [types_1.Networks.Base]: {
54
113
  [types_1.Factory.SOLV2]: [
55
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/EjB7Dsb7WnfFf1NPPr5rbGnGmk2Jqs42nWPVHjv9997u',
56
- 'https://base-factory-production.up.railway.app/'
114
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmfMs5GpdHtaDjUy4YceRhJJdQa4Po2YypLYfxw1z5JEK7",
115
+ "https://base-factory-production.up.railway.app/",
57
116
  ],
58
117
  [types_1.Factory.SOL_STABLE]: [
59
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/9wN7xinUXf8RP8dbwpkzSmCNQKfz31FDpvPEvTQyT8SL',
60
- 'https://base-factory-production.up.railway.app/'
118
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/9wN7xinUXf8RP8dbwpkzSmCNQKfz31FDpvPEvTQyT8SL",
119
+ "https://base-factory-production.up.railway.app/",
61
120
  ],
62
121
  [types_1.Factory.V2V2]: [
63
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/B7xsBeef3FohKaFPcsAsviyLKaWXTqcSELjAsPj2B7iW',
64
- 'https://base-factory-production.up.railway.app/'
122
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmQsSqSSm2gvj9LxYxmHapJV5eMjuV1JdKuWirgyJe8zn5",
123
+ "https://base-factory-production.up.railway.app/",
65
124
  ],
66
125
  },
67
126
  [types_1.Networks.Scroll]: {
68
- [types_1.Factory.SOLV2]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/9HL6kLRt3AbQsprTvk7KZdaHunJ5GGsLdYWd27nNfCFC'],
69
- [types_1.Factory.SOL_STABLE]: ['https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/C42ymmkDArE1T5wdYKwao6mntqNSjP2E34TeGusiF3sk']
127
+ [types_1.Factory.SOLV2]: [
128
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/9HL6kLRt3AbQsprTvk7KZdaHunJ5GGsLdYWd27nNfCFC",
129
+ "https://scroll-factory-production.up.railway.app/"
130
+ ],
131
+ [types_1.Factory.SOL_STABLE]: [
132
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/C42ymmkDArE1T5wdYKwao6mntqNSjP2E34TeGusiF3sk",
133
+ "https://scroll-factory-production.up.railway.app/"
134
+ ],
70
135
  },
71
136
  [types_1.Networks.Optimism]: {
72
137
  [types_1.Factory.SOLV2]: [
73
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/74C2pMzH3wNKf38PNheGZfSiY4FzmJoKiGtHLYa7oD2s',
74
- 'https://optimism-factory-production.up.railway.app/'
138
+ "https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/74C2pMzH3wNKf38PNheGZfSiY4FzmJoKiGtHLYa7oD2s",
139
+ "https://optimism-factory-production.up.railway.app/",
140
+ ],
141
+ [types_1.Factory.SOL_STABLE]: [
142
+ "https://optimism-factory-production.up.railway.app/",
75
143
  ]
76
144
  },
77
145
  [types_1.Networks.Real]: {
78
- [types_1.Factory.SOL_STABLE]: ['https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-finance/impermax-real-v2-stable/gn'],
79
- [types_1.Factory.SOLV2]: ['https://api.goldsky.com/api/public/project_cm2rhb30ot9wu01to8c9h9e37/subgraphs/impermax-real-solv2/3.0/gn']
146
+ //[Factory.SOL_STABLE]: [
147
+ // "https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-finance/impermax-real-v2-stable/gn",
148
+ //],
149
+ //[Factory.SOLV2]: [
150
+ // "https://api.goldsky.com/api/public/project_cm2rhb30ot9wu01to8c9h9e37/subgraphs/impermax-real-solv2/3.0/gn",
151
+ //],
80
152
  },
81
153
  [types_1.Networks.Sonic]: {
82
154
  [types_1.Factory.SOLV2]: [
83
155
  'https://sonic-factory-production.up.railway.app/',
84
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/HK9BA4oFp1xaoQW7YVP4m2nbxX7q2bQCZWNPKBtudtZR'
156
+ 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/HK9BA4oFp1xaoQW7YVP4m2nbxX7q2bQCZWNPKBtudtZR'
85
157
  ],
86
158
  [types_1.Factory.SOL_STABLE]: [
87
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/61ZJXkM5uRGntP1HZkmH4iaKRzsf1BBhQdZYi9euLkpM'
159
+ 'https://sonic-factory-production.up.railway.app/',
160
+ 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/61ZJXkM5uRGntP1HZkmH4iaKRzsf1BBhQdZYi9euLkpM'
88
161
  ]
89
162
  },
90
163
  [types_1.Networks.Linea]: {
91
164
  [types_1.Factory.SOLV2]: [
92
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/AyFSeFRAtUm4aY3cb1zTJqoMjcgSNrRipucuSxkEZ1v9'
165
+ 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/AyFSeFRAtUm4aY3cb1zTJqoMjcgSNrRipucuSxkEZ1v9',
166
+ 'https://linea-factory-production.up.railway.app/'
93
167
  ],
94
168
  [types_1.Factory.SOL_STABLE]: [
95
- 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/Ah5k6hzS9YicNHWuA4Uts9MQQQGbPLDtwD8tYjKaX8Ls'
169
+ 'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/subgraphs/id/Ah5k6hzS9YicNHWuA4Uts9MQQQGbPLDtwD8tYjKaX8Ls',
170
+ 'https://linea-factory-production.up.railway.app/'
96
171
  ]
97
172
  }
98
173
  };
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -22,50 +13,40 @@ class OffchainAccountBorrowable extends offchainAccountPoolToken_1.default {
22
13
  this.poolTokenType = poolTokenType;
23
14
  this.poolToken = lendingPool.getLendingPool().getPoolToken(poolTokenType);
24
15
  }
25
- getSupplyPosition() {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- const lendingPoolPosition = yield this.lendingPool.getLendingPoolPosition();
28
- if (!lendingPoolPosition)
29
- return undefined;
30
- return lendingPoolPosition.supplyPositions[this.poolTokenType];
31
- });
16
+ async getSupplyPosition() {
17
+ const lendingPoolPosition = await this.lendingPool.getLendingPoolPosition();
18
+ if (!lendingPoolPosition)
19
+ return undefined;
20
+ return lendingPoolPosition.supplyPositions[this.poolTokenType];
32
21
  }
33
22
  // TODO update to support real time exchange rate
34
- getAmount() {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- const supplyPosition = yield this.getSupplyPosition();
37
- if (!supplyPosition)
38
- return 0;
39
- const exchangeRate = yield this.poolToken.getExchangeRate();
40
- const supplyBalance = parseFloat(supplyPosition.balance);
41
- return supplyBalance * exchangeRate;
42
- });
23
+ async getAmount() {
24
+ const supplyPosition = await this.getSupplyPosition();
25
+ if (!supplyPosition)
26
+ return 0;
27
+ const exchangeRate = await this.poolToken.getExchangeRate();
28
+ const supplyBalance = parseFloat(supplyPosition.balance);
29
+ return supplyBalance * exchangeRate;
43
30
  }
44
- getBorrowPosition() {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- const lendingPoolPosition = yield this.lendingPool.getLendingPoolPosition();
47
- if (!lendingPoolPosition)
48
- return undefined;
49
- return lendingPoolPosition.borrowPositions[this.poolTokenType];
50
- });
31
+ async getBorrowPosition() {
32
+ const lendingPoolPosition = await this.lendingPool.getLendingPoolPosition();
33
+ if (!lendingPoolPosition)
34
+ return undefined;
35
+ return lendingPoolPosition.borrowPositions[this.poolTokenType];
51
36
  }
52
- getBorrowedAmount() {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- const borrowPosition = yield this.getBorrowPosition();
55
- const borrowIndex = yield this.poolToken.getBorrowIndex();
56
- if (!borrowPosition)
57
- return 0;
58
- const borrowBalance = parseFloat(borrowPosition.borrowBalance);
59
- const userBorrowIndex = parseFloat(borrowPosition.borrowIndex);
60
- return borrowBalance * borrowIndex / userBorrowIndex;
61
- });
37
+ async getBorrowedAmount() {
38
+ const borrowPosition = await this.getBorrowPosition();
39
+ const borrowIndex = await this.poolToken.getBorrowIndex();
40
+ if (!borrowPosition)
41
+ return 0;
42
+ const borrowBalance = parseFloat(borrowPosition.borrowBalance);
43
+ const userBorrowIndex = parseFloat(borrowPosition.borrowIndex);
44
+ return borrowBalance * borrowIndex / userBorrowIndex;
62
45
  }
63
- getBorrowedValue() {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const tokenPrice = yield this.poolToken.getTokenPriceAccurate();
66
- const borrowedAmount = yield this.getBorrowedAmount();
67
- return borrowedAmount * tokenPrice;
68
- });
46
+ async getBorrowedValue() {
47
+ const tokenPrice = await this.poolToken.getTokenPriceAccurate();
48
+ const borrowedAmount = await this.getBorrowedAmount();
49
+ return borrowedAmount * tokenPrice;
69
50
  }
70
51
  }
71
52
  exports.default = OffchainAccountBorrowable;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -21,23 +12,19 @@ class OffchainAccountCollateral extends offchainAccountPoolToken_1.default {
21
12
  this.lendingPool = lendingPool;
22
13
  this.poolToken = lendingPool.getLendingPool().getCollateral();
23
14
  }
24
- getCollateralPosition() {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- const lendingPoolPosition = yield this.lendingPool.getLendingPoolPosition();
27
- if (!lendingPoolPosition)
28
- return undefined;
29
- return lendingPoolPosition.collateralPosition;
30
- });
15
+ async getCollateralPosition() {
16
+ const lendingPoolPosition = await this.lendingPool.getLendingPoolPosition();
17
+ if (!lendingPoolPosition)
18
+ return undefined;
19
+ return lendingPoolPosition.collateralPosition;
31
20
  }
32
- getAmount() {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const collateralPosition = yield this.getCollateralPosition();
35
- if (!collateralPosition)
36
- return 0;
37
- const exchangeRate = yield this.poolToken.getExchangeRate();
38
- const collateralBalance = parseFloat(collateralPosition.balance);
39
- return collateralBalance * exchangeRate;
40
- });
21
+ async getAmount() {
22
+ const collateralPosition = await this.getCollateralPosition();
23
+ if (!collateralPosition)
24
+ return 0;
25
+ const exchangeRate = await this.poolToken.getExchangeRate();
26
+ const collateralBalance = parseFloat(collateralPosition.balance);
27
+ return collateralBalance * exchangeRate;
41
28
  }
42
29
  }
43
30
  exports.default = OffchainAccountCollateral;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -34,35 +25,31 @@ class OffchainAccountLendingPool {
34
25
  getPoolToken(poolTokenType) {
35
26
  return this.poolTokens[poolTokenType];
36
27
  }
37
- getLendingPoolPosition() {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- const userData = yield this.account.getUserData();
40
- if (!userData)
41
- return undefined;
42
- const userDataOfFactory = userData[this.lendingPool.getFactory()];
43
- const pairAddress = this.lendingPool.getPairAddress();
44
- const supplyPositions = userDataOfFactory.supplyPositions[pairAddress];
45
- const borrowPositions = userDataOfFactory.borrowPositions[pairAddress];
46
- return {
47
- collateralPosition: userDataOfFactory.collateralPositions[pairAddress],
48
- supplyPositions: {
49
- [types_1.PoolTokenType.BorrowableA]: supplyPositions ? supplyPositions[types_1.PoolTokenType.BorrowableA] : undefined,
50
- [types_1.PoolTokenType.BorrowableB]: supplyPositions ? supplyPositions[types_1.PoolTokenType.BorrowableB] : undefined,
51
- },
52
- borrowPositions: {
53
- [types_1.PoolTokenType.BorrowableA]: borrowPositions ? borrowPositions[types_1.PoolTokenType.BorrowableA] : undefined,
54
- [types_1.PoolTokenType.BorrowableB]: borrowPositions ? borrowPositions[types_1.PoolTokenType.BorrowableB] : undefined,
55
- },
56
- };
57
- });
28
+ async getLendingPoolPosition() {
29
+ const userData = await this.account.getUserData();
30
+ if (!userData)
31
+ return undefined;
32
+ const userDataOfFactory = userData[this.lendingPool.getFactory()];
33
+ const pairAddress = this.lendingPool.getPairAddress();
34
+ const supplyPositions = userDataOfFactory.supplyPositions[pairAddress];
35
+ const borrowPositions = userDataOfFactory.borrowPositions[pairAddress];
36
+ return {
37
+ collateralPosition: userDataOfFactory.collateralPositions[pairAddress],
38
+ supplyPositions: {
39
+ [types_1.PoolTokenType.BorrowableA]: supplyPositions ? supplyPositions[types_1.PoolTokenType.BorrowableA] : undefined,
40
+ [types_1.PoolTokenType.BorrowableB]: supplyPositions ? supplyPositions[types_1.PoolTokenType.BorrowableB] : undefined,
41
+ },
42
+ borrowPositions: {
43
+ [types_1.PoolTokenType.BorrowableA]: borrowPositions ? borrowPositions[types_1.PoolTokenType.BorrowableA] : undefined,
44
+ [types_1.PoolTokenType.BorrowableB]: borrowPositions ? borrowPositions[types_1.PoolTokenType.BorrowableB] : undefined,
45
+ },
46
+ };
58
47
  }
59
- getBorrowerEquityValue() {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- const collateralValue = yield this.getCollateral().getValue();
62
- const borrowedValueA = yield this.getBorrowableA().getBorrowedValue();
63
- const borrowedValueB = yield this.getBorrowableB().getBorrowedValue();
64
- return collateralValue - borrowedValueA - borrowedValueB;
65
- });
48
+ async getBorrowerEquityValue() {
49
+ const collateralValue = await this.getCollateral().getValue();
50
+ const borrowedValueA = await this.getBorrowableA().getBorrowedValue();
51
+ const borrowedValueB = await this.getBorrowableB().getBorrowedValue();
52
+ return collateralValue - borrowedValueA - borrowedValueB;
66
53
  }
67
54
  }
68
55
  exports.default = OffchainAccountLendingPool;