@1delta/margin-fetcher 0.0.339 → 0.0.341

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.
Files changed (43) hide show
  1. package/dist/abis/oracle/AaveOracle.d.ts +14 -0
  2. package/dist/abis/oracle/AaveOracle.d.ts.map +1 -1
  3. package/dist/index.d.ts +3 -3
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +625 -91
  6. package/dist/index.js.map +1 -1
  7. package/dist/prices/oracle-prices/derivation.d.ts +25 -0
  8. package/dist/prices/oracle-prices/derivation.d.ts.map +1 -0
  9. package/dist/prices/oracle-prices/feedStaleness.d.ts +44 -0
  10. package/dist/prices/oracle-prices/feedStaleness.d.ts.map +1 -0
  11. package/dist/prices/oracle-prices/feedStats.d.ts +145 -0
  12. package/dist/prices/oracle-prices/feedStats.d.ts.map +1 -0
  13. package/dist/prices/oracle-prices/fetchOraclePrices.d.ts +14 -2
  14. package/dist/prices/oracle-prices/fetchOraclePrices.d.ts.map +1 -1
  15. package/dist/prices/oracle-prices/fetchers/aave.d.ts +14 -0
  16. package/dist/prices/oracle-prices/fetchers/aave.d.ts.map +1 -1
  17. package/dist/prices/oracle-prices/fetchers/compoundV3.d.ts.map +1 -1
  18. package/dist/prices/oracle-prices/fetchers/euler.d.ts.map +1 -1
  19. package/dist/prices/oracle-prices/fetchers/morpho.d.ts.map +1 -1
  20. package/dist/prices/oracle-prices/index.d.ts +7 -2
  21. package/dist/prices/oracle-prices/index.d.ts.map +1 -1
  22. package/dist/prices/oracle-prices/lenderKeys.d.ts +18 -0
  23. package/dist/prices/oracle-prices/lenderKeys.d.ts.map +1 -0
  24. package/dist/prices/oracle-prices/outlierGuard.d.ts +43 -0
  25. package/dist/prices/oracle-prices/outlierGuard.d.ts.map +1 -0
  26. package/dist/prices/oracle-prices/selectAssetGroupPrices.d.ts +45 -4
  27. package/dist/prices/oracle-prices/selectAssetGroupPrices.d.ts.map +1 -1
  28. package/dist/prices/oracle-prices/types.d.ts +114 -1
  29. package/dist/prices/oracle-prices/types.d.ts.map +1 -1
  30. package/dist/prices/pendle/fetchPendlePrices.d.ts.map +1 -1
  31. package/dist/yields/intrinsic/fetcherRegistry.d.ts.map +1 -1
  32. package/dist/yields/intrinsic/fetchers/angle.d.ts.map +1 -1
  33. package/dist/yields/intrinsic/fetchers/anzen.d.ts +3 -0
  34. package/dist/yields/intrinsic/fetchers/anzen.d.ts.map +1 -0
  35. package/dist/yields/intrinsic/fetchers/liquidCollective.d.ts +3 -0
  36. package/dist/yields/intrinsic/fetchers/liquidCollective.d.ts.map +1 -0
  37. package/dist/yields/intrinsic/fetchers/reserve.d.ts.map +1 -1
  38. package/dist/yields/intrinsic/fetchers/stakewise.d.ts.map +1 -1
  39. package/dist/yields/intrinsic/fetchers/strata.d.ts +3 -0
  40. package/dist/yields/intrinsic/fetchers/strata.d.ts.map +1 -0
  41. package/dist/yields/intrinsic/fetchers/treehouse.d.ts +3 -0
  42. package/dist/yields/intrinsic/fetchers/treehouse.d.ts.map +1 -0
  43. package/package.json +5 -5
