@1delta/data-sdk 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +83 -2
- package/dist/index.mjs +70 -3
- package/dist/lending.d.ts +189 -1
- package/package.json +45 -45
package/dist/index.js
CHANGED
|
@@ -41,7 +41,13 @@ globalThis[GLOBAL_LENDER_DATA_KEY] = {
|
|
|
41
41
|
eulerVaults: {},
|
|
42
42
|
aaveV4Spokes: {},
|
|
43
43
|
aaveV4Oracles: {},
|
|
44
|
-
aaveV4Peripherals: {}
|
|
44
|
+
aaveV4Peripherals: {},
|
|
45
|
+
siloMarkets: {},
|
|
46
|
+
siloPeripherals: {},
|
|
47
|
+
siloMarketsV3: {},
|
|
48
|
+
siloPeripheralsV3: {},
|
|
49
|
+
fluidResolvers: {},
|
|
50
|
+
fluidVaults: {}
|
|
45
51
|
};
|
|
46
52
|
function getGlobalData2() {
|
|
47
53
|
return globalThis[GLOBAL_LENDER_DATA_KEY];
|
|
@@ -74,7 +80,13 @@ function initializeLenderData({
|
|
|
74
80
|
eulerVaultsOverride,
|
|
75
81
|
aaveV4SpokesOverride,
|
|
76
82
|
aaveV4OraclesOverride,
|
|
77
|
-
aaveV4PeripheralsOverride
|
|
83
|
+
aaveV4PeripheralsOverride,
|
|
84
|
+
siloMarketsOverride,
|
|
85
|
+
siloPeripheralsOverride,
|
|
86
|
+
siloMarketsV3Override,
|
|
87
|
+
siloPeripheralsV3Override,
|
|
88
|
+
fluidResolversOverride,
|
|
89
|
+
fluidVaultsOverride
|
|
78
90
|
}) {
|
|
79
91
|
const data = getGlobalData2();
|
|
80
92
|
if (aaveTokensOverride) data.aaveTokens = aaveTokensOverride;
|
|
@@ -106,6 +118,13 @@ function initializeLenderData({
|
|
|
106
118
|
if (aaveV4OraclesOverride) data.aaveV4Oracles = aaveV4OraclesOverride;
|
|
107
119
|
if (aaveV4PeripheralsOverride)
|
|
108
120
|
data.aaveV4Peripherals = aaveV4PeripheralsOverride;
|
|
121
|
+
if (siloMarketsOverride) data.siloMarkets = siloMarketsOverride;
|
|
122
|
+
if (siloPeripheralsOverride) data.siloPeripherals = siloPeripheralsOverride;
|
|
123
|
+
if (siloMarketsV3Override) data.siloMarketsV3 = siloMarketsV3Override;
|
|
124
|
+
if (siloPeripheralsV3Override)
|
|
125
|
+
data.siloPeripheralsV3 = siloPeripheralsV3Override;
|
|
126
|
+
if (fluidResolversOverride) data.fluidResolvers = fluidResolversOverride;
|
|
127
|
+
if (fluidVaultsOverride) data.fluidVaults = fluidVaultsOverride;
|
|
109
128
|
}
|
|
110
129
|
var aaveTokens = () => getGlobalData2()?.aaveTokens;
|
|
111
130
|
var aavePools = () => getGlobalData2()?.aavePools;
|
|
@@ -135,6 +154,14 @@ var eulerVaults = () => getGlobalData2()?.eulerVaults;
|
|
|
135
154
|
var aaveV4Spokes = () => getGlobalData2()?.aaveV4Spokes;
|
|
136
155
|
var aaveV4Oracles = () => getGlobalData2()?.aaveV4Oracles;
|
|
137
156
|
var aaveV4Peripherals = () => getGlobalData2()?.aaveV4Peripherals;
|
|
157
|
+
var siloMarkets = () => getGlobalData2()?.siloMarkets;
|
|
158
|
+
var siloPeripherals = () => getGlobalData2()?.siloPeripherals;
|
|
159
|
+
var siloMarketsV3 = () => getGlobalData2()?.siloMarketsV3;
|
|
160
|
+
var siloPeripheralsV3 = () => getGlobalData2()?.siloPeripheralsV3;
|
|
161
|
+
var fluidResolvers = () => getGlobalData2()?.fluidResolvers;
|
|
162
|
+
var fluidVaults = () => getGlobalData2()?.fluidVaults;
|
|
163
|
+
var fluidChains = () => Object.keys(getGlobalData2()?.fluidResolvers ?? {});
|
|
164
|
+
var fluidVaultEntries = (chainId) => Object.entries(getGlobalData2()?.fluidVaults?.[chainId] ?? {});
|
|
138
165
|
function getAaveV4SpokeEntry(chainId, lenderKey) {
|
|
139
166
|
const parsed = parseAaveV4SpokeLenderKey(lenderKey);
|
|
140
167
|
if (!parsed) return void 0;
|
|
@@ -184,6 +211,46 @@ function parseAaveV4SpokeLenderKey(lenderKey) {
|
|
|
184
211
|
if (!match) return void 0;
|
|
185
212
|
return { spokeAddrLower: "0x" + match[1].toLowerCase() };
|
|
186
213
|
}
|
|
214
|
+
function siloV2LenderKey(siloConfig) {
|
|
215
|
+
if (!siloConfig || !siloConfig.startsWith("0x") || siloConfig.length !== 42) {
|
|
216
|
+
throw new Error(`siloV2LenderKey: invalid siloConfig address ${siloConfig}`);
|
|
217
|
+
}
|
|
218
|
+
return `SILO_V2_${siloConfig.slice(2).toUpperCase()}`;
|
|
219
|
+
}
|
|
220
|
+
function parseSiloV2LenderKey(lenderKey) {
|
|
221
|
+
const match = lenderKey.match(/^SILO_V2_([0-9A-F]{40})$/);
|
|
222
|
+
if (!match) return void 0;
|
|
223
|
+
return { siloConfigAddrLower: "0x" + match[1].toLowerCase() };
|
|
224
|
+
}
|
|
225
|
+
function getSiloV2MarketEntry(chainId, lenderKey) {
|
|
226
|
+
const parsed = parseSiloV2LenderKey(lenderKey);
|
|
227
|
+
if (!parsed) return void 0;
|
|
228
|
+
const list = getGlobalData2()?.siloMarkets?.[chainId];
|
|
229
|
+
if (!list) return void 0;
|
|
230
|
+
return list.find(
|
|
231
|
+
(m) => m.siloConfig.toLowerCase() === parsed.siloConfigAddrLower
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
function siloV3LenderKey(siloConfig) {
|
|
235
|
+
if (!siloConfig || !siloConfig.startsWith("0x") || siloConfig.length !== 42) {
|
|
236
|
+
throw new Error(`siloV3LenderKey: invalid siloConfig address ${siloConfig}`);
|
|
237
|
+
}
|
|
238
|
+
return `SILO_V3_${siloConfig.slice(2).toUpperCase()}`;
|
|
239
|
+
}
|
|
240
|
+
function parseSiloV3LenderKey(lenderKey) {
|
|
241
|
+
const match = lenderKey.match(/^SILO_V3_([0-9A-F]{40})$/);
|
|
242
|
+
if (!match) return void 0;
|
|
243
|
+
return { siloConfigAddrLower: "0x" + match[1].toLowerCase() };
|
|
244
|
+
}
|
|
245
|
+
function getSiloV3MarketEntry(chainId, lenderKey) {
|
|
246
|
+
const parsed = parseSiloV3LenderKey(lenderKey);
|
|
247
|
+
if (!parsed) return void 0;
|
|
248
|
+
const list = getGlobalData2()?.siloMarketsV3?.[chainId];
|
|
249
|
+
if (!list) return void 0;
|
|
250
|
+
return list.find(
|
|
251
|
+
(m) => m.siloConfig.toLowerCase() === parsed.siloConfigAddrLower
|
|
252
|
+
);
|
|
253
|
+
}
|
|
187
254
|
|
|
188
255
|
// src/tokens.ts
|
|
189
256
|
var getListUrl = (chainId) => `https://raw.githubusercontent.com/1delta-DAO/token-lists/main/${chainId}.json`;
|
|
@@ -227,10 +294,16 @@ exports.eulerVaults = eulerVaults;
|
|
|
227
294
|
exports.fetchTokenList = fetchTokenList;
|
|
228
295
|
exports.fetchTokenLists = fetchTokenLists;
|
|
229
296
|
exports.findAaveV4PositionManager = findAaveV4PositionManager;
|
|
297
|
+
exports.fluidChains = fluidChains;
|
|
298
|
+
exports.fluidResolvers = fluidResolvers;
|
|
299
|
+
exports.fluidVaultEntries = fluidVaultEntries;
|
|
300
|
+
exports.fluidVaults = fluidVaults;
|
|
230
301
|
exports.getAaveV4GatewayAddresses = getAaveV4GatewayAddresses;
|
|
231
302
|
exports.getAaveV4PositionManagers = getAaveV4PositionManagers;
|
|
232
303
|
exports.getAaveV4SpokeEntry = getAaveV4SpokeEntry;
|
|
233
304
|
exports.getAaveV4SpokePeripherals = getAaveV4SpokePeripherals;
|
|
305
|
+
exports.getSiloV2MarketEntry = getSiloV2MarketEntry;
|
|
306
|
+
exports.getSiloV3MarketEntry = getSiloV3MarketEntry;
|
|
234
307
|
exports.initConfig = initConfig;
|
|
235
308
|
exports.initializeChainData = initializeChainData;
|
|
236
309
|
exports.initializeLenderData = initializeLenderData;
|
|
@@ -241,3 +314,11 @@ exports.morphoPools = morphoPools;
|
|
|
241
314
|
exports.morphoTypeMarkets = morphoTypeMarkets;
|
|
242
315
|
exports.morphoTypeOracles = morphoTypeOracles;
|
|
243
316
|
exports.parseAaveV4SpokeLenderKey = parseAaveV4SpokeLenderKey;
|
|
317
|
+
exports.parseSiloV2LenderKey = parseSiloV2LenderKey;
|
|
318
|
+
exports.parseSiloV3LenderKey = parseSiloV3LenderKey;
|
|
319
|
+
exports.siloMarkets = siloMarkets;
|
|
320
|
+
exports.siloMarketsV3 = siloMarketsV3;
|
|
321
|
+
exports.siloPeripherals = siloPeripherals;
|
|
322
|
+
exports.siloPeripheralsV3 = siloPeripheralsV3;
|
|
323
|
+
exports.siloV2LenderKey = siloV2LenderKey;
|
|
324
|
+
exports.siloV3LenderKey = siloV3LenderKey;
|
package/dist/index.mjs
CHANGED
|
@@ -39,7 +39,13 @@ globalThis[GLOBAL_LENDER_DATA_KEY] = {
|
|
|
39
39
|
eulerVaults: {},
|
|
40
40
|
aaveV4Spokes: {},
|
|
41
41
|
aaveV4Oracles: {},
|
|
42
|
-
aaveV4Peripherals: {}
|
|
42
|
+
aaveV4Peripherals: {},
|
|
43
|
+
siloMarkets: {},
|
|
44
|
+
siloPeripherals: {},
|
|
45
|
+
siloMarketsV3: {},
|
|
46
|
+
siloPeripheralsV3: {},
|
|
47
|
+
fluidResolvers: {},
|
|
48
|
+
fluidVaults: {}
|
|
43
49
|
};
|
|
44
50
|
function getGlobalData2() {
|
|
45
51
|
return globalThis[GLOBAL_LENDER_DATA_KEY];
|
|
@@ -72,7 +78,13 @@ function initializeLenderData({
|
|
|
72
78
|
eulerVaultsOverride,
|
|
73
79
|
aaveV4SpokesOverride,
|
|
74
80
|
aaveV4OraclesOverride,
|
|
75
|
-
aaveV4PeripheralsOverride
|
|
81
|
+
aaveV4PeripheralsOverride,
|
|
82
|
+
siloMarketsOverride,
|
|
83
|
+
siloPeripheralsOverride,
|
|
84
|
+
siloMarketsV3Override,
|
|
85
|
+
siloPeripheralsV3Override,
|
|
86
|
+
fluidResolversOverride,
|
|
87
|
+
fluidVaultsOverride
|
|
76
88
|
}) {
|
|
77
89
|
const data = getGlobalData2();
|
|
78
90
|
if (aaveTokensOverride) data.aaveTokens = aaveTokensOverride;
|
|
@@ -104,6 +116,13 @@ function initializeLenderData({
|
|
|
104
116
|
if (aaveV4OraclesOverride) data.aaveV4Oracles = aaveV4OraclesOverride;
|
|
105
117
|
if (aaveV4PeripheralsOverride)
|
|
106
118
|
data.aaveV4Peripherals = aaveV4PeripheralsOverride;
|
|
119
|
+
if (siloMarketsOverride) data.siloMarkets = siloMarketsOverride;
|
|
120
|
+
if (siloPeripheralsOverride) data.siloPeripherals = siloPeripheralsOverride;
|
|
121
|
+
if (siloMarketsV3Override) data.siloMarketsV3 = siloMarketsV3Override;
|
|
122
|
+
if (siloPeripheralsV3Override)
|
|
123
|
+
data.siloPeripheralsV3 = siloPeripheralsV3Override;
|
|
124
|
+
if (fluidResolversOverride) data.fluidResolvers = fluidResolversOverride;
|
|
125
|
+
if (fluidVaultsOverride) data.fluidVaults = fluidVaultsOverride;
|
|
107
126
|
}
|
|
108
127
|
var aaveTokens = () => getGlobalData2()?.aaveTokens;
|
|
109
128
|
var aavePools = () => getGlobalData2()?.aavePools;
|
|
@@ -133,6 +152,14 @@ var eulerVaults = () => getGlobalData2()?.eulerVaults;
|
|
|
133
152
|
var aaveV4Spokes = () => getGlobalData2()?.aaveV4Spokes;
|
|
134
153
|
var aaveV4Oracles = () => getGlobalData2()?.aaveV4Oracles;
|
|
135
154
|
var aaveV4Peripherals = () => getGlobalData2()?.aaveV4Peripherals;
|
|
155
|
+
var siloMarkets = () => getGlobalData2()?.siloMarkets;
|
|
156
|
+
var siloPeripherals = () => getGlobalData2()?.siloPeripherals;
|
|
157
|
+
var siloMarketsV3 = () => getGlobalData2()?.siloMarketsV3;
|
|
158
|
+
var siloPeripheralsV3 = () => getGlobalData2()?.siloPeripheralsV3;
|
|
159
|
+
var fluidResolvers = () => getGlobalData2()?.fluidResolvers;
|
|
160
|
+
var fluidVaults = () => getGlobalData2()?.fluidVaults;
|
|
161
|
+
var fluidChains = () => Object.keys(getGlobalData2()?.fluidResolvers ?? {});
|
|
162
|
+
var fluidVaultEntries = (chainId) => Object.entries(getGlobalData2()?.fluidVaults?.[chainId] ?? {});
|
|
136
163
|
function getAaveV4SpokeEntry(chainId, lenderKey) {
|
|
137
164
|
const parsed = parseAaveV4SpokeLenderKey(lenderKey);
|
|
138
165
|
if (!parsed) return void 0;
|
|
@@ -182,6 +209,46 @@ function parseAaveV4SpokeLenderKey(lenderKey) {
|
|
|
182
209
|
if (!match) return void 0;
|
|
183
210
|
return { spokeAddrLower: "0x" + match[1].toLowerCase() };
|
|
184
211
|
}
|
|
212
|
+
function siloV2LenderKey(siloConfig) {
|
|
213
|
+
if (!siloConfig || !siloConfig.startsWith("0x") || siloConfig.length !== 42) {
|
|
214
|
+
throw new Error(`siloV2LenderKey: invalid siloConfig address ${siloConfig}`);
|
|
215
|
+
}
|
|
216
|
+
return `SILO_V2_${siloConfig.slice(2).toUpperCase()}`;
|
|
217
|
+
}
|
|
218
|
+
function parseSiloV2LenderKey(lenderKey) {
|
|
219
|
+
const match = lenderKey.match(/^SILO_V2_([0-9A-F]{40})$/);
|
|
220
|
+
if (!match) return void 0;
|
|
221
|
+
return { siloConfigAddrLower: "0x" + match[1].toLowerCase() };
|
|
222
|
+
}
|
|
223
|
+
function getSiloV2MarketEntry(chainId, lenderKey) {
|
|
224
|
+
const parsed = parseSiloV2LenderKey(lenderKey);
|
|
225
|
+
if (!parsed) return void 0;
|
|
226
|
+
const list = getGlobalData2()?.siloMarkets?.[chainId];
|
|
227
|
+
if (!list) return void 0;
|
|
228
|
+
return list.find(
|
|
229
|
+
(m) => m.siloConfig.toLowerCase() === parsed.siloConfigAddrLower
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
function siloV3LenderKey(siloConfig) {
|
|
233
|
+
if (!siloConfig || !siloConfig.startsWith("0x") || siloConfig.length !== 42) {
|
|
234
|
+
throw new Error(`siloV3LenderKey: invalid siloConfig address ${siloConfig}`);
|
|
235
|
+
}
|
|
236
|
+
return `SILO_V3_${siloConfig.slice(2).toUpperCase()}`;
|
|
237
|
+
}
|
|
238
|
+
function parseSiloV3LenderKey(lenderKey) {
|
|
239
|
+
const match = lenderKey.match(/^SILO_V3_([0-9A-F]{40})$/);
|
|
240
|
+
if (!match) return void 0;
|
|
241
|
+
return { siloConfigAddrLower: "0x" + match[1].toLowerCase() };
|
|
242
|
+
}
|
|
243
|
+
function getSiloV3MarketEntry(chainId, lenderKey) {
|
|
244
|
+
const parsed = parseSiloV3LenderKey(lenderKey);
|
|
245
|
+
if (!parsed) return void 0;
|
|
246
|
+
const list = getGlobalData2()?.siloMarketsV3?.[chainId];
|
|
247
|
+
if (!list) return void 0;
|
|
248
|
+
return list.find(
|
|
249
|
+
(m) => m.siloConfig.toLowerCase() === parsed.siloConfigAddrLower
|
|
250
|
+
);
|
|
251
|
+
}
|
|
185
252
|
|
|
186
253
|
// src/tokens.ts
|
|
187
254
|
var getListUrl = (chainId) => `https://raw.githubusercontent.com/1delta-DAO/token-lists/main/${chainId}.json`;
|
|
@@ -199,4 +266,4 @@ async function fetchTokenLists(chainIds) {
|
|
|
199
266
|
return Object.fromEntries(results);
|
|
200
267
|
}
|
|
201
268
|
|
|
202
|
-
export { aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chains, compoundV2Oracles, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, eulerConfigs, eulerVaults, fetchTokenList, fetchTokenLists, findAaveV4PositionManager, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, initConfig, initializeChainData, initializeLenderData, listaNativeProvider, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, parseAaveV4SpokeLenderKey };
|
|
269
|
+
export { aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chains, compoundV2Oracles, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, eulerConfigs, eulerVaults, fetchTokenList, fetchTokenLists, findAaveV4PositionManager, fluidChains, fluidResolvers, fluidVaultEntries, fluidVaults, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, listaNativeProvider, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, parseAaveV4SpokeLenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey };
|
package/dist/lending.d.ts
CHANGED
|
@@ -122,6 +122,53 @@ interface MrophoOracleInfo {
|
|
|
122
122
|
type MorphoOracles = {
|
|
123
123
|
[c: string]: MrophoOracleInfo[];
|
|
124
124
|
};
|
|
125
|
+
export type FluidResolvers = {
|
|
126
|
+
lendingResolver: string;
|
|
127
|
+
vaultResolver: string;
|
|
128
|
+
liquidityResolver: string;
|
|
129
|
+
};
|
|
130
|
+
export type FluidResolversType = {
|
|
131
|
+
[chainId: string]: FluidResolvers;
|
|
132
|
+
};
|
|
133
|
+
/** One asset on a vault side — underlying token and its fToken wrapper (if any). */
|
|
134
|
+
export type FluidVaultAsset = {
|
|
135
|
+
/** Lowercased underlying ERC20 address. Native ETH is represented by
|
|
136
|
+
* `zeroAddress` (`0x0000…0000`) — the Fluid on-chain EEE sentinel is
|
|
137
|
+
* normalized away at the parser boundary to match the rest of the
|
|
138
|
+
* lending stack's convention. Use `isNativeAddress` in calldata-sdk
|
|
139
|
+
* if you need to accept either form. */
|
|
140
|
+
underlying: string;
|
|
141
|
+
/** Lowercased fToken address wrapping this underlying, or `null` if none.
|
|
142
|
+
* `null` does NOT imply "not borrowable" — borrowability is a separate
|
|
143
|
+
* Liquidity/vault-config property. */
|
|
144
|
+
fToken: string | null;
|
|
145
|
+
};
|
|
146
|
+
/** One side of a Fluid vault — supply or borrow. Uniform shape across all vault
|
|
147
|
+
* types: `assets.length === 1` means simple, `> 1` means smart (DEX LP).
|
|
148
|
+
* `dex !== null` is equivalent. */
|
|
149
|
+
export type FluidVaultSide = {
|
|
150
|
+
/** 1 entry for simple sides, 2 entries for smart (DEX LP) sides. Order matches
|
|
151
|
+
* the vault's `constantsView().{supply|borrow}Token.{token0,token1}`. */
|
|
152
|
+
assets: FluidVaultAsset[];
|
|
153
|
+
/** Fluid DEX pool contract. `null` for simple sides. */
|
|
154
|
+
dex: string | null;
|
|
155
|
+
/** Optional SmartLending wrapper over the DEX LP (ERC4626-like). `null` when unused. */
|
|
156
|
+
smartLending: string | null;
|
|
157
|
+
};
|
|
158
|
+
export type FluidVaultMeta = {
|
|
159
|
+
vaultId: number;
|
|
160
|
+
/** Raw `IFluidVault.TYPE()` — Fluid uses scaled constants 10000/20000/30000/40000
|
|
161
|
+
* for T1/T2/T3/T4. Prefer `side.dex !== null` for smart-side detection. */
|
|
162
|
+
type: 10000 | 20000 | 30000 | 40000;
|
|
163
|
+
supply: FluidVaultSide;
|
|
164
|
+
borrow: FluidVaultSide;
|
|
165
|
+
};
|
|
166
|
+
/** Keyed by vault contract address (lowercased) for O(1) lookup. */
|
|
167
|
+
export type FluidVaultsType = {
|
|
168
|
+
[chainId: string]: {
|
|
169
|
+
[vaultAddress: string]: FluidVaultMeta;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
125
172
|
type MorphoTypeOracles = {
|
|
126
173
|
[chainId: string]: {
|
|
127
174
|
[protocol: string]: MrophoOracleInfo[];
|
|
@@ -174,6 +221,80 @@ type EulerVaultsType = {
|
|
|
174
221
|
[chainId: string]: EulerVaultEntry[];
|
|
175
222
|
};
|
|
176
223
|
};
|
|
224
|
+
export type SiloHalfStatic = {
|
|
225
|
+
/** silo (vault) address */
|
|
226
|
+
silo: string;
|
|
227
|
+
/** underlying borrowable asset for this side */
|
|
228
|
+
token: string;
|
|
229
|
+
/** ERC-20 decimals for `token`, cached to avoid an extra RPC */
|
|
230
|
+
decimals: number;
|
|
231
|
+
/** Optional symbol cache for UI; not consumed by the fetcher */
|
|
232
|
+
symbol?: string;
|
|
233
|
+
/** Share-token addresses (for user-data fetchers / liquidations) */
|
|
234
|
+
protectedShareToken: string;
|
|
235
|
+
collateralShareToken: string;
|
|
236
|
+
debtShareToken: string;
|
|
237
|
+
/** Per-side oracles (1e18-scaled price quoting) */
|
|
238
|
+
solvencyOracle: string;
|
|
239
|
+
maxLtvOracle: string;
|
|
240
|
+
/** Interest rate model contract */
|
|
241
|
+
interestRateModel: string;
|
|
242
|
+
/** LTV at 1e18 scale */
|
|
243
|
+
maxLtv: string;
|
|
244
|
+
/** Liquidation threshold (LLTV) at 1e18 scale */
|
|
245
|
+
lt: string;
|
|
246
|
+
/** Target LTV after liquidation (1e18) */
|
|
247
|
+
liquidationTargetLtv: string;
|
|
248
|
+
/** Fee parameters (1e18) */
|
|
249
|
+
liquidationFee: string;
|
|
250
|
+
flashloanFee: string;
|
|
251
|
+
daoFee: string;
|
|
252
|
+
deployerFee: string;
|
|
253
|
+
/** Optional hook receiver / quote-before flag */
|
|
254
|
+
hookReceiver?: string;
|
|
255
|
+
callBeforeQuote?: boolean;
|
|
256
|
+
};
|
|
257
|
+
export type SiloMarketEntry = {
|
|
258
|
+
/** Shared SiloConfig address (one per pair) */
|
|
259
|
+
siloConfig: string;
|
|
260
|
+
/** Optional human-readable name from the factory event / curated list */
|
|
261
|
+
name?: string;
|
|
262
|
+
silo0: SiloHalfStatic;
|
|
263
|
+
silo1: SiloHalfStatic;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* chainId → list of (silo0, silo1) pairs.
|
|
267
|
+
*
|
|
268
|
+
* Stored as an array to match the on-disk `silo-v2-markets.json` shape.
|
|
269
|
+
* Per-chain pair counts are small (~100 max), so the linear lookup in
|
|
270
|
+
* `getSiloV2MarketEntry` is fine. If that ever changes, build an index
|
|
271
|
+
* lazily here.
|
|
272
|
+
*/
|
|
273
|
+
export type SiloMarketsType = {
|
|
274
|
+
[chainId: string]: SiloMarketEntry[];
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Per-chain Silo v2 peripheral / singleton addresses.
|
|
278
|
+
*
|
|
279
|
+
* Both `lens` and `factory` are deployed once per chain and shared by every
|
|
280
|
+
* Silo v2 market on that chain, so they live together in one map instead of
|
|
281
|
+
* being split across `siloLens` / `siloFactory`. Add new chain-wide
|
|
282
|
+
* singletons (e.g. `siloRouter`, `siloIncentivesController`) here.
|
|
283
|
+
*/
|
|
284
|
+
export type SiloPeripheralsEntry = {
|
|
285
|
+
/** SiloLens (v2) — exposes getDepositAPR / getBorrowAPR / getUtilization */
|
|
286
|
+
lens: string;
|
|
287
|
+
/** SiloFactory — used by the initializer to discover deployed silo pairs */
|
|
288
|
+
factory: string;
|
|
289
|
+
/** Optional: router / wrapped-native gateway, populated when needed */
|
|
290
|
+
router?: string;
|
|
291
|
+
/** Optional: incentives controller for reward APR */
|
|
292
|
+
incentivesController?: string;
|
|
293
|
+
};
|
|
294
|
+
/** chainId → Silo v2 peripheral addresses */
|
|
295
|
+
export type SiloPeripheralsType = {
|
|
296
|
+
[chainId: string]: SiloPeripheralsEntry;
|
|
297
|
+
};
|
|
177
298
|
export type AaveV4ReserveEntry = {
|
|
178
299
|
reserveId: number;
|
|
179
300
|
/** Hub-side asset id (scoped to the entry's `hub`) */
|
|
@@ -255,7 +376,7 @@ export type AaveV4PeripheralsType = {
|
|
|
255
376
|
[chainId: string]: AaveV4ChainPeripherals;
|
|
256
377
|
};
|
|
257
378
|
/** Override datas used in the SDK - works across all module instances */
|
|
258
|
-
export declare function initializeLenderData({ aaveTokensOverride, aavePoolsOverride, aaveOraclesOverride, compoundV2OraclesOverride, compoundV3OraclesDataOverride, compoundV3PoolsOverride, compoundV3BaseDataOverride, morphoPoolsOverride, compoundV2TokensOverride, compoundV2TokenArrayOverride, compoundV2PoolsOverride, initConfigOverride, aaveReservesOverride, compoundV3ReservesOverride, compoundV2ReservesOverride, morphoOraclesOverride, morphoTypeOraclesOverride, morphoTypeMarketsOverride, aaveOraclesConfigOverride, aaveWethGatewayOverride, morphoBundler3Override, listaNativeProviderOverride, compoundV3BulkerOverride, eulerConfigsOverride, eulerVaultsOverride, aaveV4SpokesOverride, aaveV4OraclesOverride, aaveV4PeripheralsOverride, }: {
|
|
379
|
+
export declare function initializeLenderData({ aaveTokensOverride, aavePoolsOverride, aaveOraclesOverride, compoundV2OraclesOverride, compoundV3OraclesDataOverride, compoundV3PoolsOverride, compoundV3BaseDataOverride, morphoPoolsOverride, compoundV2TokensOverride, compoundV2TokenArrayOverride, compoundV2PoolsOverride, initConfigOverride, aaveReservesOverride, compoundV3ReservesOverride, compoundV2ReservesOverride, morphoOraclesOverride, morphoTypeOraclesOverride, morphoTypeMarketsOverride, aaveOraclesConfigOverride, aaveWethGatewayOverride, morphoBundler3Override, listaNativeProviderOverride, compoundV3BulkerOverride, eulerConfigsOverride, eulerVaultsOverride, aaveV4SpokesOverride, aaveV4OraclesOverride, aaveV4PeripheralsOverride, siloMarketsOverride, siloPeripheralsOverride, siloMarketsV3Override, siloPeripheralsV3Override, fluidResolversOverride, fluidVaultsOverride, }: {
|
|
259
380
|
aaveTokensOverride?: AaveTokensType;
|
|
260
381
|
aavePoolsOverride?: AavePoolsType;
|
|
261
382
|
aaveOraclesOverride?: OracleMap;
|
|
@@ -284,6 +405,12 @@ export declare function initializeLenderData({ aaveTokensOverride, aavePoolsOver
|
|
|
284
405
|
aaveV4SpokesOverride?: AaveV4SpokesType;
|
|
285
406
|
aaveV4OraclesOverride?: AaveV4OraclesType;
|
|
286
407
|
aaveV4PeripheralsOverride?: AaveV4PeripheralsType;
|
|
408
|
+
siloMarketsOverride?: SiloMarketsType;
|
|
409
|
+
siloPeripheralsOverride?: SiloPeripheralsType;
|
|
410
|
+
siloMarketsV3Override?: SiloMarketsType;
|
|
411
|
+
siloPeripheralsV3Override?: SiloPeripheralsType;
|
|
412
|
+
fluidResolversOverride?: FluidResolversType;
|
|
413
|
+
fluidVaultsOverride?: FluidVaultsType;
|
|
287
414
|
}): void;
|
|
288
415
|
export declare const aaveTokens: () => AaveTokensType;
|
|
289
416
|
export declare const aavePools: () => AavePoolsType;
|
|
@@ -313,6 +440,16 @@ export declare const eulerVaults: () => EulerVaultsType;
|
|
|
313
440
|
export declare const aaveV4Spokes: () => AaveV4SpokesType;
|
|
314
441
|
export declare const aaveV4Oracles: () => AaveV4OraclesType;
|
|
315
442
|
export declare const aaveV4Peripherals: () => AaveV4PeripheralsType;
|
|
443
|
+
export declare const siloMarkets: () => SiloMarketsType;
|
|
444
|
+
export declare const siloPeripherals: () => SiloPeripheralsType;
|
|
445
|
+
export declare const siloMarketsV3: () => SiloMarketsType;
|
|
446
|
+
export declare const siloPeripheralsV3: () => SiloPeripheralsType;
|
|
447
|
+
export declare const fluidResolvers: () => FluidResolversType;
|
|
448
|
+
export declare const fluidVaults: () => FluidVaultsType;
|
|
449
|
+
/** List of chains where Fluid resolvers are registered. */
|
|
450
|
+
export declare const fluidChains: () => string[];
|
|
451
|
+
/** Vault entries for a chain as `[address, meta]` tuples. */
|
|
452
|
+
export declare const fluidVaultEntries: (chainId: string) => [string, FluidVaultMeta][];
|
|
316
453
|
/**
|
|
317
454
|
* Look up the spoke entry for a per-spoke V4 lender key (`AAVE_V4_<HEX>`).
|
|
318
455
|
* Returns `undefined` if no entry exists for that chain/spoke.
|
|
@@ -398,4 +535,55 @@ export declare function aaveV4SpokeLenderKey(spoke: string): string;
|
|
|
398
535
|
export declare function parseAaveV4SpokeLenderKey(lenderKey: string): {
|
|
399
536
|
spokeAddrLower: string;
|
|
400
537
|
} | undefined;
|
|
538
|
+
/**
|
|
539
|
+
* Synthesize the per-pair lender key for a Silo v2 market.
|
|
540
|
+
*
|
|
541
|
+
* Mirrors `aaveV4SpokeLenderKey` and the Morpho `MORPHO_BLUE_<HEX>`
|
|
542
|
+
* convention so each Silo pair shows up as its own isolated lender —
|
|
543
|
+
* exactly like an Aave V4 spoke or a Morpho Blue market — without any
|
|
544
|
+
* Silo-specific routing logic in the rest of the codebase.
|
|
545
|
+
*
|
|
546
|
+
* Format: `SILO_V2_${siloConfigAddr.slice(2).toUpperCase()}`
|
|
547
|
+
*
|
|
548
|
+
* Keyed by `SiloConfig` rather than either silo because the config is the
|
|
549
|
+
* stable, shared identity of the pair (silo0/silo1 are derived from it).
|
|
550
|
+
*
|
|
551
|
+
* `isSiloV2Type()` works on this because it matches `startsWith('SILO_V2')`.
|
|
552
|
+
*/
|
|
553
|
+
export declare function siloV2LenderKey(siloConfig: string): string;
|
|
554
|
+
/**
|
|
555
|
+
* Inverse of `siloV2LenderKey`: given a per-pair lender key, return
|
|
556
|
+
* `{ siloConfigAddrLower }`. Returns `undefined` if the key isn't a per-pair
|
|
557
|
+
* Silo v2 key (e.g. someone passed the bare prefix `SILO_V2`).
|
|
558
|
+
*/
|
|
559
|
+
export declare function parseSiloV2LenderKey(lenderKey: string): {
|
|
560
|
+
siloConfigAddrLower: string;
|
|
561
|
+
} | undefined;
|
|
562
|
+
/**
|
|
563
|
+
* Look up a Silo v2 market entry by per-pair lender key.
|
|
564
|
+
* Returns `undefined` if no entry exists for that chain/config.
|
|
565
|
+
*/
|
|
566
|
+
export declare function getSiloV2MarketEntry(chainId: string, lenderKey: string): SiloMarketEntry | undefined;
|
|
567
|
+
/**
|
|
568
|
+
* Silo v3 per-pair lender key helpers.
|
|
569
|
+
*
|
|
570
|
+
* Silo v3 uses the exact same on-chain data model and metadata shape as v2
|
|
571
|
+
* (`SiloMarketEntry`/`SiloHalfStatic`) — only the deployment set, factory
|
|
572
|
+
* and indexer protocol tag differ — so v3 pairs get their own isolated
|
|
573
|
+
* lender token namespace (`SILO_V3_<HEX>`) and live in a separate
|
|
574
|
+
* `siloMarketsV3` registry slot. Keeping the two separate means a v2 and
|
|
575
|
+
* v3 pair with the same `SiloConfig` address could in principle coexist
|
|
576
|
+
* without clashing, and downstream consumers can filter by prefix.
|
|
577
|
+
*
|
|
578
|
+
* Format: `SILO_V3_${siloConfigAddr.slice(2).toUpperCase()}`
|
|
579
|
+
*/
|
|
580
|
+
export declare function siloV3LenderKey(siloConfig: string): string;
|
|
581
|
+
export declare function parseSiloV3LenderKey(lenderKey: string): {
|
|
582
|
+
siloConfigAddrLower: string;
|
|
583
|
+
} | undefined;
|
|
584
|
+
/**
|
|
585
|
+
* Look up a Silo v3 market entry by per-pair lender key.
|
|
586
|
+
* Returns `undefined` if no entry exists for that chain/config.
|
|
587
|
+
*/
|
|
588
|
+
export declare function getSiloV3MarketEntry(chainId: string, lenderKey: string): SiloMarketEntry | undefined;
|
|
401
589
|
export {};
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
2
|
+
"name": "@1delta/data-sdk",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.0.23",
|
|
8
|
+
"description": "Hold and initialize lending protocol data across a stack",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"dex"
|
|
14
|
+
],
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"module": "dist/index.mjs",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"dev": "tsup --watch",
|
|
22
|
+
"test": "vitest --run",
|
|
23
|
+
"coverage": "vitest run --coverage",
|
|
24
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"tsup": "^8.5.1",
|
|
28
|
+
"typescript": "^5.9.3"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20"
|
|
32
|
+
},
|
|
33
|
+
"prettier": {
|
|
34
|
+
"printWidth": 120,
|
|
35
|
+
"semi": false,
|
|
36
|
+
"singleQuote": true
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"import": "./dist/index.mjs",
|
|
43
|
+
"require": "./dist/index.js"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|