@1delta/margin-fetcher 0.0.35 → 0.0.36
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/abis/morpho/lens.d.ts +38 -15
- package/dist/abis/morpho/lens.d.ts.map +1 -1
- package/dist/abis/morpho/lens.js +30 -20
- package/dist/flash-liquidity/assets.d.ts +2 -2
- package/dist/flash-liquidity/assets.d.ts.map +1 -1
- package/dist/flash-liquidity/assets.js +2 -2
- package/dist/flash-liquidity/fetchLiquidity.d.ts.map +1 -1
- package/dist/flash-liquidity/fetchLiquidity.js +2 -2
- package/dist/lending/fetchLender.d.ts.map +1 -1
- package/dist/lending/fetchLender.js +24 -5
- package/dist/lending/fetchLenderAll.d.ts.map +1 -1
- package/dist/lending/fetchLenderAll.js +15 -3
- package/dist/lending/morpho/chainsConfigs.d.ts +21 -0
- package/dist/lending/morpho/chainsConfigs.d.ts.map +1 -0
- package/dist/lending/morpho/chainsConfigs.js +234 -0
- package/dist/lending/morpho/constants/markets.d.ts +4 -0
- package/dist/lending/morpho/constants/markets.d.ts.map +1 -0
- package/dist/lending/morpho/constants/markets.js +63 -0
- package/dist/lending/morpho/convertPublic.d.ts.map +1 -1
- package/dist/lending/morpho/convertPublic.js +2 -13
- package/dist/lending/morpho/getMarketsFromChain.d.ts +8 -0
- package/dist/lending/morpho/getMarketsFromChain.d.ts.map +1 -0
- package/dist/lending/morpho/getMarketsFromChain.js +318 -0
- package/dist/lending/morpho/publicCallBuild.d.ts +5 -0
- package/dist/lending/morpho/publicCallBuild.d.ts.map +1 -1
- package/dist/lending/morpho/publicCallBuild.js +16 -0
- package/dist/lending/morpho/utils/evmParser.d.ts +22 -0
- package/dist/lending/morpho/utils/evmParser.d.ts.map +1 -0
- package/dist/lending/morpho/utils/evmParser.js +103 -0
- package/dist/lending/morpho/utils/mathLib.d.ts +125 -0
- package/dist/lending/morpho/utils/mathLib.d.ts.map +1 -0
- package/dist/lending/morpho/utils/mathLib.js +334 -0
- package/dist/lending/morpho/utils/parsers.d.ts +10 -0
- package/dist/lending/morpho/utils/parsers.d.ts.map +1 -0
- package/dist/lending/morpho/utils/parsers.js +37 -0
- package/dist/lending/user-data/abis.d.ts +37 -14
- package/dist/lending/user-data/abis.d.ts.map +1 -1
- package/dist/lending/user-data/morpho/userCallBuild.d.ts +3 -0
- package/dist/lending/user-data/morpho/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/morpho/userCallBuild.js +9 -8
- package/dist/lending-pairs/computeLendingPairs.d.ts.map +1 -1
- package/dist/lending-pairs/computeLendingPairs.js +11 -7
- package/dist/prices/main-prices/fetchOracleData.d.ts +0 -2
- package/dist/prices/main-prices/fetchOracleData.d.ts.map +1 -1
- package/dist/prices/main-prices/fetchOracleData.js +2 -22
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -5
- package/dist/utils/parsing.d.ts +2 -0
- package/dist/utils/parsing.d.ts.map +1 -1
- package/dist/utils/parsing.js +20 -0
- package/package.json +1 -1
- package/src/abis/morpho/lens.ts +40 -30
- package/src/flash-liquidity/assets.ts +3 -2
- package/src/flash-liquidity/fetchLiquidity.ts +3 -2
- package/src/lending/fetchLender.ts +29 -4
- package/src/lending/fetchLenderAll.ts +32 -12
- package/src/lending/morpho/chainsConfigs.ts +268 -0
- package/src/lending/morpho/constants/markets.ts +64 -0
- package/src/lending/morpho/convertPublic.ts +2 -14
- package/src/lending/morpho/getMarketsFromChain.ts +402 -0
- package/src/lending/morpho/publicCallBuild.ts +17 -0
- package/src/lending/morpho/utils/evmParser.ts +122 -0
- package/src/lending/morpho/utils/mathLib.ts +434 -0
- package/src/lending/morpho/utils/parsers.ts +53 -0
- package/src/lending/user-data/morpho/userCallBuild.ts +9 -8
- package/src/lending-pairs/computeLendingPairs.ts +15 -10
- package/src/prices/main-prices/fetchOracleData.ts +2 -34
- package/src/utils/index.ts +3 -4
- package/src/utils/parsing.ts +32 -0
- package/test/lenderData.test.ts +1 -1
- package/test/mbChain.test.ts +44 -0
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import { formatUnits } from 'viem';
|
|
2
1
|
import { apyToApr } from '../user-data/utils';
|
|
3
|
-
|
|
4
|
-
let str = 0;
|
|
5
|
-
try {
|
|
6
|
-
str = Number(formatUnits(BigInt(ltv), 18));
|
|
7
|
-
}
|
|
8
|
-
catch (e) { }
|
|
9
|
-
return str;
|
|
10
|
-
}
|
|
11
|
-
function formatNr(n, d) {
|
|
12
|
-
return Number(formatUnits(BigInt(n ?? 0), d));
|
|
13
|
-
}
|
|
2
|
+
import { formatNr, parseLtv } from './utils/parsers';
|
|
14
3
|
export function convertMarketsToMorphoResponse(response, chainId, additionalYields = {
|
|
15
4
|
intrinsicYields: {},
|
|
16
5
|
lenderRewards: {},
|
|
@@ -80,7 +69,7 @@ export function convertMarketsToMorphoResponse(response, chainId, additionalYiel
|
|
|
80
69
|
totalDeposits: formatNr(state.collateralAssets, collateralAsset.decimals),
|
|
81
70
|
totalDebtStable: 0,
|
|
82
71
|
totalDebt: 0,
|
|
83
|
-
totalLiquidity:
|
|
72
|
+
totalLiquidity: formatNr(state.collateralAssets, collateralAsset.decimals),
|
|
84
73
|
totalLiquidityUSD: Number(state.collateralAssetsUsd),
|
|
85
74
|
totalDepositsUSD: Number(state.collateralAssetsUsd),
|
|
86
75
|
totalDebtStableUSD: 0,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AdditionalYields } from '../../types';
|
|
2
|
+
import { GenericTokenList } from '../types';
|
|
3
|
+
import { MorphoGeneralPublicResponse } from './types';
|
|
4
|
+
export declare function getMarkets(chainId: string, markets: string[], additionalYields: AdditionalYields | undefined, tokens: GenericTokenList | undefined, prices: any): Promise<never[] | {
|
|
5
|
+
[m: string]: MorphoGeneralPublicResponse;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function getMorphoMarketDataConverter(lender: string, chainId: string, prices: any, additionalYields?: AdditionalYields, tokens?: GenericTokenList): [(data: any[]) => any | undefined, number];
|
|
8
|
+
//# sourceMappingURL=getMarketsFromChain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMarketsFromChain.d.ts","sourceRoot":"","sources":["../../../src/lending/morpho/getMarketsFromChain.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAOrD,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EAAE,EACjB,gBAAgB,EAAE,gBAAgB,YAIjC,EACD,MAAM,EAAE,gBAAgB,YAAK,EAC7B,MAAM,EAAE,GAAG;;GAwLZ;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,GAAG,EACX,gBAAgB,GAAE,gBAIjB,EACD,MAAM,GAAE,gBAAqB,GAC5B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,SAAS,EAAE,MAAM,CAAC,CAqL5C"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { morphoPools } from '@1delta/data-sdk';
|
|
2
|
+
import { getEvmClient } from '@1delta/providers';
|
|
3
|
+
import { formatEther, parseAbi } from 'viem';
|
|
4
|
+
import { MORPHO_LENS } from '../user-data/morpho/userCallBuild';
|
|
5
|
+
import { decodeMarkets } from './utils/evmParser';
|
|
6
|
+
import { formatNr, parseLtv } from './utils/parsers';
|
|
7
|
+
import { toGenericPriceKey, toOracleKey } from '../../assets';
|
|
8
|
+
import { MathLib } from './utils/mathLib';
|
|
9
|
+
import { apyToApr } from '../user-data/utils';
|
|
10
|
+
import { formatMorphoPrice } from '../../utils/parsing';
|
|
11
|
+
import { MORPHO_MARKETS } from './constants/markets';
|
|
12
|
+
export async function getMarkets(chainId, markets, additionalYields = {
|
|
13
|
+
intrinsicYields: {},
|
|
14
|
+
lenderRewards: {},
|
|
15
|
+
loaded: true,
|
|
16
|
+
}, tokens = {}, prices) {
|
|
17
|
+
const abi = parseAbi([
|
|
18
|
+
'function getMarketDataCompact(address morpho, bytes32[] calldata marketsIds) external view returns (bytes memory data)',
|
|
19
|
+
]);
|
|
20
|
+
const provider = getEvmClient(chainId);
|
|
21
|
+
const mb = morphoPools()?.MORPHO_BLUE?.[chainId];
|
|
22
|
+
if (!mb)
|
|
23
|
+
return [];
|
|
24
|
+
const returnData = await provider.simulateContract({
|
|
25
|
+
abi,
|
|
26
|
+
functionName: 'getMarketDataCompact',
|
|
27
|
+
address: MORPHO_LENS[chainId],
|
|
28
|
+
args: [mb, markets],
|
|
29
|
+
});
|
|
30
|
+
const decoded = decodeMarkets(returnData.result ?? '0x');
|
|
31
|
+
const data = {};
|
|
32
|
+
decoded.forEach((market, i) => {
|
|
33
|
+
const uniqueKey = markets[i];
|
|
34
|
+
const { lltv, irm, oracle, loanToken, collateralToken, ...state } = market;
|
|
35
|
+
if (collateralToken && loanToken && oracle) {
|
|
36
|
+
const m = 'MORPHO_BLUE_' + uniqueKey.slice(2).toUpperCase();
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
if (!data[m])
|
|
39
|
+
data[m] = { data: {} };
|
|
40
|
+
// 1. LOAN asset entry
|
|
41
|
+
const loanRewards = {};
|
|
42
|
+
// state.rewards?.forEach((reward) => {
|
|
43
|
+
// loanRewards[reward.asset.address] = {
|
|
44
|
+
// depositRate: formatNr(reward.amountPerSuppliedToken, reward.asset.decimals),
|
|
45
|
+
// variableBorrowRate: formatNr(reward.amountPerBorrowedToken, reward.asset.decimals),
|
|
46
|
+
// stableBorrowRate: 0,
|
|
47
|
+
// }
|
|
48
|
+
// })
|
|
49
|
+
// get assets from list
|
|
50
|
+
const loanAsset = tokens[loanToken.toLowerCase()];
|
|
51
|
+
const collateralAsset = tokens[collateralToken.toLowerCase()];
|
|
52
|
+
const loanKey = toOracleKey(loanAsset?.assetGroup) ??
|
|
53
|
+
toGenericPriceKey(loanAsset.address, chainId);
|
|
54
|
+
let loanPrice = prices[loanKey];
|
|
55
|
+
// try to infer loan price from collateral price if any
|
|
56
|
+
if (!loanPrice) {
|
|
57
|
+
const collateralKey = toOracleKey(collateralAsset?.assetGroup) ??
|
|
58
|
+
toGenericPriceKey(collateralAsset.address, chainId);
|
|
59
|
+
const collateralPrice = prices[collateralKey];
|
|
60
|
+
// get debt price by collateral price
|
|
61
|
+
if (collateralPrice) {
|
|
62
|
+
const priceDebtToCollateral = formatMorphoPrice(state.price.toString(), loanAsset.decimals, collateralAsset.decimals);
|
|
63
|
+
loanPrice = collateralPrice / priceDebtToCollateral;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const loanTokenAddress = loanAsset.address.toLowerCase();
|
|
67
|
+
const meta = tokens[loanTokenAddress] ?? loanAsset;
|
|
68
|
+
const totalDeposits = formatNr(state.totalSupplyAssets, loanAsset.decimals);
|
|
69
|
+
const totalDebt = formatNr(state.totalBorrowAssets, loanAsset.decimals);
|
|
70
|
+
const utilization = MathLib.getUtilization({
|
|
71
|
+
totalBorrowAssets: state.totalBorrowAssets,
|
|
72
|
+
totalSupplyAssets: state.totalSupplyAssets,
|
|
73
|
+
});
|
|
74
|
+
let borrowApy = 0n;
|
|
75
|
+
let supplyApy = 0n;
|
|
76
|
+
try {
|
|
77
|
+
borrowApy = MathLib.getBorrowApy(state.rateAtTarget, utilization, undefined, Number(state.lastUpdate));
|
|
78
|
+
supplyApy = MathLib.getSupplyApy(borrowApy, utilization, state.fee);
|
|
79
|
+
}
|
|
80
|
+
catch { }
|
|
81
|
+
const borrowApr = apyToApr(Number(formatEther(borrowApy))) * 100;
|
|
82
|
+
const depositApr = apyToApr(Number(formatEther(supplyApy))) * 100;
|
|
83
|
+
data[m].data[loanTokenAddress] = {
|
|
84
|
+
poolId: loanTokenAddress,
|
|
85
|
+
underlying: loanTokenAddress,
|
|
86
|
+
asset: meta,
|
|
87
|
+
totalDeposits,
|
|
88
|
+
totalDebtStable: 0,
|
|
89
|
+
totalDebt,
|
|
90
|
+
totalDepositsUSD: totalDeposits * loanPrice,
|
|
91
|
+
totalDebtStableUSD: 0,
|
|
92
|
+
totalLiquidity: totalDeposits - totalDebt,
|
|
93
|
+
totalLiquidityUSD: (totalDeposits - totalDebt) * loanPrice,
|
|
94
|
+
totalDebtUSD: totalDebt * loanPrice,
|
|
95
|
+
depositRate: depositApr,
|
|
96
|
+
variableBorrowRate: borrowApr,
|
|
97
|
+
stableBorrowRate: 0,
|
|
98
|
+
stakingYield: additionalYields.intrinsicYields[meta?.assetGroup] ?? 0,
|
|
99
|
+
rewards: Object.keys(loanRewards).length > 0 ? loanRewards : undefined,
|
|
100
|
+
decimals: loanAsset.decimals,
|
|
101
|
+
config: {
|
|
102
|
+
0: {
|
|
103
|
+
category: 0,
|
|
104
|
+
borrowCollateralFactor: 0,
|
|
105
|
+
collateralFactor: 0,
|
|
106
|
+
borrowFactor: 1,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
collateralActive: false,
|
|
110
|
+
borrowingEnabled: true,
|
|
111
|
+
hasStable: false,
|
|
112
|
+
isActive: true,
|
|
113
|
+
isFrozen: false,
|
|
114
|
+
};
|
|
115
|
+
const ltv = parseLtv(lltv);
|
|
116
|
+
const collateralAssetAddress = collateralAsset.address.toLowerCase();
|
|
117
|
+
const metaCollateral = tokens[collateralAssetAddress] ?? collateralAsset;
|
|
118
|
+
// 2. COLLATERAL asset entry
|
|
119
|
+
data[m].data[collateralAssetAddress] = {
|
|
120
|
+
poolId: collateralAssetAddress,
|
|
121
|
+
underlying: collateralAssetAddress,
|
|
122
|
+
asset: metaCollateral,
|
|
123
|
+
totalDeposits: 0, // we do not have these metrics when querying on-chain
|
|
124
|
+
totalDebtStable: 0,
|
|
125
|
+
totalDebt: 0,
|
|
126
|
+
totalLiquidity: 0,
|
|
127
|
+
totalLiquidityUSD: 0,
|
|
128
|
+
totalDepositsUSD: 0,
|
|
129
|
+
totalDebtStableUSD: 0,
|
|
130
|
+
totalDebtUSD: 0,
|
|
131
|
+
depositRate: 0,
|
|
132
|
+
variableBorrowRate: 0,
|
|
133
|
+
stableBorrowRate: 0,
|
|
134
|
+
stakingYield: additionalYields.intrinsicYields[metaCollateral?.assetGroup] ?? 0,
|
|
135
|
+
rewards: undefined,
|
|
136
|
+
decimals: collateralAsset.decimals,
|
|
137
|
+
config: {
|
|
138
|
+
0: {
|
|
139
|
+
category: 0,
|
|
140
|
+
borrowCollateralFactor: ltv,
|
|
141
|
+
collateralFactor: ltv,
|
|
142
|
+
borrowFactor: 1,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
collateralActive: true,
|
|
146
|
+
borrowingEnabled: false,
|
|
147
|
+
hasStable: false,
|
|
148
|
+
isActive: true,
|
|
149
|
+
isFrozen: false,
|
|
150
|
+
};
|
|
151
|
+
data[m].params = {
|
|
152
|
+
market: {
|
|
153
|
+
lender: m,
|
|
154
|
+
collateralDecimals: collateralAsset.decimals,
|
|
155
|
+
loanDecimals: loanAsset.decimals,
|
|
156
|
+
id: uniqueKey,
|
|
157
|
+
lltv: lltv.toString(),
|
|
158
|
+
oracle: oracle,
|
|
159
|
+
irm: irm,
|
|
160
|
+
collateralAddress: collateralAssetAddress,
|
|
161
|
+
loanAddress: loanTokenAddress,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
data[m].chainId = chainId;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return data;
|
|
168
|
+
}
|
|
169
|
+
export function getMorphoMarketDataConverter(lender, chainId, prices, additionalYields = {
|
|
170
|
+
intrinsicYields: {},
|
|
171
|
+
lenderRewards: {},
|
|
172
|
+
loaded: true,
|
|
173
|
+
}, tokens = {}) {
|
|
174
|
+
const markets = MORPHO_MARKETS[chainId] ?? [];
|
|
175
|
+
return [
|
|
176
|
+
(rData) => {
|
|
177
|
+
const decoded = decodeMarkets(rData[0] ?? '0x');
|
|
178
|
+
const data = {};
|
|
179
|
+
decoded.forEach((market, i) => {
|
|
180
|
+
const uniqueKey = markets[i];
|
|
181
|
+
const { lltv, irm, oracle, loanToken, collateralToken, ...state } = market;
|
|
182
|
+
if (collateralToken && loanToken && oracle) {
|
|
183
|
+
const m = 'MORPHO_BLUE_' + uniqueKey.slice(2).toUpperCase();
|
|
184
|
+
// @ts-ignore
|
|
185
|
+
if (!data[m])
|
|
186
|
+
data[m] = { data: {} };
|
|
187
|
+
// 1. LOAN asset entry
|
|
188
|
+
const loanRewards = {};
|
|
189
|
+
// state.rewards?.forEach((reward) => {
|
|
190
|
+
// loanRewards[reward.asset.address] = {
|
|
191
|
+
// depositRate: formatNr(reward.amountPerSuppliedToken, reward.asset.decimals),
|
|
192
|
+
// variableBorrowRate: formatNr(reward.amountPerBorrowedToken, reward.asset.decimals),
|
|
193
|
+
// stableBorrowRate: 0,
|
|
194
|
+
// }
|
|
195
|
+
// })
|
|
196
|
+
// get assets from list
|
|
197
|
+
const loanAsset = tokens[loanToken.toLowerCase()];
|
|
198
|
+
const collateralAsset = tokens[collateralToken.toLowerCase()];
|
|
199
|
+
const loanKey = toOracleKey(loanAsset?.assetGroup) ??
|
|
200
|
+
toGenericPriceKey(loanAsset.address, chainId);
|
|
201
|
+
let loanPrice = prices[loanKey];
|
|
202
|
+
// try to infer loan price from collateral price if any
|
|
203
|
+
if (!loanPrice) {
|
|
204
|
+
const collateralKey = toOracleKey(collateralAsset?.assetGroup) ??
|
|
205
|
+
toGenericPriceKey(collateralAsset.address, chainId);
|
|
206
|
+
const collateralPrice = prices[collateralKey];
|
|
207
|
+
// get debt price by collateral price
|
|
208
|
+
if (collateralPrice) {
|
|
209
|
+
const priceDebtToCollateral = formatMorphoPrice(state.price.toString(), loanAsset.decimals, collateralAsset.decimals);
|
|
210
|
+
loanPrice = collateralPrice / priceDebtToCollateral;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const loanTokenAddress = loanAsset.address.toLowerCase();
|
|
214
|
+
const meta = tokens[loanTokenAddress] ?? loanAsset;
|
|
215
|
+
const totalDeposits = formatNr(state.totalSupplyAssets, loanAsset.decimals);
|
|
216
|
+
const totalDebt = formatNr(state.totalBorrowAssets, loanAsset.decimals);
|
|
217
|
+
const utilization = MathLib.getUtilization({
|
|
218
|
+
totalBorrowAssets: state.totalBorrowAssets,
|
|
219
|
+
totalSupplyAssets: state.totalSupplyAssets,
|
|
220
|
+
});
|
|
221
|
+
let borrowApy = 0n;
|
|
222
|
+
let supplyApy = 0n;
|
|
223
|
+
try {
|
|
224
|
+
borrowApy = MathLib.getBorrowApy(state.rateAtTarget, utilization, undefined, Number(state.lastUpdate));
|
|
225
|
+
supplyApy = MathLib.getSupplyApy(borrowApy, utilization, state.fee);
|
|
226
|
+
}
|
|
227
|
+
catch { }
|
|
228
|
+
const borrowApr = apyToApr(Number(formatEther(borrowApy))) * 100;
|
|
229
|
+
const depositApr = apyToApr(Number(formatEther(supplyApy))) * 100;
|
|
230
|
+
data[m].data[loanTokenAddress] = {
|
|
231
|
+
poolId: loanTokenAddress,
|
|
232
|
+
underlying: loanTokenAddress,
|
|
233
|
+
asset: meta,
|
|
234
|
+
totalDeposits,
|
|
235
|
+
totalDebtStable: 0,
|
|
236
|
+
totalDebt,
|
|
237
|
+
totalDepositsUSD: totalDeposits * loanPrice,
|
|
238
|
+
totalDebtStableUSD: 0,
|
|
239
|
+
totalLiquidity: totalDeposits - totalDebt,
|
|
240
|
+
totalLiquidityUSD: (totalDeposits - totalDebt) * loanPrice,
|
|
241
|
+
totalDebtUSD: totalDebt * loanPrice,
|
|
242
|
+
depositRate: depositApr,
|
|
243
|
+
variableBorrowRate: borrowApr,
|
|
244
|
+
stableBorrowRate: 0,
|
|
245
|
+
stakingYield: additionalYields.intrinsicYields[meta?.assetGroup] ?? 0,
|
|
246
|
+
rewards: Object.keys(loanRewards).length > 0 ? loanRewards : undefined,
|
|
247
|
+
decimals: loanAsset.decimals,
|
|
248
|
+
config: {
|
|
249
|
+
0: {
|
|
250
|
+
category: 0,
|
|
251
|
+
borrowCollateralFactor: 0,
|
|
252
|
+
collateralFactor: 0,
|
|
253
|
+
borrowFactor: 1,
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
collateralActive: false,
|
|
257
|
+
borrowingEnabled: true,
|
|
258
|
+
hasStable: false,
|
|
259
|
+
isActive: true,
|
|
260
|
+
isFrozen: false,
|
|
261
|
+
};
|
|
262
|
+
const ltv = parseLtv(lltv);
|
|
263
|
+
const collateralAssetAddress = collateralAsset.address.toLowerCase();
|
|
264
|
+
const metaCollateral = tokens[collateralAssetAddress] ?? collateralAsset;
|
|
265
|
+
// 2. COLLATERAL asset entry
|
|
266
|
+
data[m].data[collateralAssetAddress] = {
|
|
267
|
+
poolId: collateralAssetAddress,
|
|
268
|
+
underlying: collateralAssetAddress,
|
|
269
|
+
asset: metaCollateral,
|
|
270
|
+
totalDeposits: 0, // we do not have these metrics when querying on-chain
|
|
271
|
+
totalDebtStable: 0,
|
|
272
|
+
totalDebt: 0,
|
|
273
|
+
totalLiquidity: 0,
|
|
274
|
+
totalLiquidityUSD: 0,
|
|
275
|
+
totalDepositsUSD: 0,
|
|
276
|
+
totalDebtStableUSD: 0,
|
|
277
|
+
totalDebtUSD: 0,
|
|
278
|
+
depositRate: 0,
|
|
279
|
+
variableBorrowRate: 0,
|
|
280
|
+
stableBorrowRate: 0,
|
|
281
|
+
stakingYield: additionalYields.intrinsicYields[metaCollateral?.assetGroup] ?? 0,
|
|
282
|
+
rewards: undefined,
|
|
283
|
+
decimals: collateralAsset.decimals,
|
|
284
|
+
config: {
|
|
285
|
+
0: {
|
|
286
|
+
category: 0,
|
|
287
|
+
borrowCollateralFactor: ltv,
|
|
288
|
+
collateralFactor: ltv,
|
|
289
|
+
borrowFactor: 1,
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
collateralActive: true,
|
|
293
|
+
borrowingEnabled: false,
|
|
294
|
+
hasStable: false,
|
|
295
|
+
isActive: true,
|
|
296
|
+
isFrozen: false,
|
|
297
|
+
};
|
|
298
|
+
data[m].params = {
|
|
299
|
+
market: {
|
|
300
|
+
lender: m,
|
|
301
|
+
collateralDecimals: collateralAsset.decimals,
|
|
302
|
+
loanDecimals: loanAsset.decimals,
|
|
303
|
+
id: uniqueKey,
|
|
304
|
+
lltv: lltv.toString(),
|
|
305
|
+
oracle: oracle,
|
|
306
|
+
irm: irm,
|
|
307
|
+
collateralAddress: collateralAssetAddress,
|
|
308
|
+
loanAddress: loanTokenAddress,
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
data[m].chainId = chainId;
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
return data;
|
|
315
|
+
},
|
|
316
|
+
markets.length > 0 ? 1 : 0,
|
|
317
|
+
];
|
|
318
|
+
}
|
|
@@ -2,4 +2,9 @@ import { AdditionalYields } from '../../types';
|
|
|
2
2
|
export declare function fetchMorphoPublicData(chainId: string, yields?: AdditionalYields): Promise<{
|
|
3
3
|
[m: string]: import("./types").MorphoGeneralPublicResponse;
|
|
4
4
|
}>;
|
|
5
|
+
export declare function buildMorphoCall(chainId: string): {
|
|
6
|
+
address: string;
|
|
7
|
+
name: string;
|
|
8
|
+
params: (string | string[])[];
|
|
9
|
+
}[];
|
|
5
10
|
//# sourceMappingURL=publicCallBuild.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallBuild.d.ts","sourceRoot":"","sources":["../../../src/lending/morpho/publicCallBuild.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publicCallBuild.d.ts","sourceRoot":"","sources":["../../../src/lending/morpho/publicCallBuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAM9C,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,gBAIP;;GAIF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM;;;;IAY9C"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { morphoPools } from '@1delta/data-sdk';
|
|
2
|
+
import { MORPHO_LENS } from '../user-data/morpho/userCallBuild';
|
|
3
|
+
import { MORPHO_MARKETS } from './constants/markets';
|
|
1
4
|
import { convertMarketsToMorphoResponse } from './convertPublic';
|
|
2
5
|
import { fetchMorphoMarkets } from './fetchPublic';
|
|
3
6
|
export async function fetchMorphoPublicData(chainId, yields = {
|
|
@@ -8,3 +11,16 @@ export async function fetchMorphoPublicData(chainId, yields = {
|
|
|
8
11
|
const mbData = await fetchMorphoMarkets(chainId);
|
|
9
12
|
return convertMarketsToMorphoResponse(mbData, chainId, yields);
|
|
10
13
|
}
|
|
14
|
+
export function buildMorphoCall(chainId) {
|
|
15
|
+
const markets = MORPHO_MARKETS[chainId] ?? [];
|
|
16
|
+
const mb = morphoPools()?.MORPHO_BLUE?.[chainId];
|
|
17
|
+
if (!mb || markets.length === 0)
|
|
18
|
+
return [];
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
address: MORPHO_LENS[chainId],
|
|
22
|
+
name: 'getMarketDataCompact',
|
|
23
|
+
params: [mb, markets],
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type Market = {
|
|
2
|
+
loanToken: string;
|
|
3
|
+
collateralToken: string;
|
|
4
|
+
oracle: string;
|
|
5
|
+
irm: string;
|
|
6
|
+
lltv: bigint;
|
|
7
|
+
price: bigint;
|
|
8
|
+
rateAtTarget: bigint;
|
|
9
|
+
totalSupplyAssets: bigint;
|
|
10
|
+
totalSupplyShares: bigint;
|
|
11
|
+
totalBorrowAssets: bigint;
|
|
12
|
+
totalBorrowShares: bigint;
|
|
13
|
+
lastUpdate: bigint;
|
|
14
|
+
fee: bigint;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Decode packed markets bytes into typed objects.
|
|
18
|
+
* Integers are parsed as big-endian BigInt. Addresses are 0x-prefixed lowercase hex.
|
|
19
|
+
*/
|
|
20
|
+
export declare function decodeMarkets(input: string | Uint8Array): Market[];
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=evmParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evmParser.d.ts","sourceRoot":"","sources":["../../../../src/lending/morpho/utils/evmParser.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAgBF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,CA+ClE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const FIELD_SIZES = {
|
|
2
|
+
addr: 20,
|
|
3
|
+
u128: 16,
|
|
4
|
+
u256: 32,
|
|
5
|
+
};
|
|
6
|
+
const RECORD_SIZE = 4 * FIELD_SIZES.addr + // loanToken, collateralToken, oracle, irm
|
|
7
|
+
1 * FIELD_SIZES.u128 + // lltv
|
|
8
|
+
2 * FIELD_SIZES.u256 + // price, rateAtTarget
|
|
9
|
+
5 * FIELD_SIZES.u128 + // totals (4) + lastUpdate
|
|
10
|
+
1 * FIELD_SIZES.u128; // fee
|
|
11
|
+
// = 256 bytes
|
|
12
|
+
/**
|
|
13
|
+
* Decode packed markets bytes into typed objects.
|
|
14
|
+
* Integers are parsed as big-endian BigInt. Addresses are 0x-prefixed lowercase hex.
|
|
15
|
+
*/
|
|
16
|
+
export function decodeMarkets(input) {
|
|
17
|
+
const bytes = normalizeToBytes(input);
|
|
18
|
+
if (bytes.length % RECORD_SIZE !== 0) {
|
|
19
|
+
throw new Error(`Invalid data length ${bytes.length}; not a multiple of ${RECORD_SIZE} bytes per record`);
|
|
20
|
+
}
|
|
21
|
+
const markets = [];
|
|
22
|
+
for (let i = 0; i < bytes.length; i += RECORD_SIZE) {
|
|
23
|
+
let o = i;
|
|
24
|
+
const loanToken = readAddress(bytes, o, FIELD_SIZES.addr);
|
|
25
|
+
o += FIELD_SIZES.addr;
|
|
26
|
+
const collateralToken = readAddress(bytes, o, FIELD_SIZES.addr);
|
|
27
|
+
o += FIELD_SIZES.addr;
|
|
28
|
+
const oracle = readAddress(bytes, o, FIELD_SIZES.addr);
|
|
29
|
+
o += FIELD_SIZES.addr;
|
|
30
|
+
const irm = readAddress(bytes, o, FIELD_SIZES.addr);
|
|
31
|
+
o += FIELD_SIZES.addr;
|
|
32
|
+
const lltv = readUintBE(bytes, o, FIELD_SIZES.u128);
|
|
33
|
+
o += FIELD_SIZES.u128;
|
|
34
|
+
const price = readUintBE(bytes, o, FIELD_SIZES.u256);
|
|
35
|
+
o += FIELD_SIZES.u256;
|
|
36
|
+
const rateAtTarget = readUintBE(bytes, o, FIELD_SIZES.u256);
|
|
37
|
+
o += FIELD_SIZES.u256;
|
|
38
|
+
const totalSupplyAssets = readUintBE(bytes, o, FIELD_SIZES.u128);
|
|
39
|
+
o += FIELD_SIZES.u128;
|
|
40
|
+
const totalSupplyShares = readUintBE(bytes, o, FIELD_SIZES.u128);
|
|
41
|
+
o += FIELD_SIZES.u128;
|
|
42
|
+
const totalBorrowAssets = readUintBE(bytes, o, FIELD_SIZES.u128);
|
|
43
|
+
o += FIELD_SIZES.u128;
|
|
44
|
+
const totalBorrowShares = readUintBE(bytes, o, FIELD_SIZES.u128);
|
|
45
|
+
o += FIELD_SIZES.u128;
|
|
46
|
+
const lastUpdate = readUintBE(bytes, o, FIELD_SIZES.u128);
|
|
47
|
+
o += FIELD_SIZES.u128;
|
|
48
|
+
const fee = readUintBE(bytes, o, FIELD_SIZES.u128);
|
|
49
|
+
o += FIELD_SIZES.u128;
|
|
50
|
+
markets.push({
|
|
51
|
+
loanToken,
|
|
52
|
+
collateralToken,
|
|
53
|
+
oracle,
|
|
54
|
+
irm,
|
|
55
|
+
lltv,
|
|
56
|
+
price,
|
|
57
|
+
rateAtTarget,
|
|
58
|
+
totalSupplyAssets,
|
|
59
|
+
totalSupplyShares,
|
|
60
|
+
totalBorrowAssets,
|
|
61
|
+
totalBorrowShares,
|
|
62
|
+
lastUpdate,
|
|
63
|
+
fee,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return markets;
|
|
67
|
+
}
|
|
68
|
+
// ---------- helpers ----------
|
|
69
|
+
function normalizeToBytes(input) {
|
|
70
|
+
if (typeof input !== "string") {
|
|
71
|
+
return input;
|
|
72
|
+
}
|
|
73
|
+
let hex = input.startsWith("0x") ? input.slice(2) : input;
|
|
74
|
+
if (hex.length % 2 !== 0)
|
|
75
|
+
throw new Error("Hex string must have even length");
|
|
76
|
+
const out = new Uint8Array(hex.length / 2);
|
|
77
|
+
for (let i = 0; i < out.length; i++) {
|
|
78
|
+
out[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
function readAddress(bytes, offset, len) {
|
|
83
|
+
// Addresses are the raw 20 bytes, render as 0x + 40 hex chars (lowercase).
|
|
84
|
+
const hex = toHex(bytes.subarray(offset, offset + len));
|
|
85
|
+
return "0x" + hex;
|
|
86
|
+
}
|
|
87
|
+
function readUintBE(bytes, offset, len) {
|
|
88
|
+
// Big-endian: (((b0 * 256) + b1) * 256 + ...) pattern.
|
|
89
|
+
let v = 0n;
|
|
90
|
+
const end = offset + len;
|
|
91
|
+
for (let i = offset; i < end; i++) {
|
|
92
|
+
v = (v << 8n) | BigInt(bytes[i]);
|
|
93
|
+
}
|
|
94
|
+
return v;
|
|
95
|
+
}
|
|
96
|
+
function toHex(arr) {
|
|
97
|
+
let s = "";
|
|
98
|
+
for (let i = 0; i < arr.length; i++) {
|
|
99
|
+
const h = arr[i].toString(16).padStart(2, "0");
|
|
100
|
+
s += h;
|
|
101
|
+
}
|
|
102
|
+
return s;
|
|
103
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export type RoundingDirection = 'Up' | 'Down';
|
|
2
|
+
/**
|
|
3
|
+
* Library to manage fixed-point arithmetic.
|
|
4
|
+
* https://github.com/morpho-org/morpho-blue/blob/main/src/libraries/MathLib.sol
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace MathLib {
|
|
7
|
+
const WAD = 1000000000000000000n;
|
|
8
|
+
const RAY = 1000000000000000000000000000n;
|
|
9
|
+
const MAX_UINT_256: bigint;
|
|
10
|
+
const MAX_UINT_160: bigint;
|
|
11
|
+
const MAX_UINT_128: bigint;
|
|
12
|
+
const MAX_UINT_48: bigint;
|
|
13
|
+
function maxUint(nBits: number): bigint;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the absolute value of a number
|
|
16
|
+
* @param a The number
|
|
17
|
+
*/
|
|
18
|
+
function abs(a: bigint): bigint;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the smallest number given as param
|
|
21
|
+
* @param x The first number
|
|
22
|
+
* @param y The second number
|
|
23
|
+
*/
|
|
24
|
+
function min(...xs: bigint[]): bigint;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the greatest number given as param
|
|
27
|
+
* @param x The first number
|
|
28
|
+
* @param y The second number
|
|
29
|
+
*/
|
|
30
|
+
function max(...xs: bigint[]): bigint;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the subtraction of b from a, floored to zero if negative
|
|
33
|
+
* @param x The first number
|
|
34
|
+
* @param y The second number
|
|
35
|
+
*/
|
|
36
|
+
function zeroFloorSub(x: bigint, y: bigint): bigint;
|
|
37
|
+
/**
|
|
38
|
+
* Perform the WAD-based multiplication of 2 numbers, rounded down
|
|
39
|
+
* @param x The first number
|
|
40
|
+
* @param y The second number
|
|
41
|
+
*/
|
|
42
|
+
function wMulDown(x: bigint, y: bigint): bigint;
|
|
43
|
+
/**
|
|
44
|
+
* Perform the WAD-based multiplication of 2 numbers, rounded up
|
|
45
|
+
* @param x The first number
|
|
46
|
+
* @param y The second number
|
|
47
|
+
*/
|
|
48
|
+
function wMulUp(x: bigint, y: bigint): bigint;
|
|
49
|
+
/**
|
|
50
|
+
* Perform the WAD-based multiplication of 2 numbers with a provided rounding direction
|
|
51
|
+
* @param x The first number
|
|
52
|
+
* @param y The second number
|
|
53
|
+
*/
|
|
54
|
+
function wMul(x: bigint, y: bigint, rounding: RoundingDirection): bigint;
|
|
55
|
+
/**
|
|
56
|
+
* Perform the WAD-based division of 2 numbers, rounded down
|
|
57
|
+
* @param x The first number
|
|
58
|
+
* @param y The second number
|
|
59
|
+
*/
|
|
60
|
+
function wDivDown(x: bigint, y: bigint): bigint;
|
|
61
|
+
/**
|
|
62
|
+
* Perform the WAD-based multiplication of 2 numbers, rounded up
|
|
63
|
+
* @param x The first number
|
|
64
|
+
* @param y The second number
|
|
65
|
+
*/
|
|
66
|
+
function wDivUp(x: bigint, y: bigint): bigint;
|
|
67
|
+
/**
|
|
68
|
+
* Perform the WAD-based multiplication of 2 numbers with a provided rounding direction
|
|
69
|
+
* @param x The first number
|
|
70
|
+
* @param y The second number
|
|
71
|
+
*/
|
|
72
|
+
function wDiv(x: bigint, y: bigint, rounding: RoundingDirection): bigint;
|
|
73
|
+
/**
|
|
74
|
+
* Multiply two numbers and divide by a denominator, rounding down the result
|
|
75
|
+
* @param x The first number
|
|
76
|
+
* @param y The second number
|
|
77
|
+
* @param denominator The denominator
|
|
78
|
+
*/
|
|
79
|
+
function mulDivDown(x: bigint, y: bigint, denominator: bigint): bigint;
|
|
80
|
+
/**
|
|
81
|
+
* Multiply two numbers and divide by a denominator, rounding up the result
|
|
82
|
+
* @param x The first number
|
|
83
|
+
* @param y The second number
|
|
84
|
+
* @param denominator The denominator
|
|
85
|
+
*/
|
|
86
|
+
function mulDivUp(x: bigint, y: bigint, denominator: bigint): bigint;
|
|
87
|
+
function mulDiv(x: bigint, y: bigint, denominator: bigint, rounding: RoundingDirection): bigint;
|
|
88
|
+
/**
|
|
89
|
+
* The sum of the first three non-zero terms of a Taylor expansion of e^(nx) - 1,
|
|
90
|
+
* to approximate a continuously compounded interest rate.
|
|
91
|
+
*
|
|
92
|
+
* @param x The base of the exponent
|
|
93
|
+
* @param n The exponent
|
|
94
|
+
*/
|
|
95
|
+
function wTaylorCompounded(x: bigint, n: bigint): bigint;
|
|
96
|
+
/**
|
|
97
|
+
* Converts a WAD-based quantity to a RAY-based quantity.
|
|
98
|
+
* @param x The WAD-based quantity.
|
|
99
|
+
*/
|
|
100
|
+
function wToRay(x: bigint): bigint;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the market's utilization rate (scaled by WAD).
|
|
103
|
+
* @param market The market state.
|
|
104
|
+
*/
|
|
105
|
+
function getUtilization({ totalSupplyAssets, totalBorrowAssets, }: {
|
|
106
|
+
totalSupplyAssets: bigint;
|
|
107
|
+
totalBorrowAssets: bigint;
|
|
108
|
+
}): bigint;
|
|
109
|
+
/**
|
|
110
|
+
* The market's instantaneous supply-side Annual Percentage Yield (APY) at the given timestamp,
|
|
111
|
+
* if the state remains unchanged (not accrued) (scaled by WAD).
|
|
112
|
+
* @param timestamp The timestamp at which to calculate the supply APY.
|
|
113
|
+
* Must be greater than or equal to `lastUpdate`.
|
|
114
|
+
* Defaults to `Time.timestamp()` (returns the current supply APY).
|
|
115
|
+
*/
|
|
116
|
+
function getSupplyApy(borrowApy: bigint, utilization: bigint, fee: bigint): bigint;
|
|
117
|
+
function getBorrowApy(rateAtTarget: bigint | null, utilization: bigint, _timestamp: number | undefined, _lastUpdate: number): bigint;
|
|
118
|
+
function wExp(x: bigint): bigint;
|
|
119
|
+
function _getBorrowRate(startUtilization: bigint, startRateAtTarget: bigint, elapsed: bigint): {
|
|
120
|
+
avgBorrowRate: bigint;
|
|
121
|
+
endBorrowRate: bigint;
|
|
122
|
+
endRateAtTarget: bigint;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=mathLib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mathLib.d.ts","sourceRoot":"","sources":["../../../../src/lending/morpho/utils/mathLib.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAAA;AAE7C;;;GAGG;AACH,yBAAiB,OAAO,CAAC;IAChB,MAAM,GAAG,uBAAwB,CAAA;IACjC,MAAM,GAAG,gCAAiC,CAAA;IAE1C,MAAM,YAAY,QAAe,CAAA;IACjC,MAAM,YAAY,QAAe,CAAA;IACjC,MAAM,YAAY,QAAe,CAAA;IACjC,MAAM,WAAW,QAAc,CAAA;IAEtC,SAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,UAIpC;IAED;;;OAGG;IACH,SAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,UAI5B;IAED;;;;OAIG;IACH,SAAgB,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,UAElC;IAED;;;;OAIG;IACH,SAAgB,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,UAElC;IAED;;;;OAIG;IACH,SAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAKhD;IAED;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAE5C;IAED;;;;OAIG;IACH,SAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAE1C;IAED;;;;OAIG;IACH,SAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,UAErE;IAED;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAE5C;IAED;;;;OAIG;IACH,SAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAE1C;IAED;;;;OAIG;IACH,SAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,UAErE;IAED;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAOnE;IAED;;;;;OAKG;IACH,SAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UASjE;IAED,SAAgB,MAAM,CACpB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,iBAAiB,UAG5B;IAED;;;;;;OAMG;IACH,SAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAcrD;IAED;;;OAGG;IACH,SAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,UAE/B;IAED;;;OAGG;IACH,SAAgB,cAAc,CAAC,EAC7B,iBAAiB,EACjB,iBAAiB,GAClB,EAAE;QACD,iBAAiB,EAAE,MAAM,CAAA;QACzB,iBAAiB,EAAE,MAAM,CAAA;KAC1B,UAQA;IAED;;;;;;OAMG;IACH,SAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,UAOZ;IAwDD,SAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,YAAgC,EAClD,WAAW,EAAE,MAAM,UAUpB;IA+BD,SAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,UAoB7B;IAED,SAAgB,cAAc,CAC5B,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM;;;;MAgFhB;CACF"}
|