REMIX: ParserError: Bezeichner erwartet, aber zahlbares Adressziel erhalten

Hallo, ich habe folgenden Vertrag:

https://pastebin.com/dQJY55hs

Ich möchte diesen Code zum obigen Code hinzufügen:

    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);

}

Das Problem ist, dass ich nicht weiß, was falsch ist, aber ich erhalte diesen Fehler in REMIX:

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

Dieser Code sendet nur 1% der Tokes an die X-Adresse, damit ich nicht weiß, was los ist. Bitte helfen Sie mir.

Danke

Dieses Stück Code, das den Fehler anzeigt, ist nicht in Ihrem Code, ich denke, Sie verwechseln Dateien, auf jeden Fall address payableist es in 4.25 nicht verfügbar, aber ^ 5.0, Sie sollten das vielleicht überprüfen

Antworten (1)

Der payableModifikator für Adresstypen ist in Solidity erst ab 0.5.0 verfügbar. Entfernen Sie entweder den Zahlungsmodifikator oder aktualisieren Sie Ihre Verträge, um Solidity v0.5.0 zu verwenden.