Allowance Methods

allowance launcher methods for presale.

increaseAllowance

increaseAllowance is a method that helps developers to increase allowance from payment method token for the presale contract if the payment token is ERC20 token. It is commonly used before any methods in the buy section pages. See more details about its usage in the section for buy method

Parameter

ArgumentTypeDescription
tokenAddressStringone of the payment method token of the presale contract
allowanceAmountStringamount of increased allowance
signerSignerthe instance to represent wallet address.

Example

const paymentToken = PAYMENT_METHOD
// assume PAYMENT_METHOD stores a payment method from the list 
// of payment methods returned by getPaymentMethods
await presaleSdk.increaseAllowance(paymentToken, amount.toString(), signer)

getAllowance

getAllowance is a method that helps get the allowance amount of a given erc20 contract for presale contract to spend. It is commonly used to check allowance of payment contract before increaseAllowance

📘

No parameter is needed for this method

PropertyTypeDescription
PromiseBigNumberthe amount of allowance

Response

const allowance = await presaleSdk.getAllowance(paymentToken, await signer.getAddress())