import { Asset, AssetWithAmountInTarget } from "../base/types.js"; import { QuotaSlice } from "../market/credit/types.js"; import { Address } from "viem"; //#region src/onchain/accounts/quota-utils.d.ts export interface CalcDefaultQuotaProps { amount: bigint; lt: bigint; quotaReserve: bigint; } export interface CalcRecommendedQuotaProps { amount: bigint; debt: bigint; lt: bigint; quotaReserve: bigint; } export interface MaxAmountForQuotaProps { available: bigint; initialQuota: bigint; totalInitialQuota: bigint; maxDebt: bigint; lt: bigint; quotaReserve: bigint; } export interface CalcQuotaUpdateProps { quotas: Record; initialQuotas: Record; liquidationThresholds: Record; assetsAfterUpdate: Record; maxDebt: bigint; calcModification?: { type: "recommendedQuota"; debt: bigint; }; allowedToSpend: Record; allowedToObtain: Record; quotaReserve: bigint; } interface CalcQuotaUpdateReturnType { desiredQuota: Record; quotaIncrease: Array; quotaDecrease: Array; } /** * Quota that keeps a directly transferred token enabled, so a liquidation * counts it. */ export declare const DIRECT_TRANSFERS_QUOTA = 10000n; /** * Rounds quota deltas to protocol precision step (`PERCENTAGE_FACTOR`). * * The `MIN_INT96` sentinel is preserved as-is because it encodes * "reset quota" semantics and must not be transformed. * * @param quotaChange Raw quota delta. * @returns Rounded quota delta, or untouched `MIN_INT96` sentinel. */ export declare function roundUpQuota(quotaChange: bigint): bigint; /** * Computes recommended quota for a token when debt-aware capping is enabled. * * Base quota is `min(debt, amount * LT)`, then reserve buffer is applied. * Final value is rounded to protocol quota step. * * @param props Token amount in target units, debt, liquidation threshold, reserve. * @returns Recommended rounded quota. */ export declare function calcRecommendedQuota({ amount, debt, lt, quotaReserve }: CalcRecommendedQuotaProps): bigint; /** * Computes default quota for a token without debt capping. * * Base quota is `amount * LT`, then reserve buffer is applied. * Final value is rounded to protocol quota step. * * @param props Token amount in target units, liquidation threshold, reserve. * @returns Default rounded quota. */ export declare function calcDefaultQuota({ amount, lt, quotaReserve }: CalcDefaultQuotaProps): bigint; /** Inverse of default quota rounding, including the account-wide increase cap. */ export declare function maxAmountForQuota({ available, initialQuota, totalInitialQuota, maxDebt, lt, quotaReserve }: MaxAmountForQuotaProps): bigint | undefined; /** * Produces desired quota state and explicit increase/decrease actions. * * The function: * - computes decreases for spendable tokens * - computes increase capacity based on global quota cap * - computes increases for obtainable tokens within remaining capacity * - applies changes on top of initial quotas for active quota tokens * * `MIN_INT96` is treated as a full reset marker for a token quota. * * @param props Current quotas, initial quotas, permissions, and calculation context. * @returns Desired quota map plus separate increase/decrease instruction lists. */ export declare function calcQuotaUpdate(props: CalcQuotaUpdateProps): CalcQuotaUpdateReturnType; //#endregion export {};