Hello I have a simple implementation for a ERC223 Token. I use this repository: ERC223-token-standard

Here is my contract Code:

pragma solidity ^0.5.8;

import "./ERC223-token-standard-development/token/ERC223/ERC223Burnable.sol";
import "./ERC223-token-standard-development/token/ERC223/ERC223Mintable.sol";

contract MyToken is ERC223Burnable, ERC223Mintable{

The first strange Thing is that I get this warning when compiling:

Warning: Function state mutability can be restricted to view
    function mint(address account, uint256 amount) public onlyMinter returns (bool) {
    ^ (Relevant source part starts here and spans across multiple lines).

I think this is weird because to my understanding it changes the state of the contract and should not be a view function

However after creating my contract and using the mint function the totalSupply is still 0 even though isMinter(myaddr) returns true. I thought that I was just doing something wrong in the truffle testfile but after I pushed my code into Remix I still get the same warning and the total supply is still 0.

I hope you can help me with this issue.

1 Answer 1


The implementation of mint is wrong

function mint(address account, uint256 amount) public onlyMinter returns (bool) {
    return true;

It should be

function mint(address account, uint256 amount) public onlyMinter returns (bool) {
    bytes memory empty = hex"00000000";
    _totalSupply = _totalSupply.add(amount);
    balances[msg.sender] = balances[msg.sender].add(amount);
    emit Transfer(address(0x0), msg.sender, amount, empty);
    return true;
  • Thank you for your answer. But isnt this the official ERC223 implementation. how could this be wrong? I wonder what else is wrong with this Code. Sep 17, 2019 at 19:44
  • The key part to note is that _totalSupply.add(amount) doesn't do anything. It just adds two numbers and returns the result. _totalSupply = _totalSupply.add(amount) actually changes the value of _totalSupply. (Same thing for `balances[msg.sender].)
    – user19510
    Sep 17, 2019 at 19:52
  • Yes thank you I understand. It works now but I still get the warning. Sep 17, 2019 at 19:58
  • You have to note that ERC223 has never gained much traction. Some of the functionality is provided now by ERC777.
    – Ismael
    Sep 18, 2019 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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