I have a basic knowledge of solidity. I am trying to create an upgradable ERC20 Token. For that, I create TokenStorage
contract and Logic
contract and trying to write the Proxy
contract.
In the Logic
contract:
pragma solidity ^0.4.24;
import "./TokenStorage.sol";
import "./SafeMath.sol";
import './Ownable.sol';
In the TokenStorage
contract:
function addTotalSupply(uint256 _value) public onlyOwner {
totalSupply = totalSupply.add(_value);
}
When I call balances.addTotalSupply(_amount)
from Logic.mint()
, I get error.
If I remove onlyOwner
in addTotalSupply
, it executes correctly.
Note All contracts are deployed using the same account.
Please help me to understand why this happens.
Please Share me a proper guide to creating an upgradeable ERC20 Token is much appreciable
Thank you. Sorry for my bad English
Logic
fromTokenStorage
, or implement a new modifier calledonlyLogic
and use it instead ofonlyOwner
.