The ERC20 token standard specifies balanceof()
to return a constant
.
function balanceOf(address _owner) constant returns (uint256 balance)
But the balance amount might change or am I getting something wrong here?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityThe constant keyword does not specify what the function returns. A function marked as constant like this one tells you that the function will return a value and will not modify any state variables. A large use for the constant/view keywords is to declare a function that can be called without sending a transaction, i.e. a free "query" of the blockchain.
http://solidity.readthedocs.io/en/develop/contracts.html#view-functions
constant
in balanceof()
? The function itself doesn't change any state, it only returns return balances[_owner];
Nov 10, 2017 at 14:00
constant on functions is an alias to view, so when executed you can view the contents that function returns