@1delta/margin-fetcher 0.0.19 → 0.0.20

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 (67) hide show
  1. package/dist/abis/aave-v2/YLDR.d.ts.map +1 -1
  2. package/dist/abis/aave-v2/YLDR.js +176 -148
  3. package/dist/abis/aave-v3/YLDR.js +29 -29
  4. package/dist/abis/compound-v3/Comet.d.ts +0 -20
  5. package/dist/abis/compound-v3/Comet.d.ts.map +1 -1
  6. package/dist/abis/compound-v3/Comet.js +0 -25
  7. package/dist/lending/fetchLender.js +1 -1
  8. package/dist/lending/user-data/abis.d.ts +20 -20
  9. package/dist/lending/user-data/compound-v3/userCallBuild.d.ts.map +1 -1
  10. package/dist/lending/user-data/compound-v3/userCallBuild.js +1 -7
  11. package/dist/lending/user-data/compound-v3/userCallParse.d.ts +2 -2
  12. package/dist/lending/user-data/compound-v3/userCallParse.d.ts.map +1 -1
  13. package/dist/lending/user-data/compound-v3/userCallParse.js +19 -20
  14. package/dist/lending/user-data/morpho/userCallBuild.d.ts.map +1 -1
  15. package/dist/lending/user-data/morpho/userCallBuild.js +6 -4
  16. package/dist/prices/main-prices/addresses/morpho.d.ts.map +1 -1
  17. package/dist/prices/main-prices/addresses/morpho.js +191 -0
  18. package/dist/prices/main-prices/fetchOracleData.js +4 -2
  19. package/dist/yields/index.d.ts.map +1 -1
  20. package/dist/yields/index.js +13 -1
  21. package/package.json +2 -2
  22. package/src/abis/aave-v2/YLDR.ts +177 -149
  23. package/src/abis/aave-v3/YLDR.ts +45 -45
  24. package/src/abis/compound-v3/Comet.ts +0 -25
  25. package/src/lending/fetchLender.ts +1 -1
  26. package/src/lending/user-data/compound-v3/userCallBuild.ts +1 -8
  27. package/src/lending/user-data/compound-v3/userCallParse.ts +39 -29
  28. package/src/lending/user-data/morpho/userCallBuild.ts +6 -4
  29. package/src/prices/main-prices/addresses/morpho.ts +191 -0
  30. package/src/prices/main-prices/fetchOracleData.ts +4 -2
  31. package/src/yields/index.ts +15 -0
  32. package/test/index.test.ts +101 -97
  33. package/test/mainPriceMB.test.ts +1 -1
  34. package/test/mainPrices.test.ts +2 -2
  35. package/test/morpho.test.ts +1 -1
  36. package/test/morphoPrice.test.ts +1 -1
  37. package/test/yields.test.ts +27 -0
  38. package/tsconfig.json +2 -1
  39. package/dist/abis/aave/AToken.d.ts +0 -526
  40. package/dist/abis/aave/AToken.d.ts.map +0 -1
  41. package/dist/abis/aave/AToken.js +0 -686
  42. package/dist/abis/aave/AavePoolV3.d.ts +0 -819
  43. package/dist/abis/aave/AavePoolV3.d.ts.map +0 -1
  44. package/dist/abis/aave/AavePoolV3.js +0 -1060
  45. package/dist/abis/init/Core.d.ts +0 -523
  46. package/dist/abis/init/Core.d.ts.map +0 -1
  47. package/dist/abis/init/Core.js +0 -681
  48. package/dist/abis/init/InitFlashAggregator.d.ts +0 -624
  49. package/dist/abis/init/InitFlashAggregator.d.ts.map +0 -1
  50. package/dist/abis/init/InitFlashAggregator.js +0 -795
  51. package/dist/abis/init/PosManager.d.ts +0 -802
  52. package/dist/abis/init/PosManager.d.ts.map +0 -1
  53. package/dist/abis/init/PosManager.js +0 -1055
  54. package/dist/abis/uniswap/FeeOnTransferDetector.d.ts +0 -102
  55. package/dist/abis/uniswap/FeeOnTransferDetector.d.ts.map +0 -1
  56. package/dist/abis/uniswap/FeeOnTransferDetector.js +0 -133
  57. package/dist/abis/uniswap/UniswapV2Pair.d.ts +0 -513
  58. package/dist/abis/uniswap/UniswapV2Pair.d.ts.map +0 -1
  59. package/dist/abis/uniswap/UniswapV2Pair.js +0 -659
  60. package/src/abis/aave/AToken.ts +0 -686
  61. package/src/abis/aave/AavePoolV3.ts +0 -1060
  62. package/src/abis/init/Core.ts +0 -681
  63. package/src/abis/init/InitFlashAggregator.ts +0 -795
  64. package/src/abis/init/PosManager.ts +0 -1055
  65. package/src/abis/uniswap/FeeOnTransferDetector.ts +0 -133
  66. package/src/abis/uniswap/UniswapV2Pair.ts +0 -659
  67. /package/test/{userdata.test.ts → userData.test.ts} +0 -0
