Skip to content

Latest commit

 

History

History
328 lines (279 loc) · 8.65 KB

FakeToken.md

File metadata and controls

328 lines (279 loc) · 8.65 KB

FakeToken.sol

View Source: contracts/fakes/FakeToken.sol

↗ Extends: ERC20

FakeToken

Contract Members

Constants & Variables

//public members
address public deployer;
mapping(address => bool) public minters;

//private members
uint8 private _decimals;

Modifiers

onlyDeployer

modifier onlyDeployer() internal

Arguments

Name Type Description

Functions

addMinter

function addMinter(address account, bool flag) public nonpayable onlyDeployer 

Arguments

Name Type Description
account address
flag bool
Source Code
function addMinter(address account, bool flag) public onlyDeployer {
    minters[account] = flag;
  }

function (string name, string symbol, uint256 supply, uint8 decimalPlaces) public nonpayable ERC20 

Arguments

Name Type Description
name string
symbol string
supply uint256
decimalPlaces uint8
Source Code
constructor(
    string memory name,
    string memory symbol,
    uint256 supply,
    uint8 decimalPlaces
  ) ERC20(name, symbol) {
    require(decimalPlaces > 0, "Invalid decimal places value");

    super._mint(msg.sender, supply);
    deployer = msg.sender;
    minters[msg.sender] = true;
    _decimals = decimalPlaces;
  }

decimals

function decimals() public view
returns(uint8)

Arguments

Name Type Description
Source Code
function decimals() public view virtual override returns (uint8) {
    return _decimals;
  }

mint

function mint(uint256 amount) external nonpayable

Arguments

Name Type Description
amount uint256
Source Code
function mint(uint256 amount) external {
    if (amount > 2000 * (10**_decimals)) {
      require(minters[msg.sender], "Please specify a smaller value");
    }

    super._mint(msg.sender, amount);
  }

burn

function burn(uint256 amount) external nonpayable

Arguments

Name Type Description
amount uint256
Source Code
function burn(uint256 amount) external {
    super._burn(msg.sender, amount);
  }

Contracts