Token

Git Source

Inherits: ERC20, ERC20Permit

Author: EridianAlpha

An ERC20 token contract used in the Pool Playground project.

State Variables

preApprovedAddresses

address[] public preApprovedAddresses;

Functions

constructor

Constructor for the Token contract

constructor(uint256 initialMintAmount, string memory name, string memory symbol, address[] memory _preApprovedAddresses)
    ERC20(name, symbol)
    ERC20Permit(name);

Parameters

NameTypeDescription
initialMintAmountuint256The amount of tokens to mint to the deployer
namestringThe name of the token
symbolstringThe symbol of the token
_preApprovedAddressesaddress[]An array of addresses that are pre-approved to spend an unlimited amount of tokens

isPreApproved

Checks if an address is pre-approved to spend an unlimited amount of tokens

function isPreApproved(address spender) public view returns (bool);

Parameters

NameTypeDescription
spenderaddressThe address to check

Returns

NameTypeDescription
<none>booltrue if the address is pre-approved, false otherwise

allowance

Overrides the allowance function to return type(uint256).max for pre-approved addresses

function allowance(address owner, address spender) public view override returns (uint256);

Parameters

NameTypeDescription
owneraddressThe owner of the tokens
spenderaddressThe spender of the tokens

Returns

NameTypeDescription
<none>uint256The allowance of the spender

approve

Overrides the approve function to return true for pre-approved addresses

function approve(address spender, uint256 amount) public override returns (bool);

Parameters

NameTypeDescription
spenderaddressThe spender of the tokens
amountuint256The amount of tokens to approve

Returns

NameTypeDescription
<none>booltrue if the approval was successful, false otherwise