contract StandardToken is BasicToken, ERC20 {

mapping (address => mapping (address => uint)) public allowed;

uint public constant MAX_UINT = 2**256 - 1;

function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
    uint _allowance = allowed[_from][msg.sender];

    uint fee = (_value.mul(basisPointsRate)).div(10000); //because 10000 Basis Points == 100% percentage terms
    if (fee > maximumFee) {
        fee = maximumFee;
    if (_allowance < MAX_UINT) {
        allowed[_from][msg.sender] = _allowance.sub(_value);
    uint sendAmount = _value.sub(fee);
    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(sendAmount);
    if (fee > 0) {
        balances[owner] = balances[owner].add(fee);
        emit Transfer(_from, owner, fee);
    emit Transfer(_from, _to, sendAmount);

function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {

    require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));

    allowed[msg.sender][_spender] = _value;

    emit Approval(msg.sender, _spender, _value);

function allowance(address _owner, address _spender) public constant returns (uint remaining) {
    return allowed[_owner][_spender];


contract UpgradedStandardToken is StandardToken{

function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;

function approveByLegacy(address from, address spender, uint value) public;

The main purpose which i think is to make the contract backward compatible with ERC20 while having your own transfer and transferfrom with custom business logic.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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