@1delta/margin-fetcher 0.0.331 → 0.0.332
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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +390 -2
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/fluid/publicCallParse.d.ts +1 -1
- package/dist/lending/public-data/term/apiClient.d.ts +9 -1
- package/dist/lending/public-data/term/apiClient.d.ts.map +1 -1
- package/dist/lending/public-data/term/index.d.ts +1 -1
- package/dist/lending/public-data/term/index.d.ts.map +1 -1
- package/dist/lending/public-data/term/types.d.ts +49 -0
- package/dist/lending/public-data/term/types.d.ts.map +1 -1
- package/dist/prices/oracle-prices/fetchOraclePrices.d.ts +2 -1
- package/dist/prices/oracle-prices/fetchOraclePrices.d.ts.map +1 -1
- package/dist/prices/oracle-prices/fetchers/exactly.d.ts +420 -0
- package/dist/prices/oracle-prices/fetchers/exactly.d.ts.map +1 -0
- package/dist/prices/oracle-prices/fetchers/index.d.ts +4 -0
- package/dist/prices/oracle-prices/fetchers/index.d.ts.map +1 -1
- package/dist/prices/oracle-prices/fetchers/liquity.d.ts +49 -0
- package/dist/prices/oracle-prices/fetchers/liquity.d.ts.map +1 -0
- package/dist/prices/oracle-prices/fetchers/river.d.ts +269 -0
- package/dist/prices/oracle-prices/fetchers/river.d.ts.map +1 -0
- package/dist/prices/oracle-prices/fetchers/term.d.ts +59 -0
- package/dist/prices/oracle-prices/fetchers/term.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { FetcherResult, OraclePriceEntry, ParseContext } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* River (Satoshi rebrand — Liquity V1/Prisma-lineage omni-chain CDP) oracle
|
|
4
|
+
* price fetcher.
|
|
5
|
+
*
|
|
6
|
+
* Each market's `TroveManager.fetchPrice()` returns the COLLATERAL price in USD
|
|
7
|
+
* (1e18-scaled) — the same read the public-data fetcher makes. `fetchPrice` is
|
|
8
|
+
* nonpayable but simulates cleanly under an `eth_call` multicall. Direct USD
|
|
9
|
+
* (PASS 1) → feeds the shared `usdPrices` map, so River collateral on chains
|
|
10
|
+
* where no other integrated protocol prices it (BNB / Base / Hemi bespoke LSTs)
|
|
11
|
+
* is covered from River's own oracle. The debt token (satUSD) is emitted pegged
|
|
12
|
+
* to $1 (matching `convertPublic`).
|
|
13
|
+
*/
|
|
14
|
+
interface RiverMarketMeta {
|
|
15
|
+
lender: string;
|
|
16
|
+
chainId: string;
|
|
17
|
+
index: number;
|
|
18
|
+
collToken: string;
|
|
19
|
+
debtToken?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Build one `fetchPrice()` call per market across every River deployment. */
|
|
22
|
+
export declare function getRiverCalls(chainId: string): FetcherResult<RiverMarketMeta>[];
|
|
23
|
+
/**
|
|
24
|
+
* Parse a market's `fetchPrice` into direct-USD entries: the collateral at its
|
|
25
|
+
* on-chain USD price, and satUSD pegged to $1. Keyed under the per-market
|
|
26
|
+
* `RIVER_<chain>_<index>` lender.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseRiverResults(data: any[], meta: RiverMarketMeta, context: ParseContext): OraclePriceEntry[];
|
|
29
|
+
/** ABI for the River oracle call (`fetchPrice`). */
|
|
30
|
+
export declare function getRiverAbi(): readonly [{
|
|
31
|
+
readonly type: "function";
|
|
32
|
+
readonly name: "getEntireSystemColl";
|
|
33
|
+
readonly stateMutability: "view";
|
|
34
|
+
readonly inputs: readonly [];
|
|
35
|
+
readonly outputs: readonly [{
|
|
36
|
+
readonly name: "";
|
|
37
|
+
readonly type: "uint256";
|
|
38
|
+
}];
|
|
39
|
+
}, {
|
|
40
|
+
readonly type: "function";
|
|
41
|
+
readonly name: "getEntireSystemDebt";
|
|
42
|
+
readonly stateMutability: "view";
|
|
43
|
+
readonly inputs: readonly [];
|
|
44
|
+
readonly outputs: readonly [{
|
|
45
|
+
readonly name: "";
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
}];
|
|
48
|
+
}, {
|
|
49
|
+
readonly type: "function";
|
|
50
|
+
readonly name: "MCR";
|
|
51
|
+
readonly stateMutability: "view";
|
|
52
|
+
readonly inputs: readonly [];
|
|
53
|
+
readonly outputs: readonly [{
|
|
54
|
+
readonly name: "";
|
|
55
|
+
readonly type: "uint256";
|
|
56
|
+
}];
|
|
57
|
+
}, {
|
|
58
|
+
readonly type: "function";
|
|
59
|
+
readonly name: "interestRate";
|
|
60
|
+
readonly stateMutability: "view";
|
|
61
|
+
readonly inputs: readonly [];
|
|
62
|
+
readonly outputs: readonly [{
|
|
63
|
+
readonly name: "";
|
|
64
|
+
readonly type: "uint256";
|
|
65
|
+
}];
|
|
66
|
+
}, {
|
|
67
|
+
readonly type: "function";
|
|
68
|
+
readonly name: "getBorrowingRateWithDecay";
|
|
69
|
+
readonly stateMutability: "view";
|
|
70
|
+
readonly inputs: readonly [];
|
|
71
|
+
readonly outputs: readonly [{
|
|
72
|
+
readonly name: "";
|
|
73
|
+
readonly type: "uint256";
|
|
74
|
+
}];
|
|
75
|
+
}, {
|
|
76
|
+
readonly type: "function";
|
|
77
|
+
readonly name: "borrowingFeeFloor";
|
|
78
|
+
readonly stateMutability: "view";
|
|
79
|
+
readonly inputs: readonly [];
|
|
80
|
+
readonly outputs: readonly [{
|
|
81
|
+
readonly name: "";
|
|
82
|
+
readonly type: "uint256";
|
|
83
|
+
}];
|
|
84
|
+
}, {
|
|
85
|
+
readonly type: "function";
|
|
86
|
+
readonly name: "maxBorrowingFee";
|
|
87
|
+
readonly stateMutability: "view";
|
|
88
|
+
readonly inputs: readonly [];
|
|
89
|
+
readonly outputs: readonly [{
|
|
90
|
+
readonly name: "";
|
|
91
|
+
readonly type: "uint256";
|
|
92
|
+
}];
|
|
93
|
+
}, {
|
|
94
|
+
readonly type: "function";
|
|
95
|
+
readonly name: "maxSystemDebt";
|
|
96
|
+
readonly stateMutability: "view";
|
|
97
|
+
readonly inputs: readonly [];
|
|
98
|
+
readonly outputs: readonly [{
|
|
99
|
+
readonly name: "";
|
|
100
|
+
readonly type: "uint256";
|
|
101
|
+
}];
|
|
102
|
+
}, {
|
|
103
|
+
readonly type: "function";
|
|
104
|
+
readonly name: "debtGasCompensation";
|
|
105
|
+
readonly stateMutability: "view";
|
|
106
|
+
readonly inputs: readonly [];
|
|
107
|
+
readonly outputs: readonly [{
|
|
108
|
+
readonly name: "";
|
|
109
|
+
readonly type: "uint256";
|
|
110
|
+
}];
|
|
111
|
+
}, {
|
|
112
|
+
readonly type: "function";
|
|
113
|
+
readonly name: "collateralToken";
|
|
114
|
+
readonly stateMutability: "view";
|
|
115
|
+
readonly inputs: readonly [];
|
|
116
|
+
readonly outputs: readonly [{
|
|
117
|
+
readonly name: "";
|
|
118
|
+
readonly type: "address";
|
|
119
|
+
}];
|
|
120
|
+
}, {
|
|
121
|
+
readonly type: "function";
|
|
122
|
+
readonly name: "sortedTroves";
|
|
123
|
+
readonly stateMutability: "view";
|
|
124
|
+
readonly inputs: readonly [];
|
|
125
|
+
readonly outputs: readonly [{
|
|
126
|
+
readonly name: "";
|
|
127
|
+
readonly type: "address";
|
|
128
|
+
}];
|
|
129
|
+
}, {
|
|
130
|
+
readonly type: "function";
|
|
131
|
+
readonly name: "getTroveOwnersCount";
|
|
132
|
+
readonly stateMutability: "view";
|
|
133
|
+
readonly inputs: readonly [];
|
|
134
|
+
readonly outputs: readonly [{
|
|
135
|
+
readonly name: "";
|
|
136
|
+
readonly type: "uint256";
|
|
137
|
+
}];
|
|
138
|
+
}, {
|
|
139
|
+
readonly type: "function";
|
|
140
|
+
readonly name: "paused";
|
|
141
|
+
readonly stateMutability: "view";
|
|
142
|
+
readonly inputs: readonly [];
|
|
143
|
+
readonly outputs: readonly [{
|
|
144
|
+
readonly name: "";
|
|
145
|
+
readonly type: "bool";
|
|
146
|
+
}];
|
|
147
|
+
}, {
|
|
148
|
+
readonly type: "function";
|
|
149
|
+
readonly name: "sunsetting";
|
|
150
|
+
readonly stateMutability: "view";
|
|
151
|
+
readonly inputs: readonly [];
|
|
152
|
+
readonly outputs: readonly [{
|
|
153
|
+
readonly name: "";
|
|
154
|
+
readonly type: "bool";
|
|
155
|
+
}];
|
|
156
|
+
}, {
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
readonly name: "fetchPrice";
|
|
159
|
+
readonly stateMutability: "nonpayable";
|
|
160
|
+
readonly inputs: readonly [];
|
|
161
|
+
readonly outputs: readonly [{
|
|
162
|
+
readonly name: "";
|
|
163
|
+
readonly type: "uint256";
|
|
164
|
+
}];
|
|
165
|
+
}, {
|
|
166
|
+
readonly type: "function";
|
|
167
|
+
readonly name: "troves";
|
|
168
|
+
readonly stateMutability: "view";
|
|
169
|
+
readonly inputs: readonly [{
|
|
170
|
+
readonly name: "";
|
|
171
|
+
readonly type: "address";
|
|
172
|
+
}];
|
|
173
|
+
readonly outputs: readonly [{
|
|
174
|
+
readonly name: "debt";
|
|
175
|
+
readonly type: "uint256";
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "coll";
|
|
178
|
+
readonly type: "uint256";
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "stake";
|
|
181
|
+
readonly type: "uint256";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "status";
|
|
184
|
+
readonly type: "uint8";
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "arrayIndex";
|
|
187
|
+
readonly type: "uint128";
|
|
188
|
+
}, {
|
|
189
|
+
readonly name: "activeInterestIndex";
|
|
190
|
+
readonly type: "uint256";
|
|
191
|
+
}];
|
|
192
|
+
}, {
|
|
193
|
+
readonly type: "function";
|
|
194
|
+
readonly name: "getEntireDebtAndColl";
|
|
195
|
+
readonly stateMutability: "view";
|
|
196
|
+
readonly inputs: readonly [{
|
|
197
|
+
readonly name: "_borrower";
|
|
198
|
+
readonly type: "address";
|
|
199
|
+
}];
|
|
200
|
+
readonly outputs: readonly [{
|
|
201
|
+
readonly name: "debt";
|
|
202
|
+
readonly type: "uint256";
|
|
203
|
+
}, {
|
|
204
|
+
readonly name: "coll";
|
|
205
|
+
readonly type: "uint256";
|
|
206
|
+
}, {
|
|
207
|
+
readonly name: "pendingDebtReward";
|
|
208
|
+
readonly type: "uint256";
|
|
209
|
+
}, {
|
|
210
|
+
readonly name: "pendingCollateralReward";
|
|
211
|
+
readonly type: "uint256";
|
|
212
|
+
}];
|
|
213
|
+
}, {
|
|
214
|
+
readonly type: "function";
|
|
215
|
+
readonly name: "getTroveStatus";
|
|
216
|
+
readonly stateMutability: "view";
|
|
217
|
+
readonly inputs: readonly [{
|
|
218
|
+
readonly name: "_borrower";
|
|
219
|
+
readonly type: "address";
|
|
220
|
+
}];
|
|
221
|
+
readonly outputs: readonly [{
|
|
222
|
+
readonly name: "";
|
|
223
|
+
readonly type: "uint256";
|
|
224
|
+
}];
|
|
225
|
+
}, {
|
|
226
|
+
readonly type: "function";
|
|
227
|
+
readonly name: "getCurrentICR";
|
|
228
|
+
readonly stateMutability: "view";
|
|
229
|
+
readonly inputs: readonly [{
|
|
230
|
+
readonly name: "_borrower";
|
|
231
|
+
readonly type: "address";
|
|
232
|
+
}, {
|
|
233
|
+
readonly name: "_price";
|
|
234
|
+
readonly type: "uint256";
|
|
235
|
+
}];
|
|
236
|
+
readonly outputs: readonly [{
|
|
237
|
+
readonly name: "";
|
|
238
|
+
readonly type: "uint256";
|
|
239
|
+
}];
|
|
240
|
+
}, {
|
|
241
|
+
readonly type: "function";
|
|
242
|
+
readonly name: "surplusBalances";
|
|
243
|
+
readonly stateMutability: "view";
|
|
244
|
+
readonly inputs: readonly [{
|
|
245
|
+
readonly name: "";
|
|
246
|
+
readonly type: "address";
|
|
247
|
+
}];
|
|
248
|
+
readonly outputs: readonly [{
|
|
249
|
+
readonly name: "";
|
|
250
|
+
readonly type: "uint256";
|
|
251
|
+
}];
|
|
252
|
+
}, {
|
|
253
|
+
readonly type: "function";
|
|
254
|
+
readonly name: "claimCollateral";
|
|
255
|
+
readonly stateMutability: "nonpayable";
|
|
256
|
+
readonly inputs: readonly [{
|
|
257
|
+
readonly name: "_receiver";
|
|
258
|
+
readonly type: "address";
|
|
259
|
+
}];
|
|
260
|
+
readonly outputs: readonly [];
|
|
261
|
+
}];
|
|
262
|
+
/** River Oracle Fetcher module. */
|
|
263
|
+
export declare const riverFetcher: {
|
|
264
|
+
getCalls: typeof getRiverCalls;
|
|
265
|
+
parse: typeof parseRiverResults;
|
|
266
|
+
getAbi: typeof getRiverAbi;
|
|
267
|
+
};
|
|
268
|
+
export {};
|
|
269
|
+
//# sourceMappingURL=river.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"river.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/river.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AAIjB;;;;;;;;;;;GAWG;AAEH,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,GACd,aAAa,CAAC,eAAe,CAAC,EAAE,CA4BlC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CAqCpB;AAED,oDAAoD;AACpD,wBAAgB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B;AAED,mCAAmC;AACnC,eAAO,MAAM,YAAY;;;;CAIxB,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FetcherResult, OraclePriceEntry, ParseContext } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Term Finance oracle price fetcher.
|
|
4
|
+
*
|
|
5
|
+
* Term values collateral against `TermPriceConsumerV3` (one singleton per
|
|
6
|
+
* chain, `config.priceOracle`) — the SAME oracle it liquidates against, so it
|
|
7
|
+
* is the correct source for a Term borrower's liquidation risk (its prices can
|
|
8
|
+
* differ from a generic Chainlink read; without this, Term collateral was only
|
|
9
|
+
* priced by cross-protocol flattening, which uses OTHER protocols' feeds).
|
|
10
|
+
*
|
|
11
|
+
* `usdValueOfTokens(token, amount)` returns the USD value of `amount` tokens as
|
|
12
|
+
* an Exp `{ mantissa }` (1e18-scaled). Passing `amount = 10^decimals` yields the
|
|
13
|
+
* price of ONE whole token → direct USD (PASS 1). Many repos share the same
|
|
14
|
+
* collateral/loan tokens, so calls are DEDUPED per unique token (one call each)
|
|
15
|
+
* and the parser fans each priced token out to every repo that uses it.
|
|
16
|
+
*/
|
|
17
|
+
interface TermTokenMeta {
|
|
18
|
+
token: string;
|
|
19
|
+
/** All repo lender keys (`TERM_FINANCE_<id>`) that reference this token. */
|
|
20
|
+
repoKeys: string[];
|
|
21
|
+
}
|
|
22
|
+
/** One `usdValueOfTokens(token, 10^dec)` call per unique Term token on a chain. */
|
|
23
|
+
export declare function getTermCalls(chainId: string): FetcherResult<TermTokenMeta>[];
|
|
24
|
+
/**
|
|
25
|
+
* Parse a token's `usdValueOfTokens(token, 10^dec)` result (Exp mantissa, the
|
|
26
|
+
* per-whole-token USD price in 1e18) into one direct-USD entry per repo that
|
|
27
|
+
* uses the token, keyed by that repo's `TERM_FINANCE_<id>` lender so the
|
|
28
|
+
* marketUids join the Term lending data.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseTermResults(data: any[], meta: TermTokenMeta, context: ParseContext): OraclePriceEntry[];
|
|
31
|
+
/** ABI for the Term oracle call (`usdValueOfTokens`). */
|
|
32
|
+
export declare function getTermAbi(): readonly [{
|
|
33
|
+
readonly type: "function";
|
|
34
|
+
readonly name: "usdValueOfTokens";
|
|
35
|
+
readonly stateMutability: "view";
|
|
36
|
+
readonly inputs: readonly [{
|
|
37
|
+
readonly name: "token";
|
|
38
|
+
readonly type: "address";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "amount";
|
|
41
|
+
readonly type: "uint256";
|
|
42
|
+
}];
|
|
43
|
+
readonly outputs: readonly [{
|
|
44
|
+
readonly name: "";
|
|
45
|
+
readonly type: "tuple";
|
|
46
|
+
readonly components: readonly [{
|
|
47
|
+
readonly name: "mantissa";
|
|
48
|
+
readonly type: "uint256";
|
|
49
|
+
}];
|
|
50
|
+
}];
|
|
51
|
+
}];
|
|
52
|
+
/** Term Finance Oracle Fetcher module. */
|
|
53
|
+
export declare const termFetcher: {
|
|
54
|
+
getCalls: typeof getTermCalls;
|
|
55
|
+
parse: typeof parseTermResults;
|
|
56
|
+
getAbi: typeof getTermAbi;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=term.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"term.d.ts","sourceRoot":"","sources":["../../../../src/prices/oracle-prices/fetchers/term.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAEb,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAA;AAIjB;;;;;;;;;;;;;;GAcG;AAEH,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,CAuC5E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,YAAY,GACpB,gBAAgB,EAAE,CA4BpB;AAED,yDAAyD;AACzD,wBAAgB,UAAU;;;;;;;;;;;;;;;;;;;GAEzB;AAED,0CAA0C;AAC1C,eAAO,MAAM,WAAW;;;;CAIvB,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.332",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"async-retry": "^1.3.3",
|
|
24
24
|
"lodash": "^4.17.23",
|
|
25
|
-
"@1delta/abis": "0.0.24",
|
|
26
25
|
"@1delta/calldata-sdk": "0.0.159",
|
|
27
|
-
"@1delta/
|
|
26
|
+
"@1delta/abis": "0.0.25",
|
|
28
27
|
"@1delta/dex-registry": "0.0.104",
|
|
29
|
-
"@1delta/
|
|
28
|
+
"@1delta/data-sdk": "0.0.33",
|
|
30
29
|
"@1delta/lender-registry": "0.0.35",
|
|
30
|
+
"@1delta/providers": "0.0.62",
|
|
31
31
|
"@1delta/proxy-fetch": "0.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|