@1delta/data-sdk 0.0.43 → 0.0.45
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 +40 -0
- package/dist/index.mjs +35 -1
- package/dist/lending/aaveV4.d.ts +48 -0
- package/dist/lending/lista.d.ts +74 -0
- package/dist/lending/registry.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ var LENDER_DATA_DEFAULTS = () => ({
|
|
|
69
69
|
morphoBundler3: {},
|
|
70
70
|
initConfig: {},
|
|
71
71
|
listaNativeProvider: {},
|
|
72
|
+
listaCollateralProviders: {},
|
|
72
73
|
midnightConfig: {},
|
|
73
74
|
midnightMarkets: {},
|
|
74
75
|
termConfig: {},
|
|
@@ -175,6 +176,13 @@ function findAaveV4PositionManager(chainId, lenderKey, nameQuery) {
|
|
|
175
176
|
);
|
|
176
177
|
return hit?.address?.toLowerCase();
|
|
177
178
|
}
|
|
179
|
+
function getAaveV4SpokeAccess(chainId, lenderKey) {
|
|
180
|
+
return getAaveV4SpokeEntry(chainId, lenderKey)?.access;
|
|
181
|
+
}
|
|
182
|
+
function isAaveV4OperationRestricted(chainId, lenderKey, operation) {
|
|
183
|
+
const access = getAaveV4SpokeAccess(chainId, lenderKey);
|
|
184
|
+
return !!access?.restrictedOperations?.includes(operation);
|
|
185
|
+
}
|
|
178
186
|
function aaveV4SpokeLenderKey(spoke) {
|
|
179
187
|
if (!spoke || !spoke.startsWith("0x") || spoke.length !== 42) {
|
|
180
188
|
throw new Error(`aaveV4SpokeLenderKey: invalid spoke address ${spoke}`);
|
|
@@ -302,6 +310,32 @@ var initConfig = () => getGlobalData2()?.initConfig;
|
|
|
302
310
|
|
|
303
311
|
// src/lending/lista.ts
|
|
304
312
|
var listaNativeProvider = () => getGlobalData2()?.listaNativeProvider;
|
|
313
|
+
var listaCollateralProviders = () => getGlobalData2()?.listaCollateralProviders;
|
|
314
|
+
var listaCollateralProvider = (chainId, provider) => {
|
|
315
|
+
if (!provider) return void 0;
|
|
316
|
+
return listaCollateralProviders()?.[String(chainId)]?.[provider.toLowerCase()];
|
|
317
|
+
};
|
|
318
|
+
var listaSmartLpByCollateral = (chainId, collateralToken) => {
|
|
319
|
+
if (!collateralToken) return void 0;
|
|
320
|
+
const chain = listaCollateralProviders()?.[String(chainId)];
|
|
321
|
+
if (!chain) return void 0;
|
|
322
|
+
const needle = collateralToken.toLowerCase();
|
|
323
|
+
for (const [address, entry] of Object.entries(chain)) {
|
|
324
|
+
if (entry.kind !== "smart-lp") continue;
|
|
325
|
+
if (entry.collateralToken.toLowerCase() === needle) {
|
|
326
|
+
return { ...entry, address };
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return void 0;
|
|
330
|
+
};
|
|
331
|
+
var isListaSmartLpAsset = (entry, asset) => {
|
|
332
|
+
const needle = asset.toLowerCase();
|
|
333
|
+
if (entry.dexLp && entry.dexLp.toLowerCase() === needle) return true;
|
|
334
|
+
return (entry.coins ?? []).some(
|
|
335
|
+
(c) => c.address.toLowerCase() === needle || // the pool spells its native coin with the same 0xEeee… sentinel
|
|
336
|
+
c.isNative && needle === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
|
337
|
+
);
|
|
338
|
+
};
|
|
305
339
|
|
|
306
340
|
// src/lending/midnight.ts
|
|
307
341
|
var midnightConfig = () => getGlobalData2()?.midnightConfig;
|
|
@@ -937,6 +971,7 @@ exports.gearboxResolvers = gearboxResolvers;
|
|
|
937
971
|
exports.gearboxV3LenderKey = gearboxV3LenderKey;
|
|
938
972
|
exports.getAaveV4GatewayAddresses = getAaveV4GatewayAddresses;
|
|
939
973
|
exports.getAaveV4PositionManagers = getAaveV4PositionManagers;
|
|
974
|
+
exports.getAaveV4SpokeAccess = getAaveV4SpokeAccess;
|
|
940
975
|
exports.getAaveV4SpokeEntry = getAaveV4SpokeEntry;
|
|
941
976
|
exports.getAaveV4SpokePeripherals = getAaveV4SpokePeripherals;
|
|
942
977
|
exports.getChainEntries = getChainEntries;
|
|
@@ -951,6 +986,8 @@ exports.inverseConfigFor = inverseConfigFor;
|
|
|
951
986
|
exports.inverseLendersByChain = inverseLendersByChain;
|
|
952
987
|
exports.inverseMarketByAddress = inverseMarketByAddress;
|
|
953
988
|
exports.inverseMarkets = inverseMarkets;
|
|
989
|
+
exports.isAaveV4OperationRestricted = isAaveV4OperationRestricted;
|
|
990
|
+
exports.isListaSmartLpAsset = isListaSmartLpAsset;
|
|
954
991
|
exports.liquityBranchByIndex = liquityBranchByIndex;
|
|
955
992
|
exports.liquityBranchByTroveManager = liquityBranchByTroveManager;
|
|
956
993
|
exports.liquityBranchesByChain = liquityBranchesByChain;
|
|
@@ -958,7 +995,10 @@ exports.liquityConfig = liquityConfig;
|
|
|
958
995
|
exports.liquityConfigFor = liquityConfigFor;
|
|
959
996
|
exports.liquityLendersByChain = liquityLendersByChain;
|
|
960
997
|
exports.liquityMarkets = liquityMarkets;
|
|
998
|
+
exports.listaCollateralProvider = listaCollateralProvider;
|
|
999
|
+
exports.listaCollateralProviders = listaCollateralProviders;
|
|
961
1000
|
exports.listaNativeProvider = listaNativeProvider;
|
|
1001
|
+
exports.listaSmartLpByCollateral = listaSmartLpByCollateral;
|
|
962
1002
|
exports.llamaLendApiBaseUrl = llamaLendApiBaseUrl;
|
|
963
1003
|
exports.llamaLendChainData = llamaLendChainData;
|
|
964
1004
|
exports.llamaLendConfig = llamaLendConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -67,6 +67,7 @@ var LENDER_DATA_DEFAULTS = () => ({
|
|
|
67
67
|
morphoBundler3: {},
|
|
68
68
|
initConfig: {},
|
|
69
69
|
listaNativeProvider: {},
|
|
70
|
+
listaCollateralProviders: {},
|
|
70
71
|
midnightConfig: {},
|
|
71
72
|
midnightMarkets: {},
|
|
72
73
|
termConfig: {},
|
|
@@ -173,6 +174,13 @@ function findAaveV4PositionManager(chainId, lenderKey, nameQuery) {
|
|
|
173
174
|
);
|
|
174
175
|
return hit?.address?.toLowerCase();
|
|
175
176
|
}
|
|
177
|
+
function getAaveV4SpokeAccess(chainId, lenderKey) {
|
|
178
|
+
return getAaveV4SpokeEntry(chainId, lenderKey)?.access;
|
|
179
|
+
}
|
|
180
|
+
function isAaveV4OperationRestricted(chainId, lenderKey, operation) {
|
|
181
|
+
const access = getAaveV4SpokeAccess(chainId, lenderKey);
|
|
182
|
+
return !!access?.restrictedOperations?.includes(operation);
|
|
183
|
+
}
|
|
176
184
|
function aaveV4SpokeLenderKey(spoke) {
|
|
177
185
|
if (!spoke || !spoke.startsWith("0x") || spoke.length !== 42) {
|
|
178
186
|
throw new Error(`aaveV4SpokeLenderKey: invalid spoke address ${spoke}`);
|
|
@@ -300,6 +308,32 @@ var initConfig = () => getGlobalData2()?.initConfig;
|
|
|
300
308
|
|
|
301
309
|
// src/lending/lista.ts
|
|
302
310
|
var listaNativeProvider = () => getGlobalData2()?.listaNativeProvider;
|
|
311
|
+
var listaCollateralProviders = () => getGlobalData2()?.listaCollateralProviders;
|
|
312
|
+
var listaCollateralProvider = (chainId, provider) => {
|
|
313
|
+
if (!provider) return void 0;
|
|
314
|
+
return listaCollateralProviders()?.[String(chainId)]?.[provider.toLowerCase()];
|
|
315
|
+
};
|
|
316
|
+
var listaSmartLpByCollateral = (chainId, collateralToken) => {
|
|
317
|
+
if (!collateralToken) return void 0;
|
|
318
|
+
const chain = listaCollateralProviders()?.[String(chainId)];
|
|
319
|
+
if (!chain) return void 0;
|
|
320
|
+
const needle = collateralToken.toLowerCase();
|
|
321
|
+
for (const [address, entry] of Object.entries(chain)) {
|
|
322
|
+
if (entry.kind !== "smart-lp") continue;
|
|
323
|
+
if (entry.collateralToken.toLowerCase() === needle) {
|
|
324
|
+
return { ...entry, address };
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return void 0;
|
|
328
|
+
};
|
|
329
|
+
var isListaSmartLpAsset = (entry, asset) => {
|
|
330
|
+
const needle = asset.toLowerCase();
|
|
331
|
+
if (entry.dexLp && entry.dexLp.toLowerCase() === needle) return true;
|
|
332
|
+
return (entry.coins ?? []).some(
|
|
333
|
+
(c) => c.address.toLowerCase() === needle || // the pool spells its native coin with the same 0xEeee… sentinel
|
|
334
|
+
c.isNative && needle === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
|
335
|
+
);
|
|
336
|
+
};
|
|
303
337
|
|
|
304
338
|
// src/lending/midnight.ts
|
|
305
339
|
var midnightConfig = () => getGlobalData2()?.midnightConfig;
|
|
@@ -857,4 +891,4 @@ async function fetchMainTokensMap() {
|
|
|
857
891
|
return await data.json();
|
|
858
892
|
}
|
|
859
893
|
|
|
860
|
-
export { CURVANCE_MONAD_CONFIG, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, RESUPPLY_ETHEREUM_CONFIG, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chainLogoURI, chains, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, curvanceConfig, curvanceConfigFor, curvanceLendersByChain, curvancePositionManager, curvancePositionManagersFor, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, dssChainData, dssConfigFor, dssDebtJoin, dssDebtToken, dssMarketByIlk, eulerConfigs, eulerVaults, exactlyConfig, exactlyMarketByAddress, exactlyMarketByAsset, exactlyMarkets, exactlyMarketsByChain, fetchMainTokensMap, fetchTokenList, fetchTokenListFile, fetchTokenLists, findAaveV4PositionManager, fluidChains, fluidResolvers, fluidVaultEntries, fluidVaults, frankencoinChainData, frankencoinConfig, frankencoinConfigFor, frankencoinLendersByChain, frankencoinMarketByPosition, frankencoinMarkets, fraxlendConfig, fraxlendConfigFor, fraxlendLendersByChain, fraxlendPairKey, fraxlendPairsFor, gearboxAccountCompressor, gearboxAddressProviderV310, gearboxBotListV3, gearboxChains, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxResolvers, gearboxV3LenderKey, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, inverseChainData, inverseConfig, inverseConfigFor, inverseLendersByChain, inverseMarketByAddress, inverseMarkets, liquityBranchByIndex, liquityBranchByTroveManager, liquityBranchesByChain, liquityConfig, liquityConfigFor, liquityLendersByChain, liquityMarkets, listaNativeProvider, llamaLendApiBaseUrl, llamaLendChainData, llamaLendConfig, llamaLendConfigFor, llamaLendLenderKey, llamaLendLendersByChain, llamaLendLeverageZap, llamaLendMarketByController, llamaLendMarketByVault, llamaLendMarkets, llamaLendSupportsDelegation, llamaLendSupportsLeverage, midnightApiBaseOverride, midnightConfig, midnightMarketById, midnightMarkets, midnightMarketsByChain, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, resolveMidnightApiBase, resolveTermApiBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setTermApiBase, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey, skyChainData, skyConfig, skyConfigFor, skyLendersByChain, skyMarkets, tellerConfig, tellerConfigByChain, tellerPoolByAddress, tellerPools, tellerPoolsByChain, termApiBaseOverride, termConfig, termMarketById, termMarkets, termMarketsByChain, termMaxApiBaseUrl, termMaxChainIds, termMaxConfig, termMaxConfigByChain, termMaxLenderKey, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
|
|
894
|
+
export { CURVANCE_MONAD_CONFIG, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, RESUPPLY_ETHEREUM_CONFIG, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chainLogoURI, chains, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, curvanceConfig, curvanceConfigFor, curvanceLendersByChain, curvancePositionManager, curvancePositionManagersFor, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, dssChainData, dssConfigFor, dssDebtJoin, dssDebtToken, dssMarketByIlk, eulerConfigs, eulerVaults, exactlyConfig, exactlyMarketByAddress, exactlyMarketByAsset, exactlyMarkets, exactlyMarketsByChain, fetchMainTokensMap, fetchTokenList, fetchTokenListFile, fetchTokenLists, findAaveV4PositionManager, fluidChains, fluidResolvers, fluidVaultEntries, fluidVaults, frankencoinChainData, frankencoinConfig, frankencoinConfigFor, frankencoinLendersByChain, frankencoinMarketByPosition, frankencoinMarkets, fraxlendConfig, fraxlendConfigFor, fraxlendLendersByChain, fraxlendPairKey, fraxlendPairsFor, gearboxAccountCompressor, gearboxAddressProviderV310, gearboxBotListV3, gearboxChains, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxResolvers, gearboxV3LenderKey, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeAccess, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, inverseChainData, inverseConfig, inverseConfigFor, inverseLendersByChain, inverseMarketByAddress, inverseMarkets, isAaveV4OperationRestricted, isListaSmartLpAsset, liquityBranchByIndex, liquityBranchByTroveManager, liquityBranchesByChain, liquityConfig, liquityConfigFor, liquityLendersByChain, liquityMarkets, listaCollateralProvider, listaCollateralProviders, listaNativeProvider, listaSmartLpByCollateral, llamaLendApiBaseUrl, llamaLendChainData, llamaLendConfig, llamaLendConfigFor, llamaLendLenderKey, llamaLendLendersByChain, llamaLendLeverageZap, llamaLendMarketByController, llamaLendMarketByVault, llamaLendMarkets, llamaLendSupportsDelegation, llamaLendSupportsLeverage, midnightApiBaseOverride, midnightConfig, midnightMarketById, midnightMarkets, midnightMarketsByChain, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, resolveMidnightApiBase, resolveTermApiBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setTermApiBase, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey, skyChainData, skyConfig, skyConfigFor, skyLendersByChain, skyMarkets, tellerConfig, tellerConfigByChain, tellerPoolByAddress, tellerPools, tellerPoolsByChain, termApiBaseOverride, termConfig, termMarketById, termMarkets, termMarketsByChain, termMaxApiBaseUrl, termMaxChainIds, termMaxConfig, termMaxConfigByChain, termMaxLenderKey, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
|
package/dist/lending/aaveV4.d.ts
CHANGED
|
@@ -12,11 +12,44 @@ export type AaveV4ReserveEntry = {
|
|
|
12
12
|
oracle?: string;
|
|
13
13
|
oracleDecimals?: number;
|
|
14
14
|
};
|
|
15
|
+
/** A user-facing spoke operation a whitelabel variant may restrict. */
|
|
16
|
+
export type AaveV4RestrictedOperation = 'supply' | 'borrow' | 'withdraw' | 'repay';
|
|
17
|
+
export type AaveV4AccessGate = {
|
|
18
|
+
/** Contract answering the membership question. */
|
|
19
|
+
contract: string;
|
|
20
|
+
/** Solidity signature of the `(address) -> bool` membership check. */
|
|
21
|
+
check: string;
|
|
22
|
+
/** Human label for the allowed set, for API/UI copy. */
|
|
23
|
+
label: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Operation restrictions a spoke imposes BEYOND the stock V4 rules.
|
|
27
|
+
*
|
|
28
|
+
* Set by the `lender-metadata` access probe, which positively identifies a
|
|
29
|
+
* whitelabel spoke on-chain. ABSENT means the spoke behaves like a stock one.
|
|
30
|
+
*
|
|
31
|
+
* The distinction that matters: the stock `onlyPositionManager(onBehalfOf)`
|
|
32
|
+
* rule — which makes EVERY on-behalf op revert `Unauthorized()` without a
|
|
33
|
+
* user-approved PM — is protocol-wide and modelled by the position-manager
|
|
34
|
+
* layer, so it is deliberately NOT recorded here. This field carries only what
|
|
35
|
+
* a given deployment does differently, and it is about the OWNER of the
|
|
36
|
+
* position (`onBehalfOf`), not the caller.
|
|
37
|
+
*
|
|
38
|
+
* Today the only instance is ether.fi's Optimism spoke, whose `borrow` is
|
|
39
|
+
* restricted to ether.fi Cash Safes.
|
|
40
|
+
*/
|
|
41
|
+
export type AaveV4SpokeAccess = {
|
|
42
|
+
/** Ops NOT available to an arbitrary address acting FOR ITSELF. */
|
|
43
|
+
restrictedOperations: AaveV4RestrictedOperation[];
|
|
44
|
+
gate: AaveV4AccessGate;
|
|
45
|
+
};
|
|
15
46
|
export type AaveV4SpokeEntry = {
|
|
16
47
|
spoke: string;
|
|
17
48
|
oracle: string;
|
|
18
49
|
label: string;
|
|
19
50
|
dynamicConfigKeyMax?: number;
|
|
51
|
+
/** Present only when the spoke restricts an op — see `AaveV4SpokeAccess`. */
|
|
52
|
+
access?: AaveV4SpokeAccess;
|
|
20
53
|
/**
|
|
21
54
|
* UI/grouping hint only (`AAVE_V4_CORE` / `AAVE_V4_PLUS` / `AAVE_V4_PRIME`).
|
|
22
55
|
* NOT used for routing or lender keying.
|
|
@@ -136,6 +169,21 @@ export declare function getAaveV4PositionManagers(chainId: string, lenderKey: st
|
|
|
136
169
|
* without hardcoding the addresses.
|
|
137
170
|
*/
|
|
138
171
|
export declare function findAaveV4PositionManager(chainId: string, lenderKey: string, nameQuery: string): string | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Access restrictions for a per-spoke V4 lender key, or `undefined` when the
|
|
174
|
+
* spoke behaves like a stock one.
|
|
175
|
+
*/
|
|
176
|
+
export declare function getAaveV4SpokeAccess(chainId: string, lenderKey: string): AaveV4SpokeAccess | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Is `operation` restricted to an allowlist on this spoke?
|
|
179
|
+
*
|
|
180
|
+
* Answers the MARKET-level question only — whether a gate exists at all. It
|
|
181
|
+
* cannot say whether a given address passes it; that needs an on-chain call to
|
|
182
|
+
* `access.gate.contract` with `access.gate.check`. Callers that have no user in
|
|
183
|
+
* hand (quotes, listings) should treat `true` as "not available by default" and
|
|
184
|
+
* say so, rather than building a transaction that reverts on-chain.
|
|
185
|
+
*/
|
|
186
|
+
export declare function isAaveV4OperationRestricted(chainId: string, lenderKey: string, operation: AaveV4RestrictedOperation): boolean;
|
|
139
187
|
/**
|
|
140
188
|
* Synthesize the per-spoke lender key for an Aave V4 spoke.
|
|
141
189
|
*
|
package/dist/lending/lista.d.ts
CHANGED
|
@@ -4,3 +4,77 @@ export type ListaNativeProviderType = {
|
|
|
4
4
|
};
|
|
5
5
|
};
|
|
6
6
|
export declare const listaNativeProvider: () => ListaNativeProviderType;
|
|
7
|
+
/**
|
|
8
|
+
* SHAPE of a per-market Lista collateral provider.
|
|
9
|
+
*
|
|
10
|
+
* Moolah gates collateral behind `providers(id, collateralToken)`: when it is
|
|
11
|
+
* non-zero, only that contract may `supplyCollateral` / `withdrawCollateral`
|
|
12
|
+
* (and on withdraw the receiver must be the provider itself). Two INCOMPATIBLE
|
|
13
|
+
* shapes are deployed and nothing on-chain announces which one an address is:
|
|
14
|
+
*
|
|
15
|
+
* - `erc20` — forwards Moolah's own selectors verbatim and takes the
|
|
16
|
+
* collateral token itself (the slisBNB provider).
|
|
17
|
+
* - `native` — the chain-level provider from `listaNativeProvider()`: same
|
|
18
|
+
* selectors plus WBNB/WETH-native variants.
|
|
19
|
+
* - `smart-lp` — Lista's `SmartProvider`. A DIFFERENT ABI: it zaps a two-coin
|
|
20
|
+
* StableSwap pool, so the inputs are the POOL COINS, not the
|
|
21
|
+
* collateral token — which is `onlyMoolah`-transferable and can
|
|
22
|
+
* never be held or approved by a user.
|
|
23
|
+
*
|
|
24
|
+
* Encoding one shape for the other calls a selector the contract does not
|
|
25
|
+
* implement, i.e. an empty revert. Callers therefore resolve the shape here and
|
|
26
|
+
* must FAIL CLOSED on a provider that is absent.
|
|
27
|
+
*/
|
|
28
|
+
export type ListaCollateralProviderKind = 'erc20' | 'native' | 'smart-lp';
|
|
29
|
+
export type ListaSmartLpCoin = {
|
|
30
|
+
address: string;
|
|
31
|
+
symbol: string;
|
|
32
|
+
decimals: number;
|
|
33
|
+
/** the pool holds the chain's native coin behind the 0xEeee… sentinel */
|
|
34
|
+
isNative: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type ListaCollateralProvider = {
|
|
37
|
+
kind: ListaCollateralProviderKind;
|
|
38
|
+
collateralToken: string;
|
|
39
|
+
collateralSymbol: string;
|
|
40
|
+
collateralDecimals: number;
|
|
41
|
+
/** `smart-lp` only — the StableSwap pool the provider zaps through */
|
|
42
|
+
dex?: string;
|
|
43
|
+
/** `smart-lp` only — the pool's info/quoting contract */
|
|
44
|
+
dexInfo?: string;
|
|
45
|
+
/** `smart-lp` only — the pool's LP token (1:1 with the collateral receipt) */
|
|
46
|
+
dexLp?: string;
|
|
47
|
+
/**
|
|
48
|
+
* `smart-lp` only — pool coin order, which comes from `dex.coins(i)` and
|
|
49
|
+
* NOT from the collateral symbol: "USDT & USDe-SmartLP" is `[USDe, USDT]`.
|
|
50
|
+
*/
|
|
51
|
+
coins?: [ListaSmartLpCoin, ListaSmartLpCoin];
|
|
52
|
+
};
|
|
53
|
+
/** chainId -> provider address (lowercase) -> shape */
|
|
54
|
+
export type ListaCollateralProvidersType = {
|
|
55
|
+
[chainId: string]: {
|
|
56
|
+
[provider: string]: ListaCollateralProvider;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export declare const listaCollateralProviders: () => ListaCollateralProvidersType;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a provider address (as returned live by the Lista lens on
|
|
62
|
+
* `params.market.collateralProvider`) to its shape. `undefined` means the
|
|
63
|
+
* roster has never seen it — treat that as UNSUPPORTED, never as
|
|
64
|
+
* "assume Morpho-shaped".
|
|
65
|
+
*/
|
|
66
|
+
export declare const listaCollateralProvider: (chainId: string | number, provider: string | undefined) => ListaCollateralProvider | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Reverse lookup: the SmartLP provider serving a given collateral token, with
|
|
69
|
+
* its own address folded in.
|
|
70
|
+
*
|
|
71
|
+
* Callers that hold a market's `collateralProvider` should use
|
|
72
|
+
* {@link listaCollateralProvider} — it is authoritative. This exists for the
|
|
73
|
+
* paths that only know the ASSET (routing decisions taken before market data
|
|
74
|
+
* is fetched, e.g. "can the direct route pay this market with USDT?").
|
|
75
|
+
*/
|
|
76
|
+
export declare const listaSmartLpByCollateral: (chainId: string | number, collateralToken: string | undefined) => (ListaCollateralProvider & {
|
|
77
|
+
address: string;
|
|
78
|
+
}) | undefined;
|
|
79
|
+
/** Is `asset` one of the provider's two pool coins, or its LP token? */
|
|
80
|
+
export declare const isListaSmartLpAsset: (entry: ListaCollateralProvider, asset: string) => boolean;
|
|
@@ -33,7 +33,7 @@ import type { FrankencoinConfigType, FrankencoinMarketsType } from './frankencoi
|
|
|
33
33
|
import type { GearboxResolversType } from './gearbox';
|
|
34
34
|
import type { InitConfigType } from './initProtocol';
|
|
35
35
|
import type { InverseConfigType, InverseMarketsType } from './inverse';
|
|
36
|
-
import type { ListaNativeProviderType } from './lista';
|
|
36
|
+
import type { ListaCollateralProvidersType, ListaNativeProviderType } from './lista';
|
|
37
37
|
import type { LiquityConfigType, LiquityMarketsType } from './liquity';
|
|
38
38
|
import type { LlamaLendConfigType, LlamaLendMarketsType } from './llamalend';
|
|
39
39
|
import type { MidnightConfigType, MidnightMarketsType } from './midnight';
|
|
@@ -79,6 +79,7 @@ export interface GlobalLenderDataRegistry {
|
|
|
79
79
|
morphoBundler3: MorphoBundler3Type;
|
|
80
80
|
initConfig: InitConfigType;
|
|
81
81
|
listaNativeProvider: ListaNativeProviderType;
|
|
82
|
+
listaCollateralProviders: ListaCollateralProvidersType;
|
|
82
83
|
midnightConfig: MidnightConfigType;
|
|
83
84
|
midnightMarkets: MidnightMarketsType;
|
|
84
85
|
termConfig: TermConfigType;
|