@kasufinance/kasu-sdk 2.16.0 → 2.17.0
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 +1 -1
- package/dist/bundle.cjs.js +233 -16
- package/dist/bundle.esm.js +230 -17
- package/dist/domain/index.d.ts +2 -2
- package/dist/domain/index.js +1 -1
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/yields.d.ts +200 -15
- package/dist/domain/yields.js +211 -14
- package/dist/domain/yields.js.map +1 -1
- package/dist/services/Locking/locking.d.ts +12 -0
- package/dist/services/Locking/locking.js +16 -0
- package/dist/services/Locking/locking.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/index.ts +5 -1
- package/src/domain/yields.ts +257 -15
- package/src/services/Locking/locking.ts +17 -0
package/README.md
CHANGED
|
@@ -235,7 +235,7 @@ application formats them in its own design system and language.
|
|
|
235
235
|
| Pools | `selectVisiblePools`, `poolMaxApy`, `pickHighestYieldTranche`, `maxNetRateCeiling` |
|
|
236
236
|
| Partners | `getCreditOriginator`, `getInstitutionalLender`, `getStrategyRegion`, `APXIUM`, `INVOICEMATE`, `RIXON_CAPITAL` (each with a `region`) |
|
|
237
237
|
| Fixed term | `availableFixedTermConfigs`, `isFixedTermConfigId`, `lockDurationDays`, `lockDurationMonths`, `DAYS_PER_EPOCH`, `DAYS_PER_MONTH`, `MIN_DAYS_FOR_MONTHS` |
|
|
238
|
-
| Yields | `weeklyInterest`, `dailyInterest`, `
|
|
238
|
+
| Yields | `weeklyInterest`, `dailyInterest`, `accruedInterestSince`, `epochAccrual`, `epochEndTimestamp`, `MAX_ACCRUAL_EPOCHS`, `accruedInterest` (deprecated), `projectedAnnualEarnings`, `weightedAverageApy`, `SECONDS_PER_WEEK` — NET of the performance fee; one epoch from each pool's last clearing (its epoch end if late), held to the next epoch end, then capped at 4 epochs (owner ruling 2026-11-07: a pool can stop being cleared without being flagged stopped) (`Locking.getInitialEpochStartTimestamp()` gives epoch zero) |
|
|
239
239
|
| Batch proof | `validateDepositBatchCalls`, `proveDepositInReceipt`, `DepositBatchMismatchError`, `ENTRY_POINT_V07` |
|
|
240
240
|
| Tranche display name | `getTrancheDisplayName`, `UPPER_MEZZANINE` |
|
|
241
241
|
| Strategy summary | `pickShortDescription` — the CMS short blurb as one line of plain text, or `undefined` (also on every `Strategy` as `summary`) |
|
package/dist/bundle.cjs.js
CHANGED
|
@@ -18092,6 +18092,22 @@ class KSULocking {
|
|
|
18092
18092
|
return (yield this._systemVariablesAbi.nextEpochStartTimestamp()).toNumber();
|
|
18093
18093
|
});
|
|
18094
18094
|
}
|
|
18095
|
+
/**
|
|
18096
|
+
* Unix SECONDS at which epoch 0 started:
|
|
18097
|
+
* `SystemVariables.epochStartTimestamp(0)`. The contract writes this once,
|
|
18098
|
+
* at initialisation, so it never changes for a deployment and may be cached
|
|
18099
|
+
* for the life of the app. Every epoch boundary follows from it —
|
|
18100
|
+
* `epochEndTimestamp(initial, epoch)` and `epochAccrual` in the domain
|
|
18101
|
+
* layer.
|
|
18102
|
+
*
|
|
18103
|
+
* Available on every deployment, Full and Lite. A failed read rejects; the
|
|
18104
|
+
* caller validates the value (a positive integer) before using it.
|
|
18105
|
+
*/
|
|
18106
|
+
getInitialEpochStartTimestamp() {
|
|
18107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18108
|
+
return (yield this._systemVariablesAbi.epochStartTimestamp(0)).toNumber();
|
|
18109
|
+
});
|
|
18110
|
+
}
|
|
18095
18111
|
getNextClearingPeriodDate() {
|
|
18096
18112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18097
18113
|
const nextEpochDate = yield this.getNextEpochDate();
|
|
@@ -32242,6 +32258,16 @@ function getTrancheDisplayName(trancheName, pool) {
|
|
|
32242
32258
|
* window, and the accrual spreads an epoch's interest across it.
|
|
32243
32259
|
*/
|
|
32244
32260
|
const SECONDS_PER_WEEK = 604800;
|
|
32261
|
+
/**
|
|
32262
|
+
* The most unpaid interest {@link accruedInterestSince} shows for one pool:
|
|
32263
|
+
* this many epochs of its weekly figure (owner ruling 2026-11-07).
|
|
32264
|
+
*
|
|
32265
|
+
* A pool can stop being cleared without being flagged stopped. On Base, one
|
|
32266
|
+
* pool is more than six epochs behind and another more than a hundred.
|
|
32267
|
+
* Uncapped, the figure would show interest that may never be credited. Four
|
|
32268
|
+
* epochs covers any ordinary late clearing.
|
|
32269
|
+
*/
|
|
32270
|
+
const MAX_ACCRUAL_EPOCHS = 4;
|
|
32245
32271
|
function isUsableFeePercent(feePercent) {
|
|
32246
32272
|
return (feePercent !== null &&
|
|
32247
32273
|
Number.isFinite(feePercent) &&
|
|
@@ -32295,28 +32321,40 @@ function dailyInterest(weekly) {
|
|
|
32295
32321
|
return weekly / 7;
|
|
32296
32322
|
}
|
|
32297
32323
|
/**
|
|
32298
|
-
* Interest accrued since each pool's OWN last
|
|
32299
|
-
*
|
|
32324
|
+
* Interest accrued since each pool's OWN last clearing transaction, capped at
|
|
32325
|
+
* one epoch per pool.
|
|
32300
32326
|
*
|
|
32301
32327
|
* ```
|
|
32302
32328
|
* accrued = Σ_pool weekly_pool × clamp(now − clearing_pool, 0, 604 800) / 604 800
|
|
32303
32329
|
* ```
|
|
32304
32330
|
*
|
|
32305
|
-
*
|
|
32306
|
-
*
|
|
32307
|
-
*
|
|
32308
|
-
*
|
|
32309
|
-
*
|
|
32310
|
-
*
|
|
32311
|
-
*
|
|
32312
|
-
*
|
|
32313
|
-
*
|
|
32314
|
-
*
|
|
32315
|
-
*
|
|
32316
|
-
*
|
|
32331
|
+
* Per pool, because pools clear independently: one shared anchor accrues a
|
|
32332
|
+
* stale pool's share from a close it never had, and when another pool clears
|
|
32333
|
+
* it drops the total by the stale pool's whole weekly share.
|
|
32334
|
+
*
|
|
32335
|
+
* **The one-epoch cap rested on a wrong premise.** It assumed a late
|
|
32336
|
+
* clearing credits only one epoch, so accruing past seven days would promise
|
|
32337
|
+
* interest no close pays. The contracts say otherwise. `ClearingCoordinator`
|
|
32338
|
+
* states that clearing "must be executed once per epoch for each lending
|
|
32339
|
+
* pool" and that "clearing epochs must be executed in order"; `doClearing`
|
|
32340
|
+
* reverts unless the target epoch is the pool's `nextLendingPoolClearingEpoch`,
|
|
32341
|
+
* and it calls `LendingPool.applyInterests(targetEpoch)` on every clearing,
|
|
32342
|
+
* late or not ("if clearing for the epoch is executed only after the clearing
|
|
32343
|
+
* period, only yield will be applied"). Every missed epoch's interest is
|
|
32344
|
+
* therefore credited when the clearings catch up — on Base, one pool cleared
|
|
32345
|
+
* epochs 116 to 119 in the same block, four weeks credited at once.
|
|
32346
|
+
* Capped, the figure freezes as soon as a clearing is a week late; anchored
|
|
32347
|
+
* on the transaction, it also DIPS on a catch-up (elapsed resets to zero
|
|
32348
|
+
* while only one week is credited per clearing).
|
|
32349
|
+
*
|
|
32350
|
+
* The low clamp makes a close ahead of the local clock zero, never negative.
|
|
32317
32351
|
* A non-finite term contributes nothing; a non-finite `nowSeconds` accrues
|
|
32318
|
-
* nothing.
|
|
32319
|
-
*
|
|
32352
|
+
* nothing.
|
|
32353
|
+
*
|
|
32354
|
+
* @deprecated Use {@link accruedInterestSince} with {@link epochAccrual}:
|
|
32355
|
+
* identical while clearings run on time, and it keeps accruing, up to four
|
|
32356
|
+
* epochs, when they run late. Kept, behaviour-identical, for existing
|
|
32357
|
+
* callers.
|
|
32320
32358
|
*/
|
|
32321
32359
|
function accruedInterest(accruals, nowSeconds) {
|
|
32322
32360
|
if (!Number.isFinite(nowSeconds))
|
|
@@ -32331,6 +32369,181 @@ function accruedInterest(accruals, nowSeconds) {
|
|
|
32331
32369
|
}
|
|
32332
32370
|
return accrued;
|
|
32333
32371
|
}
|
|
32372
|
+
/**
|
|
32373
|
+
* Unix SECONDS at which `epoch` ENDS — the start of the next one:
|
|
32374
|
+
*
|
|
32375
|
+
* ```
|
|
32376
|
+
* epochEnd(e) = initialEpochStart + (e + 1) × 604 800
|
|
32377
|
+
* ```
|
|
32378
|
+
*
|
|
32379
|
+
* `SystemVariables.epochStartTimestamp(e)` is `initial + e × EPOCH_DURATION`,
|
|
32380
|
+
* and the initial start is written once, at initialisation, so the end of any
|
|
32381
|
+
* epoch follows from `epochStartTimestamp(0)` with no further read.
|
|
32382
|
+
*
|
|
32383
|
+
* FAILS CLOSED with `NaN`: a non-integer, non-finite or negative epoch, an
|
|
32384
|
+
* initial start that is not a positive integer, or a result past
|
|
32385
|
+
* `Number.MAX_SAFE_INTEGER`.
|
|
32386
|
+
*
|
|
32387
|
+
* @param initialEpochStart unix seconds, `epochStartTimestamp(0)`.
|
|
32388
|
+
* @param epoch the epoch number, 0-based.
|
|
32389
|
+
*/
|
|
32390
|
+
function epochEndTimestamp(initialEpochStart, epoch) {
|
|
32391
|
+
if (!Number.isSafeInteger(initialEpochStart) || initialEpochStart <= 0) {
|
|
32392
|
+
return NaN;
|
|
32393
|
+
}
|
|
32394
|
+
if (!Number.isSafeInteger(epoch) || epoch < 0)
|
|
32395
|
+
return NaN;
|
|
32396
|
+
const end = initialEpochStart + (epoch + 1) * SECONDS_PER_WEEK;
|
|
32397
|
+
return Number.isSafeInteger(end) ? end : NaN;
|
|
32398
|
+
}
|
|
32399
|
+
/**
|
|
32400
|
+
* Builds one pool's {@link EpochAccrual} from what the chain and the subgraph
|
|
32401
|
+
* say about its last clearing:
|
|
32402
|
+
*
|
|
32403
|
+
* ```
|
|
32404
|
+
* epochEnd = epochEndTimestamp(initialEpochStart, lastClearedEpoch)
|
|
32405
|
+
* accruesFrom = min(clearingStartedAt, epochEnd)
|
|
32406
|
+
* ```
|
|
32407
|
+
*
|
|
32408
|
+
* - **On time** (the clearing started inside its window, before its epoch
|
|
32409
|
+
* ended): `accruesFrom` is the clearing's start. Clearing applies the
|
|
32410
|
+
* epoch's interest first and only then accepts requests, so today's
|
|
32411
|
+
* balance — which includes a deposit that clearing accepted — is never
|
|
32412
|
+
* charged for time before it: a new lender starts at exactly 0.
|
|
32413
|
+
* - **Late** (it started at or after its epoch end): `accruesFrom` is the
|
|
32414
|
+
* epoch end. A late clearing accepts no requests and credits exactly one
|
|
32415
|
+
* epoch, so the time it did not credit is kept.
|
|
32416
|
+
*
|
|
32417
|
+
* `lastClearedEpoch` is the newest epoch whose clearing has STARTED (the
|
|
32418
|
+
* subgraph has a `LendingPoolClearing` for it), not the newest that has
|
|
32419
|
+
* finished, and `clearingStartedAt` is that clearing's `startTimestamp`.
|
|
32420
|
+
* `ClearingCoordinator.doClearing` mints the epoch's interest in its FIRST
|
|
32421
|
+
* transaction (`applyInterests`), while `nextLendingPoolClearingEpoch` only
|
|
32422
|
+
* advances when the clearing ENDS, so it is the wrong source.
|
|
32423
|
+
*
|
|
32424
|
+
* FAILS CLOSED with `null`: whatever {@link epochEndTimestamp} rejects, a
|
|
32425
|
+
* `clearingStartedAt` that is not a finite positive number, or a
|
|
32426
|
+
* `weeklyInterest` that is not finite or is negative. The caller then offers
|
|
32427
|
+
* no term for that pool.
|
|
32428
|
+
*
|
|
32429
|
+
* @param input.weeklyInterest the pool's net interest for one epoch.
|
|
32430
|
+
* @param input.initialEpochStart unix seconds, `epochStartTimestamp(0)`.
|
|
32431
|
+
* @param input.lastClearedEpoch the newest epoch whose clearing has started.
|
|
32432
|
+
* @param input.clearingStartedAt unix seconds, that clearing's start.
|
|
32433
|
+
*/
|
|
32434
|
+
function epochAccrual(input) {
|
|
32435
|
+
const { weeklyInterest: weekly, clearingStartedAt } = input;
|
|
32436
|
+
if (!Number.isFinite(weekly) || weekly < 0)
|
|
32437
|
+
return null;
|
|
32438
|
+
if (!Number.isFinite(clearingStartedAt) || clearingStartedAt <= 0) {
|
|
32439
|
+
return null;
|
|
32440
|
+
}
|
|
32441
|
+
const epochEnd = epochEndTimestamp(input.initialEpochStart, input.lastClearedEpoch);
|
|
32442
|
+
if (Number.isNaN(epochEnd))
|
|
32443
|
+
return null;
|
|
32444
|
+
return {
|
|
32445
|
+
weeklyInterest: weekly,
|
|
32446
|
+
accruesFrom: Math.min(clearingStartedAt, epochEnd),
|
|
32447
|
+
epochEnd,
|
|
32448
|
+
};
|
|
32449
|
+
}
|
|
32450
|
+
/**
|
|
32451
|
+
* Interest accrued and not yet credited — the moving part of lifetime
|
|
32452
|
+
* interest (lifetime = settled on chain + this). Per term, with
|
|
32453
|
+
* `W` = 604 800 s:
|
|
32454
|
+
*
|
|
32455
|
+
* ```
|
|
32456
|
+
* accrued = min( weekly × ( min(max(now − accruesFrom, 0), W)
|
|
32457
|
+
* + max(now − (epochEnd + W), 0) ) / W,
|
|
32458
|
+
* MAX_ACCRUAL_EPOCHS × weekly )
|
|
32459
|
+
* ```
|
|
32460
|
+
*
|
|
32461
|
+
* Read along the clock, for one pool:
|
|
32462
|
+
* 1. from `accruesFrom`, one epoch of interest accrues linearly;
|
|
32463
|
+
* 2. it then HOLDS from `accruesFrom + W` until `epochEnd + W`, the end of
|
|
32464
|
+
* the next epoch — at most 48 h after an on-time clearing (its clearing
|
|
32465
|
+
* window), no time at all after a late one (`accruesFrom == epochEnd`);
|
|
32466
|
+
* 3. then it resumes, up to {@link MAX_ACCRUAL_EPOCHS} (4) epochs of
|
|
32467
|
+
* `weekly` in all, and stops there.
|
|
32468
|
+
*
|
|
32469
|
+
* **Why it keeps accruing past one epoch.** Clearing must run once per
|
|
32470
|
+
* epoch for each pool, in order (`ClearingCoordinator.doClearing` reverts
|
|
32471
|
+
* unless the target epoch is the pool's `nextLendingPoolClearingEpoch`), and
|
|
32472
|
+
* every clearing, on time or late, starts with
|
|
32473
|
+
* `LendingPool.applyInterests(targetEpoch)`. A missed epoch is therefore
|
|
32474
|
+
* credited when the clearings catch up (on Base, one pool cleared epochs 116
|
|
32475
|
+
* to 119 in the same block).
|
|
32476
|
+
*
|
|
32477
|
+
* **Why it stops at four epochs** (owner ruling 2026-11-07). A pool can stop
|
|
32478
|
+
* being cleared without being flagged stopped. On Base today one pool is
|
|
32479
|
+
* more than six epochs behind and another more than a hundred. Past four
|
|
32480
|
+
* epochs the figure would show interest that may never be credited. Four
|
|
32481
|
+
* covers any ordinary late clearing.
|
|
32482
|
+
*
|
|
32483
|
+
* **Why the hold.** Without it an on-time anchor accrues past one epoch
|
|
32484
|
+
* while the next on-time clearing — which credits exactly one — is still to
|
|
32485
|
+
* come, and the total steps DOWN when it lands. With it, at a constant
|
|
32486
|
+
* balance, `settled + accrued` never steps down at a clearing (`t` = the
|
|
32487
|
+
* NEW clearing's start, `E` = the end of the epoch it clears):
|
|
32488
|
+
* - on time after on time: identical to the deprecated `accruedInterest`
|
|
32489
|
+
* at every instant. With `gap` = `t` − the previous clearing's start, it
|
|
32490
|
+
* steps UP by `weekly × (W − gap) / W` when `gap < W` (at most 2/7 of one
|
|
32491
|
+
* weekly, as before), and not at all when `gap ≥ W`;
|
|
32492
|
+
* - late after on time, and late after late: exactly continuous;
|
|
32493
|
+
* - on time after late: steps UP by `weekly × (E − t) / W`, at most 2/7 of
|
|
32494
|
+
* one weekly.
|
|
32495
|
+
* A deposit or top-up accepted at an on-time clearing starts at 0, so it
|
|
32496
|
+
* never dips the total either.
|
|
32497
|
+
*
|
|
32498
|
+
* **At the cap.** All of the above holds for a pool below the cap, where
|
|
32499
|
+
* the cap changes nothing. A pool AT the cap shows `4 × weekly` before a
|
|
32500
|
+
* catch-up clearing; after it, one more `weekly` is settled and the new term
|
|
32501
|
+
* shows `min(elapsed′, 4 × weekly)`, so `after = min(elapsed′ + weekly,
|
|
32502
|
+
* 5 × weekly) ≥ before`. Each clearing steps the total UP by at most one
|
|
32503
|
+
* weekly until the pool is back under the cap. Never down, and never above
|
|
32504
|
+
* settled plus `4 × weekly` per pool.
|
|
32505
|
+
*
|
|
32506
|
+
* **Never negative**, and non-decreasing in `now`. A term is skipped — it
|
|
32507
|
+
* contributes nothing — when `weeklyInterest` is not finite or is negative,
|
|
32508
|
+
* when `accruesFrom` or `epochEnd` is not finite, when `accruesFrom >
|
|
32509
|
+
* epochEnd` (inconsistent: the anchor is never after the epoch end), or when
|
|
32510
|
+
* an elapsed time overflows. A non-finite `nowSeconds` accrues nothing.
|
|
32511
|
+
*
|
|
32512
|
+
* **Per pool, because pools clear independently.** One shared anchor accrues
|
|
32513
|
+
* a stale pool's share from a close it never had.
|
|
32514
|
+
*
|
|
32515
|
+
* **Accepted approximation.** `weekly` is today's balance at today's epoch
|
|
32516
|
+
* rate. Over a multi-week gap the chain compounds weekly and may apply other
|
|
32517
|
+
* epochs' rates, so a long accrual reads slightly LOW. It is a ticking
|
|
32518
|
+
* estimate, not a ledger.
|
|
32519
|
+
*
|
|
32520
|
+
* Callers fail closed upstream: no term for a pool whose weekly interest or
|
|
32521
|
+
* clearing is unknown (`epochAccrual` returns `null`), and none for a pool
|
|
32522
|
+
* that has stopped — it will never clear again.
|
|
32523
|
+
*/
|
|
32524
|
+
function accruedInterestSince(accruals, nowSeconds) {
|
|
32525
|
+
if (!Number.isFinite(nowSeconds))
|
|
32526
|
+
return 0;
|
|
32527
|
+
let accrued = 0;
|
|
32528
|
+
for (const { weeklyInterest: weekly, accruesFrom, epochEnd } of accruals) {
|
|
32529
|
+
if (!Number.isFinite(weekly) || weekly < 0)
|
|
32530
|
+
continue;
|
|
32531
|
+
if (!Number.isFinite(accruesFrom) || !Number.isFinite(epochEnd)) {
|
|
32532
|
+
continue;
|
|
32533
|
+
}
|
|
32534
|
+
if (accruesFrom > epochEnd)
|
|
32535
|
+
continue;
|
|
32536
|
+
const sinceAnchor = nowSeconds - accruesFrom;
|
|
32537
|
+
const sinceHoldEnd = nowSeconds - (epochEnd + SECONDS_PER_WEEK);
|
|
32538
|
+
if (!Number.isFinite(sinceAnchor) || !Number.isFinite(sinceHoldEnd)) {
|
|
32539
|
+
continue;
|
|
32540
|
+
}
|
|
32541
|
+
const elapsed = Math.min(Math.max(sinceAnchor, 0), SECONDS_PER_WEEK) +
|
|
32542
|
+
Math.max(sinceHoldEnd, 0);
|
|
32543
|
+
accrued += Math.min((weekly * elapsed) / SECONDS_PER_WEEK, MAX_ACCRUAL_EPOCHS * weekly);
|
|
32544
|
+
}
|
|
32545
|
+
return accrued;
|
|
32546
|
+
}
|
|
32334
32547
|
/**
|
|
32335
32548
|
* What `amount` earns in a year at a NET rate — the "≈ $Y a year" line.
|
|
32336
32549
|
* Feed it `netEffectiveApy(...)`, never a gross APY: the result is a lender's
|
|
@@ -32399,6 +32612,7 @@ exports.INVALID_AUTH_SIGNATURE_MESSAGE = INVALID_AUTH_SIGNATURE_MESSAGE;
|
|
|
32399
32612
|
exports.INVOICEMATE = INVOICEMATE;
|
|
32400
32613
|
exports.Kasu = Kasu;
|
|
32401
32614
|
exports.KasuSdk = KasuSdk;
|
|
32615
|
+
exports.MAX_ACCRUAL_EPOCHS = MAX_ACCRUAL_EPOCHS;
|
|
32402
32616
|
exports.MAX_LENDING_AMOUNT_FALLBACK = MAX_LENDING_AMOUNT_FALLBACK;
|
|
32403
32617
|
exports.MIN_DAYS_FOR_MONTHS = MIN_DAYS_FOR_MONTHS;
|
|
32404
32618
|
exports.MIN_LENDING_AMOUNT_FALLBACK = MIN_LENDING_AMOUNT_FALLBACK;
|
|
@@ -32428,6 +32642,7 @@ exports.TvlHistoryInputError = TvlHistoryInputError;
|
|
|
32428
32642
|
exports.UPPER_MEZZANINE = UPPER_MEZZANINE;
|
|
32429
32643
|
exports.WithdrawFlow = WithdrawFlow;
|
|
32430
32644
|
exports.accruedInterest = accruedInterest;
|
|
32645
|
+
exports.accruedInterestSince = accruedInterestSince;
|
|
32431
32646
|
exports.aggregateYieldHistory = aggregateYieldHistory;
|
|
32432
32647
|
exports.apyToEpochRate = apyToEpochRate;
|
|
32433
32648
|
exports.asContractType = asContractType;
|
|
@@ -32459,6 +32674,8 @@ exports.encodeDepositData = encodeDepositData;
|
|
|
32459
32674
|
exports.encodeRequestWithdrawalCall = encodeRequestWithdrawalCall;
|
|
32460
32675
|
exports.encodeStableTransfer = encodeStableTransfer;
|
|
32461
32676
|
exports.encodeWithdrawAtExpiryCall = encodeWithdrawAtExpiryCall;
|
|
32677
|
+
exports.epochAccrual = epochAccrual;
|
|
32678
|
+
exports.epochEndTimestamp = epochEndTimestamp;
|
|
32462
32679
|
exports.epochRateToApy = epochRateToApy;
|
|
32463
32680
|
exports.epochTrancheYield = epochTrancheYield;
|
|
32464
32681
|
exports.explorerAddressUrl = explorerAddressUrl;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -18090,6 +18090,22 @@ class KSULocking {
|
|
|
18090
18090
|
return (yield this._systemVariablesAbi.nextEpochStartTimestamp()).toNumber();
|
|
18091
18091
|
});
|
|
18092
18092
|
}
|
|
18093
|
+
/**
|
|
18094
|
+
* Unix SECONDS at which epoch 0 started:
|
|
18095
|
+
* `SystemVariables.epochStartTimestamp(0)`. The contract writes this once,
|
|
18096
|
+
* at initialisation, so it never changes for a deployment and may be cached
|
|
18097
|
+
* for the life of the app. Every epoch boundary follows from it —
|
|
18098
|
+
* `epochEndTimestamp(initial, epoch)` and `epochAccrual` in the domain
|
|
18099
|
+
* layer.
|
|
18100
|
+
*
|
|
18101
|
+
* Available on every deployment, Full and Lite. A failed read rejects; the
|
|
18102
|
+
* caller validates the value (a positive integer) before using it.
|
|
18103
|
+
*/
|
|
18104
|
+
getInitialEpochStartTimestamp() {
|
|
18105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18106
|
+
return (yield this._systemVariablesAbi.epochStartTimestamp(0)).toNumber();
|
|
18107
|
+
});
|
|
18108
|
+
}
|
|
18093
18109
|
getNextClearingPeriodDate() {
|
|
18094
18110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18095
18111
|
const nextEpochDate = yield this.getNextEpochDate();
|
|
@@ -32240,6 +32256,16 @@ function getTrancheDisplayName(trancheName, pool) {
|
|
|
32240
32256
|
* window, and the accrual spreads an epoch's interest across it.
|
|
32241
32257
|
*/
|
|
32242
32258
|
const SECONDS_PER_WEEK = 604800;
|
|
32259
|
+
/**
|
|
32260
|
+
* The most unpaid interest {@link accruedInterestSince} shows for one pool:
|
|
32261
|
+
* this many epochs of its weekly figure (owner ruling 2026-11-07).
|
|
32262
|
+
*
|
|
32263
|
+
* A pool can stop being cleared without being flagged stopped. On Base, one
|
|
32264
|
+
* pool is more than six epochs behind and another more than a hundred.
|
|
32265
|
+
* Uncapped, the figure would show interest that may never be credited. Four
|
|
32266
|
+
* epochs covers any ordinary late clearing.
|
|
32267
|
+
*/
|
|
32268
|
+
const MAX_ACCRUAL_EPOCHS = 4;
|
|
32243
32269
|
function isUsableFeePercent(feePercent) {
|
|
32244
32270
|
return (feePercent !== null &&
|
|
32245
32271
|
Number.isFinite(feePercent) &&
|
|
@@ -32293,28 +32319,40 @@ function dailyInterest(weekly) {
|
|
|
32293
32319
|
return weekly / 7;
|
|
32294
32320
|
}
|
|
32295
32321
|
/**
|
|
32296
|
-
* Interest accrued since each pool's OWN last
|
|
32297
|
-
*
|
|
32322
|
+
* Interest accrued since each pool's OWN last clearing transaction, capped at
|
|
32323
|
+
* one epoch per pool.
|
|
32298
32324
|
*
|
|
32299
32325
|
* ```
|
|
32300
32326
|
* accrued = Σ_pool weekly_pool × clamp(now − clearing_pool, 0, 604 800) / 604 800
|
|
32301
32327
|
* ```
|
|
32302
32328
|
*
|
|
32303
|
-
*
|
|
32304
|
-
*
|
|
32305
|
-
*
|
|
32306
|
-
*
|
|
32307
|
-
*
|
|
32308
|
-
*
|
|
32309
|
-
*
|
|
32310
|
-
*
|
|
32311
|
-
*
|
|
32312
|
-
*
|
|
32313
|
-
*
|
|
32314
|
-
*
|
|
32329
|
+
* Per pool, because pools clear independently: one shared anchor accrues a
|
|
32330
|
+
* stale pool's share from a close it never had, and when another pool clears
|
|
32331
|
+
* it drops the total by the stale pool's whole weekly share.
|
|
32332
|
+
*
|
|
32333
|
+
* **The one-epoch cap rested on a wrong premise.** It assumed a late
|
|
32334
|
+
* clearing credits only one epoch, so accruing past seven days would promise
|
|
32335
|
+
* interest no close pays. The contracts say otherwise. `ClearingCoordinator`
|
|
32336
|
+
* states that clearing "must be executed once per epoch for each lending
|
|
32337
|
+
* pool" and that "clearing epochs must be executed in order"; `doClearing`
|
|
32338
|
+
* reverts unless the target epoch is the pool's `nextLendingPoolClearingEpoch`,
|
|
32339
|
+
* and it calls `LendingPool.applyInterests(targetEpoch)` on every clearing,
|
|
32340
|
+
* late or not ("if clearing for the epoch is executed only after the clearing
|
|
32341
|
+
* period, only yield will be applied"). Every missed epoch's interest is
|
|
32342
|
+
* therefore credited when the clearings catch up — on Base, one pool cleared
|
|
32343
|
+
* epochs 116 to 119 in the same block, four weeks credited at once.
|
|
32344
|
+
* Capped, the figure freezes as soon as a clearing is a week late; anchored
|
|
32345
|
+
* on the transaction, it also DIPS on a catch-up (elapsed resets to zero
|
|
32346
|
+
* while only one week is credited per clearing).
|
|
32347
|
+
*
|
|
32348
|
+
* The low clamp makes a close ahead of the local clock zero, never negative.
|
|
32315
32349
|
* A non-finite term contributes nothing; a non-finite `nowSeconds` accrues
|
|
32316
|
-
* nothing.
|
|
32317
|
-
*
|
|
32350
|
+
* nothing.
|
|
32351
|
+
*
|
|
32352
|
+
* @deprecated Use {@link accruedInterestSince} with {@link epochAccrual}:
|
|
32353
|
+
* identical while clearings run on time, and it keeps accruing, up to four
|
|
32354
|
+
* epochs, when they run late. Kept, behaviour-identical, for existing
|
|
32355
|
+
* callers.
|
|
32318
32356
|
*/
|
|
32319
32357
|
function accruedInterest(accruals, nowSeconds) {
|
|
32320
32358
|
if (!Number.isFinite(nowSeconds))
|
|
@@ -32329,6 +32367,181 @@ function accruedInterest(accruals, nowSeconds) {
|
|
|
32329
32367
|
}
|
|
32330
32368
|
return accrued;
|
|
32331
32369
|
}
|
|
32370
|
+
/**
|
|
32371
|
+
* Unix SECONDS at which `epoch` ENDS — the start of the next one:
|
|
32372
|
+
*
|
|
32373
|
+
* ```
|
|
32374
|
+
* epochEnd(e) = initialEpochStart + (e + 1) × 604 800
|
|
32375
|
+
* ```
|
|
32376
|
+
*
|
|
32377
|
+
* `SystemVariables.epochStartTimestamp(e)` is `initial + e × EPOCH_DURATION`,
|
|
32378
|
+
* and the initial start is written once, at initialisation, so the end of any
|
|
32379
|
+
* epoch follows from `epochStartTimestamp(0)` with no further read.
|
|
32380
|
+
*
|
|
32381
|
+
* FAILS CLOSED with `NaN`: a non-integer, non-finite or negative epoch, an
|
|
32382
|
+
* initial start that is not a positive integer, or a result past
|
|
32383
|
+
* `Number.MAX_SAFE_INTEGER`.
|
|
32384
|
+
*
|
|
32385
|
+
* @param initialEpochStart unix seconds, `epochStartTimestamp(0)`.
|
|
32386
|
+
* @param epoch the epoch number, 0-based.
|
|
32387
|
+
*/
|
|
32388
|
+
function epochEndTimestamp(initialEpochStart, epoch) {
|
|
32389
|
+
if (!Number.isSafeInteger(initialEpochStart) || initialEpochStart <= 0) {
|
|
32390
|
+
return NaN;
|
|
32391
|
+
}
|
|
32392
|
+
if (!Number.isSafeInteger(epoch) || epoch < 0)
|
|
32393
|
+
return NaN;
|
|
32394
|
+
const end = initialEpochStart + (epoch + 1) * SECONDS_PER_WEEK;
|
|
32395
|
+
return Number.isSafeInteger(end) ? end : NaN;
|
|
32396
|
+
}
|
|
32397
|
+
/**
|
|
32398
|
+
* Builds one pool's {@link EpochAccrual} from what the chain and the subgraph
|
|
32399
|
+
* say about its last clearing:
|
|
32400
|
+
*
|
|
32401
|
+
* ```
|
|
32402
|
+
* epochEnd = epochEndTimestamp(initialEpochStart, lastClearedEpoch)
|
|
32403
|
+
* accruesFrom = min(clearingStartedAt, epochEnd)
|
|
32404
|
+
* ```
|
|
32405
|
+
*
|
|
32406
|
+
* - **On time** (the clearing started inside its window, before its epoch
|
|
32407
|
+
* ended): `accruesFrom` is the clearing's start. Clearing applies the
|
|
32408
|
+
* epoch's interest first and only then accepts requests, so today's
|
|
32409
|
+
* balance — which includes a deposit that clearing accepted — is never
|
|
32410
|
+
* charged for time before it: a new lender starts at exactly 0.
|
|
32411
|
+
* - **Late** (it started at or after its epoch end): `accruesFrom` is the
|
|
32412
|
+
* epoch end. A late clearing accepts no requests and credits exactly one
|
|
32413
|
+
* epoch, so the time it did not credit is kept.
|
|
32414
|
+
*
|
|
32415
|
+
* `lastClearedEpoch` is the newest epoch whose clearing has STARTED (the
|
|
32416
|
+
* subgraph has a `LendingPoolClearing` for it), not the newest that has
|
|
32417
|
+
* finished, and `clearingStartedAt` is that clearing's `startTimestamp`.
|
|
32418
|
+
* `ClearingCoordinator.doClearing` mints the epoch's interest in its FIRST
|
|
32419
|
+
* transaction (`applyInterests`), while `nextLendingPoolClearingEpoch` only
|
|
32420
|
+
* advances when the clearing ENDS, so it is the wrong source.
|
|
32421
|
+
*
|
|
32422
|
+
* FAILS CLOSED with `null`: whatever {@link epochEndTimestamp} rejects, a
|
|
32423
|
+
* `clearingStartedAt` that is not a finite positive number, or a
|
|
32424
|
+
* `weeklyInterest` that is not finite or is negative. The caller then offers
|
|
32425
|
+
* no term for that pool.
|
|
32426
|
+
*
|
|
32427
|
+
* @param input.weeklyInterest the pool's net interest for one epoch.
|
|
32428
|
+
* @param input.initialEpochStart unix seconds, `epochStartTimestamp(0)`.
|
|
32429
|
+
* @param input.lastClearedEpoch the newest epoch whose clearing has started.
|
|
32430
|
+
* @param input.clearingStartedAt unix seconds, that clearing's start.
|
|
32431
|
+
*/
|
|
32432
|
+
function epochAccrual(input) {
|
|
32433
|
+
const { weeklyInterest: weekly, clearingStartedAt } = input;
|
|
32434
|
+
if (!Number.isFinite(weekly) || weekly < 0)
|
|
32435
|
+
return null;
|
|
32436
|
+
if (!Number.isFinite(clearingStartedAt) || clearingStartedAt <= 0) {
|
|
32437
|
+
return null;
|
|
32438
|
+
}
|
|
32439
|
+
const epochEnd = epochEndTimestamp(input.initialEpochStart, input.lastClearedEpoch);
|
|
32440
|
+
if (Number.isNaN(epochEnd))
|
|
32441
|
+
return null;
|
|
32442
|
+
return {
|
|
32443
|
+
weeklyInterest: weekly,
|
|
32444
|
+
accruesFrom: Math.min(clearingStartedAt, epochEnd),
|
|
32445
|
+
epochEnd,
|
|
32446
|
+
};
|
|
32447
|
+
}
|
|
32448
|
+
/**
|
|
32449
|
+
* Interest accrued and not yet credited — the moving part of lifetime
|
|
32450
|
+
* interest (lifetime = settled on chain + this). Per term, with
|
|
32451
|
+
* `W` = 604 800 s:
|
|
32452
|
+
*
|
|
32453
|
+
* ```
|
|
32454
|
+
* accrued = min( weekly × ( min(max(now − accruesFrom, 0), W)
|
|
32455
|
+
* + max(now − (epochEnd + W), 0) ) / W,
|
|
32456
|
+
* MAX_ACCRUAL_EPOCHS × weekly )
|
|
32457
|
+
* ```
|
|
32458
|
+
*
|
|
32459
|
+
* Read along the clock, for one pool:
|
|
32460
|
+
* 1. from `accruesFrom`, one epoch of interest accrues linearly;
|
|
32461
|
+
* 2. it then HOLDS from `accruesFrom + W` until `epochEnd + W`, the end of
|
|
32462
|
+
* the next epoch — at most 48 h after an on-time clearing (its clearing
|
|
32463
|
+
* window), no time at all after a late one (`accruesFrom == epochEnd`);
|
|
32464
|
+
* 3. then it resumes, up to {@link MAX_ACCRUAL_EPOCHS} (4) epochs of
|
|
32465
|
+
* `weekly` in all, and stops there.
|
|
32466
|
+
*
|
|
32467
|
+
* **Why it keeps accruing past one epoch.** Clearing must run once per
|
|
32468
|
+
* epoch for each pool, in order (`ClearingCoordinator.doClearing` reverts
|
|
32469
|
+
* unless the target epoch is the pool's `nextLendingPoolClearingEpoch`), and
|
|
32470
|
+
* every clearing, on time or late, starts with
|
|
32471
|
+
* `LendingPool.applyInterests(targetEpoch)`. A missed epoch is therefore
|
|
32472
|
+
* credited when the clearings catch up (on Base, one pool cleared epochs 116
|
|
32473
|
+
* to 119 in the same block).
|
|
32474
|
+
*
|
|
32475
|
+
* **Why it stops at four epochs** (owner ruling 2026-11-07). A pool can stop
|
|
32476
|
+
* being cleared without being flagged stopped. On Base today one pool is
|
|
32477
|
+
* more than six epochs behind and another more than a hundred. Past four
|
|
32478
|
+
* epochs the figure would show interest that may never be credited. Four
|
|
32479
|
+
* covers any ordinary late clearing.
|
|
32480
|
+
*
|
|
32481
|
+
* **Why the hold.** Without it an on-time anchor accrues past one epoch
|
|
32482
|
+
* while the next on-time clearing — which credits exactly one — is still to
|
|
32483
|
+
* come, and the total steps DOWN when it lands. With it, at a constant
|
|
32484
|
+
* balance, `settled + accrued` never steps down at a clearing (`t` = the
|
|
32485
|
+
* NEW clearing's start, `E` = the end of the epoch it clears):
|
|
32486
|
+
* - on time after on time: identical to the deprecated `accruedInterest`
|
|
32487
|
+
* at every instant. With `gap` = `t` − the previous clearing's start, it
|
|
32488
|
+
* steps UP by `weekly × (W − gap) / W` when `gap < W` (at most 2/7 of one
|
|
32489
|
+
* weekly, as before), and not at all when `gap ≥ W`;
|
|
32490
|
+
* - late after on time, and late after late: exactly continuous;
|
|
32491
|
+
* - on time after late: steps UP by `weekly × (E − t) / W`, at most 2/7 of
|
|
32492
|
+
* one weekly.
|
|
32493
|
+
* A deposit or top-up accepted at an on-time clearing starts at 0, so it
|
|
32494
|
+
* never dips the total either.
|
|
32495
|
+
*
|
|
32496
|
+
* **At the cap.** All of the above holds for a pool below the cap, where
|
|
32497
|
+
* the cap changes nothing. A pool AT the cap shows `4 × weekly` before a
|
|
32498
|
+
* catch-up clearing; after it, one more `weekly` is settled and the new term
|
|
32499
|
+
* shows `min(elapsed′, 4 × weekly)`, so `after = min(elapsed′ + weekly,
|
|
32500
|
+
* 5 × weekly) ≥ before`. Each clearing steps the total UP by at most one
|
|
32501
|
+
* weekly until the pool is back under the cap. Never down, and never above
|
|
32502
|
+
* settled plus `4 × weekly` per pool.
|
|
32503
|
+
*
|
|
32504
|
+
* **Never negative**, and non-decreasing in `now`. A term is skipped — it
|
|
32505
|
+
* contributes nothing — when `weeklyInterest` is not finite or is negative,
|
|
32506
|
+
* when `accruesFrom` or `epochEnd` is not finite, when `accruesFrom >
|
|
32507
|
+
* epochEnd` (inconsistent: the anchor is never after the epoch end), or when
|
|
32508
|
+
* an elapsed time overflows. A non-finite `nowSeconds` accrues nothing.
|
|
32509
|
+
*
|
|
32510
|
+
* **Per pool, because pools clear independently.** One shared anchor accrues
|
|
32511
|
+
* a stale pool's share from a close it never had.
|
|
32512
|
+
*
|
|
32513
|
+
* **Accepted approximation.** `weekly` is today's balance at today's epoch
|
|
32514
|
+
* rate. Over a multi-week gap the chain compounds weekly and may apply other
|
|
32515
|
+
* epochs' rates, so a long accrual reads slightly LOW. It is a ticking
|
|
32516
|
+
* estimate, not a ledger.
|
|
32517
|
+
*
|
|
32518
|
+
* Callers fail closed upstream: no term for a pool whose weekly interest or
|
|
32519
|
+
* clearing is unknown (`epochAccrual` returns `null`), and none for a pool
|
|
32520
|
+
* that has stopped — it will never clear again.
|
|
32521
|
+
*/
|
|
32522
|
+
function accruedInterestSince(accruals, nowSeconds) {
|
|
32523
|
+
if (!Number.isFinite(nowSeconds))
|
|
32524
|
+
return 0;
|
|
32525
|
+
let accrued = 0;
|
|
32526
|
+
for (const { weeklyInterest: weekly, accruesFrom, epochEnd } of accruals) {
|
|
32527
|
+
if (!Number.isFinite(weekly) || weekly < 0)
|
|
32528
|
+
continue;
|
|
32529
|
+
if (!Number.isFinite(accruesFrom) || !Number.isFinite(epochEnd)) {
|
|
32530
|
+
continue;
|
|
32531
|
+
}
|
|
32532
|
+
if (accruesFrom > epochEnd)
|
|
32533
|
+
continue;
|
|
32534
|
+
const sinceAnchor = nowSeconds - accruesFrom;
|
|
32535
|
+
const sinceHoldEnd = nowSeconds - (epochEnd + SECONDS_PER_WEEK);
|
|
32536
|
+
if (!Number.isFinite(sinceAnchor) || !Number.isFinite(sinceHoldEnd)) {
|
|
32537
|
+
continue;
|
|
32538
|
+
}
|
|
32539
|
+
const elapsed = Math.min(Math.max(sinceAnchor, 0), SECONDS_PER_WEEK) +
|
|
32540
|
+
Math.max(sinceHoldEnd, 0);
|
|
32541
|
+
accrued += Math.min((weekly * elapsed) / SECONDS_PER_WEEK, MAX_ACCRUAL_EPOCHS * weekly);
|
|
32542
|
+
}
|
|
32543
|
+
return accrued;
|
|
32544
|
+
}
|
|
32332
32545
|
/**
|
|
32333
32546
|
* What `amount` earns in a year at a NET rate — the "≈ $Y a year" line.
|
|
32334
32547
|
* Feed it `netEffectiveApy(...)`, never a gross APY: the result is a lender's
|
|
@@ -32371,4 +32584,4 @@ function weightedAverageApy(slices) {
|
|
|
32371
32584
|
return weighted / totalBalance;
|
|
32372
32585
|
}
|
|
32373
32586
|
|
|
32374
|
-
export { APXIUM, AU_ALPHA3, AU_MIN_CUMULATIVE_BY_STABLE, BatchPendingError, BatchRevertedError, BatchSubmissionError, CHAIN_CONFIGS, CLEARING_WINDOW_SECONDS, CONTRACT_TTL_MS, CallsFacade, DAYS_PER_EPOCH, DAYS_PER_MONTH, DEFAULT_BATCH_POLLING_POLICY, DepositBatchMismatchError, DepositFlow, DepositsFacade, ENTRY_POINT_V07, EPOCHS_IN_YEAR, Flow, FlowStore, FlowsFacade, INVALID_ACCEPTANCE_SIGNATURE_MESSAGE, INVALID_AUTH_SIGNATURE_MESSAGE, INVOICEMATE, Kasu, KasuSdk, MAX_LENDING_AMOUNT_FALLBACK, MIN_DAYS_FOR_MONTHS, MIN_LENDING_AMOUNT_FALLBACK, MIN_TRANCHE_CAPACITY, NOT_A_WITHDRAWAL_CALL_MESSAGE, NO_DIRECTUS_URL_MESSAGE, NO_HISTORY_PROVIDER_MESSAGE, NO_KYC_PARAMS_MESSAGE, NO_SPENDER_MESSAGE, NO_WITHDRAWAL_ENCODER_MESSAGE, PastStateUnavailableError, PoolTvlHistoryAbortedError, PoolTvlHistoryTimeoutError, PortfolioFacade, READ_ONLY_MESSAGE, RISK_GROUP_ORDER, RIXON_CAPITAL, SECONDS_PER_WEEK, SPONSORED_CALL_KINDS, SPONSORED_CALL_SELECTORS, SdkConfig, SponsoredCallInputError, StrategiesFacade, StrategyDeploymentInputError, StrategyTotalsInputError, TvlHistoryInputError, UPPER_MEZZANINE, WithdrawFlow, accruedInterest, aggregateYieldHistory, apyToEpochRate, asContractType, auMinimumRemaining, auThresholdFor, availableFixedTermConfigs, batchOutcomeOf, buildContractVersionType, buildFullNameRequestMessage, buildLegacyContractRequestMessage, buildLoanAgreementSignMessage, cancelDeadline, ceilToCents, checkBatchOutcome, checkSponsoredCallOutcome, classifyWalletFailure, combineTvlHistories, compareTrancheSeniority, computeSettlementWindow, countSubmissions, dailyInterest, decodeRevert, deriveCycleDates, derivePoolStatus, deriveRequestState, encodeCancelDepositCall, encodeCancelWithdrawalCall, encodeDepositData, encodeRequestWithdrawalCall, encodeStableTransfer, encodeWithdrawAtExpiryCall, epochRateToApy, epochTrancheYield, explorerAddressUrl, explorerTxUrl, extractRevertData, fetchUnusedPoolIds, firstSubmissionTimestamp, floorToCents, formatSignTimestampUtc, getCreditOriginator, getInstitutionalLender, getStrategyRegion, getTrancheDisplayName, groupRiskManagementItems, isAuMinimumExempt, isAustralianKyc, isBelowMinimumCapacity, isCycleClosed, isDefinitivelyNotSubmitted, isFixedTermConfigId, isUnpredictableGas, isUserRejected, lastEventTimestamp, lockDurationDays, lockDurationMonths, maxNetRateCeiling, netEffectiveApy, netTrancheApyBounds, nextCycleBoundary, parseFacility, parseFormattedMessage, parseMinorUnits, parseTrancheBound, pickDefaultTrancheId, pickHighestYieldTranche, pickShortDescription, poolAllTranchesFull, poolMaxApy, poolTvl, projectedAnnualEarnings, proveDepositInReceipt, proveUserOperationInReceipt, readCmsStartDate, resolveBoundShortcuts, resolveDepositBounds, securityStructureOf, selectVisiblePools, splitBusinessTypes, splitNumberedClauses, strategyDeployments, strategyTotalsUsd, submissionEvents, submitBatch, submitSponsoredCall, trancheApyBounds, trancheHasCapacity, trancheRiskRank, validateDepositBatchCalls, weeklyInterest, weightedAverageApy };
|
|
32587
|
+
export { APXIUM, AU_ALPHA3, AU_MIN_CUMULATIVE_BY_STABLE, BatchPendingError, BatchRevertedError, BatchSubmissionError, CHAIN_CONFIGS, CLEARING_WINDOW_SECONDS, CONTRACT_TTL_MS, CallsFacade, DAYS_PER_EPOCH, DAYS_PER_MONTH, DEFAULT_BATCH_POLLING_POLICY, DepositBatchMismatchError, DepositFlow, DepositsFacade, ENTRY_POINT_V07, EPOCHS_IN_YEAR, Flow, FlowStore, FlowsFacade, INVALID_ACCEPTANCE_SIGNATURE_MESSAGE, INVALID_AUTH_SIGNATURE_MESSAGE, INVOICEMATE, Kasu, KasuSdk, MAX_ACCRUAL_EPOCHS, MAX_LENDING_AMOUNT_FALLBACK, MIN_DAYS_FOR_MONTHS, MIN_LENDING_AMOUNT_FALLBACK, MIN_TRANCHE_CAPACITY, NOT_A_WITHDRAWAL_CALL_MESSAGE, NO_DIRECTUS_URL_MESSAGE, NO_HISTORY_PROVIDER_MESSAGE, NO_KYC_PARAMS_MESSAGE, NO_SPENDER_MESSAGE, NO_WITHDRAWAL_ENCODER_MESSAGE, PastStateUnavailableError, PoolTvlHistoryAbortedError, PoolTvlHistoryTimeoutError, PortfolioFacade, READ_ONLY_MESSAGE, RISK_GROUP_ORDER, RIXON_CAPITAL, SECONDS_PER_WEEK, SPONSORED_CALL_KINDS, SPONSORED_CALL_SELECTORS, SdkConfig, SponsoredCallInputError, StrategiesFacade, StrategyDeploymentInputError, StrategyTotalsInputError, TvlHistoryInputError, UPPER_MEZZANINE, WithdrawFlow, accruedInterest, accruedInterestSince, aggregateYieldHistory, apyToEpochRate, asContractType, auMinimumRemaining, auThresholdFor, availableFixedTermConfigs, batchOutcomeOf, buildContractVersionType, buildFullNameRequestMessage, buildLegacyContractRequestMessage, buildLoanAgreementSignMessage, cancelDeadline, ceilToCents, checkBatchOutcome, checkSponsoredCallOutcome, classifyWalletFailure, combineTvlHistories, compareTrancheSeniority, computeSettlementWindow, countSubmissions, dailyInterest, decodeRevert, deriveCycleDates, derivePoolStatus, deriveRequestState, encodeCancelDepositCall, encodeCancelWithdrawalCall, encodeDepositData, encodeRequestWithdrawalCall, encodeStableTransfer, encodeWithdrawAtExpiryCall, epochAccrual, epochEndTimestamp, epochRateToApy, epochTrancheYield, explorerAddressUrl, explorerTxUrl, extractRevertData, fetchUnusedPoolIds, firstSubmissionTimestamp, floorToCents, formatSignTimestampUtc, getCreditOriginator, getInstitutionalLender, getStrategyRegion, getTrancheDisplayName, groupRiskManagementItems, isAuMinimumExempt, isAustralianKyc, isBelowMinimumCapacity, isCycleClosed, isDefinitivelyNotSubmitted, isFixedTermConfigId, isUnpredictableGas, isUserRejected, lastEventTimestamp, lockDurationDays, lockDurationMonths, maxNetRateCeiling, netEffectiveApy, netTrancheApyBounds, nextCycleBoundary, parseFacility, parseFormattedMessage, parseMinorUnits, parseTrancheBound, pickDefaultTrancheId, pickHighestYieldTranche, pickShortDescription, poolAllTranchesFull, poolMaxApy, poolTvl, projectedAnnualEarnings, proveDepositInReceipt, proveUserOperationInReceipt, readCmsStartDate, resolveBoundShortcuts, resolveDepositBounds, securityStructureOf, selectVisiblePools, splitBusinessTypes, splitNumberedClauses, strategyDeployments, strategyTotalsUsd, submissionEvents, submitBatch, submitSponsoredCall, trancheApyBounds, trancheHasCapacity, trancheRiskRank, validateDepositBatchCalls, weeklyInterest, weightedAverageApy };
|
package/dist/domain/index.d.ts
CHANGED
|
@@ -64,5 +64,5 @@ export { combineTvlHistories, poolTvl, TvlHistoryInputError } from './pool-tvl';
|
|
|
64
64
|
export type { PoolTvlHistoryEntry, StrategyTvlHistoryEntry, TvlHistoryInputErrorCode, TvlHistoryLeg, } from './pool-tvl';
|
|
65
65
|
export { aggregateYieldHistory, epochTrancheYield } from './yield-history';
|
|
66
66
|
export type { EpochLockShares, EpochTrancheYield, EpochTrancheYieldInput, YieldHistoryEntry, YieldHistoryFilter, YieldHistoryPoint, } from './yield-history';
|
|
67
|
-
export { accruedInterest, dailyInterest, projectedAnnualEarnings, SECONDS_PER_WEEK, weeklyInterest, weightedAverageApy, } from './yields';
|
|
68
|
-
export type { InterestSlice, PoolAccrual } from './yields';
|
|
67
|
+
export { accruedInterest, accruedInterestSince, dailyInterest, epochAccrual, epochEndTimestamp, MAX_ACCRUAL_EPOCHS, projectedAnnualEarnings, SECONDS_PER_WEEK, weeklyInterest, weightedAverageApy, } from './yields';
|
|
68
|
+
export type { EpochAccrual, InterestSlice, PoolAccrual } from './yields';
|
package/dist/domain/index.js
CHANGED
|
@@ -46,5 +46,5 @@ export { compareTrancheSeniority, derivePoolStatus, MIN_TRANCHE_CAPACITY, netTra
|
|
|
46
46
|
export { classifyWalletFailure, isUnpredictableGas, isUserRejected, } from './wallet-errors';
|
|
47
47
|
export { combineTvlHistories, poolTvl, TvlHistoryInputError } from './pool-tvl';
|
|
48
48
|
export { aggregateYieldHistory, epochTrancheYield } from './yield-history';
|
|
49
|
-
export { accruedInterest, dailyInterest, projectedAnnualEarnings, SECONDS_PER_WEEK, weeklyInterest, weightedAverageApy, } from './yields';
|
|
49
|
+
export { accruedInterest, accruedInterestSince, dailyInterest, epochAccrual, epochEndTimestamp, MAX_ACCRUAL_EPOCHS, projectedAnnualEarnings, SECONDS_PER_WEEK, weeklyInterest, weightedAverageApy, } from './yields';
|
|
50
50
|
//# sourceMappingURL=index.js.map
|
package/dist/domain/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"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"}
|