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代币,部署的时候需要填入initialSupplydefaultOperators。 这里的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

请先 登录 后评论

最佳答案 2022-02-15 12:18

[ ] 里每个地址用""包起来

请先 登录 后评论

其它 1 个回答

bugfly
请先 登录 后评论
  • 2 关注
  • 0 收藏,2698 浏览
  • bugfly 提出于 2022-02-15 11:18