import type { BigNumber } from 'ethers'; import { ethers } from 'ethers'; import erc20Abi from '../abis/erc20_abi.json'; export class Token { public contract: ethers.Contract; public address: string; constructor( address: string, signerOrProvider: ethers.Signer | ethers.providers.Provider ) { this.contract = new ethers.Contract(address, erc20Abi, signerOrProvider); this.address = address; } totalSupply() { return this.contract.totalSupply(); } balanceOf(account: string): Promise { return this.contract.balanceOf(account); } allowance(owner: string, spender: string): Promise { return this.contract.allowance(owner, spender); } approve(spender: string, amount: string) { return this.contract.approve(spender, amount); } decimals(): Promise { return this.contract.decimals(); } }