在新的 Solidity ERC20 合约中找不到标识符

Identifier not found in new Solidity ERC20 contract

我正在尝试使用本指南在 remix.ethereum 上创建 solidity 合约,但是在尝试编译时出现以下错误:

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

这是我的代码:

    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);
  }

  
}

我曾尝试将 burn 重命名为 _burn 或 BurnToken,但无论哪种方式,我都会遇到相同的错误。如果我用 mint 交换订单,我也会在 mint 函数上得到错误。

这是由打字错误造成的 - 将 unint 替换为 uint


然后您将在 mint() 函数中看到另一个错误,调用内部 _mint()。您的外部 mint() 接受名为 account 的第一个参数,但随后您试图将未声明的变量 to 传递给内部 _mint() 函数。

重命名这两个变量(accountto)中的任何一个,使它们相同。