@1delta/margin-fetcher 5.0.66 → 5.0.68

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PublicClient, Address, Hex } from 'viem';
2
2
  import { Lender } from '@1delta/lender-registry';
3
3
  export { hasCrossMarginRisk, isAaveType, isAaveV2Type, isAaveV32Type, isAaveV3Type, isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isMultiMarket, isYLDR } from '@1delta/lender-registry';
4
- import { DebitData, LenderDebitData, LstAcceptedInput } from '@1delta/calldata-sdk';
4
+ import { DebitData, LenderDebitData, LendingMode as LendingMode$1, LstAcceptedInput } from '@1delta/calldata-sdk';
5
5
  import { RelayProxyConfig } from '@1delta/proxy-fetch';
6
6
  import { TermMarketConfig, LiquityBranchConfig, LiquityConfigChain, RiverMarketConfig, RiverConfigChain, RiverChainData, InverseMarketConfig, InverseConfigChain, InverseChainData, FraxlendConfigChain, ResupplyConfigChain, CoolerConfigChain, LlamaLendMarketConfig, LlamaLendConfigChain, LlamaLendChainData, UsddMarketConfig, UsddConfigChain, UsddChainData, FrankencoinMarketConfig, FrankencoinConfigChain, FrankencoinChainData, TellerPoolConfig, MorphoTypeVaultEntry } from '@1delta/data-sdk';
7
7
  export { MorphoLensAbi } from '@1delta/abis';
@@ -1632,6 +1632,17 @@ declare function needsLenderApproval(params: {
1632
1632
  aaveV4Spoke?: string;
1633
1633
  /** Silo: check the protected share token instead of collateral */
1634
1634
  isProtected?: boolean;
1635
+ /**
1636
+ * This is a BORROW delegation check — resolve against the entry the borrow
1637
+ * grant actually lives on (Silo: debt share token; Aave: variable/stable
1638
+ * debt token's `borrowAllowance`; Venus: the comptroller's `updateDelegate`
1639
+ * boolean) instead of the withdraw-side key. Without it a borrow check
1640
+ * reads a withdraw allowance that is 0 for a borrow-only grant and the
1641
+ * permission is re-emitted forever.
1642
+ */
1643
+ isBorrow?: boolean;
1644
+ /** Aave borrow checks: which debt token to resolve (default VARIABLE). */
1645
+ mode?: LendingMode$1;
1635
1646
  }): boolean;
1636
1647
  /**
1637
1648
  * Checks whether an ERC20 or Permit2 token approval is needed for
@@ -7972,6 +7983,22 @@ interface LiquidationTerms {
7972
7983
  * Aave-style escalation: the close factor rises to 1 once health falls below
7973
7984
  * this. Without it, `closeFactor: 0.5` understates the worst case.
7974
7985
  */
7986
+ /**
7987
+ * The health factor BELOW WHICH the position becomes liquidatable, when the
7988
+ * protocol's trigger is not the usual `HF < 1`.
7989
+ *
7990
+ * Added for Flying Tulip, whose `marginHfTargetBps = 12500` makes a position
7991
+ * liquidatable at **HF < 1.25** — `liquidateFlash` reverts above it. Every
7992
+ * consumer in this repo otherwise assumes `HF < 1 ⇒ liquidatable`, which
7993
+ * understates the danger zone by a quarter of a point of health on the side
7994
+ * that costs the borrower money.
7995
+ *
7996
+ * ABSENT means the ordinary `HF < 1`. Do not default it to 1 at the call
7997
+ * site — an explicit 1 and an absent field should read the same, and a
7998
+ * lender that has no health factor at all (Frankencoin's challenge game,
7999
+ * Teller's time-based default) must not acquire one by omission.
8000
+ */
8001
+ liquidationHealthFactor?: number;
7975
8002
  fullCloseBelowHealthFactor?: number;
7976
8003
  /**
7977
8004
  * `repay-to-target-hf` only: the health factor at or below which the