Solidity security: The Reentrancy Guard pattern

In this story, I focus on one of the pattern to protect against one of the main attacks: Reentrancy attack.

ReentrancyGuard prevents reentrant calls to a function.

By inheriting ReentrancyGuard, a contract can use the nonReentrant modifier, which ensures that a function cannot have nested (reentrant) calls to it.

There is one limitation: functions marked as nonReentrant cannot call each other.

Example

// SPDX-License-Identifier: GPL-3.0
pragma…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bruno Delb

Blockchains, DevOps, Agile Coaching, development, testing, Cloud, Management 3.0, ITIL. It defines me.