Hi. My contract has the following initialize
-method:
function initialize(
address minter,
address[] memory pausers
) public initializer {
}
How can I pass the second arguments on zos create
properly? And how can I achieve, that inherited initialize
-methods also were called properly within this method (second part of the question below).
I have tried the following:
zos create NCDToken --init initialize --args 0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086, [0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086, 0xbc19d2a8f611d7f81757420a1cd6a41148a3c9e4]
Ends up with:
Using custom deployment of openzeppelin-eth
All logic contracts are up to date
Error parsing arguments: SyntaxError: Unexpected token ] in JSON at position 46
zos create NCDToken --init initialize --args '0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086', ['0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086', '0xbc19d2a8f611d7f81757420a1cd6a41148a3c9e4']
Ends up with the same error message.
Then I tried a "flattened" array with only one parameter:
zos create NCDToken --init initialize --args 0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086, 0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086
Same error message.
Then I have eliminated the spaces between arguments:
zos create NCDToken --init initialize --args 0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086,[0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086,0xbc19d2a8f611d7f81757420a1cd6a41148a3c9e4]
It seems to work better. But first I was curious why it still was asking for "decimals", as the initialize
-method of ERC20Detailed is already called within the main initialize
-method.
Second, it could not parse either the other arguments seemingly:
sing session with network development, sender address 0xe280db001246e1cff4b437d161f47e4a8895506d, timeout 3600 seconds
WARNING: Address 0xe280db001246e1cff4b437d161f47e4a8895506d is not checksummed. Consider checksumming it to avoid future warnings or errors.
Using session with network development, sender address 0xe280db001246e1cff4b437d161f47e4a8895506d, timeout 3600 seconds
WARNING: Address 0xe280db001246e1cff4b437d161f47e4a8895506d is not checksummed. Consider checksumming it to avoid future warnings or errors.
Using custom deployment of openzeppelin-eth
All logic contracts are up to date
? decimals: 18
Deploying new ProxyAdmin...
Deployed ProxyAdmin at 0xfc0756F0642D877662EBEEd9c5D5A9e8A3c88fC1
invalid string value (arg="", coderType="string", value=["0x6c32ee3d8dcd2a88142c6ba35fc97ce92904f086","0xbc19d2a8f611d7f81757420a1cd6a41148a3c9e4"], version=4.0.30)
Updated zos.dev-1561494218904.json
For the sake of completeness, the whole token contract looks like this and can be found on GitHub:
pragma solidity ^0.5.7;
import "openzeppelin-eth/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-eth/contracts/token/ERC20/ERC20Mintable.sol";
import "openzeppelin-eth/contracts/token/ERC20/ERC20Pausable.sol";
import "openzeppelin-eth/contracts/ownership/Ownable.sol";
contract NCDToken is ERC20Detailed, ERC20Mintable, ERC20Pausable {
function initialize(
address minter,
address[] memory pausers
) public initializer {
require(pausers[0] != address(0));
ERC20Detailed.initialize("NCDToken", "NCD", uint8(18));
ERC20Mintable.initialize(minter);
ERC20Pausable.initialize(pausers[0]);
// add the other pausers as well if existing
for (uint256 i = 1; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}
function () external payable {
//revert();
}
/**
* @dev Minting tokens
* @param account The account of beneficiary who will get the minted token
* @param value The amount of minted token
*/
function _mint(address account, uint256 value) internal whenNotPaused onlyMinter {
super._mint(account, value);
}
}