I deployed a ERC20Mintable token in truffle env(the .sol file is ERC20Mintable.sol).
2_mintable.js
=============
Deploying 'ERC20Mintable'
-------------------------
> transaction hash: 0x02c7b8e1dbde226304614ceeea48e1d4eb123bd1a70e73b1955d8718f3d49e08
> Blocks: 0 Seconds: 0
> contract address: 0x25CcB91c6643a0679591F888c3a16B12745b9594
> block number: 3
> block timestamp: 1562326476
> account: 0x6D04f90886E0651381c174B2752C6c0F06626a54
> balance: 99.96399902
> gas used: 1496633
> gas price: 20 gwei
> value sent: 0 ETH
> total cost: 0.02993266 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.02993266 ETH
the 2_mintable.js code is:
const ERC20Mintable = artifacts.require("ERC20Mintable.sol");
module.exports = function(deployer) {
deployer.deploy(ERC20Mintable);
};
I want to check whether accounts[0] is minter, and call function as below:
let instance = await ERC20Mintable.deployed()//It can display correct contract info.
let accounts = await web3.eth.getAccounts()
instance.MinterRole.isMinter(accounts[0])
there is an error information like below, how to fix the problem, many thanks!
truffle(develop)> instance.MinterRole.isMinter(accounts[0])
evalmachine.<anonymous>:0
instance.MinterRole.isMinter(accounts[0])
^
TypeError: Cannot read property 'isMinter' of undefined
at evalmachine.<anonymous>:0:21
at sigintHandlersWrap (vm.js:285:15)
at Script.runInContext (vm.js:127:14)
at runScript (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:368533:21)
at Console.interpret (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:368548:21)
at ReplManager.interpret (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:369389:18)
at bound (domain.js:395:14)
at REPLServer.runBound [as eval] (domain.js:408:12)
at REPLServer.onLine (repl.js:639:10)
at REPLServer.emit (events.js:189:13)