@@ -1,199 +1,227 @@
1
1
  export const YLDRProtocolDataProviderAbi = [
2
2
  {
3
- "type": "constructor",
4
- "inputs": [
5
- {
6
- "type": "address",
7
- "name": "addressesProvider",
8
- "internalType": "contract ILendingPoolAddressesProvider"
9
- }
10
- ]
3
+ type: 'constructor',
4
+ inputs: [
5
+ {
6
+ type: 'address',
7
+ name: 'addressesProvider',
8
+ internalType: 'contract ILendingPoolAddressesProvider',
9
+ },
10
+ ],
11
11
  },
12
12
  {
13
- "type": "function",
14
- "stateMutability": "view",
15
- "outputs": [
16
- {
17
- "type": "address",
18
- "name": "",
19
- "internalType": "contract ILendingPoolAddressesProvider"
20
- }
13
+ type: 'function',
14
+ stateMutability: 'view',
15
+ outputs: [
16
+ {
17
+ type: 'address',
18
+ name: '',
19
+ internalType: 'contract ILendingPoolAddressesProvider',
20
+ },
21
21
  ],
22
- "name": "ADDRESSES_PROVIDER",
23
- "inputs": []
22
+ name: 'ADDRESSES_PROVIDER',
23
+ inputs: [],
24
24
  },
25
25
  {
26
- "type": "function",
27
- "stateMutability": "view",
28
- "outputs": [
29
- {
30
- "type": "tuple[]",
31
- "name": "",
32
- "internalType": "struct AaveProtocolDataProvider.TokenData[]",
33
- "components": [
26
+ type: 'function',
27
+ stateMutability: 'view',
28
+ outputs: [
29
+ {
30
+ type: 'tuple[]',
31
+ name: '',
32
+ internalType: 'struct AaveProtocolDataProvider.TokenData[]',
33
+ components: [
34
34
  {
35
- "type": "string"
35
+ type: 'string',
36
36
  },
37
37
  {
38
- "type": "address"
39
- }
40
- ]
41
- }
38
+ type: 'address',
39
+ },
40
+ ],
41
+ },
42
42
  ],
43
- "name": "getAllATokens",
44
- "inputs": []
43
+ name: 'getAllATokens',
44
+ inputs: [],
45
45
  },
46
46
  {
47
- "type": "function",
48
- "stateMutability": "view",
49
- "outputs": [
50
- {
51
- "type": "tuple[]",
52
- "name": "",
53
- "internalType": "struct AaveProtocolDataProvider.TokenData[]",
54
- "components": [
47
+ type: 'function',
48
+ stateMutability: 'view',
49
+ outputs: [
50
+ {
51
+ type: 'tuple[]',
52
+ name: '',
53
+ internalType: 'struct AaveProtocolDataProvider.TokenData[]',
54
+ components: [
55
55
  {
56
- "type": "string"
56
+ type: 'string',
57
57
  },
58
58
  {
59
- "type": "address"
60
- }
61
- ]
62
- }
59
+ type: 'address',
60
+ },
61
+ ],
62
+ },
63
63
  ],
64
- "name": "getAllReservesTokens",
65
- "inputs": []
64
+ name: 'getAllReservesTokens',
65
+ inputs: [],
66
66
  },
67
- {"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getReserveConfigurationData","outputs":[{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"uint256","name":"ltv","type":"uint256"},{"internalType":"uint256","name":"liquidationThreshold","type":"uint256"},{"internalType":"uint256","name":"liquidationBonus","type":"uint256"},{"internalType":"uint256","name":"reserveFactor","type":"uint256"},{"internalType":"bool","name":"usageAsCollateralEnabled","type":"bool"},{"internalType":"bool","name":"borrowingEnabled","type":"bool"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"bool","name":"isFrozen","type":"bool"}],"stateMutability":"view","type":"function"},
68
67
  {
69
- "inputs": [{
70
- "internalType": "address",
71
- "name": "asset",
72
- "type": "address"
73
- }],
74
- "name": "getReserveData",
75
- "outputs": [{
76
- "internalType": "uint256",
77
- "name": "accruedToTreasuryScaled",
78
- "type": "uint256"
79
- },
80
- {
81
- "internalType": "uint256",
82
- "name": "totalYToken",
83
- "type": "uint256"
84
- }, {
85
- "internalType": "uint256",
86
- "name": "totalVariableDebt",
87
- "type": "uint256"
88
- },
89
- {
90
- "internalType": "uint256",
91
- "name": "liquidityRate",
92
- "type": "uint256"
93
- }, {
94
- "internalType": "uint256",
95
- "name": "variableBorrowRate",
96
- "type": "uint256"
97
- },
98
- {
99
- "internalType": "uint256",
100
- "name": "liquidityIndex",
101
- "type": "uint256"
102
- }, { "internalType": "uint256", "name": "variableBorrowIndex", "type": "uint256" },
103
- { "internalType": "uint40", "name": "lastUpdateTimestamp", "type": "uint40" }],
104
- "stateMutability": "view", "type": "function"
68
+ inputs: [{ internalType: 'address', name: 'asset', type: 'address' }],
69
+ name: 'getReserveConfigurationData',
70
+ outputs: [
71
+ { internalType: 'uint256', name: 'decimals', type: 'uint256' },
72
+ { internalType: 'uint256', name: 'ltv', type: 'uint256' },
73
+ {
74
+ internalType: 'uint256',
75
+ name: 'liquidationThreshold',
76
+ type: 'uint256',
77
+ },
78
+ { internalType: 'uint256', name: 'liquidationBonus', type: 'uint256' },
79
+ { internalType: 'uint256', name: 'reserveFactor', type: 'uint256' },
80
+ { internalType: 'bool', name: 'usageAsCollateralEnabled', type: 'bool' },
81
+ { internalType: 'bool', name: 'borrowingEnabled', type: 'bool' },
82
+ { internalType: 'bool', name: 'isActive', type: 'bool' },
83
+ { internalType: 'bool', name: 'isFrozen', type: 'bool' },
84
+ ],
85
+ stateMutability: 'view',
86
+ type: 'function',
105
87
  },
106
88
  {
107
- "type": "function",
108
- "stateMutability": "view",
109
- "outputs": [
89
+ inputs: [
110
90
  {
111
- "type": "address",
112
- "name": "aTokenAddress",
113
- "internalType": "address"
91
+ internalType: 'address',
92
+ name: 'asset',
93
+ type: 'address',
114
94
  },
95
+ ],
96
+ name: 'getReserveData',
97
+ outputs: [
115
98
  {
116
- "type": "address",
117
- "name": "stableDebtTokenAddress",
118
- "internalType": "address"
99
+ internalType: 'uint256',
100
+ name: 'accruedToTreasuryScaled',
101
+ type: 'uint256',
119
102
  },
120
103
  {
121
- "type": "address",
122
- "name": "variableDebtTokenAddress",
123
- "internalType": "address"
124
- }
104
+ internalType: 'uint256',
105
+ name: 'totalYToken',
106
+ type: 'uint256',
107
+ },
108
+ {
109
+ internalType: 'uint256',
110
+ name: 'totalVariableDebt',
111
+ type: 'uint256',
112
+ },
113
+ {
114
+ internalType: 'uint256',
115
+ name: 'liquidityRate',
116
+ type: 'uint256',
117
+ },
118
+ {
119
+ internalType: 'uint256',
120
+ name: 'variableBorrowRate',
121
+ type: 'uint256',
122
+ },
123
+ {
124
+ internalType: 'uint256',
125
+ name: 'liquidityIndex',
126
+ type: 'uint256',
127
+ },
128
+ { internalType: 'uint256', name: 'variableBorrowIndex', type: 'uint256' },
129
+ { internalType: 'uint40', name: 'lastUpdateTimestamp', type: 'uint40' },
130
+ ],
131
+ stateMutability: 'view',
132
+ type: 'function',
133
+ },
134
+ {
135
+ type: 'function',
136
+ stateMutability: 'view',
137
+ outputs: [
138
+ {
139
+ type: 'address',
140
+ name: 'aTokenAddress',
141
+ internalType: 'address',
142
+ },
143
+ {
144
+ type: 'address',
145
+ name: 'stableDebtTokenAddress',
146
+ internalType: 'address',
147
+ },
148
+ {
149
+ type: 'address',
150
+ name: 'variableDebtTokenAddress',
151
+ internalType: 'address',
152
+ },
153
+ ],
154
+ name: 'getReserveTokensAddresses',
155
+ inputs: [
156
+ {
157
+ type: 'address',
158
+ name: 'asset',
159
+ internalType: 'address',
160
+ },
125
161
  ],
126
- "name": "getReserveTokensAddresses",
127
- "inputs": [
128
- {
129
- "type": "address",
130
- "name": "asset",
131
- "internalType": "address"
132
- }
133
- ]
134
162
  },
135
163
  {
136
- "type": "function",
137
- "stateMutability": "view",
138
- "outputs": [
164
+ type: 'function',
165
+ stateMutability: 'view',
166
+ outputs: [
139
167
  {
140
- "type": "uint256",
141
- "name": "currentATokenBalance",
142
- "internalType": "uint256"
168
+ type: 'uint256',
169
+ name: 'currentATokenBalance',
170
+ internalType: 'uint256',
143
171
  },
144
172
  {
145
- "type": "uint256",
146
- "name": "currentStableDebt",
147
- "internalType": "uint256"
173
+ type: 'uint256',
174
+ name: 'currentStableDebt',
175
+ internalType: 'uint256',
148
176
  },
149
177
  {
150
- "type": "uint256",
151
- "name": "currentVariableDebt",
152
- "internalType": "uint256"
178
+ type: 'uint256',
179
+ name: 'currentVariableDebt',
180
+ internalType: 'uint256',
153
181
  },
154
182
  {
155
- "type": "uint256",
156
- "name": "principalStableDebt",
157
- "internalType": "uint256"
183
+ type: 'uint256',
184
+ name: 'principalStableDebt',
185
+ internalType: 'uint256',
158
186
  },
159
187
  {
160
- "type": "uint256",
161
- "name": "scaledVariableDebt",
162
- "internalType": "uint256"
188
+ type: 'uint256',
189
+ name: 'scaledVariableDebt',
190
+ internalType: 'uint256',
163
191
  },
164
192
  {
165
- "type": "uint256",
166
- "name": "stableBorrowRate",
167
- "internalType": "uint256"
193
+ type: 'uint256',
194
+ name: 'stableBorrowRate',
195
+ internalType: 'uint256',
168
196
  },
169
197
  {
170
- "type": "uint256",
171
- "name": "liquidityRate",
172
- "internalType": "uint256"
198
+ type: 'uint256',
199
+ name: 'liquidityRate',
200
+ internalType: 'uint256',
173
201
  },
174
202
  {
175
- "type": "uint40",
176
- "name": "stableRateLastUpdated",
177
- "internalType": "uint40"
203
+ type: 'uint40',
204
+ name: 'stableRateLastUpdated',
205
+ internalType: 'uint40',
178
206
  },
179
207
  {
180
- "type": "bool",
181
- "name": "usageAsCollateralEnabled",
182
- "internalType": "bool"
183
- }
208
+ type: 'bool',
209
+ name: 'usageAsCollateralEnabled',
210
+ internalType: 'bool',
211
+ },
184
212
  ],
185
- "name": "getUserReserveData",
186
- "inputs": [
213
+ name: 'getUserReserveData',
214
+ inputs: [
187
215
  {
188
- "type": "address",
189
- "name": "asset",
190
- "internalType": "address"
216
+ type: 'address',
217
+ name: 'asset',
218
+ internalType: 'address',
191
219
  },
192
220
  {
193
- "type": "address",
194
- "name": "user",
195
- "internalType": "address"
196
- }
197
- ]
198
- }
199
- ] as const
221
+ type: 'address',
222
+ name: 'user',
223
+ internalType: 'address',
224
+ },
225
+ ],
226
+ },
227
+ ] as const
@@ -1,46 +1,46 @@
1
1
  export const YLDRAbi = [
2
- {
3
- "inputs": [
4
- {
5
- "internalType": "address",
6
- "name": "asset",
7
- "type": "address"
8
- },
9
- {
10
- "internalType": "address",
11
- "name": "user",
12
- "type": "address"
13
- }
14
- ],
15
- "name": "getUserReserveData",
16
- "outputs": [
17
- {
18
- "internalType": "uint256",
19
- "name": "currentYTokenBalance",
20
- "type": "uint256"
21
- },
22
- {
23
- "internalType": "uint256",
24
- "name": "currentVariableDebt",
25
- "type": "uint256"
26
- },
27
- {
28
- "internalType": "uint256",
29
- "name": "scaledVariableDebt",
30
- "type": "uint256"
31
- },
32
- {
33
- "internalType": "uint256",
34
- "name": "liquidityRate",
35
- "type": "uint256"
36
- },
37
- {
38
- "internalType": "bool",
39
- "name": "usageAsCollateralEnabled",
40
- "type": "bool"
41
- }
42
- ],
43
- "stateMutability": "view",
44
- "type": "function"
45
- }
46
- ] as const
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'address',
6
+ name: 'asset',
7
+ type: 'address',
8
+ },
9
+ {
10
+ internalType: 'address',
11
+ name: 'user',
12
+ type: 'address',
13
+ },
14
+ ],
15
+ name: 'getUserReserveData',
16
+ outputs: [
17
+ {
18
+ internalType: 'uint256',
19
+ name: 'currentYTokenBalance',
20
+ type: 'uint256',
21
+ },
22
+ {
23
+ internalType: 'uint256',
24
+ name: 'currentVariableDebt',
25
+ type: 'uint256',
26
+ },
27
+ {
28
+ internalType: 'uint256',
29
+ name: 'scaledVariableDebt',
30
+ type: 'uint256',
31
+ },
32
+ {
33
+ internalType: 'uint256',
34
+ name: 'liquidityRate',
35
+ type: 'uint256',
36
+ },
37
+ {
38
+ internalType: 'bool',
39
+ name: 'usageAsCollateralEnabled',
40
+ type: 'bool',
41
+ },
42
+ ],
43
+ stateMutability: 'view',
44
+ type: 'function',
45
+ },
46
+ ] as const
@@ -1292,31 +1292,6 @@ export const CometAbi = [
1292
1292
  "stateMutability": "nonpayable",
1293
1293
  "type": "function"
1294
1294
  },
