英文:
remix Why do some functions work and others don't
问题
以下是您要求的翻译内容:
// 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 以帮助解释。
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论