ERC20Mintable contract call return wrong number

by Ntydrm   Last Updated August 13, 2019 12:28 PM - source

I use OpenZeppilin ERC20Mintable contract and add MaxSupply parameter to contraint the ERC20 token amount allowed to issue.

what I want is only permit contract ower to view MaxSupply info, my function is below:

uint256 MaxSupply;//contract static variable
// self defined function
function ViewMaxSupply() public view onlyMinter return(uint256) {
 return ( MaxSupply* (10 ** uint256(decimals)) );

decimals is equal to 18.

I found when I use onlyMiner modifier, the return value is a very strange number: 3963877391197344453575983046348115674221700746820753546331534351508065746944. when not use modifier onlyMinter, the result is correct: 100000000000000000000

How to fix the error? Thanks.

Related Questions

ERC20 not recognized by TokenTracker

Updated September 02, 2019 09:28 AM

Help me Understand the flow of this smart contract

Updated October 02, 2019 13:28 PM

openzeppelin access roles.sol

Updated September 25, 2019 02:28 AM

openzeppelin mint sequence

Updated August 09, 2019 22:28 PM