/** * LoanCarryVault attestations (carry-contracts; D25, D40, D42, D45, D52, D56, D60, D71, D80) — the decisions both * carry actions take, as pure functions the unit suite exercises directly: * * - which vault domain and signer an attestation may be for (the D40 pinned pairing; hardhat takes the caller's); * - whether a loan is attestable (not liquidated; an EOA borrower — v1 has no Safe borrowers, D45); * - exact decimal → ×1e8 funding rates, the deterministic sample window, contiguity and the average (D60); * - the paginated Hyperliquid fundingHistory read; * - signing with the pinned carry signer, over the vault's EIP-712 types (constants/chunks/carry.ts). * * The vault re-checks everything it can on-chain (CarryAuth): freshness, replay, binding, the funding shape. What * only this action can check — the loan's state on Ethereum, the vault's BTC, Hyperliquid's funding — it refuses to * sign rather than sign a flag (D21). */ import { type CarryPairing } from "../constants/chunks/carry"; import type { ChainPolicy } from "./chain-policy"; /** LoanStatusLib.LoanStatus.LIQUIDATED — the only loan state a carry attestation refuses (D52, D56). */ export declare const LOAN_STATUS_LIQUIDATED = 5; export interface CarryDomain { name: string; version: string; chainId: number; verifyingContract: string; } export interface RequestedCarryDomain { /** HyperEVM chain id the attestation is for (998 testnet, 999 mainnet). */ chainId: number; /** LoanCarryVault proxy. */ vault: string; } /** * D40: on enforced chains the requested (HyperEVM chain, vault) and the signer must equal the pinned pairing for this * source chain; a chain with no pairing refuses. On hardhat the caller's values are used (local, no funds) — the * same switch as the loan contracts' address pinning (`policy.pinContractAddresses`). */ export declare function resolveCarryDomain(policy: ChainPolicy, requested: RequestedCarryDomain, signer: string, pairing: CarryPairing | null, name: string, version: string): CarryDomain; /** * The borrower's Ethereum code: none → an EOA; an EIP-7702 delegation designator (0xef0100 ‖ address, 23 bytes) → * still an EOA (it keeps its key and signs ECDSA). Anything else is a contract (a Safe), which v1 refuses (D45). */ export declare function isEoaCode(code: string): boolean; export declare function assertCollateralAttestable(loanId: string, status: number, borrower: string, borrowerCode: string): void; /** LoanOperationsManager.BALANCE_CONFIRMATION_TYPEHASH — field order normative (the loans' type, not carry's). */ export declare const BALANCE_CONFIRMATION_TYPES: { BalanceConfirmation: { name: string; type: string; }[]; }; /** PositionManager.updateBalance — the consumer whose OAR validator signs BalanceConfirmations. */ export declare const UPDATE_BALANCE_SIGNATURE = "updateBalance(bytes32,uint256,uint256,uint256,bytes)"; /** The house 3-quantum window (past, current, next) for a signed quantum timestamp. */ export declare const BALANCE_CONFIRMATION_MAX_AGE_SECONDS = 180; export interface BalanceConfirmationInput { vaultBalance: string; btcPrice: string; quantumTimestamp: number | string; signature: string; } /** * Verify the loans' BalanceConfirmation and return its collateral (sats). The carry action never reads BTC itself: * the loans' `loan-vault-btc-balance` produced this, signed by the `updateBalance` validator, under the * LoanOperationsManager domain — so the carry figure is by construction the loans' figure, and the carry action * never holds the loan validator key (D40). Refuses another signer, position or borrower, and a stale or future * confirmation. */ export declare function verifyBalanceConfirmation(args: { confirmation: BalanceConfirmationInput; positionId: string; borrower: string; /** The ACTIVE `updateBalance` validator, read on-chain from the pinned PositionManager's registry. */ validator: string; /** EIP-712 domain of the loans: DiamondHands.Protocol / 1 / source chainId / LoanOperationsManagerModule. */ domain: { name: string; version: string; chainId: number; verifyingContract: string; }; nowSeconds: number; }): bigint; /** * Hyperliquid's decimal-string rate → hourly rate × 1e8, exactly, rounded toward zero (D60). Accepts plain decimals * only ("-0.0000125"); anything else — exponent form, empty, junk — throws rather than being guessed at. */ export declare function parseFundingRate(rate: string): bigint; export interface FundingWindow { /** ms, an hour boundary: the oldest sample. */ firstTime: number; /** ms, an hour boundary: the newest sample — at least CARRY_FUNDING_PUBLICATION_LAG_MS before `atSeconds`. */ lastTime: number; } /** The `windowHours` hourly samples ending at the newest hour boundary that is safely published at `atSeconds`. */ export declare function fundingWindow(atSeconds: number, windowHours: number): FundingWindow; export interface FundingRecord { coin: string; fundingRate: string; time: number; } export interface FundingValues { windowHours: number; avgFundingRate: bigint; sampleCount: number; firstTime: number; lastTime: number; } /** * Exactly one sample per hour of the window (a record's time is taken to its hour — Hyperliquid stamps funding a * few ms after the boundary), each within the cap, averaged and rounded toward zero. A gap, a duplicate hour, another * coin or an out-of-cap sample refuses: the vault would accept the shape, so the data must be right here. */ export declare function computeFundingValues(records: FundingRecord[], coin: string, window: FundingWindow): FundingValues; /** * Hyperliquid `fundingHistory` for `coin` over [startTime, endTime] (ms), following the forward 500-record page cap. * Throws on any HTTP or shape failure — never returns a partial history. */ export declare function fetchFundingHistory(infoUrl: string, coin: string, startTime: number, endTime: number): Promise; /** Sign `value` as `types` under `domain` with the carry signer wallet (Chipotle `getPrivateKey` by wallet address). */ export declare function signCarryAttestation(signerWallet: string, domain: CarryDomain, types: Record>, value: Record): Promise<{ signature: string; signer: string; }>; //# sourceMappingURL=carry-attestation.module.d.ts.map