为什么有些函数能够工作而其他的不能?

huangapple go评论52阅读模式
英文:

remix Why do some functions work and others don't

问题

以下是您要求的翻译内容:

Remix IDE 中的功能列表

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";

contract Token is ERC20Votes {
    constructor(
        string memory _name,
        string memory _symbol,
        uint256 _initialSupply
    ) ERC20(_name, _symbol) ERC20Permit(_name) {
        _mint(msg.sender, _initialSupply);
    }

    // 下面的函数是 Solidity 所需的重写。

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal override(ERC20Votes) {
        super._afterTokenTransfer(from, to, amount);
    }

    function _mint(address to, uint256 amount) internal override(ERC20Votes) {
        super._mint(to, amount);
    }

    function _burn(
        address account,
        uint256 amount
    ) internal override(ERC20Votes) {
        super._burn(account, amount);
    }
}

请理解以太坊的 Solidity 以帮助解释。

英文:

Functions list in Remix IDE

pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";

contract Token is ERC20Votes {
    constructor(
        string memory _name,
        string memory _symbol,
        uint256 _initialSupply
    ) ERC20(_name, _symbol) ERC20Permit(_name) {
        _mint(msg.sender, _initialSupply);
    }

    // The following functions are overrides required by Solidity.

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal override(ERC20Votes) {
        super._afterTokenTransfer(from, to, amount);
    }

    function _mint(address to, uint256 amount) internal override(ERC20Votes) {
        super._mint(to, amount);
    }

    function _burn(
        address account,
        uint256 amount
    ) internal override(ERC20Votes) {
        super._burn(account, amount);
    }
}

Please understand Ethereum solidity to help explain

答案1

得分: 0

以下是翻译好的部分:

有些功能需要输入参数。
在您的图像中,CLOCK_MODE有效,因为它是一个不带参数的函数,您只需点击它即可。
其他功能需要参数。例如,balanceOf预期一个钱包地址作为参数,您可以在按钮旁边的输入框中输入。

英文:

Some functions require parameters to be entered.
In your image, CLOCK_MODE works because it's a function with no parameters, you just have to click on it.
The others require parameters. For example, balanceOf expects a wallet address as a parameter, which you enter in the input next to the button

huangapple
  • 本文由 发表于 2023年7月20日 17:06:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76728298.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定