0

I am trying to use this guide to create a solidity contract on remix.ethereum however I get the following error when trying to compile:

DeclarationError: Identifier not found or not unique.
--> ACToken.sol:13:19:
|
13 | function burn(unint amount) external {
| ^^^^

this is my code:

    pragma solidity ^0.8.3;

import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol';

contract ACoolToken is ERC20 {
  address public admin;
  
  constructor() ERC20('ACoolToken', 'ACT') {
    _mint(msg.sender, 1000000 * 10 ** 18);
    admin = msg.sender;
  }
  
  function burn(unint amount) external {
      _burn(msg.sender, amount);
  }
  
  function mint(address account, uint256 amount) external {
      require(msg.sender == admin, 'only admin');
      _mint(to, amount);
  }

  
}

I have tried renaming burn to _burn or BurnToken but I get the same error either way. If I swap the order with mint, I get the error on the mint function too.

Wayneio
  • 3,466
  • 7
  • 42
  • 73

1 Answers1

3

It's caused by a typo - replace unint to uint.


Then you're going to see another error in the mint() function, calling the internal _mint(). Your external mint() accepts the first argument named account, but then you're trying to pass an undeclared variable to to the internal _mint() function.

Rename either of these two variables (account and to) so that they are the same.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100