29 lines
612 B
Solidity
29 lines
612 B
Solidity
/*
|
|
|
|
Copyright 2020 DODO ZOO.
|
|
SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
pragma solidity 0.6.9;
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
/**
|
|
* @title ReentrancyGuard
|
|
* @author DODO Breeder
|
|
*
|
|
* @notice Protect functions from Reentrancy Attack
|
|
*/
|
|
contract ReentrancyGuard {
|
|
// https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations
|
|
// zero-state of _ENTERED_ is false
|
|
bool private _ENTERED_;
|
|
|
|
modifier preventReentrant() {
|
|
require(!_ENTERED_, "REENTRANT");
|
|
_ENTERED_ = true;
|
|
_;
|
|
_ENTERED_ = false;
|
|
}
|
|
}
|