LSDVault - Dependencies
ReentrancyGuard.sol
This is a Solidity contract module named 'ReentrancyGuard' that prevents reentrant calls to a function. It provides a 'nonReentrant' modifier that can be applied to functions to block nested (reentrant) calls to them. Note that functions marked as 'nonReentrant' may not call one another. This can be avoided by marking those functions 'private', and then adding 'external' 'nonReentrant' entry points to them.
The ReentrancyGuard class is a contract module that helps prevent reentrant calls to a function.
This modifier ensures that the contract cannot call itself, directly or indirectly. It prevents a nonReentrant
function from being called from another nonReentrant
function.
- ReentrancyGuard: reentrant call: This error is thrown when a contract tries to call itself, directly or indirectly.
This example shows how to use the nonReentrant modifier to prevent reentrant calls to a function.
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.11;
import './ReentrancyGuard.sol';
contract MyContract is ReentrancyGuard {
function myFunction() public nonReentrant {
// Function logic here
}
}