-1

When i invoke the function mint directly on the ERC20Token it works as expected. However when i invoke via the TokenManager.mint i receive an out of gas expection.

I am running a local parity client, i believe there should be sufficient gasLimit/Block and gasLimit/transaction. And I have ensured that I correctly initiated TokenManager with the correct address.

Could anyone provide a reason this might be occurring or have any alternative suggestions for implementations ?

ERC20Token:

contract ERC20Token {
    function mint( address to, uint256 value)
       public onlyMinter returns (bool)
      {
       //does logic 
       return true;
      }
 }

TokenManager:

contract TokenManager {
    ERC20Token token;

    constructor(address _token){
        token = ERC20Token(_token)
    }

    function mint( address to, uint256 value) public onlyMinter returns (bool)
    {
       return token.mint(to,value)
    }

}

Create Instances of Deployed Contract:

const token = new web3.eth.Contract(ERC20Token.abi, ERC20Token.address)
const tokenManager = new web3.eth.Contract(TokenManager.abi, TokenManager.address)

Call Mint directly on token:

token.mint('0x923d1a26b64ee3219f4b32dc4f2e6d550eec7248',1) //works

Call Mint on TokenManager (indirectly invoking token.mint):

tokenManager.mint('0x923d1a26b64ee3219f4b32dc4f2e6d550eec7248',1) //provides exception:

Error ocurred: Error: Transaction ran out of gas. Please provide more gas:
{
  "blockHash": "0x663e50cf29addd19f9d8ed689994d93e47b15de4e733d72c51c21ccefbf74947",
  "blockNumber": 78106,
  "contractAddress": null,
  "cumulativeGasUsed": 26323,
  "from": "0xbd8d6de54fc0978605aa79447a38dd1c25a403c6",
  "gasUsed": 26323,
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "root": null,
  "status": false,
  "to": "0x4f386c3bb7b706d2df4806a696ac5f57afd35ff1",
  "transactionHash": "0x13a05890e9761a3cb0a9c3aba3111aeb3fda683f3a797f32d8088ee195bb4f0a",
  "transactionIndex": 0,
  "events": {}
}
  • What is onlyMinter? Is TokenManager a minter of ERC20Token? – Ismael Dec 7 '18 at 3:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.