I am trying to learn from other contracts and have seen an example which I do not understand. In this example a first contract is defined as follows, but it seems that the functions do not actually do anything. (BTW this is the etherdelta smartcontract...)
contract Token {
//part of the contract functions goes here
function transfer(address _to, uint256 _value) returns (bool success) {}
// other part of the contract functions goes here
}
Then, a new contract is defined, which seems to refer to the first contract:
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
Can anybody explain me please what this does?