import { AccountAddress, CommittedTransactionResponse, Ed25519Account } from "@aptos-labs/ts-sdk"; import { AptosContractWrapperBaseClass } from "./baseClass"; import { AptosProvider } from "./aptosProvider"; import { InterestRateContract } from "../contracts/interestRate"; export type InterestRateDataRay = { optimalUsageRatio: bigint; baseVariableBorrowRate: bigint; variableRateSlope1: bigint; variableRateSlope2: bigint; }; /** * The `InterestRateClient` class provides methods to interact with the interest rate management system * of the Aave protocol on the Aptos blockchain. It extends the `AptosContractWrapperBaseClass` and * includes functionalities for configuring and calculating interest rates, managing rate strategies, * and retrieving rate parameters for assets. * * @remarks * This client is designed to work with the interest rate contracts and provides a high-level API * for interest rate operations. The client can be instantiated in two ways: * 1. Using the constructor directly with a provider and optional signer * 2. Using the static buildWithDefaultSigner method which automatically configures the client with the provider's pool profile account * * @example * ```typescript * // Using buildWithDefaultSigner * const provider = new AptosProvider(); * const client = InterestRateClient.buildWithDefaultSigner(provider); * * // Using constructor directly * const provider = new AptosProvider(); * const signer = provider.getPoolProfileAccount(); * const client = new InterestRateClient(provider, signer); * * // Get interest rate strategy for a reserve * const strategy = await client.getReserveInterestRateStrategy(reserveAddress); * ``` * * @param provider - The AptosProvider instance used to interact with the Aptos blockchain. * @param signer - Optional Ed25519Account signer for transaction signing. */ export declare class InterestRateClient extends AptosContractWrapperBaseClass { interestRateContract: InterestRateContract; constructor(provider: AptosProvider, signer?: Ed25519Account); /** * Creates an instance of `InterestRateClient` using the default signer provided by the `AptosProvider`. * * @param provider - An instance of `AptosProvider` which provides the necessary configurations and signer. * @returns A new instance of `InterestRateClient` initialized with the default signer. */ static buildWithDefaultSigner(provider: AptosProvider): InterestRateClient; /** * Sets the interest rate strategy for a given reserve asset. * * @param reserve - The address of the reserve asset. * @param optimalUsageRatio - The optimal usage ratio for the reserve. * @param baseVariableBorrowRate - The base variable borrow rate for the reserve. * @param variableRateSlope1 - The first slope of the variable rate for the reserve. * @param variableRateSlope2 - The second slope of the variable rate for the reserve. * @returns A promise that resolves to a `CommittedTransactionResponse` object. */ setReserveInterestRateStrategy(reserve: AccountAddress, optimalUsageRatio: bigint, baseVariableBorrowRate: bigint, variableRateSlope1: bigint, variableRateSlope2: bigint): Promise; /** * Retrieves the optimal usage ratio for a given asset. * * @param asset - The account address of the asset for which to get the optimal usage ratio. * @returns A promise that resolves to the optimal usage ratio as a bigint. */ getOptimalUsageRatio(asset: AccountAddress): Promise; /** * Retrieves the variable rate slope 1 for a given asset. * * @param asset - The address of the asset for which to get the variable rate slope 1. * @returns A promise that resolves to a bigint representing the variable rate slope 1 of the specified asset. */ getVariableRateSlope1(asset: AccountAddress): Promise; /** * Retrieves the variable rate slope 2 for a given asset. * * @param asset - The address of the asset for which to get the variable rate slope 2. * @returns A promise that resolves to the variable rate slope 2 as a bigint. */ getVariableRateSlope2(asset: AccountAddress): Promise; /** * Retrieves the base variable borrow rate for a given asset. * * @param asset - The account address of the asset. * @returns A promise that resolves to the base variable borrow rate as a bigint. */ getBaseVariableBorrowRate(asset: AccountAddress): Promise; /** * Retrieves the maximum variable borrow rate for a given asset. * * @param asset - The account address of the asset. * @returns A promise that resolves to the maximum variable borrow rate as a bigint. */ getMaxVariableBorrowRate(asset: AccountAddress): Promise; /** * Calculates the current liquidity rate and current variable borrow rate for a given reserve. * * @param unbacked - The amount of unbacked assets. * @param liquidityAdded - The amount of liquidity added to the reserve. * @param liquidityTaken - The amount of liquidity taken from the reserve. * @param totalVariableDebt - The total variable debt of the reserve. * @param reserveFactor - The reserve factor. * @param reserve - The address of the reserve account. * @param virtualUnderlyingBalance - The virtual balance of the aToken underlying. * @returns An object containing the current liquidity rate and current variable borrow rate. */ calculateInterestRates(unbacked: bigint, liquidityAdded: bigint, liquidityTaken: bigint, totalDebt: bigint, reserveFactor: bigint, reserve: AccountAddress, virtualUnderlyingBalance: bigint): Promise<{ currentLiquidityRate: bigint; currentVariableBorrowRate: bigint; }>; /** * Returns the full InterestRateData object for the given reserve, in ray * * @param reserve - The address of the reserve account. * @returns The InterestRateDataRay object for the given reserve. */ getReserveInterestRateStrategy(reserve: AccountAddress): Promise; /** * Returns the full InterestRateData object for the given reserve, in bps * * @param reserve - The address of the reserve account. * @returns The InterestRateDataRay object for the given reserve. */ getReserveInterestRateStrategyBps(reserve: AccountAddress): Promise; }