Hi I write a new ERC20 contract by openzeppelin-contracts-ethereum-package,
and I run oz deploy
first .for example in my code I changed thet Token name from "Crypto" to "Crypto1" but when I run oz upgrade
and call name() it returns "Crypto",
This is my code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;`Preformatted text`
import '@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/presets/ERC20PresetMinterPauser.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol';
contract CryptomindToken is Initializable, ERC20PresetMinterPauserUpgradeSafe {
uint256 private _totalSupply;
function initialize() public initializer {
ERC20PresetMinterPauserUpgradeSafe.initialize("Crypto", "CR");
_setupDecimals(8);
_totalSupply = totalSupply();
if(_totalSupply ==0){
_mint(msg.sender, 2000000000 * (10 ** 8));
}
transfer(0x9C593f37322Adc092aa8996B14C217b4e1fC4c84,200);
}
function inc(address recipient) public returns (bool){
transfer(recipient,200);
return true;
}
}
Also, when I added a new function it didn't work.
For example, I add this function:
function incMore(address recipient) public returns (bool){
transfer(recipient,300);
return true;
}
this error appears:
npx oz send-tx
? Pick a network development
? Pick an instance CryptomindToken at 0x4d7251741cd0bc241e32A362328DB00eee859aFa
? Select which function incMore(recipient: address)
? recipient: address: 0x7D1b02681995408bC896AE1CfF622F43037A2B16
× Calling: 'incMore' with:
- recipient (address): "0x7D1b02681995408bC896AE1CfF622F43037A2B16"
Error while trying to send transaction to 0x4d7251741cd0bc241e32A362328DB00eee859aFa. Error: Error: Returned error: VM Exception while processing transaction: revert