import type { BigIntish } from "../types.js"; /** * JS implementation of {@link https://github.com/morpho-org/morpho-blue-irm/blob/main/src/libraries/adaptive-curve/ExpLib.sol ExpLib} used by the Adaptive Curve IRM. */ export declare namespace AdaptiveCurveIrmLib { /** Curve steepness constant, scaled by WAD. */ const CURVE_STEEPNESS = 4000000000000000000n; /** Target utilization for the Adaptive Curve IRM, scaled by WAD. */ const TARGET_UTILIZATION = 900000000000000000n; /** Initial per-second rate at target utilization, scaled by WAD. */ const INITIAL_RATE_AT_TARGET: bigint; /** Per-second speed used to adjust the rate at target utilization. */ const ADJUSTMENT_SPEED: bigint; /** Minimum per-second rate at target utilization, scaled by WAD. */ const MIN_RATE_AT_TARGET: bigint; /** Maximum per-second rate at target utilization, scaled by WAD. */ const MAX_RATE_AT_TARGET: bigint; /** * ln(2), scaled by WAD. */ const LN_2_INT = 693147180559945309n; /** * ln(1e-18), scaled by WAD. */ const LN_WEI_INT = -41446531673892822312n; /** * Above this bound, `wExp` is clipped to avoid overflowing when multiplied with 1 ether. * This upper bound corresponds to: ln(type(int256).max / 1e36) (scaled by WAD, floored). */ const WEXP_UPPER_BOUND = 93859467695000404319n; /** * The value of wExp(`WEXP_UPPER_BOUND`). */ const WEXP_UPPER_VALUE = 57716089161558943949701069502944508345128422502756744429568n; /** * Returns an approximation of exp(x) used by the Adaptive Curve IRM. * @param x - The WAD-scaled exponent. * @returns The WAD-scaled exponential approximation. * @example * ```ts * import { AdaptiveCurveIrmLib } from "@morpho-org/blue-sdk"; * * const value = AdaptiveCurveIrmLib.wExp(0n); * // value === 1000000000000000000n * ``` */ function wExp(x: BigIntish): bigint; /** * Computes Adaptive Curve IRM borrow rates from utilization and elapsed time. * * @param startUtilization - The market utilization at the start of the period, scaled by WAD. * @param startRateAtTarget - The rate at target utilization at the start of the period, scaled by WAD. * @param elapsed - The elapsed time in seconds. * @returns The average borrow rate, end borrow rate, and end rate at target, all scaled by WAD. * @example * ```ts * import { AdaptiveCurveIrmLib } from "@morpho-org/blue-sdk"; * * const rates = AdaptiveCurveIrmLib.getBorrowRate( * AdaptiveCurveIrmLib.TARGET_UTILIZATION, * AdaptiveCurveIrmLib.INITIAL_RATE_AT_TARGET, * 12n, * ); * // rates satisfies { avgBorrowRate: bigint; endBorrowRate: bigint; endRateAtTarget: bigint } * ``` */ function getBorrowRate(startUtilization: BigIntish, startRateAtTarget: BigIntish, elapsed: BigIntish): { avgBorrowRate: bigint; endBorrowRate: bigint; endRateAtTarget: bigint; }; /** * Finds the utilization corresponding to a borrow rate and rate at target. * * @param borrowRate - The borrow rate to invert, scaled by WAD. * @param rateAtTarget - The rate at target utilization, scaled by WAD. * @returns The utilization corresponding to `borrowRate`, scaled by WAD. * @example * ```ts * import { AdaptiveCurveIrmLib } from "@morpho-org/blue-sdk"; * * const utilization = AdaptiveCurveIrmLib.getUtilizationAtBorrowRate( * AdaptiveCurveIrmLib.INITIAL_RATE_AT_TARGET, * AdaptiveCurveIrmLib.INITIAL_RATE_AT_TARGET, * ); * // utilization === AdaptiveCurveIrmLib.TARGET_UTILIZATION * ``` */ function getUtilizationAtBorrowRate(borrowRate: BigIntish, rateAtTarget: BigIntish): bigint; }