import { Provider } from '@ethersproject/providers'; import { BigNumber, BigNumberish, BytesLike, ContractTransaction, Signer } from 'ethers'; import { IKasuAllowListAbi__factory } from '../../contracts'; import { SdkConfig } from '../../sdk-config'; import { PortfolioUserTrancheBalance, UserApyBonus, UserPoolBalance, UserRequest, UserTrancheBalance } from './types'; /** Thrown when the subgraph reports a request type with no known unit. */ export declare const UNKNOWN_REQUEST_TYPE_MESSAGE = "UserLending: unknown request type, its amount unit is unknown"; export declare class UserLending { private _kasuConfig; private readonly _graph; private readonly _directus; private _dataService; private readonly _userManagerAbi; private readonly _lendingPoolManagerAbi; private readonly _userLoyaltyRewardsAbi; private readonly _clearingCoordinatorAbi; private readonly _systemVariablesAbi; readonly _signerOrProvider: Signer | Provider; constructor(_kasuConfig: SdkConfig, signerOrProvider: Signer | Provider); getUserTotalPendingAndActiveDepositedAmount(user: string): Promise<[BigNumber, BigNumber]>; getUserTotalPendingAndActiveDepositedAmountForCurrentEpoch(user: string): Promise<[BigNumber, BigNumber]>; hasUserRKSU(user: string): Promise; buildKycSignatureParams(userAddress: `0x${string}`, chainId: string): { contractAbi: IKasuAllowListAbi__factory; contractAddress: string; functionName: string; args: BytesLike[]; userAddress: string; chainId: string; }; buildDepositSwapData(fromToken: string, fromAmount: string, routerAddress: string, swapCallData: string, minAmountOut: string): BytesLike; requestDepositWithKyc(lendingPool: string, tranche: string, maxAmount: BigNumberish, swapData: BytesLike, fixedTermConfigId: BigNumberish, depositData: BytesLike, kycData: { blockExpiration: BigNumberish; signature: BytesLike; }, ethValue: string): Promise; requestDeposit(lendingPool: string, tranche: string, amount: BigNumberish, swapData: BytesLike, fixedTermConfigId: BigNumberish, depositData: BytesLike): Promise; withdrawAtExpiry(lendingPool: string, fixedTermDepositId: string): Promise; lockDepositForFixedTerm(lendingPool: string, tranche: string, amount: BigNumberish, fixedTermConfigId: BigNumberish): Promise; cancelDepositRequest(lendingPool: string, dNftID: BigNumberish): Promise; requestWithdrawal(lendingPool: string, tranche: string, amount: BigNumberish): Promise; /** * The tranche shares a withdrawal of `assetAmount` requests — the * tranche's own `convertToShares`, read now. `requestWithdrawalInAsset` * and the sponsored `kasu.calls.requestWithdrawal` both use this, so the * two paths cannot convert differently. */ getWithdrawalSharesForAssets(tranche: string, assetAmount: BigNumberish): Promise; /** * Every tranche share `user` holds — what a max withdrawal requests * (`balanceOf(user)` on the tranche, read now). Shared by * `requestWithdrawalMax` and the sponsored `kasu.calls.requestWithdrawal`. */ getWithdrawalSharesMax(tranche: string, user: string): Promise; requestWithdrawalInAsset(lendingPool: string, tranche: string, assetAmount: BigNumberish): Promise; /** @deprecated Use `requestWithdrawalInAsset` instead. */ requestWithdrawalInUSDC(lendingPool: string, tranche: string, amount: BigNumberish): Promise; requestWithdrawalMax(lendingPool: string, tranche: string, user: string): Promise; cancelWithdrawalRequest(lendingPool: string, dNftID: BigNumberish): Promise; claimRepaidLoss(lendingPool: string, tranche: string, lossId: BigNumberish): Promise; getUserRequests(userAddress: `0x${string}`, epochId: string): Promise; getCurrentEpoch(): Promise; getCurrentFtdBalance(poolId: string, userId: string): Promise>; getCurrentEpochFtdAmount(poolIds: string[], userId: string, currentEpoch: string): Promise>; getCurrentEpochDepositedAmount(lendingPoolIds: string[], userId: string): Promise>; /** * A request's outstanding amount in ASSETS (the deployment's stable token). * * The subgraph's `UserRequest.amountRequested` is denominated by request * type. A DEPOSIT request holds assets: the deposit NFT's `assetAmount`, * top-ups added, accepted and rejected amounts taken off. A WITHDRAWAL * request holds tranche SHARES: the withdrawal NFT's `sharesAmount`, * accepted shares taken off. So only a withdrawal is converted, at the * tranche's current share price; a deposit passes through unchanged — * pricing it as shares overstated it by the share price. */ private requestedAmountInAssets; convertSharesToAssets(sharesAmount: string, totalAssets: string, totalSupply: string): string; isClearingPending(poolId: string): Promise; isCancelable(status: string, lendingPoolId: string): Promise; getUserPoolBalance(user: string, poolIds: string[], provider?: Provider): Promise; /** * The lender's ACTIVE assets in each tranche, read from the chain * (`LendingPoolTranche.userActiveAssets`), in the order of `trancheIds`, * in the stable token's base units. Active shares are the ones the lender * owns in the tranche — fixed-term-locked and withdrawal-pending shares * included — whatever path brought them there; `LendingPool.userBalance` * is their sum. One call per tranche. */ getUserTrancheActiveAssets(user: string, trancheIds: readonly string[], provider?: Provider, blockTag?: number): Promise; /** * The lender's balance in each pool (`LendingPool.userBalance`, the sum * of its tranches' active assets), in the order of `poolIds`, in the * stable token's base units, at `blockTag` (default `latest`). One call * per pool. */ getUserPoolBalancesAt(user: string, poolIds: readonly string[], provider?: Provider, blockTag?: number): Promise; getPortfolioUserTrancheBalances(user: string): Promise; getUserTrancheBalance(user: string, poolId: string, trancheId: string): Promise; getUserApyBonus(user: string): Promise; }