1295
- {
1296
- "anonymous": false,
1297
- "inputs": [
1298
- {
1299
- "indexed": true,
1300
- "internalType": "address",
1301
- "name": "owner",
1302
- "type": "address"
1303
- },
1304
- {
1305
- "indexed": true,
1306
- "internalType": "address",
1307
- "name": "spender",
1308
- "type": "address"
1309
- },
1310
- {
1311
- "indexed": false,
1312
- "internalType": "uint256",
1313
- "name": "amount",
1314
- "type": "uint256"
1315
- }
1316
- ],
1317
- "name": "Approval",
1318
- "type": "event"
1319
- },
1320
1295
  {
1321
1296
  "inputs": [
1322
1297
  {
@@ -2,7 +2,7 @@
2
2
  import { ProtocolDataProviderAbi } from '../abis/aave-v2/ProtocolDataProvider'
3
3
  import { IncentivesControllerAbi } from '../abis/lendle/IncentivesController'
4
4
  import { RewarderAbi } from '../abis/aurelius/Rewarder'
5
- import { UniswapV2PairAbi } from '../abis/uniswap/UniswapV2Pair'
5
+ import { UniswapV2PairAbi } from '../abis/oracle/UniswapV2Pair'
6
6
 
7
7
  // aave v3 style
8
8
  import { AavePoolV3UpgradedAbi } from '../abis/aave/AavePoolV3Upgraded'
@@ -1,6 +1,6 @@
1
1
  import { Lender } from "@1delta/asset-registry"
2
2
  import { Call } from "../../../utils/multicall"
3
- import { getComposerAddress, getLenderAssets } from "../../../utils"
3
+ import { getLenderAssets } from "../../../utils"
4
4
  import { getCompoundV3BaseAsset, getCompoundV3CometAddress, getCompoundV3CometRewardsAddress } from "./addresses"
5
5
 
6
6
  export const buildCompoundV3UserCall = (chainId: string, lender: Lender, account: string): Call[] => {
@@ -10,12 +10,6 @@ export const buildCompoundV3UserCall = (chainId: string, lender: Lender, account
10
10
  const assets = getLenderAssets(chainId, lender)
11
11
  const assetsNoBase = assets.filter(a => a !== baseAsset)
12
12
 
13
- const allowedCall = {
14
- address: cometContractAddress,
15
- name: 'isAllowed',
16
- params: [account, getComposerAddress(chainId)],
17
- }
18
-
19
13
  const baseCalls = [
20
14
  {
21
15
  address: cometContractAddress,
@@ -45,7 +39,6 @@ export const buildCompoundV3UserCall = (chainId: string, lender: Lender, account
45
39
  const calls = [
46
40
  ...callsNonBase,
47
41
  ...baseCalls,
48
- allowedCall,
49
42
  callEarnedBalances
50
43
  ]
51
44
  return calls