ERC777 实现初始化的问题 | 登链社区 | 技术问答
source link: https://learnblockchain.cn/question/3093
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
5 ERC777 实现初始化的问题
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
contract GLDToken is ERC777 {
constructor(uint256 initialSupply, address[] memory defaultOperators)
ERC777("Gold", "GLD", defaultOperators)
{
_mint(msg.sender, initialSupply, "", "");
}
}
使用openZeppelin官网文档提供的代码实现一个ERC777代币,部署的时候需要填入initialSupply
和defaultOperators
。
这里的initialSupply
是一个unit256 的数值,用于初始化代币总量,defaultOperators
是一个地址数组,正确的填入格式应该是什么样的?
试了几次都提示类似以下的错误:
Error encoding arguments: Error: expected array value (argument=null, value="", code=INVALID_ARGUMENT, version=abi/5.5.0
或者这样的错误:
Error encoding arguments: Error: types/values length mismatch (count={"types":2,"values":3}, value={"types":["uint256","address[]"],"values":["100000","[",",]"]}, code=INVALID_ARGUMENT, version=abi/5.5.0)
defaultOperators 填入 ["0xBac5E6755AC066DF89220477360D01B315Fd930C"],又提示:
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Returned error: VM Exception while processing transaction: revert
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK