I create this contract using Remix.
When I call to totalsupply,it shows 0.
What am I doing wrong? Any help is much appreciated.
I create this contract using Remix.
When I call to totalsupply,it shows 0.
What am I doing wrong? Any help is much appreciated.
You have naming conflict here:
function totalSupply () public constant returns (uint totalSupply) {
return totalSupply;
}
Statement return totalSupply
refers to returns (uint totalSupply)
rather than to totalSupply
state variable.
BTW, simplest fix would be to remove this function completely, as totalSupply
state variable is already declared as public
, so no need to define explicit getter.
If you are using the compiler version greater than 0.4.18 than replace the constant with view.