@ajna-finance/sdk
Version:
A typescript SDK that can be used to create Dapps in Ajna ecosystem.
55 lines (54 loc) • 2.19 kB
TypeScript
import { BigNumber, Contract, Signer } from 'ethers';
import { Address, PoolInfoUtils, SignerOrProvider } from '../types';
export interface CRAStatus {
/** time a reserve auction was last kicked */
lastKickTime: Date;
/** amount of Ajna token to burn in exchange of total auction reseves */
ajnaToBurn: BigNumber;
/** the amount of excess quote tokens */
reserves: BigNumber;
/** denominated in quote token, or `0` if no reserves can be auctioned */
claimableReserves: BigNumber;
/** amount of claimable reserves which has not yet been taken */
claimableReservesRemaining: BigNumber;
/** current price at which `1` quote token may be purchased, denominated in `Ajna` */
price: BigNumber;
}
/**
* Models a pool's claimable reserve auction (CRA).
*/
export declare class ClaimableReserveAuction {
provider: SignerOrProvider;
contract: Contract;
contractUtils: PoolInfoUtils;
poolAddress: Address;
/**
* @param provider JSON-RPC endpoint
* @param contract pool contract reference
* @param contractUtils PoolInfoUtils contract rererence
* @param poolAddress identifies pool where claimable reserve auction is started
*/
constructor(provider: SignerOrProvider, contract: Contract, contractUtils: PoolInfoUtils, poolAddress: Address);
/**
* Purchases claimable reserves during a `CRA` using `Ajna` token.
* @param maxAmount maximum amount of quote token to purchase at the current auction price
* @return promise to transaction
*/
takeAndBurn(signer: Signer, maxAmount?: BigNumber): Promise<import("../types").WrappedTransaction>;
/**
* Called by actor to start a `Claimable Reserve Auction` (`CRA`).
* @param signer auction initiator
* @return promise to transaction
*/
kick(signer: Signer): Promise<import("../types").WrappedTransaction>;
/**
* Retrieves claimable reserve auction statistics.
* @returns {@link CRAStatus}
*/
getStatus(): Promise<CRAStatus>;
/**
* Defines if auction is ongoing.
* @returns boolean that defines if auction is ongoing
*/
isTakeable(): Promise<boolean>;
}