@1delta/margin-fetcher 0.0.245 → 0.0.247
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 +248 -189
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/gearbox/publicCallBuild.d.ts +18 -8
- package/dist/lending/public-data/gearbox/publicCallBuild.d.ts.map +1 -1
- package/dist/lending/public-data/gearbox/publicCallParse.d.ts +20 -12
- package/dist/lending/public-data/gearbox/publicCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/gearbox/userCallBuild.d.ts +12 -9
- package/dist/lending/user-data/gearbox/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/gearbox/userCallParse.d.ts +18 -14
- package/dist/lending/user-data/gearbox/userCallParse.d.ts.map +1 -1
- package/dist/prices/oracle-prices/fetchers/gearbox.d.ts +510 -514
- package/dist/prices/oracle-prices/fetchers/gearbox.d.ts.map +1 -1
- package/dist/prices/oracle-prices/fetchers/morpho.d.ts.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/vaults/gearbox/publicCallBuild.d.ts +10 -5
- package/dist/vaults/gearbox/publicCallBuild.d.ts.map +1 -1
- package/dist/vaults/gearbox/publicCallParse.d.ts +13 -3
- package/dist/vaults/gearbox/publicCallParse.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builds the multicall descriptor for Gearbox V3 public data.
|
|
2
|
+
* Builds the multicall descriptor for Gearbox V3.1 public data.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Single call to `MarketCompressor.getMarkets(filter)` with:
|
|
5
|
+
* - `configurators`: all curators registered for the chain (cp0x,
|
|
6
|
+
* Chaos Labs, Re7, …) — discovered from the resolver JSON
|
|
7
|
+
* - `pools: []` — no narrowing, return every market run by those
|
|
8
|
+
* configurators
|
|
9
|
+
* - `underlying: 0x0` — no underlying filter
|
|
8
10
|
*
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
11
|
+
* The response carries pool + creditManagers + facades + oracle info
|
|
12
|
+
* in one nested struct per market. Parser fans out to per-CM
|
|
13
|
+
* `GEARBOX_V3_<CM_HEX>` buckets.
|
|
14
|
+
*
|
|
15
|
+
* Returns `[]` when the chain has no configurators or MarketCompressor
|
|
16
|
+
* isn't configured — safe no-op.
|
|
11
17
|
*/
|
|
12
18
|
export declare const buildGearboxCall: (chainId: string, _lender?: string) => {
|
|
13
19
|
address: string;
|
|
14
20
|
name: string;
|
|
15
|
-
params:
|
|
21
|
+
params: {
|
|
22
|
+
configurators: string[];
|
|
23
|
+
pools: string[];
|
|
24
|
+
underlying: "0x0000000000000000000000000000000000000000";
|
|
25
|
+
}[];
|
|
16
26
|
}[];
|
|
17
27
|
//# sourceMappingURL=publicCallBuild.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/gearbox/publicCallBuild.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publicCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/gearbox/publicCallBuild.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM;;;;;eAe3C,MAAM,EAAE;;;GAM9B,CAAA"}
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { AdditionalYields, GenericTokenList } from '../../../types';
|
|
2
2
|
/**
|
|
3
|
-
* Parser for the
|
|
3
|
+
* Parser for the single-call Gearbox V3.1 public data fetch.
|
|
4
4
|
*
|
|
5
|
-
* data[0] =
|
|
6
|
-
* data[1] = CreditManagerData[] (getCreditManagersV3List)
|
|
5
|
+
* data[0] = MarketData[] (MarketCompressor.getMarkets(filter))
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* when both draw from the same pool). We therefore emit one bucket per CM,
|
|
11
|
-
* keyed by `GEARBOX_V3_<CM_HEX>` via `gearboxV3LenderKey`, and join to the
|
|
12
|
-
* pool via `cm.pool` to recover per-pool supply/borrow rates.
|
|
7
|
+
* MarketCompressor collapses the old `getPoolsV3List + getCreditManagersV3List`
|
|
8
|
+
* pair into one nested struct per market:
|
|
13
9
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
10
|
+
* MarketData { pool, quotaKeeper, priceOracle, creditManagers[], ... }
|
|
11
|
+
*
|
|
12
|
+
* Each `creditManagers[i]` carries its own `creditFacade` sub-struct
|
|
13
|
+
* (with minDebt / maxDebt / expirationDate / isPaused / degenNFT /
|
|
14
|
+
* forbiddenTokensMask) plus the `creditManager` sub-struct
|
|
15
|
+
* (collateralTokens[{token, liquidationThreshold}], maxEnabledTokens,
|
|
16
|
+
* fees). We fan out to per-CM `GEARBOX_V3_<CM_HEX>` buckets — one CA is
|
|
17
|
+
* bound to exactly one CM, so CMs are the isolation unit.
|
|
18
|
+
*
|
|
19
|
+
* Filtering applied here:
|
|
20
|
+
* - skip the whole market if the pool is paused
|
|
21
|
+
* - skip individual CMs that are paused, expired, or in degen-NFT mode
|
|
22
|
+
* (can't be operated without a DegenNFT, which we don't support)
|
|
23
|
+
*
|
|
24
|
+
* Per-CM totals (totalDebt, availableToBorrow) come from the pool's
|
|
25
|
+
* `creditManagerDebtParams[]` array, indexed by the CM address.
|
|
18
26
|
*
|
|
19
27
|
* The passive ERC-4626 lender side (PoolV3) is NOT modeled here — it's a
|
|
20
28
|
* standalone vault with no borrow and lives under `vaults/gearbox/`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/gearbox/publicCallParse.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAmBnE
|
|
1
|
+
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/gearbox/publicCallParse.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAmBnE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,+BAA+B,GAC1C,SAAS,MAAM,EACf,SAAS,MAAM,EACf,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,YAAW,gBAAqB,KAC/B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,EAAE,MAAM,CAwQjE,CAAA"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { Call } from '../../../utils/multicall';
|
|
2
2
|
/**
|
|
3
|
-
* Number of multicall slots consumed by one
|
|
4
|
-
* `
|
|
3
|
+
* Number of multicall slots consumed by one user-data fetch for Gearbox V3.1:
|
|
4
|
+
* one `getCreditAccounts(cmFilter, caFilter, offset, limit)` call that
|
|
5
|
+
* returns every Credit Account the borrower owns across all known curators.
|
|
5
6
|
*/
|
|
6
7
|
export declare const GEARBOX_V3_USER_CALL_COUNT = 1;
|
|
7
8
|
/**
|
|
8
|
-
* Build the user-data multicall descriptor for Gearbox V3.
|
|
9
|
+
* Build the user-data multicall descriptor for Gearbox V3.1.
|
|
9
10
|
*
|
|
10
|
-
* Single call: `
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Single call: `CreditAccountCompressor.getCreditAccounts(cmFilter,
|
|
12
|
+
* caFilter, 0, 128)` with
|
|
13
|
+
* - `cmFilter.configurators` = every curator registered for this chain
|
|
14
|
+
* in `gearbox-resolvers.json`
|
|
15
|
+
* - `caFilter.owner` = the borrower address
|
|
13
16
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* Returns `(CreditAccountData[], uint256 nextOffset)`. The parser keeps
|
|
18
|
+
* the CA array and ignores `nextOffset` — see `CA_QUERY_LIMIT` for the
|
|
19
|
+
* pagination caveat.
|
|
17
20
|
*/
|
|
18
21
|
export declare const buildGearboxV3UserCall: (chainId: string, _lender: string, account: string) => Call[];
|
|
19
22
|
//# sourceMappingURL=userCallBuild.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/gearbox/userCallBuild.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/gearbox/userCallBuild.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAU/C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,SAAS,MAAM,EACf,SAAS,MAAM,KACd,IAAI,EAoCN,CAAA"}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { LenderToLenderCrossPoolMeta, UserData } from '../utils/types';
|
|
2
2
|
/**
|
|
3
|
-
* Returns a [converter, expectedCallCount] tuple for Gearbox V3 user
|
|
3
|
+
* Returns a [converter, expectedCallCount] tuple for Gearbox V3.1 user
|
|
4
|
+
* data.
|
|
4
5
|
*
|
|
5
|
-
* Single call `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Single call `CreditAccountCompressor.getCreditAccounts(cmFilter,
|
|
7
|
+
* caFilter, offset, limit)` returns
|
|
8
|
+
* `(CreditAccountData[] data, uint256 nextOffset)`.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Each `CreditAccountData` describes one isolated Credit Account owned
|
|
11
|
+
* by exactly one CreditManager. We fan out by `creditManager` address
|
|
12
|
+
* and emit one `UserData` per CM under `GEARBOX_V3_<CM_HEX>` — each
|
|
13
|
+
* Credit Account becomes a sub-account under its CM (mirroring the
|
|
14
|
+
* Fluid-NFT / Init-subAccount pattern).
|
|
12
15
|
*
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
16
|
-
* -
|
|
16
|
+
* V3.0 → V3.1 field renames handled here:
|
|
17
|
+
* - `isSuccessful` → `success`
|
|
18
|
+
* - `ca.addr` → `ca.creditAccount`
|
|
19
|
+
* - `ca.balances[]` → `ca.tokens[]` (with `{token, mask, balance,
|
|
20
|
+
* quota, success}`; "quoted" is
|
|
21
|
+
* now derived from `quota > 0`)
|
|
17
22
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* a deposit entry so the UI can show "held but uncollateralized".
|
|
23
|
+
* `ca.owner` replaces the old implicit "caller passed as borrower"
|
|
24
|
+
* semantic — we don't use it directly since the filter pinned it.
|
|
21
25
|
*/
|
|
22
26
|
export declare const getGearboxV3UserDataConverter: (_lender: string, chainId: string, account: string, meta?: LenderToLenderCrossPoolMeta) => [(data: any[]) => {
|
|
23
27
|
[lender: string]: UserData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/gearbox/userCallParse.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,gBAAgB,CAAA;AAiBvB
|
|
1
|
+
{"version":3,"file":"userCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/gearbox/userCallParse.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,gBAAgB,CAAA;AAiBvB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,SAAS,MAAM,EACf,SAAS,MAAM,EACf,OAAO,2BAA2B,KACjC,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAAG,SAAS,EAAE,MAAM,CAsNtE,CAAA"}
|