Functions of ERC-20 Token Standard should throw in special cases:
</p>
<ul>
<li><code>transfer</code> should throw if the <code>_from</code> account balance does not have enough tokens to spend</li>
<li><code>transferFrom</code> should throw unless the <code>_from</code> account has deliberately authorized the sender of the message via some mechanism</li>
function transfer(uint256 _value) returns (bool success) {
if (_value > 0) {
return true;
}
else {return false;}
}
}
contract Token2{
function transfer(address _token, uint _value) returns (bool success) {
ERC20(_token).transfer(msg.sender, _value);
}
function transferFrom(uint _value) returns (bool success) {
require(_value > 10 wei);
return false;
}
}
contract Token3 is Token2{
function transferFrom(uint _value) returns (bool success) {
if (_value < 20 wei) {
revert();
}
return true;
}
function transfer(address _token, uint _value) returns (bool success) {
return super.transfer(_token,_value);
}
}
```
### Abstract Syntax Tree
[Click Here](https://astexplorer.net/#/gist/4ad9caab2b9399efcce232ae82d7dbb1/803e711642dc5333147ea15f9247f2a6a54aa224) to view the AST for the above code. Code generated from AST Explorer using _solidity-parser-antlr-0.4.11_