UNPKG

@tempus-labs/utils

Version:

Tempus utility helpers

57 lines 2.86 kB
import { Decimal } from "../utils/Decimal"; import { Numberish } from "../utils/DecimalUtils"; import { Addressable } from "../utils/ContractBase"; /** * Interface for ERC20-like contracts */ export interface IERC20 { /** @brief Decimals precision of this contract's numbers */ decimals: number; /** @return ERC20 name of this contract */ name(): Promise<string>; /** @return ERC20 symbol of this contract */ symbol(): Promise<string>; /** @returns Total supply of this ERC20 token as a decimal, such as 10.0 */ totalSupply(): Promise<Decimal>; /** * @param account ERC20 account's address * @returns Balance of ERC20 address in decimals, eg 2.0 */ balanceOf(account: Addressable): Promise<Decimal>; /** * @dev Moves `amount` tokens from the sender's account to `recipient`. * @param sender The sender/caller of this transfer * @param recipient ERC20 transfer recipient's address * @param amount Amount of tokens to send in contract decimals, eg 2.0 or "0.00001" */ transfer(sender: Addressable, recipient: Addressable, amount: Numberish): Promise<any>; /** * @param owner ERC20 owner's address * @param spender ERC20 spender's address * @returns The remaining number of tokens that `spender` will be allowed to * spend on behalf of `owner` through {transferFrom}. This is zero by default. */ allowance(owner: Addressable, spender: Addressable): Promise<Decimal>; /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * @param caller The caller who is sending this approve * @param spender ERC20 approve's, spender's address * @param amount Amount of tokens to approve in contract decimals, eg 2.0 or "0.00001" */ approve(caller: Addressable, spender: Addressable, amount: Numberish): Promise<any>; /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's allowance. * @param sender ERC20 transferFrom sender's address * @param recipient ERC20 transferFrom recipient's address * @param amount Amount of tokens to send in contract decimals, eg 2.0 or "0.00001" */ transferFrom(sender: Addressable, recipient: Addressable, amount: Numberish): Promise<any>; /** @return Converts a Number or String into this Contract's Scaled BigInt decimal */ toBigNum(amount: Numberish): bigint; /** @return Converts a Scaled BigInt decimal of this Contract into a String or Number */ fromBigNum(contractDecimal: bigint): Numberish; /** @return Converts a Numberish value into a Decimal with this contract's precision */ toDecimal(number: Numberish): Decimal; } //# sourceMappingURL=IERC20.d.ts.map