@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
748 lines • 33.8 kB
JSON
{
"contractName": "ReentrancyGuard",
"abi": [
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"details\":\"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 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]. * _Since v2.5.0:_ this module is now much more gas efficient, given net gas metering changes introduced in the Istanbul hardfork.\",\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xb63221b23818d622bfd83d18e0968307e4fcb7a35536bdceded76e1cf8349acd\",\"urls\":[\"bzz-raw://44e1e8c22362c4708a8c3362735f1465f5b05e2f7315e16c7010d694ce019d73\",\"dweb:/ipfs/QmWj9g8X1hxkXRre2kwkEjLBetjuzmSbWHD81bsSojnBkS\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"sourceMap": "",
"deployedSourceMap": "",
"source": "pragma solidity ^0.5.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n *\n * _Since v2.5.0:_ this module is now much more gas efficient, given net gas\n * metering changes introduced in the Istanbul hardfork.\n */\ncontract ReentrancyGuard {\n bool private _notEntered;\n\n constructor () internal {\n // Storing an initial non-zero value makes deployment a bit more\n // expensive, but in exchange the refund on every call to nonReentrant\n // will be lower in amount. Since refunds are capped to a percetange of\n // the total transaction's gas, it is best to keep them low in cases\n // like this one, to increase the likelihood of the full refund coming\n // into effect.\n _notEntered = true;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_notEntered, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _notEntered = false;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _notEntered = true;\n }\n}\n",
"sourcePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"ast": {
"absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"exportedSymbols": {
"ReentrancyGuard": [
38092
]
},
"id": 38093,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 38064,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:156"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@dev Contract module that helps prevent reentrant calls to a function.\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\navailable, which can be applied to functions to make sure there are no nested\n(reentrant) calls to them.\n * Note that because there is a single `nonReentrant` guard, functions marked as\n`nonReentrant` may not call one another. This can be worked around by making\nthose functions `private`, and then adding `external` `nonReentrant` entry\npoints to them.\n * TIP: If you would like to learn more about reentrancy and alternative ways\nto protect against it, check out our blog post\nhttps://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n * _Since v2.5.0:_ this module is now much more gas efficient, given net gas\nmetering changes introduced in the Istanbul hardfork.",
"fullyImplemented": true,
"id": 38092,
"linearizedBaseContracts": [
38092
],
"name": "ReentrancyGuard",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 38066,
"name": "_notEntered",
"nodeType": "VariableDeclaration",
"scope": 38092,
"src": "944:24:156",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 38065,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "944:4:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "private"
},
{
"body": {
"id": 38073,
"nodeType": "Block",
"src": "999:447:156",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 38071,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 38069,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "1421:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 38070,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1435:4:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "1421:18:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 38072,
"nodeType": "ExpressionStatement",
"src": "1421:18:156"
}
]
},
"documentation": null,
"id": 38074,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 38067,
"nodeType": "ParameterList",
"parameters": [],
"src": "987:2:156"
},
"returnParameters": {
"id": 38068,
"nodeType": "ParameterList",
"parameters": [],
"src": "999:0:156"
},
"scope": 38092,
"src": "975:471:156",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 38090,
"nodeType": "Block",
"src": "1845:410:156",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 38077,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "1934:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "5265656e7472616e637947756172643a207265656e7472616e742063616c6c",
"id": 38078,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1947:33:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619",
"typeString": "literal_string \"ReentrancyGuard: reentrant call\""
},
"value": "ReentrancyGuard: reentrant call"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619",
"typeString": "literal_string \"ReentrancyGuard: reentrant call\""
}
],
"id": 38076,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
38110,
38111
],
"referencedDeclaration": 38111,
"src": "1926:7:156",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 38079,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1926:55:156",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 38080,
"nodeType": "ExpressionStatement",
"src": "1926:55:156"
},
{
"expression": {
"argumentTypes": null,
"id": 38083,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 38081,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "2056:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 38082,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2070:5:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"src": "2056:19:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 38084,
"nodeType": "ExpressionStatement",
"src": "2056:19:156"
},
{
"id": 38085,
"nodeType": "PlaceholderStatement",
"src": "2086:1:156"
},
{
"expression": {
"argumentTypes": null,
"id": 38088,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 38086,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "2230:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 38087,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2244:4:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "2230:18:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 38089,
"nodeType": "ExpressionStatement",
"src": "2230:18:156"
}
]
},
"documentation": "@dev Prevents a contract from calling itself, directly or indirectly.\nCalling a `nonReentrant` function from another `nonReentrant`\nfunction is not supported. It is possible to prevent this from happening\nby making the `nonReentrant` function external, and make it call a\n`private` function that does the actual work.",
"id": 38091,
"name": "nonReentrant",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 38075,
"nodeType": "ParameterList",
"parameters": [],
"src": "1842:2:156"
},
"src": "1821:434:156",
"visibility": "internal"
}
],
"scope": 38093,
"src": "913:1344:156"
}
],
"src": "0:2258:156"
},
"legacyAST": {
"absolutePath": "@openzeppelin/contracts/utils/ReentrancyGuard.sol",
"exportedSymbols": {
"ReentrancyGuard": [
38092
]
},
"id": 38093,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 38064,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:156"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": "@dev Contract module that helps prevent reentrant calls to a function.\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\navailable, which can be applied to functions to make sure there are no nested\n(reentrant) calls to them.\n * Note that because there is a single `nonReentrant` guard, functions marked as\n`nonReentrant` may not call one another. This can be worked around by making\nthose functions `private`, and then adding `external` `nonReentrant` entry\npoints to them.\n * TIP: If you would like to learn more about reentrancy and alternative ways\nto protect against it, check out our blog post\nhttps://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n * _Since v2.5.0:_ this module is now much more gas efficient, given net gas\nmetering changes introduced in the Istanbul hardfork.",
"fullyImplemented": true,
"id": 38092,
"linearizedBaseContracts": [
38092
],
"name": "ReentrancyGuard",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 38066,
"name": "_notEntered",
"nodeType": "VariableDeclaration",
"scope": 38092,
"src": "944:24:156",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 38065,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "944:4:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "private"
},
{
"body": {
"id": 38073,
"nodeType": "Block",
"src": "999:447:156",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 38071,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 38069,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "1421:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 38070,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1435:4:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "1421:18:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 38072,
"nodeType": "ExpressionStatement",
"src": "1421:18:156"
}
]
},
"documentation": null,
"id": 38074,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 38067,
"nodeType": "ParameterList",
"parameters": [],
"src": "987:2:156"
},
"returnParameters": {
"id": 38068,
"nodeType": "ParameterList",
"parameters": [],
"src": "999:0:156"
},
"scope": 38092,
"src": "975:471:156",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 38090,
"nodeType": "Block",
"src": "1845:410:156",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 38077,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "1934:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "5265656e7472616e637947756172643a207265656e7472616e742063616c6c",
"id": 38078,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1947:33:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619",
"typeString": "literal_string \"ReentrancyGuard: reentrant call\""
},
"value": "ReentrancyGuard: reentrant call"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619",
"typeString": "literal_string \"ReentrancyGuard: reentrant call\""
}
],
"id": 38076,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
38110,
38111
],
"referencedDeclaration": 38111,
"src": "1926:7:156",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 38079,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1926:55:156",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 38080,
"nodeType": "ExpressionStatement",
"src": "1926:55:156"
},
{
"expression": {
"argumentTypes": null,
"id": 38083,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 38081,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "2056:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 38082,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2070:5:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"src": "2056:19:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 38084,
"nodeType": "ExpressionStatement",
"src": "2056:19:156"
},
{
"id": 38085,
"nodeType": "PlaceholderStatement",
"src": "2086:1:156"
},
{
"expression": {
"argumentTypes": null,
"id": 38088,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 38086,
"name": "_notEntered",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38066,
"src": "2230:11:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 38087,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "2244:4:156",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"src": "2230:18:156",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"id": 38089,
"nodeType": "ExpressionStatement",
"src": "2230:18:156"
}
]
},
"documentation": "@dev Prevents a contract from calling itself, directly or indirectly.\nCalling a `nonReentrant` function from another `nonReentrant`\nfunction is not supported. It is possible to prevent this from happening\nby making the `nonReentrant` function external, and make it call a\n`private` function that does the actual work.",
"id": 38091,
"name": "nonReentrant",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 38075,
"nodeType": "ParameterList",
"parameters": [],
"src": "1842:2:156"
},
"src": "1821:434:156",
"visibility": "internal"
}
],
"scope": 38093,
"src": "913:1344:156"
}
],
"src": "0:2258:156"
},
"compiler": {
"name": "solc",
"version": "0.5.16+commit.9c3226ce.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.0.23",
"updatedAt": "2026-03-02T16:38:29.159Z",
"devdoc": {
"details": "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 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]. * _Since v2.5.0:_ this module is now much more gas efficient, given net gas metering changes introduced in the Istanbul hardfork.",
"methods": {}
},
"userdoc": {
"methods": {}
}
}