Hello i have the follow contract:


I want add this code tu the code above:

    constructor(uint _totalSupply) public {
    totalSupply = _totalSupply;
    balanceOf[msg.sender] = totalSupply;

// your standard token transfer function with the addition of the share that
// goes to your target address
function transfer(address _to, uint amount) public {

    // calculate the share for your target address
    uint shareForX = amount/100;

    // store the previous balance of the sender for later assertion
    // (check that all works as intended)
    uint senderBalance = balanceOf[msg.sender];
    // check the sender actually has enough tokens to send
    require(senderBalance >= amount);
    // reduce sender balance first to avoid that the sender sends more than
    // he owns by submitting multiple transactions.
    balanceOf[msg.sender] -= amount;
    // store the previous balance of the receiver for later assertion
    // (check that all works as intended)
    uint receiverBalance = balanceOf[_to];

    // add the amount of tokens to the receiver but deduce the share for your
    // target address
    balanceOf[_to] += amount-shareForX;
    // add the share to your target address
    balanceOf[target] += shareForX;

    // check that everything works as intended, specifically checking that
    // the sum of tokens in all reladed accounts is the same before and after
    // the transaction. 
    assert(balanceOf[msg.sender] + balanceOf[_to] + shareForX ==
        senderBalance + receiverBalance);


The problem is i dont know whats wrong but i receive this error in REMIX:

browser/savingcoin.sol:79:13: ParserError: Expected identifier but got 'payable'
address payable target = 0x158de12EE547EAe06Cbdb200A017aCa6B75D230D;

This code just send 1% of tokes to X address so i dont know whats wring so please help to me.


  • This piece of code that shows the error is not in your code, I think you are confusing files, in any case address payable is not available in 4.25 but ^5.0, you may want to check that
    – Jaime
    Dec 4, 2018 at 23:00

1 Answer 1


The payable modifier for address types is not available in Solidity until 0.5.0. Either remove the payable modifier, or upgrade your contracts to use Solidity v0.5.0.

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.