Cyfrin / solidity-by-example.github.io

Solidity By Example
https://solidity-by-example.org/
MIT License
605 stars 191 forks source link

Change transfer function to call function for best and secure practice #220

Closed ErdemOzgen closed 2 years ago

ErdemOzgen commented 2 years ago

For good practice and coherent with other code samples. Changed 'transfer' function to 'call' function.

Link

t4sk commented 2 years ago

@ErdemOzgen Thanks for PR.

Here transfer is good enough, because msg.sender is the owner. No point in doing a re-entrancy on your on contract.

However if you think call is better here, can you add a comment saying transfer is also safe here?

Thanks

ErdemOzgen commented 2 years ago

@t4sk Thanks for your feedback, You are absolutely right.