@@ -6,6 +6,7 @@ import { CallOverrides, PopulatedTransaction } from "@ethersproject/contracts";
66import { ERC20 } from "../typechain-types/@openzeppelin/contracts/token/ERC20" ;
77import { ERC20__factory } from "../typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory" ;
88import { PromiseOrValue } from "../typechain-types/common" ;
9+ import { defaultGasOverrides } from "./config/overrides" ;
910
1011export class ERC20Client {
1112 private readonly contract : ERC20 ;
@@ -19,7 +20,7 @@ export class ERC20Client {
1920 * @returns a promise that resolves with a BigNumber that represents the amount of tokens in existence
2021 */
2122 public async totalSupply ( provider : Provider , overrides : CallOverrides = { } ) : Promise < BigNumber > {
22- return this . contract . connect ( provider ) . totalSupply ( overrides ) ;
23+ return this . contract . connect ( provider ) . totalSupply ( { ... defaultGasOverrides , ... overrides } ) ;
2324 }
2425
2526 /**
@@ -30,7 +31,7 @@ export class ERC20Client {
3031 account : PromiseOrValue < string > ,
3132 overrides : CallOverrides = { }
3233 ) : Promise < BigNumber > {
33- return this . contract . connect ( provider ) . balanceOf ( account , overrides ) ;
34+ return this . contract . connect ( provider ) . balanceOf ( account , { ... defaultGasOverrides , ... overrides } ) ;
3435 }
3536
3637 /**
@@ -42,7 +43,7 @@ export class ERC20Client {
4243 spender : PromiseOrValue < string > ,
4344 overrides : CallOverrides = { }
4445 ) : Promise < BigNumber > {
45- return this . contract . connect ( provider ) . allowance ( owner , spender , overrides ) ;
46+ return this . contract . connect ( provider ) . allowance ( owner , spender , { ... defaultGasOverrides , ... overrides } ) ;
4647 }
4748
4849 /**
@@ -53,7 +54,7 @@ export class ERC20Client {
5354 amount : PromiseOrValue < BigNumberish > ,
5455 overrides : Overrides & { from ?: PromiseOrValue < string > } = { }
5556 ) : Promise < PopulatedTransaction > {
56- return this . contract . populateTransaction . transfer ( to , amount , overrides ) ;
57+ return this . contract . populateTransaction . transfer ( to , amount , { ... defaultGasOverrides , ... overrides } ) ;
5758 }
5859
5960 /**
@@ -64,7 +65,7 @@ export class ERC20Client {
6465 amount : PromiseOrValue < BigNumberish > ,
6566 overrides : Overrides & { from ?: PromiseOrValue < string > } = { }
6667 ) : Promise < PopulatedTransaction > {
67- return this . contract . populateTransaction . approve ( spender , amount , overrides ) ;
68+ return this . contract . populateTransaction . approve ( spender , amount , { ... defaultGasOverrides , ... overrides } ) ;
6869 }
6970
7071 /**
@@ -76,6 +77,6 @@ export class ERC20Client {
7677 amount : PromiseOrValue < BigNumberish > ,
7778 overrides : Overrides & { from ?: PromiseOrValue < string > } = { }
7879 ) : Promise < PopulatedTransaction > {
79- return this . contract . populateTransaction . transferFrom ( from , to , amount , overrides ) ;
80+ return this . contract . populateTransaction . transferFrom ( from , to , amount , { ... defaultGasOverrides , ... overrides } ) ;
8081 }
8182}
0 commit comments