The following function must be implemented for a token to be ERC-20 compliant:

    // Transfer the balance from owner's account to another account
15     function transfer(address _to, uint256 _amount) returns (bool success) {
16         if (balances[msg.sender] >= _amount 
17             && _amount > 0
18             && balances[_to] + _amount > balances[_to]) {
19             balances[msg.sender] -= _amount;
20             balances[_to] += _amount;
21             return true;
22         } else {
23             return false;
24         }
25     }

Notice that one of the parameters is the _amount. That's the amount that the user specifies. However, isn't one of the internal properties of a transaction the msg.value parameter? That means that the _amount variable is redundant, and a code smell.

1 Answer 1


Nope, _amount is not redundant; the variable msg.value denotes the number of wei (not token, but ether itself) sent along with the transaction! See also here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.