ERC20Mintable contract call return wrong number

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

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


Updated August 09, 2019 22:28 PM

Updated November 30, 2017 06:28 AM

Updated August 13, 2017 12:28 PM

Updated September 14, 2018 04:28 AM

Updated February 10, 2018 22:28 PM