Difference between revisions of "User talk:Zenrasta"

11 bytes removed ,  03:43, 26 April 2022
no edit summary
(→‎Reentracy attack: new section)
 
 
Line 10: Line 10:
That is, functions which call external contracts should execute in the following order:
That is, functions which call external contracts should execute in the following order:


# Numbered list item
 
'''Checks''' -First perform some checks (who called the function, are the arguments in range, did they send enough Ether, does the person have tokens, etc.).  
'''1. Checks''' -First perform some checks (who called the function, are the arguments in range, did they send enough Ether, does the person have tokens, etc.).  
'''Effects''' -As the second step, if all checks passed, effects to the state variables of the current contract should be made. This updates the contract state
'''2. Effects''' -As the second step, if all checks passed, effects to the state variables of the current contract should be made. This updates the contract state
'''Interaction''' - Interaction with other contracts should be the very last step in any function.
'''3. Interaction''' - Interaction with other contracts should be the very last step in any function.


To illustrate the above consider a smart contract with only two (2) functions as follows:
To illustrate the above consider a smart contract with only two (2) functions as follows:
4

edits