Token
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
Name | Type | Description |
---|---|---|
initialMintAmount | uint256 | The amount of tokens to mint to the deployer |
name | string | The name of the token |
symbol | string | The symbol of the token |
_preApprovedAddresses | address[] | 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
Name | Type | Description |
---|---|---|
spender | address | The address to check |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true 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
Name | Type | Description |
---|---|---|
owner | address | The owner of the tokens |
spender | address | The spender of the tokens |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
spender | address | The spender of the tokens |
amount | uint256 | The amount of tokens to approve |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | true if the approval was successful, false otherwise |