@1delta/margin-fetcher 0.0.277 → 0.0.279
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/README.md +104 -0
- package/dist/abis/compound-v2/Comptroller.d.ts +20 -0
- package/dist/abis/compound-v2/Comptroller.d.ts.map +1 -1
- package/dist/ccip-VFYF2C5F.js +5 -0
- package/dist/{ccip-XQNAHYUN.js.map → ccip-VFYF2C5F.js.map} +1 -1
- package/dist/{chunk-H6U3H7VY.js → chunk-Z3MGRQJR.js} +11 -6
- package/dist/chunk-Z3MGRQJR.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +997 -92
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/aave-v2-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/aave-v3-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/aave-v4-type/fetcher/normalize.d.ts +16 -0
- package/dist/lending/public-data/aave-v4-type/fetcher/normalize.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/convert/benqi.d.ts +3 -0
- package/dist/lending/public-data/compound-v2/convert/benqi.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/convert/kinetic.d.ts +3 -0
- package/dist/lending/public-data/compound-v2/convert/kinetic.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/convert/risk.d.ts +3 -0
- package/dist/lending/public-data/compound-v2/convert/risk.d.ts.map +1 -0
- package/dist/lending/public-data/compound-v2/convert/standard.d.ts +5 -0
- package/dist/lending/public-data/compound-v2/convert/standard.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/convert/sumer.d.ts +1 -0
- package/dist/lending/public-data/compound-v2/convert/sumer.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/convert/takara.d.ts +3 -0
- package/dist/lending/public-data/compound-v2/convert/takara.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/convert/tectonic.d.ts +3 -0
- package/dist/lending/public-data/compound-v2/convert/tectonic.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/publicCallBuild.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v2/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v3/publicCallBuild.d.ts.map +1 -1
- package/dist/lending/public-data/compound-v3/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/dolomite/emodeConfig.d.ts +2 -0
- package/dist/lending/public-data/dolomite/emodeConfig.d.ts.map +1 -1
- package/dist/lending/public-data/dolomite/fetchFromSubgraph.d.ts.map +1 -1
- package/dist/lending/public-data/dolomite/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/euler/fetcher/normalize.d.ts +7 -0
- package/dist/lending/public-data/euler/fetcher/normalize.d.ts.map +1 -1
- package/dist/lending/public-data/euler/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/gearbox/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/init/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/lista/getMarketsFromChain.d.ts.map +1 -1
- package/dist/lending/public-data/lista/listaBroker.d.ts +65 -0
- package/dist/lending/public-data/lista/listaBroker.d.ts.map +1 -0
- package/dist/lending/public-data/lista/publicCallBuild.d.ts.map +1 -1
- package/dist/lending/public-data/morpho/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/morpho/getMarketsFromChain.d.ts.map +1 -1
- package/dist/lending/public-data/morpho/utils/parsers.d.ts +8 -0
- package/dist/lending/public-data/morpho/utils/parsers.d.ts.map +1 -1
- package/dist/lending/public-data/silo-v2/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/silo-v2/publicCallParse.d.ts.map +1 -1
- package/dist/lending/public-data/silo-v3/convertPublic.d.ts.map +1 -1
- package/dist/lending/public-data/silo-v3/publicCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/morpho/userCallBuild.d.ts +2 -2
- package/dist/lending/user-data/morpho/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/morpho/userCallParse.d.ts +10 -1
- package/dist/lending/user-data/morpho/userCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/utils/types.d.ts +10 -0
- package/dist/lending/user-data/utils/types.d.ts.map +1 -1
- package/dist/types/apiReturnType.d.ts +38 -0
- package/dist/types/apiReturnType.d.ts.map +1 -1
- package/dist/types/lender/morpho-types.d.ts +17 -2
- package/dist/types/lender/morpho-types.d.ts.map +1 -1
- package/dist/types/lenderTypes.d.ts +66 -0
- package/dist/types/lenderTypes.d.ts.map +1 -1
- package/dist/vaults/lst/celoValidatorGroups.d.ts +40 -0
- package/dist/vaults/lst/celoValidatorGroups.d.ts.map +1 -0
- package/dist/vaults/lst/fetchPublic.d.ts +7 -1
- package/dist/vaults/lst/fetchPublic.d.ts.map +1 -1
- package/dist/vaults/lst/index.d.ts +2 -0
- package/dist/vaults/lst/index.d.ts.map +1 -1
- package/dist/vaults/lst/readers/offChain.d.ts +5 -1
- package/dist/vaults/lst/readers/offChain.d.ts.map +1 -1
- package/dist/vaults/lst/readers/shared.d.ts +6 -0
- package/dist/vaults/lst/readers/shared.d.ts.map +1 -1
- package/dist/vaults/lst/readers/veda.d.ts +7 -3
- package/dist/vaults/lst/readers/veda.d.ts.map +1 -1
- package/dist/vaults/lst/registry.d.ts +7 -0
- package/dist/vaults/lst/registry.d.ts.map +1 -1
- package/dist/vaults/lst/types.d.ts +32 -10
- package/dist/vaults/lst/types.d.ts.map +1 -1
- package/dist/vaults/lst/validators.d.ts +65 -0
- package/dist/vaults/lst/validators.d.ts.map +1 -0
- package/dist/vaults/savings/fetchPublic.d.ts.map +1 -1
- package/dist/vaults/savings/types.d.ts +5 -0
- package/dist/vaults/savings/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/ccip-XQNAHYUN.js +0 -5
- package/dist/chunk-H6U3H7VY.js.map +0 -1
package/README.md
CHANGED
|
@@ -195,3 +195,107 @@ Lista is a Morpho Blue fork with additional per-market fields. Uses a 357-byte b
|
|
|
195
195
|
| `broker` | address | Authorized broker contract |
|
|
196
196
|
|
|
197
197
|
User data also includes per-market whitelist flags prepended before the balance records.
|
|
198
|
+
|
|
199
|
+
### Fixed-term broker (`LendingBroker`)
|
|
200
|
+
|
|
201
|
+
Some Lista markets register a **`LendingBroker`** — the mandatory debt-side gateway of a Moolah
|
|
202
|
+
(Morpho-fork) market. Collateral supply/withdraw still go through the normal Moolah path, but
|
|
203
|
+
**borrow and repay run through the broker**, which overlays a richer debt model on top of the raw
|
|
204
|
+
Moolah position. The on-chain broker is an ERC1967 proxy (e.g. BNB `0x1Fa2…8b54` → impl `0xb680…58bb`),
|
|
205
|
+
verified source `LendingBroker.sol` / `BrokerMath.sol`. Fetcher support lives in
|
|
206
|
+
[`lending/public-data/lista/listaBroker.ts`](src/lending/public-data/lista/listaBroker.ts); the composer
|
|
207
|
+
encoders live in `contracts-delegation` (`ListaBrokerLending.sol`, `CalldataLib.encodeListaBroker*`).
|
|
208
|
+
|
|
209
|
+
**Two debt buckets per user.** A brokered market has **no flexible/variable borrowing** at the
|
|
210
|
+
Moolah layer — instead each user holds:
|
|
211
|
+
|
|
212
|
+
- **N fixed-term positions** — each a `{posId, principal, apr, start, end, …}` tranche with a *locked*
|
|
213
|
+
APR and a maturity. Identified by `posId`.
|
|
214
|
+
- **One dynamic position** — a variable-rate position, the catch-all bucket. Targeted on repay by the
|
|
215
|
+
sentinel `posId == type(uint128).max` (`LISTA_BROKER_DYNAMIC_POS`).
|
|
216
|
+
|
|
217
|
+
`broker.getUserTotalDebt(user)` is the authoritative total (fixed + dynamic + all interest).
|
|
218
|
+
|
|
219
|
+
#### Borrow
|
|
220
|
+
|
|
221
|
+
The composer calls `borrow(amount, termId, user, receiver)`. `user` (the position owner) is **always
|
|
222
|
+
the authenticated caller** and must have authorized the composer in Moolah (`setAuthorization`) — debt
|
|
223
|
+
can never be opened against someone else. The broker borrows from Moolah and forwards the loan token to
|
|
224
|
+
`receiver`.
|
|
225
|
+
|
|
226
|
+
> **Native:** the broker *can* unwrap WBNB→BNB, but only on its EOA-direct `borrow(amount)` /
|
|
227
|
+
> `borrow(amount, termId)` overloads that pay `msg.sender`. The `receiver`-variant the composer must use
|
|
228
|
+
> (Moolah requires `receiver == broker` when a broker is registered) **always sends ERC20 WBNB, never
|
|
229
|
+
> native**. To deliver native BNB, chain an unwrap step after the borrow.
|
|
230
|
+
|
|
231
|
+
#### Repay
|
|
232
|
+
|
|
233
|
+
`encodeListaBrokerRepay(loanToken, assets, native, broker, posId, onBehalf)` →
|
|
234
|
+
`repay(amount, posId, onBehalf)` (fixed) or `repay(amount, onBehalf)` (dynamic, sentinel `posId`).
|
|
235
|
+
|
|
236
|
+
- **Interest-first, then principal.**
|
|
237
|
+
- **`onBehalf`** is taken straight from calldata (exactly like Morpho's repay `onBehalfOf`) — repaying
|
|
238
|
+
only ever pays debt down and refunds excess to the composer, so **repay-on-behalf is permissionless**.
|
|
239
|
+
Must be non-zero (broker reverts `ZeroAddress`); there is no caller fallback.
|
|
240
|
+
- **`assets == 0`** repays the composer's full balance (`balanceOf` / `selfbalance`); the broker refunds
|
|
241
|
+
any excess. The clean "close it out" pattern: over-fund slightly, repay with `assets == 0`, take the dust.
|
|
242
|
+
- **Native:** both repay overloads are `payable` and wrap `msg.value` internally (gated on
|
|
243
|
+
`LOAN_TOKEN == WBNB`, else `NativeNotSupported`). The composer's native path forwards the value and
|
|
244
|
+
skips the ERC20 approve. Excess refunds as native BNB to the composer (un-swept on explicit amounts).
|
|
245
|
+
|
|
246
|
+
#### Early-repayment penalty
|
|
247
|
+
|
|
248
|
+
Repaying a fixed position's **principal before `end`** incurs a penalty
|
|
249
|
+
(`BrokerMath.getPenaltyForFixedPosition`):
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
penalty = ceil( ceil(repayPrincipal × aprPerSecond / RATE_SCALE) × timeLeft / 2 )
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
≈ **half the interest that principal would still accrue over the remaining term**. It's skimmed off the
|
|
256
|
+
principal payment and supplied to the Moolah vault as revenue, so it is **additive** — on top of
|
|
257
|
+
`outstanding + accruedInterest`. Penalty is **0 once matured** (`block.timestamp > end`). The fetcher
|
|
258
|
+
surfaces it per loan as `earlyRepayPenalty` (computed for the *full outstanding principal*; scale linearly
|
|
259
|
+
for partials). Use the broker's `previewRepayFixedLoanPosition(user, amount, posId)` for the exact
|
|
260
|
+
`(interest, penalty, principal)` split.
|
|
261
|
+
|
|
262
|
+
#### Maturity & refinancing
|
|
263
|
+
|
|
264
|
+
A fixed position's **interest freezes at `end`** (`getAccruedInterestForFixedPosition` caps at
|
|
265
|
+
`position.end`); after maturity it accrues no further fixed interest and carries no penalty.
|
|
266
|
+
|
|
267
|
+
`refinanceMaturedFixedPositions(user, posIds)` is a **bot-only** function (`onlyRole(BOT)`) — users and
|
|
268
|
+
the composer **cannot** call it, so it is **not** exposed as an SDK/composer op. It migrates matured fixed
|
|
269
|
+
positions into the dynamic bucket: net principal + frozen interest are normalized at the current dynamic
|
|
270
|
+
rate and added to the dynamic position, and the fixed position is **deleted**. The window between maturity
|
|
271
|
+
and the bot's call is interest-free (the protocol absorbs it).
|
|
272
|
+
|
|
273
|
+
#### Repaying late
|
|
274
|
+
|
|
275
|
+
| When | Target | Cost |
|
|
276
|
+
|------|--------|------|
|
|
277
|
+
| Before `end` | fixed `posId` | principal + accrued interest + **early penalty** |
|
|
278
|
+
| After `end`, before bot refinances | fixed `posId` | principal + **frozen** interest, **no penalty** — cheapest |
|
|
279
|
+
| After bot refinances | **dynamic** sentinel | principal + interest captured at refinance + **dynamic-rate interest since** |
|
|
280
|
+
|
|
281
|
+
> **Refinance is a race.** A repay targeting a matured `posId` **reverts** (`position not found`) if the
|
|
282
|
+
> bot refinances first; fall back to the dynamic repay. The matured-but-not-yet-refinanced window
|
|
283
|
+
> (`isMatured: true`, `earlyRepayPenalty: '0'`) is the cheapest time to repay.
|
|
284
|
+
|
|
285
|
+
#### Data shape
|
|
286
|
+
|
|
287
|
+
Brokered markets emit **no variable debt** — the position's `debt` is `0`, the authoritative total sits in
|
|
288
|
+
`debtStable`, and each fixed loan is itemized in a `terms[]` array (`ListaTermLoan`):
|
|
289
|
+
|
|
290
|
+
| Field | Description |
|
|
291
|
+
|-------|-------------|
|
|
292
|
+
| `loanId` | `posId` — the repay target for the `LISTA_BROKER_REPAY` composer op |
|
|
293
|
+
| `debt` | outstanding (principal + accrued interest), loan-token units |
|
|
294
|
+
| `aprFraction` | locked fixed APR as a fraction |
|
|
295
|
+
| `maturity` / `termDays` | unix maturity timestamp / term length |
|
|
296
|
+
| `accruedInterest` | outstanding accrued interest |
|
|
297
|
+
| `earlyRepayPenalty` | penalty to close the loan now; `0` once matured |
|
|
298
|
+
| `isMatured` | `now >= end` |
|
|
299
|
+
|
|
300
|
+
> **Note:** `terms[]` currently itemizes only fixed loans. The dynamic position (post-refinance) is
|
|
301
|
+
> included in the `debtStable` total but not yet surfaced as its own repayable term.
|
|
@@ -12,5 +12,25 @@ export declare const ComptrollerAbi: readonly [{
|
|
|
12
12
|
}];
|
|
13
13
|
readonly stateMutability: "view";
|
|
14
14
|
readonly type: "function";
|
|
15
|
+
}, {
|
|
16
|
+
readonly inputs: readonly [];
|
|
17
|
+
readonly name: "closeFactorMantissa";
|
|
18
|
+
readonly outputs: readonly [{
|
|
19
|
+
readonly internalType: "uint256";
|
|
20
|
+
readonly name: "";
|
|
21
|
+
readonly type: "uint256";
|
|
22
|
+
}];
|
|
23
|
+
readonly stateMutability: "view";
|
|
24
|
+
readonly type: "function";
|
|
25
|
+
}, {
|
|
26
|
+
readonly inputs: readonly [];
|
|
27
|
+
readonly name: "liquidationIncentiveMantissa";
|
|
28
|
+
readonly outputs: readonly [{
|
|
29
|
+
readonly internalType: "uint256";
|
|
30
|
+
readonly name: "";
|
|
31
|
+
readonly type: "uint256";
|
|
32
|
+
}];
|
|
33
|
+
readonly stateMutability: "view";
|
|
34
|
+
readonly type: "function";
|
|
15
35
|
}];
|
|
16
36
|
//# sourceMappingURL=Comptroller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Comptroller.d.ts","sourceRoot":"","sources":["../../../src/abis/compound-v2/Comptroller.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"Comptroller.d.ts","sourceRoot":"","sources":["../../../src/abis/compound-v2/Comptroller.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCjB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ccip-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"ccip-VFYF2C5F.js"}
|
|
@@ -2122,9 +2122,9 @@ var checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
|
2122
2122
|
function checksumAddress(address_, chainId) {
|
|
2123
2123
|
if (checksumAddressCache.has(`${address_}.${chainId}`))
|
|
2124
2124
|
return checksumAddressCache.get(`${address_}.${chainId}`);
|
|
2125
|
-
const hexAddress = address_.substring(2).toLowerCase();
|
|
2125
|
+
const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
|
|
2126
2126
|
const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
|
|
2127
|
-
const address = (hexAddress).split("");
|
|
2127
|
+
const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
|
|
2128
2128
|
for (let i = 0; i < 40; i += 2) {
|
|
2129
2129
|
if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
|
|
2130
2130
|
address[i] = address[i].toUpperCase();
|
|
@@ -2137,6 +2137,11 @@ function checksumAddress(address_, chainId) {
|
|
|
2137
2137
|
checksumAddressCache.set(`${address_}.${chainId}`, result);
|
|
2138
2138
|
return result;
|
|
2139
2139
|
}
|
|
2140
|
+
function getAddress(address, chainId) {
|
|
2141
|
+
if (!isAddress(address, { strict: false }))
|
|
2142
|
+
throw new InvalidAddressError({ address });
|
|
2143
|
+
return checksumAddress(address, chainId);
|
|
2144
|
+
}
|
|
2140
2145
|
|
|
2141
2146
|
// ../../node_modules/.pnpm/viem@2.45.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@6.0.6_zod@4.3.6/node_modules/viem/_esm/errors/cursor.js
|
|
2142
2147
|
var NegativeOffsetError = class extends BaseError3 {
|
|
@@ -3763,7 +3768,7 @@ async function call(client, args) {
|
|
|
3763
3768
|
return { data: response };
|
|
3764
3769
|
} catch (err) {
|
|
3765
3770
|
const data2 = getRevertErrorData(err);
|
|
3766
|
-
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import('./ccip-
|
|
3771
|
+
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import('./ccip-VFYF2C5F.js');
|
|
3767
3772
|
if (client.ccipRead !== false && data2?.slice(0, 10) === offchainLookupSignature2 && to)
|
|
3768
3773
|
return { data: await offchainLookup2(client, { data: data2, to }) };
|
|
3769
3774
|
if (deploylessCall && data2?.slice(0, 10) === "0x101bb98d")
|
|
@@ -4144,6 +4149,6 @@ async function ccipRequest({ data, sender, urls }) {
|
|
|
4144
4149
|
throw error;
|
|
4145
4150
|
}
|
|
4146
4151
|
|
|
4147
|
-
export { AbiEncodingLengthMismatchError, BaseError3 as BaseError, BytesSizeMismatchError, InvalidAddressError, UnsupportedPackedAbiType, arrayRegex, boolToHex, bytesRegex2 as bytesRegex, ccipRequest, concatHex, decodeAbiParameters, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, formatEther, formatUnits, integerRegex2 as integerRegex, isAddress, keccak256, numberToHex, offchainLookup, offchainLookupAbiItem, offchainLookupSignature, pad2 as pad, parseAbi, stringToHex };
|
|
4148
|
-
//# sourceMappingURL=chunk-
|
|
4149
|
-
//# sourceMappingURL=chunk-
|
|
4152
|
+
export { AbiEncodingLengthMismatchError, BaseError3 as BaseError, BytesSizeMismatchError, InvalidAddressError, UnsupportedPackedAbiType, arrayRegex, boolToHex, bytesRegex2 as bytesRegex, ccipRequest, concatHex, decodeAbiParameters, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, formatEther, formatUnits, getAddress, integerRegex2 as integerRegex, isAddress, keccak256, numberToHex, offchainLookup, offchainLookupAbiItem, offchainLookupSignature, pad2 as pad, parseAbi, stringToHex };
|
|
4153
|
+
//# sourceMappingURL=chunk-Z3MGRQJR.js.map
|
|
4154
|
+
//# sourceMappingURL=chunk-Z3MGRQJR.js.map
|