@@ -0,0 +1,25 @@
1
+ import { OraclePriceEntry, PriceDerivation } from './types';
2
+ /**
3
+ * Rank order of `PriceDerivation` — lower is better. Used directly as a
4
+ * ranking tier in `selectAssetGroupPrices`.
5
+ */
6
+ export declare const DERIVATION_RANK: Record<PriceDerivation, number>;
7
+ /**
8
+ * Resolve an entry's derivation class.
9
+ *
10
+ * Precedence:
11
+ * 1. What the fetcher put on the entry (most specific — e.g. Euler knows
12
+ * per-vault whether its unit of account is a fiat code or a token).
13
+ * 2. The fetcher group's declared default. `derived` wins over the
14
+ * structural guess below: Fluid/Silo collateral legs carry a `baseAsset`
15
+ * exactly like a real quoted feed, but there is no feed for the asset —
16
+ * only a market ratio.
17
+ * 3. The `baseAsset`/`staticBase` convention every fetcher already follows:
18
+ * a non-base asset carrying a `baseAsset` is quoted in it; anything else
19
+ * is a direct USD read.
20
+ *
21
+ * Step 3 is what keeps third-party or older entries (which predate the
22
+ * `derivation` field) from silently ranking as `direct`.
23
+ */
24
+ export declare function resolveDerivation(entry: OraclePriceEntry, groupDefault?: PriceDerivation): PriceDerivation;
25
+ //# sourceMappingURL=derivation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivation.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE3D;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAI3D,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,YAAY,CAAC,EAAE,eAAe,GAC7B,eAAe,CAKjB"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Feed timestamps for AAVE-family oracles.
3
+ *
4
+ * `AaveOracle.getAssetPrice()` returns a bare uint — no timestamp — so the
5
+ * only way to tell a live feed from a dead one is to resolve the per-asset
6
+ * source (`getSourceOfAsset`) and read `latestRoundData().updatedAt` on it.
7
+ * That matters because AAVE forks are the dominant (often only) price source
8
+ * on several chains: Avalanche has no Compound V3 deployment at all, so
9
+ * before this probe existed NOTHING on that chain was ever checked for
10
+ * staleness.
11
+ *
12
+ * Two multicalls, both `allowFailure` and both best-effort: a chain where the
13
+ * probe fails just yields no timestamps, never a missing price. Roughly half
14
+ * of AAVE's sources are price-cap adapters that do not implement
15
+ * `latestRoundData` — those legitimately return no timestamp.
16
+ */
17
+ /** asset (lowercase) -> feed timestamp info */
18
+ export type AssetFeedInfo = {
19
+ source: string;
20
+ updatedAt: number;
21
+ description?: string;
22
+ };
23
+ /** lender -> asset (lowercase) -> feed info */
24
+ export type FeedTimestampMap = {
25
+ [lender: string]: {
26
+ [asset: string]: AssetFeedInfo;
27
+ };
28
+ };
29
+ interface ProbeOptions {
30
+ rpcOverrides?: {
31
+ [chainId: string]: string[];
32
+ };
33
+ batchSize?: number;
34
+ retries?: number;
35
+ }
36
+ /**
37
+ * Resolve `updatedAt` for every AAVE-family (lender, asset) pair on a chain.
38
+ *
39
+ * Returns an empty map — never throws — when the chain has no AAVE-family
40
+ * lender or when the RPC calls fail.
41
+ */
42
+ export declare function probeAaveFeedTimestamps(chainId: string, options?: ProbeOptions): Promise<FeedTimestampMap>;
43
+ export {};
44
+ //# sourceMappingURL=feedStaleness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedStaleness.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/feedStaleness.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,+CAA+C;AAC/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,CAAA;CACrD,CAAA;AAcD,UAAU,YAAY;IACpB,YAAY,CAAC,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAQD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAgG3B"}
@@ -0,0 +1,145 @@
1
+ import { OraclePriceEntry, OutlierGuardConfig, StructuredOraclePrices, TokenListMap } from './types';
2
+ /**
3
+ * Self-calibrating per-feed quality stats.
4
+ *
5
+ * Everything here is learned from data the price pipeline already fetches —
6
+ * nobody ranks a lender by hand. Two observations per cycle per feed:
7
+ *
8
+ * 1. **Its own update cadence.** Chainlink heartbeats range from ~27s to 24h,
9
+ * and we cannot read a feed's configured heartbeat on-chain. Recording the
10
+ * gaps between distinct `updatedAt` values learns it, so "stale" becomes
11
+ * "far past what THIS feed normally does" instead of one global constant
12
+ * that is wrong for almost every feed.
13
+ *
14
+ * 2. **Its agreement with the rest of the market.** A feed that keeps
15
+ * disagreeing with every other source for the same asset is broken,
16
+ * whether or not it still updates. This is the only signal that catches a
17
+ * frozen Compound-V2-style oracle, which exposes no timestamp at all.
18
+ *
19
+ * The stats are a plain JSON blob: this module computes, the caller persists
20
+ * (worker KV, a DB row, a file — margin-fetcher stays storage-agnostic).
21
+ *
22
+ * SAFETY: reliability may only ever DEMOTE a candidate. A cold start, a lost
23
+ * blob or a corrupted stat therefore degrades to the structural ranking
24
+ * rather than promoting a bad price.
25
+ */
26
+ /** Stats for one feed, keyed `<chainId>|<feedKey>`. */
27
+ export interface FeedStat {
28
+ /** Chain the feed lives on */
29
+ chainId: string;
30
+ /**
31
+ * Feed identity: the aggregator address when the oracle exposes one,
32
+ * otherwise `lender|asset` (Compound V2 forks, Morpho `price()` — no
33
+ * readable feed address, but still a stable identity to score).
34
+ */
35
+ feedKey: string;
36
+ /** Most recent `updatedAt` seen (unix seconds); 0 when the feed has none */
37
+ lastUpdatedAt: number;
38
+ /** Wall-clock (unix seconds) of the last observation */
39
+ lastObservedAt: number;
40
+ /** Number of distinct updates observed */
41
+ updates: number;
42
+ /** Rolling estimate of this feed's typical update interval, seconds */
43
+ intervalEwmaSeconds: number;
44
+ /** Largest interval observed between updates, seconds */
45
+ intervalMaxSeconds: number;
46
+ /** Rolling |price/consensus - 1| across cycles; undefined until measurable */
47
+ deviationEwma?: number;
48
+ /** Number of cycles where a consensus existed to compare against */
49
+ deviationSamples: number;
50
+ }
51
+ export type FeedStatsMap = {
52
+ [key: string]: FeedStat;
53
+ };
54
+ /**
55
+ * Cycles of agreement data required before `classifyReliability` will act.
56
+ * Below this, a feed is treated as unknown (neutral), never as bad.
57
+ */
58
+ export declare const MIN_DEVIATION_SAMPLES = 5;
59
+ /** Rolling deviation above which a feed is considered broken (25%). */
60
+ export declare const BAD_DEVIATION = 0.25;
61
+ /** Rolling deviation above which a feed is considered degraded (5%). */
62
+ export declare const DEGRADED_DEVIATION = 0.05;
63
+ /**
64
+ * Multiple of a feed's own learned interval past which it counts as stale.
65
+ * Generous because the EWMA tracks the mean while heartbeats are an upper
66
+ * bound — a 24h-heartbeat feed that usually updates on 6h price moves must
67
+ * not be called stale at 12h.
68
+ */
69
+ export declare const STALE_INTERVAL_MULTIPLE = 4;
70
+ /**
71
+ * Minimum learned interval used for the staleness test, seconds. Stops a
72
+ * fast feed (27s heartbeat) from being called stale after two minutes of
73
+ * quiet, which is normal when the price does not move.
74
+ */
75
+ export declare const MIN_LEARNED_STALE_SECONDS: number;
76
+ /** Updates required before a learned interval is trusted over the default. */
77
+ export declare const MIN_UPDATES_FOR_INTERVAL = 4;
78
+ export type FreshnessClass = 'fresh' | 'stale' | 'unknown';
79
+ export type ReliabilityClass = 'good' | 'degraded' | 'bad' | 'unknown';
80
+ /** Rank order — lower is better; used directly as a ranking tier. */
81
+ export declare const FRESHNESS_RANK: Record<FreshnessClass, number>;
82
+ export declare const RELIABILITY_RANK: Record<ReliabilityClass, number>;
83
+ /**
84
+ * Stable identity of the source behind an entry.
85
+ *
86
+ * Prefers the aggregator address so the many protocols reading the same
87
+ * Chainlink feed collapse to one source — on Avalanche, Aave V3, Aave V2,
88
+ * Granary, Nereus and Benqi all read the same AVAX/USD aggregator, and
89
+ * counting them as five independent opinions is exactly the mistake that
90
+ * makes consensus checks worthless.
91
+ *
92
+ * When no aggregator is readable (Compound V2 forks, Morpho `price()`), the
93
+ * fallback is keyed on the protocol FAMILY, not the raw lender key: Morpho's
94
+ * per-market keys are one protocol's opinion repeated, not N sources.
95
+ */
96
+ export declare function feedKeyOf(entry: OraclePriceEntry, lender: string): string;
97
+ export declare function feedStatKey(chainId: string, feedKey: string): string;
98
+ /**
99
+ * One observation of a feed within a cycle.
100
+ * `consensusDeviation` is `|price/consensus - 1|`, omitted when the asset
101
+ * group had no independent consensus to compare against.
102
+ */
103
+ export interface FeedObservation {
104
+ chainId: string;
105
+ feedKey: string;
106
+ updatedAt?: number;
107
+ consensusDeviation?: number;
108
+ }
109
+ /**
110
+ * Fold a cycle's observations into the stats blob. Pure and idempotent for
111
+ * repeated `updatedAt` values, so re-running a cycle cannot corrupt the
112
+ * learned cadence.
113
+ */
114
+ export declare function updateFeedStats(prev: FeedStatsMap, observations: FeedObservation[], nowSeconds?: number): FeedStatsMap;
115
+ /**
116
+ * Is this feed past its own normal cadence?
117
+ *
118
+ * Falls back to `defaultStaleSeconds` until the feed has enough observed
119
+ * updates to trust its learned interval.
120
+ */
121
+ export declare function classifyFreshness(updatedAt: number | undefined, stat: FeedStat | undefined, defaultStaleSeconds: number, nowSeconds?: number): FreshnessClass;
122
+ /** How far this feed habitually sits from the rest of the market. */
123
+ export declare function classifyReliability(stat: FeedStat | undefined): ReliabilityClass;
124
+ /**
125
+ * Collect this cycle's observations straight from the structured prices.
126
+ *
127
+ * A feed is only scored on agreement when the rest of the group forms a
128
+ * STRONG consensus — the same standard the selection guard applies. Learning
129
+ * "this feed disagrees" from two other sources would repeat the mistake the
130
+ * guard exists to avoid: for a thinly-sourced yield-bearing token, the
131
+ * majority is often the one that is wrong, and a feed must never accumulate
132
+ * a bad reputation for being right about something obscure.
133
+ *
134
+ * The reference excludes the feed being scored, so no feed is ever measured
135
+ * against itself, and a protocol emitting one entry per market votes once.
136
+ */
137
+ export declare function collectFeedObservations(structuredPrices: StructuredOraclePrices, lists?: {
138
+ [chainId: string]: TokenListMap;
139
+ }, guard?: OutlierGuardConfig): FeedObservation[];
140
+ /**
141
+ * Drop stats for feeds not seen in a long time so the blob cannot grow
142
+ * without bound as markets come and go.
143
+ */
144
+ export declare function pruneFeedStats(stats: FeedStatsMap, maxAgeSeconds?: number, nowSeconds?: number): FeedStatsMap;
145
+ //# sourceMappingURL=feedStats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedStats.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/feedStats.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACb,MAAM,SAAS,CAAA;AAQhB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,uDAAuD;AACvD,MAAM,WAAW,QAAQ;IACvB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAA;IACrB,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAA;IACtB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,uEAAuE;IACvE,mBAAmB,EAAE,MAAM,CAAA;IAC3B,yDAAyD;IACzD,kBAAkB,EAAE,MAAM,CAAA;IAC1B,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,oEAAoE;IACpE,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAA;AAKtD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,uEAAuE;AACvE,eAAO,MAAM,aAAa,OAAO,CAAA;AAEjC,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAA;AAExC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,QAAW,CAAA;AAEjD,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,IAAI,CAAA;AAEzC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,S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AChD,eAAe,EAAE,CA2FnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,aAAa,SAAiB,EAC9B,UAAU,GAAE,MAAsC,GACjD,YAAY,CAMd"}
@@ -34,9 +34,21 @@ export interface FetchOraclePricesOptions {
34
34
  /**
35
35
  * Chainlink staleness threshold in seconds (default: 3600 = 1 hour).
36
36
  * Feeds with updatedAt older than this are flagged in diagnostics.
37
- * Set to 0 to disable staleness checking.
37
+ * Set to 0 to disable staleness checking (also skips the AAVE feed probe).
38
+ *
39
+ * This is a REPORTING threshold only — it is intentionally tighter than the
40
+ * `staleRejectSeconds` used by `selectAssetGroupPrices` to demote a price,
41
+ * because a healthy 24h-heartbeat stablecoin feed is routinely hours old.
38
42
  */
39
43
  stalenessThresholdSeconds?: number;
44
+ /**
45
+ * Resolve AAVE-family feed sources and read their `updatedAt` (default true
46
+ * when staleness checking is on). Costs two extra multicalls per chain, run
47
+ * concurrently with the price groups. Without it, chains whose only price
48
+ * source is an AAVE fork — Avalanche has no Compound V3 deployment — get no
49
+ * staleness coverage at all.
50
+ */
51
+ probeFeedStaleness?: boolean;
40
52
  /**
41
53
  * Only run these fetcher groups. Useful for debugging individual protocols.
42
54
  * Values: 'aave', 'compoundV2', 'compoundV3', 'lista', 'eulerV2', 'aaveV4',
@@ -61,5 +73,5 @@ export declare function fetchOraclePrices(chainIds: string[], rpcOverrides?: {
61
73
  [chainId: string]: string[];
62
74
  }, lists?: TokenListInput, retries?: number, batchSize?: {
63
75
  [chainId: string]: number;
64
- } | undefined, allowFailure?: boolean, basePrices?: USDPriceMap, morphoMarketOverrides?: MorphoMarketOverrides, listaMarketOverrides?: ListaMarketOverrides, stalenessThresholdSeconds?: number, onlyFetchers?: string[]): Promise<OraclePricesResult>;
76
+ } | undefined, allowFailure?: boolean, basePrices?: USDPriceMap, morphoMarketOverrides?: MorphoMarketOverrides, listaMarketOverrides?: ListaMarketOverrides, stalenessThresholdSeconds?: number, onlyFetchers?: string[], probeFeedStaleness?: boolean): Promise<OraclePricesResult>;
65
77
  //# sourceMappingURL=fetchOraclePrices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchOraclePrices.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/fetchOraclePrices.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EAEX,YAAY,EAKZ,kBAAkB,EAEnB,MAAM,SAAS,CAAA;AAChB,OAAO,EA2BL,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAA;AAiBnB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAA;CAChC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,YAAY,CAAC,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;IAC9C,sEAAsE;IACtE,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mDAAmD;IACnD,SAAS,CAAC,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACzC,gEAAgE;IAChE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,gEAAgE;IAChE,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB,oDAAoD;IACpD,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AA2KD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,CAA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AAoD;IACpD,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C;;;;;;;;OAQG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AAoLD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,CAAC,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,EAC9C,KAAK,GAAE,cAAmB,EAC1B,OAAO,SAAI,EACX,SAAS,GAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,SAAqB,EAChE,YAAY,UAAO,EACnB,UAAU,GAAE,WAAgB,EAC5B,qBAAqB,CAAC,EAAE,qBAAqB,EAC7C,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,yBAAyB,SAAO,EAChC,YAAY,CAAC,EAAE,MAAM,EAAE,EACvB,kBAAkB,UAAO,GACxB,OAAO,CAAC,kBAAkB,CAAC,CAg/B7B"}
@@ -79,6 +79,20 @@ export declare function getAaveAbi(): readonly [{
79
79
  }];
80
80
  readonly stateMutability: "view";
81
81
  readonly type: "function";
82
+ }, {
83
+ readonly inputs: readonly [{
84
+ readonly internalType: "address";
85
+ readonly name: "asset";
86
+ readonly type: "address";
87
+ }];
88
+ readonly name: "getSourceOfAsset";
89
+ readonly outputs: readonly [{
90
+ readonly internalType: "address";
91
+ readonly name: "";
92
+ readonly type: "address";
93
+ }];
94
+ readonly stateMutability: "view";
95
+ readonly type: "function";
82
96
  }];
83
97
  /**
84
98
  * AAVE Oracle Fetcher module
@@ -1 +1 @@
1
- {"version":3,"file":"aave.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/aave.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AAIjB;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,0DAA0D;IAC1D,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAA;IACtB,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,2DAA2D;IAC3D,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAmBD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GACd,aAAa,CAAC,qBAAqB,CAAC,EAAE,CAqDxC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CAqEpB;AAED;;GAEG;AACH,wBAAgB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEzB;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAA"}
1
+ {"version":3,"file":"aave.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/aave.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AAIjB;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,0DAA0D;IAC1D,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAA;IACtB,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,2DAA2D;IAC3D,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAmBD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GACd,aAAa,CAAC,qBAAqB,CAAC,EAAE,CAqDxC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CAqEpB;AAED;;GAEG;AACH,wBAAgB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEzB;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"compoundV3.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/compoundV3.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AAKjB;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;EAczB,CAAA;AAkBV;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GACd,aAAa,CAAC,mBAAmB,EAAE,CAAC,EAAE,CA0DxC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,mBAAmB,EAAE,EAC3B,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CAqDpB;AAED;;GAEG;AACH,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;GAE/B;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAA"}
1
+ {"version":3,"file":"compoundV3.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/compoundV3.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AAKjB;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;EAczB,CAAA;AAqBV;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GACd,aAAa,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAwDxC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,mBAAmB,EAAE,EAC3B,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CA6DpB;AAED;;GAEG;AACH,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;GAE/B;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"euler.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/euler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AA6CjB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,OAAO,CAAA;CACtB;AAKD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,GACd,aAAa,CAAC,gBAAgB,EAAE,CAAC,EAAE,CA6CrC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,gBAAgB,EAAE,EACxB,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CAmEpB;AAED;;GAEG;AACH,wBAAgB,aAAa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AgB,EAAE,GAAG,IAAI,CAAC,CAsDpC;AAID;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,eAAe,EAAE,EAC7B,MAAM,EAAE,MAAM,GACb,gBAAgB,EAAE,GAAG,IAAI,CAqG3B;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;CAIzB,CAAA"}
@@ -1,6 +1,11 @@
1
1
  export { fetchOraclePrices, type TokenListInput, type FetchOraclePricesOptions, } from './fetchOraclePrices';
2
- export { selectAssetGroupPrices } from './selectAssetGroupPrices';
3
- export type { OraclePriceEntry, StructuredOraclePrices, USDPriceMap, TvlMap, FlattenPriorityConfig, ParseContext, TokenListEntry, TokenListMap, MulticallCall, FetcherResult, ParserFn, OracleFetcher, AaveQueryMeta, MorphoQueryMeta, MorphoMarketOverride, ListaQueryMeta, ListaMarketOverride, CompoundV2QueryMeta, CompoundV3QueryMeta, OracleDiagnostics, OraclePricesResult, ChainDiagnostic, TrackerDiagnostic, StaleFeedEntry, } from './types';
2
+ export { selectAssetGroupPrices, DEFAULT_STALE_REJECT_SECONDS, DEFAULT_OUTLIER_GUARD, type SelectPricesOptions, } from './selectAssetGroupPrices';
3
+ export { resolveDerivation, DERIVATION_RANK } from './derivation';
4
+ export { lenderFamily } from './lenderKeys';
5
+ export { consensusReference, rejectOutliers as rejectPriceOutliers, type FeedPriced, } from './outlierGuard';
6
+ export { updateFeedStats, collectFeedObservations, classifyFreshness, classifyReliability, pruneFeedStats, feedKeyOf, feedStatKey, type FeedStat, type FeedStatsMap, type FeedObservation, type FreshnessClass, type ReliabilityClass, } from './feedStats';
7
+ export { probeAaveFeedTimestamps, type FeedTimestampMap, type AssetFeedInfo, } from './feedStaleness';
8
+ export type { OraclePriceEntry, StructuredOraclePrices, USDPriceMap, TvlMap, DepthMap, PriceDerivation, PriceSelection, FlattenPriorityConfig, OutlierGuardConfig, ParseContext, TokenListEntry, TokenListMap, MulticallCall, FetcherResult, ParserFn, OracleFetcher, AaveQueryMeta, MorphoQueryMeta, MorphoMarketOverride, ListaQueryMeta, ListaMarketOverride, CompoundV2QueryMeta, CompoundV3QueryMeta, OracleDiagnostics, OraclePricesResult, ChainDiagnostic, TrackerDiagnostic, StaleFeedEntry, } from './types';
4
9
  export { aaveFetcher, getAaveCalls, parseAaveResults, getAaveAbi, } from './fetchers/aave';
5
10
  export { morphoFetcher, getMorphoCalls, parseMorphoResults, getMorphoAbi, fetchMorphoGraphQLPrices, type MorphoMarketOverrides, type MorphoFetcherContext, } from './fetchers/morpho';
6
11
  export { midnightFetcher, getMidnightCalls, parseMidnightResults, getMidnightAbi, } from './fetchers/midnight';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,wBAAwB,GAC9B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAGjE,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,MAAM,EACN,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,SAAS,CAAA;AAGhB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,wBAAwB,GAC9B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,KAAK,mBAAmB,GACzB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EACL,kBAAkB,EAClB,cAAc,IAAI,mBAAmB,EACrC,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,WAAW,EACX,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,eA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a,EACb,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Collapse a market-keyed lender key to its protocol family:
3
+ * `MORPHO_BLUE_<id>` / `AAVE_V4_<spoke>` / `SILO_V2_<silo>` -> `MORPHO_BLUE`,
4
+ * `AAVE_V4`, `SILO_V2`.
5
+ *
6
+ * Used wherever INDEPENDENT sources are counted. One protocol emitting a
7
+ * price per market must not look like agreement between many protocols —
8
+ * that is the difference between "four oracles agree" and "one oracle, read
9
+ * four times".
10
+ *
11
+ * Suffixes that are not pure hex (`COMPOUND_V3_USDC`, `AAVE_V3_ETHER_FI`)
12
+ * are distinct deployments and keep their key.
13
+ *
14
+ * Lives in its own module so `feedStats` and `selectAssetGroupPrices` can
15
+ * both use it without an import cycle.
16
+ */
17
+ export declare function lenderFamily(lender: string): string;
18
+ //# sourceMappingURL=lenderKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lenderKeys.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/lenderKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,43 @@
1
+ import { OutlierGuardConfig } from './types';
2
+ /**
3
+ * Cross-source consensus: the one signal that works on oracles exposing no
4
+ * timestamp at all (Compound V2 forks return a bare `getUnderlyingPrice`,
5
+ * Morpho a bare `price()`), where a dead feed is indistinguishable from a
6
+ * live one on-chain.
7
+ *
8
+ * Shared by the selection guard and by the feed-reliability stats so BOTH
9
+ * apply the same standard of proof. Learning "this feed disagrees" from a
10
+ * two-source group would be the same mistake as rejecting on it.
11
+ */
12
+ export declare const DEFAULT_OUTLIER_GUARD: OutlierGuardConfig;
13
+ export declare function median(values: number[]): number;
14
+ /** Anything carrying a price and the identity of the source behind it. */
15
+ export interface FeedPriced {
16
+ priceUSD: number;
17
+ feedKey: string;
18
+ }
19
+ /**
20
+ * The reference price a group agrees on, or `undefined` when the group has
21
+ * no broad agreement.
22
+ *
23
+ * The reference is the median of PER-FEED medians, so the five protocols
24
+ * reading one Chainlink aggregator count once, not five times, and a
25
+ * protocol emitting a price per market cannot outvote everyone else.
26
+ *
27
+ * Requiring a real cluster is what stops a minority of broken feeds from
28
+ * overruling a correct price: where two dead feeds quote a `1e-8` sentinel
29
+ * and only AAVE quotes the truth, no cluster forms and the caller is told
30
+ * there is no consensus — rather than being handed `1e-8` as one.
31
+ */
32
+ export declare function consensusReference(candidates: FeedPriced[], guard?: OutlierGuardConfig): number | undefined;
33
+ /**
34
+ * Drop candidates that contradict a strong cross-feed consensus.
35
+ *
36
+ * Rejects on a FACTOR (default >2x off), never on a percentage, so ordinary
37
+ * oracle disagreement is untouched — and never empties a group.
38
+ *
39
+ * Exported so tests can assert against the real implementation instead of a
40
+ * copy that can drift from it.
41
+ */
42
+ export declare function rejectOutliers<T extends FeedPriced>(candidates: T[], guard?: OutlierGuardConfig): T[];
43
+ //# sourceMappingURL=outlierGuard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outlierGuard.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/outlierGuard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;;;;;;GASG;AAEH,eAAO,MAAM,qBAAqB,EAAE,kBAInC,CAAA;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAI/C;AAED,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EAAE,EACxB,KAAK,GAAE,kBAA0C,GAChD,MAAM,GAAG,SAAS,CAqBpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EACjD,UAAU,EAAE,CAAC,EAAE,EACf,KAAK,GAAE,kBAA0C,GAChD,CAAC,EAAE,CAUL"}
@@ -1,10 +1,51 @@
1
1
  import { TokenListInput } from './fetchOraclePrices';
2
- import { StructuredOraclePrices, USDPriceMap, FlattenPriorityConfig, TvlMap } from './types';
2
+ import { StructuredOraclePrices, USDPriceMap, FlattenPriorityConfig, TvlMap, DepthMap, PriceSelection } from './types';
3
+ import { FeedStatsMap } from './feedStats';
4
+ /**
5
+ * Feeds older than this are demoted below every fresh candidate, when the
6
+ * feed has no learned cadence of its own yet.
7
+ *
8
+ * 48h = 2x the slowest standard Chainlink heartbeat (24h). A healthy
9
+ * stablecoin feed on a 24h heartbeat is routinely 10-20h old, so anything
10
+ * tighter would demote perfectly good prices. Once `feedStats` has watched a
11
+ * feed for a few updates, its own cadence replaces this constant.
12
+ */
13
+ export declare const DEFAULT_STALE_REJECT_SECONDS = 172800;
14
+ export { DEFAULT_OUTLIER_GUARD } from './outlierGuard';
15
+ /** Options for the evidence-driven tiers. */
16
+ export interface SelectPricesOptions {
17
+ /**
18
+ * Market depth behind each price, keyed by `marketUid`
19
+ * (`LENDER:chainId:asset`) or, for the legacy shape, by lender.
20
+ * Orders the long tail of lenders that no priority list mentions — without
21
+ * it, ties there fall through to the deterministic identity tiebreak.
22
+ */
23
+ depth?: DepthMap | TvlMap;
24
+ /** Learned per-feed cadence + agreement stats from `feedStats.ts` */
25
+ feedStats?: FeedStatsMap;
26
+ /** Wall clock override (unix seconds), for deterministic tests */
27
+ nowSeconds?: number;
28
+ /**
29
+ * Receives the winning candidate per asset group. Provenance is otherwise
30
+ * unrecoverable from the flat map — "why is AVAX $23.78" should not
31
+ * require re-deriving the whole pipeline.
32
+ */
33
+ onSelection?: (selection: PriceSelection) => void;
34
+ }
3
35
  /**
4
36
  * Flattens structured oracle prices to a simple USD price map.
5
37
  *
6
- * When multiple oracles report a price for the same assetGroup the
7
- * priority config decides which one wins (first-write-wins after sorting).
38
+ * Ranking, in order:
39
+ * 1. freshness — past this feed's own learned cadence loses
40
+ * 2. reliability — a feed that habitually disagrees with the market loses
41
+ * 3. derivation — a direct oracle read beats a price derived from one
42
+ * 4. lender — operator preference from the priority config
43
+ * 5. depth — deeper market wins (also picks an asset's home chain)
44
+ * 6. chain — configured chain preference
45
+ * 7. identity — deterministic, never input order
46
+ *
47
+ * Before ranking, candidates contradicting a strong cross-feed consensus are
48
+ * dropped by the outlier guard.
8
49
  */
9
- export declare function selectAssetGroupPrices(structuredPrices: StructuredOraclePrices, lists?: TokenListInput, tvlMap?: TvlMap, priorityCfg?: FlattenPriorityConfig): USDPriceMap;
50
+ export declare function selectAssetGroupPrices(structuredPrices: StructuredOraclePrices, lists?: TokenListInput, depthOrTvl?: DepthMap | TvlMap, priorityCfg?: FlattenPriorityConfig, options?: SelectPricesOptions): USDPriceMap;
10
51
  //# sourceMappingURL=selectAssetGroupPrices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectAssetGroupPrices.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/selectAssetGroupPrices.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAA;AAoFhB;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,gBAAgB,EAAE,sBAAsB,EACxC,KAAK,GAAE,cAAmB,EAC1B,MAAM,GAAE,MAAW,EACnB,WAAW,GAAE,qBAAwC,GACpD,WAAW,CA0Cb"}
1
+ {"version":3,"file":"selectAssetGroupPrices.d.ts","sourceRoot":"","sources":["../../../src/prices/oracle-prices/selectAssetGroupPrices.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EAErB,MAAM,EACN,QAAQ,EAER,cAAc,EACf,MAAM,SAAS,CAAA;AAKhB,OAAO,EACL,YAAY,EAOb,MAAM,aAAa,CAAA;AAMpB;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,SAAU,CAAA;AASnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AA2KtD,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;IACzB,qEAAqE;IACrE,SAAS,CAAC,EAAE,YAAY,CAAA;IACxB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAA;CAClD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,gBAAgB,EAAE,sBAAsB,EACxC,KAAK,GAAE,cAAmB,EAC1B,UAAU,GAAE,QAAQ,GAAG,MAAW,EAClC,WAAW,GAAE,qBAAwC,EACrD,OAAO,GAAE,mBAAwB,GAChC,WAAW,CA8Fb"}
@@ -29,7 +29,45 @@ export interface OraclePriceEntry {
29
29
  * `undefined` means the price is config-agnostic (all other lenders).
30
30
  */
31
31
  configId?: string;
32
+ /**
33
+ * Unix seconds of the feed's last update, when the oracle exposes one
34
+ * (Chainlink-style `latestRoundData().updatedAt`).
35
+ *
36
+ * Set directly by fetchers that read round data (Compound V3) and
37
+ * back-filled for AAVE-family entries by the source probe in
38
+ * `feedStaleness.ts`. `undefined` means the oracle has no readable
39
+ * timestamp (e.g. Compound V2 `getUnderlyingPrice`, Morpho `price()`)
40
+ * — NOT that the feed is fresh. Staleness for those oracles can only be
41
+ * caught by the cross-source outlier guard in `selectAssetGroupPrices`.
42
+ */
43
+ updatedAt?: number;
44
+ /** Feed address the `updatedAt` was read from (diagnostics only) */
45
+ feedSource?: string;
46
+ /**
47
+ * How this USD price was obtained. The single highest-signal ranking input:
48
+ * a derived price inherits the error of whatever it was derived from and
49
+ * can never be better than it, so it must lose to a direct oracle read.
50
+ *
51
+ * Set by the fetcher (or defaulted per fetcher group in
52
+ * `fetchOraclePrices`); resolved with `resolveDerivation` so legacy or
53
+ * third-party entries still classify sensibly from `baseAsset`/`staticBase`.
54
+ */
55
+ derivation?: PriceDerivation;
32
56
  }
57
+ /**
58
+ * Quality class of a USD price, in descending order of trust.
59
+ *
60
+ * - `direct` — the oracle returns USD (or the asset IS the base and prices
61
+ * itself at 1). No dependency on any other price.
62
+ * - `quoted` — a real feed for this asset denominated in another asset
63
+ * (e.g. `cbBTC / ETH`), multiplied by that asset's USD price. One
64
+ * dependency, but the asset itself has a dedicated feed.
65
+ * - `derived` — no feed for this asset at all: a market ratio
66
+ * (Morpho `price()`, Fluid/Silo/Teller/Gearbox exchange ratios)
67
+ * multiplied by another asset's USD. Error compounds and the result is
68
+ * only as good as the leg it hangs off.
69
+ */
70
+ export type PriceDerivation = 'direct' | 'quoted' | 'derived';
33
71
  /**
34
72
  * Structured oracle price data
35
73
  * chainId -> lender -> array of price entries
@@ -258,11 +296,84 @@ export interface FlattenPriorityConfig {
258
296
  excludedLendersPerChain: {
259
297
  [chainId: string]: string[];
260
298
  };
299
+ /**
300
+ * Entries whose `updatedAt` is older than this many seconds are demoted
301
+ * below every fresh candidate (they still fill gaps when nothing else
302
+ * prices the asset). Default `DEFAULT_STALE_REJECT_SECONDS` (48h).
303
+ *
304
+ * Deliberately far above the reporting threshold in `fetchOraclePrices`:
305
+ * the slowest standard Chainlink heartbeat is 24h, so a healthy stablecoin
306
+ * feed is routinely several hours old and must NOT be demoted.
307
+ * Set to 0 to disable staleness demotion.
308
+ */
309
+ staleRejectSeconds?: number;
310
+ /**
311
+ * Cross-source sanity guard. When several independent protocol families
312
+ * agree on a price, candidates that disagree by more than
313
+ * `rejectFactor` are dropped before priority is applied — this is the only
314
+ * defense against oracles that expose no timestamp (Compound V2 forks,
315
+ * Morpho `price()`), where a dead feed is indistinguishable from a live
316
+ * one on-chain. Set to `false` to disable.
317
+ */
318
+ outlierGuard?: OutlierGuardConfig | false;
261
319
  }
262
- /** TVL map keyed by lender -> total liquidity USD */
320
+ /**
321
+ * Cross-source outlier rejection settings.
322
+ *
323
+ * Deliberately conservative: it only fires when a large majority of
324
+ * INDEPENDENT protocol families agree, and only drops candidates that are
325
+ * off by a factor, not a percentage. A minority of broken feeds must never
326
+ * be able to reject a correct price.
327
+ */
328
+ export interface OutlierGuardConfig {
329
+ /**
330
+ * Minimum number of distinct protocol families that must agree (within
331
+ * `agreementTolerance` of the reference price) before any candidate is
332
+ * dropped. Below this the group is left untouched.
333
+ */
334
+ minAgreeingFamilies: number;
335
+ /** Relative tolerance for counting a family as "agreeing" (0.05 = 5%) */
336
+ agreementTolerance: number;
337
+ /**
338
+ * Multiplicative deviation from the reference price above which a
339
+ * candidate is rejected (2 = more than 2x or less than half).
340
+ */
341
+ rejectFactor: number;
342
+ }
343
+ /** TVL map keyed by lender -> total liquidity USD (legacy shape) */
263
344
  export type TvlMap = {
264
345
  [lender: string]: number;
265
346
  };
347
+ /**
348
+ * Market depth behind a price, keyed by `marketUid`
349
+ * (`LENDER:chainId:asset`, see `createMarketUid`) — the same key the lending
350
+ * pipeline already uses, so producers can join the two without a new
351
+ * identifier.
352
+ *
353
+ * Accepts lender-level keys too, so the legacy `TvlMap` keeps working: the
354
+ * per-market key is tried first and the lender key is the fallback.
355
+ */
356
+ export type DepthMap = {
357
+ [marketUidOrLender: string]: number;
358
+ };
359
+ /**
360
+ * Why a given asset group ended up with the price it did. Emitted per group
361
+ * via `SelectPricesOptions.onSelection` — the flat price map alone makes
362
+ * "where did this number come from" unanswerable.
363
+ */
364
+ export interface PriceSelection {
365
+ assetGroup: string;
366
+ priceUSD: number;
367
+ chainId: string;
368
+ lender: string;
369
+ /** Aggregator address, or `lender|asset` when the oracle exposes none */
370
+ feedKey: string;
371
+ derivation: PriceDerivation;
372
+ /** Candidates considered for this group */
373
+ candidates: number;
374
+ /** How many the outlier guard dropped */
375
+ rejected: number;
376
+ }
266
377
  /**
267
378
  * Per-tracker diagnostics (one entry per fetcher/lender per chain)
268
379
  */
@@ -317,6 +428,8 @@ export interface StaleFeedEntry {
317
428
  oracle: string;
318
429
  /** Seconds since the feed was last updated */
319
430
  staleSeconds: number;
431
+ /** Feed description when the aggregator exposes one (e.g. "EURC / USD") */
432
+ description?: string;
320
433
  }
321
434
  /**
322
435
  * Top-level diagnostics report returned alongside oracle prices