@1delta/margin-fetcher 0.0.338 → 0.0.339
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 +18 -4
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/liquity/convertPublic.d.ts +20 -0
- package/dist/lending/public-data/liquity/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/liquity/types.d.ts +5 -1
- package/dist/lending/public-data/liquity/types.d.ts.map +1 -1
- package/dist/prices/oracle-prices/fetchers/liquity.d.ts +24 -0
- package/dist/prices/oracle-prices/fetchers/liquity.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -19,6 +19,26 @@ export declare function liquityKeyParts(key: string): {
|
|
|
19
19
|
chainId: string;
|
|
20
20
|
collIndex: number;
|
|
21
21
|
} | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Human USD price of a branch's collateral from its `lastGoodPrice()` read.
|
|
24
|
+
*
|
|
25
|
+
* The feed is WAD-USD on canonical (18-dec) collateral, but forks that list
|
|
26
|
+
* NON-18-dec collateral split into two camps:
|
|
27
|
+
* - the feed stays 1e18 and the fork normalizes collateral to 18 decimals
|
|
28
|
+
* inside its CR math (Enosys: 6-dec FXRP/stXRP);
|
|
29
|
+
* - the FEED absorbs the scaling and returns USD x 10^(36 - collDecimals),
|
|
30
|
+
* leaving trove collateral in raw token units (Ebisu: 8-dec WBTC/LBTC,
|
|
31
|
+
* 6-dec XAUt0/syrupUSDT).
|
|
32
|
+
* Both satisfy `collRaw * price / 1e18 = USD_WAD`, so no on-chain read tells
|
|
33
|
+
* them apart — `branch.priceDecimals` pins it per branch when metadata has it.
|
|
34
|
+
*
|
|
35
|
+
* Absent metadata, auto-detect: the two candidates differ by
|
|
36
|
+
* 10^(18 - collDecimals) (>= 1e10 on every listed branch), so at most one can
|
|
37
|
+
* land in a sane USD band. Prefer the 1e18 reading, fall back to the
|
|
38
|
+
* decimals-adjusted one only when 1e18 is implausibly large, and return 0
|
|
39
|
+
* (unknown -> caller falls back to the shared price map) if neither fits.
|
|
40
|
+
*/
|
|
41
|
+
export declare function liquityCollateralPrice(raw: bigint | null | undefined, collDecimals: number, priceDecimals?: number): number;
|
|
22
42
|
/**
|
|
23
43
|
* Map one deployment's on-chain branch batch into the shared
|
|
24
44
|
* `MorphoGeneralPublicResponse` shape (identical to Midnight/Term/Exactly),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertPublic.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/liquity/convertPublic.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GACV;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAOpE;
|
|
1
|
+
{"version":3,"file":"convertPublic.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/liquity/convertPublic.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GACV;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAOpE;AAWD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,YAAY,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CASR;AAgBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAO,EACxC,iBAAiB,GAAE,gBAIlB,EACD,MAAM,GAAE,gBAAqB,GAC5B;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,2BAA2B,CAAA;CAAE,CAoP9C"}
|
|
@@ -18,7 +18,11 @@ export interface LiquityBranchRaw {
|
|
|
18
18
|
aggWeightedDebtSum: bigint | null;
|
|
19
19
|
/** StabilityPool.getTotalBoldDeposits() — the branch "earn" pool size */
|
|
20
20
|
spDeposits: bigint | null;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* PriceFeed.lastGoodPrice() — USD scaled by `branch.priceDecimals` (1e18 on
|
|
23
|
+
* canonical 18-dec collateral; fork-dependent otherwise). Always read it
|
|
24
|
+
* through `liquityCollateralPrice`, never a bare `/1e18`.
|
|
25
|
+
*/
|
|
22
26
|
collPrice: bigint | null;
|
|
23
27
|
/** SortedTroves.getSize() — live (non-zombie) trove count */
|
|
24
28
|
troveCount: bigint | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/liquity/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE/E;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,mBAAmB,CAAA;IAC3B,oFAAoF;IACpF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,mEAAmE;IACnE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,qFAAqF;IACrF,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,2FAA2F;IAC3F,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,yEAAyE;IACzE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/liquity/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE/E;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,mBAAmB,CAAA;IAC3B,oFAAoF;IACpF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,mEAAmE;IACnE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,qFAAqF;IACrF,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,2FAA2F;IAC3F,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,yEAAyE;IACzE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;OAIG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,kBAAkB,GAAG,SAAS,CAAA;IACtC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAC7B"}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import { FetcherResult, OraclePriceEntry, ParseContext } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Liquity-family oracle price fetcher (Liquity V2 + friendly forks: Felix,
|
|
4
|
+
* USDaf, Nerite, Quill, Enosys, Soneta, Ebisu).
|
|
5
|
+
*
|
|
6
|
+
* Each branch's `PriceFeed.lastGoodPrice()` returns the COLLATERAL price in USD
|
|
7
|
+
* (1e18-scaled on canonical 18-dec collateral; see `liquityCollateralPrice` for
|
|
8
|
+
* the fork-dependent scale on non-18-dec branches) — the same value the branch
|
|
9
|
+
* uses for its collateral ratio, and the same read the public-data fetcher
|
|
10
|
+
* already makes. So these are DIRECT USD prices (PASS 1) that feed the shared
|
|
11
|
+
* `usdPrices` map.
|
|
12
|
+
*
|
|
13
|
+
* Why a dedicated fetcher (not cross-protocol flattening): the family spans
|
|
14
|
+
* chains where no other integrated protocol prices the collateral (Felix/HYPE
|
|
15
|
+
* on HyperEVM, Enosys on Flare, Soneta on Sonic, Ebisu on Plasma, plus bespoke
|
|
16
|
+
* LST/stable collateral on mainnet). Without this those branches would serve a
|
|
17
|
+
* null oracle price. It also uses each branch's OWN feed — the correct oracle
|
|
18
|
+
* for risk. `lastGoodPrice` is a view (fresh on any active branch), so one call
|
|
19
|
+
* per branch. The stablecoin (BOLD / USDaf / satUSD-like) is the debt asset and
|
|
20
|
+
* is emitted pegged to $1 (the same peg `convertPublic` uses) so debt is priced.
|
|
21
|
+
*/
|
|
2
22
|
interface LiquityBranchMeta {
|
|
3
23
|
lender: string;
|
|
4
24
|
chainId: string;
|
|
5
25
|
collIndex: number;
|
|
6
26
|
collToken: string;
|
|
27
|
+
/** Collateral token decimals — sets the feed scale (see below). */
|
|
28
|
+
collDecimals: number;
|
|
29
|
+
/** Feed decimals from metadata when known; auto-detected otherwise. */
|
|
30
|
+
priceDecimals?: number;
|
|
7
31
|
/** Stable/debt token (pegged to 1). Emitted once per branch. */
|
|
8
32
|
debtToken?: string;
|
|
9
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquity.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/liquity.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"liquity.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/liquity.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AAOjB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAA;IACpB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,GACd,aAAa,CAAC,iBAAiB,CAAC,EAAE,CA8BpC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CAmDpB;AAED,yDAAyD;AACzD,wBAAgB,aAAa;;;;;;;;;;;;;;;;;;;;;GAE5B;AAED,4CAA4C;AAC5C,eAAO,MAAM,cAAc;;;;CAI1B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1delta/margin-fetcher",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.339",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"async-retry": "^1.3.3",
|
|
24
24
|
"lodash": "^4.17.23",
|
|
25
25
|
"@1delta/abis": "0.0.27",
|
|
26
|
+
"@1delta/data-sdk": "0.0.35",
|
|
26
27
|
"@1delta/calldata-sdk": "0.0.161",
|
|
27
|
-
"@1delta/lender-registry": "0.0.36",
|
|
28
|
-
"@1delta/data-sdk": "0.0.34",
|
|
29
28
|
"@1delta/dex-registry": "0.0.104",
|
|
30
|
-
"@1delta/
|
|
31
|
-
"@1delta/proxy-fetch": "0.0.1"
|
|
29
|
+
"@1delta/lender-registry": "0.0.36",
|
|
30
|
+
"@1delta/proxy-fetch": "0.0.1",
|
|
31
|
+
"@1delta/providers": "0.0.62"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/async-retry": "^1.4.9",
|