Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.

Commit

Permalink
Updating deprecated .send(...) to .transfer(...) (#734)
Browse files Browse the repository at this point in the history
.send(...) is now deprecated.
Send vs transfer comparsion:
https://vomtom.at/solidity-send-vs-transfer/
Also the Solidity by Example Documentation got updated and now uses the .transfer() function.
http://solidity.readthedocs.io/en/develop/solidity-by-example.html
We dont need to use require, as transfer fully propagates errors.
  • Loading branch information
scp1001 authored and alexvansande committed Jan 4, 2018
1 parent 945fe84 commit f655ec7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion views/content/token.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ The next step is making the buy and sell functions:
balanceOf[this] += amount; // adds the amount to owner's balance
balanceOf[msg.sender] -= amount; // subtracts the amount from seller's balance
revenue = amount * sellPrice;
require(msg.sender.send(revenue)); // sends ether to the seller: it's important to do this last to prevent recursion attacks
msg.sender.transfer(revenue); // sends ether to the seller: it's important to do this last to prevent recursion attacks
Transfer(msg.sender, this, amount); // executes an event reflecting on the change
return revenue; // ends function and returns
}
Expand Down

0 comments on commit f655ec7

Please sign in to comment.