August 2019
Intermediate to advanced
486 pages
13h 52m
English
There is a type of attack pattern where an attacker can call the function of a contract repeatedly. This is called a reentrancy attack. Using these types of attacks, an attacker may steal funds from the contract or perform unsafe operations on it. To prevent these types of attacks, the ReentrancyGuard.sol contract is used, which ensures that a function should be called only once per transaction.
However, it is the developer's responsibility to write code that isn't prone to reentrancy attacks. If there is still a chance of reentrancy attacks that cannot be stopped by code, then the modifier provided by this contract could be helpful.
The OpenZeppelin contract present at Chapter09/openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol ...