0

I am having a question considering inheritance/extending of ERC-20 Token Smart Contracts.

I would like to add additional mutable variables to an ERC-20 token before the deployment on the Ethereum Mainnet.

Alongside the defined variables by the interface:

name (string),
symbol (string),
decimals (uint8),
totalSupply(uint8)

I would like to add additional mutable variables, which values could be changed after deployment through transactions. They would look something like this:

issuedSupply(uint8),
dedicatedManager(string)

I did not find an answer yet in the official specification references:

There are two similar questions:

So, to make my question complete:

Can I implement a smart contract, complying to the ERC-20 standard and having additional parameters which are publicly visible and which values can be changed after deployment through transactions?

Thanks a lot for having a look at my my question,

Kind regards

1

The smart contracts can be extended using the inheritance pattern and you can add additional fields on block storage if you want. You can also update these fields using a transaction. A sample would look like

contract ERC20FixedSupply is ERC20 {
    string public test;
    constructor() public {
        _mint(msg.sender, 1000);
    }
    function setTest(string memory _test) public {
       require( msg.sender == owner, "Should be owner" );
       test = _test;
    }
}

In the above example the setTest function can be used to set the custom variable test and ERC20FixedSupply is a ERC-20 Smart contract

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.