Why I failed to deploy the contract to the main network, but not to the virtual machine: creation of MyToken errored: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"code":-32600,"message":"value is not of type array"}}}'
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract MyToken is Initializable, ERC20Upgradeable, ERC20SnapshotUpgradeable, OwnableUpgradeable, ERC20PermitUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function initialize() initializer public {
__ERC20_init("MyToken", "MTK");
__ERC20Snapshot_init();
__Ownable_init();
__ERC20Permit_init("MyToken");
}
function snapshot() public onlyOwner {
_snapshot();
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
// The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20SnapshotUpgradeable)
{
super._beforeTokenTransfer(from, to, amount);
}
}