When I deploy contract test net, it shows an error that gas limit exceeds: 3000000 What's the solution?
Github Link to the smart contract.
And is it normal to have the infinite gas estimate of almost all the functions?
I do non know your application, but there I see a “decimal()” with infinite gas estimation. If it is something like the same function in ERC20 it is not justified.
May be you are dereferencing to other SC that are not known at the deploy time, or that you use dynamic arrays, strings included, or that you have for loops with indefinite maximum number of iterations. In those cases the estimation is not adequate and fails.
I tried to compile your contract with Solidity 0.4.18 with optimizations disabled, and deploy costs
3,224,320 gas for me. However, with optimizations it consts only
1,682,401 gas. So either enable optimizations or increase gas limit.
The warning about infinite gas look like static analyser bug. The following line is treated as consuming infinite gas:
balances[msg.sender] = balances[msg.sender].sub(_value);
But rewriting it like this solves the problem:
balances[msg.sender] = SafeMath.sub (balances[msg.sender], _value);