UNPKG

@ajna-finance/sdk

Version:

A typescript SDK that can be used to create Dapps in Ajna ecosystem.

73 lines (72 loc) 3.53 kB
import { BigNumber, Contract, Signer } from 'ethers'; import { Address, AuctionStatus, CallData, PoolInfoUtils, SignerOrProvider } from '../types'; /** * Models an auction used to liquidate an undercollateralized borrower. */ export declare class Liquidation { provider: SignerOrProvider; poolContract: Contract; utilsContract: PoolInfoUtils; borrowerAddress: Address; /** * @param provider JSON-RPC endpoint. * @param pool Identifies pool to which this bucket belongs. * @param borrowerAddress Identifies the loan being liquidated. */ constructor(provider: SignerOrProvider, pool: Contract, borrowerAddress: Address); /** * Retrieve current state of the auction. * @returns {@link AuctionStatus} */ getStatus(): Promise<AuctionStatus>; static _prepareAuctionStatus(currentTimestamp: number, kickTimestamp: BigNumber, collateral: BigNumber, debtToCover: BigNumber, isCollateralized: boolean, price: BigNumber, neutralPrice: BigNumber): { kickTime: Date; collateral: BigNumber; debtToCover: BigNumber; isTakeable: boolean; isCollateralized: boolean; price: BigNumber; neutralPrice: BigNumber; isSettleable: boolean; }; /** * Performs arb take operation during debt liquidation auction. * @param signer taker * @param bucketIndex identifies the price bucket * @returns promise to transaction */ arbTake(signer: Signer, bucketIndex: number): Promise<import("../types").WrappedTransaction>; /** * Performs deposit take operation during debt liquidation auction. * @param signer taker * @param bucketIndex identifies the price bucket * @returns promise to transaction */ depositTake(signer: Signer, bucketIndex: number): Promise<import("../types").WrappedTransaction>; /** * called by actors to purchase collateral from the auction in exchange for quote token * @param signer taker * @param maxAmount max amount of collateral that will be taken from the auction * @returns promise to transaction */ take(signer: Signer, maxAmount?: BigNumber): Promise<import("../types").WrappedTransaction>; /** * Called by actors to purchase collateral from the auction in exchange for quote token with otption to invoke callback function. * @param signer taker * @param maxAmount max amount of collateral that will be taken from the auction * @param callee identifies where collateral should be sent and where quote token should be obtained * @param callData if provided, take will assume the callee implements IERC*Taker. Take will send collateral to * callee before passing this data to IERC*Taker.atomicSwapCallback. If not provided, * the callback function will not be invoked. * @returns promise to transaction */ takeWithCall(signer: Signer, maxAmount: BigNumber, callee: Address, callData?: CallData): Promise<import("../types").WrappedTransaction>; /** * Called by actors to settle an amount of debt in a completed liquidation. * @param signer settler * @param maxDepth measured from HPB, maximum number of buckets deep to settle debt, * used to prevent unbounded iteration clearing large liquidations * @returns promise to transaction */ settle(signer: Signer, maxDepth?: number): Promise<import("../types").WrappedTransaction>; }