From 5fd2098273cc6a8e5fcddb2b76cc6774279fec84 Mon Sep 17 00:00:00 2001 From: YnQzZ2w <138340846+YnQzZ2w@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:49:37 -0700 Subject: [PATCH] add checks effects interact pattern --- .../vulnerabilities/reentrancy_attacks/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/advanced_expert/vulnerabilities/reentrancy_attacks/README.md b/advanced_expert/vulnerabilities/reentrancy_attacks/README.md index 625b03c..d9c0763 100644 --- a/advanced_expert/vulnerabilities/reentrancy_attacks/README.md +++ b/advanced_expert/vulnerabilities/reentrancy_attacks/README.md @@ -1,6 +1,7 @@ ## reentrancy attacks
+

@@ -73,6 +74,14 @@ function withdrawBalance() public noReentrant { #### Option 2: CEI (checks effects interaction) pattern +
+ +

+ +

+ +
+ ``` function withdrawBalance() public { uint amountToWithdraw = userBalances[msg.sender]; @@ -90,6 +99,8 @@ function withdrawBalance() public { ### resources +
+ * [reentrancy on solidity docs](https://docs.soliditylang.org/en/latest/security-considerations.html#re-entrancy) * [reentrancy on DASP](https://www.dasp.co/#item-1) * [reentrancy on SWC](https://swcregistry.io/docs/SWC-107)