548 lines
18 KiB
JSON
548 lines
18 KiB
JSON
{
|
|
"id": "f3169dee14b15bb83cd6fa7122114231",
|
|
"_format": "hh-sol-build-info-1",
|
|
"solcVersion": "0.8.26",
|
|
"solcLongVersion": "0.8.26+commit.8a97fa7a",
|
|
"input": {
|
|
"language": "Solidity",
|
|
"sources": {
|
|
"contracts/NoDelegateCall.sol": {
|
|
"content": "// SPDX-License-Identifier: BUSL-1.1\r\npragma solidity =0.8.26;\r\n\r\n/// @title Prevents delegatecall to a contract\r\n/// @notice Base contract that provides a modifier for preventing delegatecall to methods in a child contract\r\nabstract contract NoDelegateCall {\r\n /// @dev The original address of this contract\r\n address private immutable original;\r\n\r\n constructor() {\r\n // Immutables are computed in the init code of the contract, and then inlined into the deployed bytecode.\r\n // In other words, this variable won't change when it's checked at runtime.\r\n original = address(this);\r\n }\r\n\r\n /// @dev Private method is used instead of inlining into modifier because modifiers are copied into each method,\r\n /// and the use of immutable means the address bytes are copied in every place the modifier is used.\r\n function checkNotDelegateCall() private view {\r\n require(address(this) == original);\r\n }\r\n\r\n /// @notice Prevents delegatecall into the modified method\r\n modifier noDelegateCall() {\r\n checkNotDelegateCall();\r\n _;\r\n }\r\n}\r\n"
|
|
}
|
|
},
|
|
"settings": {
|
|
"optimizer": {
|
|
"enabled": false,
|
|
"runs": 200
|
|
},
|
|
"outputSelection": {
|
|
"*": {
|
|
"": [
|
|
"ast"
|
|
],
|
|
"*": [
|
|
"abi",
|
|
"metadata",
|
|
"devdoc",
|
|
"userdoc",
|
|
"storageLayout",
|
|
"evm.legacyAssembly",
|
|
"evm.bytecode",
|
|
"evm.deployedBytecode",
|
|
"evm.methodIdentifiers",
|
|
"evm.gasEstimates",
|
|
"evm.assembly"
|
|
]
|
|
}
|
|
},
|
|
"remappings": []
|
|
}
|
|
},
|
|
"output": {
|
|
"contracts": {
|
|
"contracts/NoDelegateCall.sol": {
|
|
"NoDelegateCall": {
|
|
"abi": [],
|
|
"devdoc": {
|
|
"kind": "dev",
|
|
"methods": {},
|
|
"stateVariables": {
|
|
"original": {
|
|
"details": "The original address of this contract"
|
|
}
|
|
},
|
|
"title": "Prevents delegatecall to a contract",
|
|
"version": 1
|
|
},
|
|
"evm": {
|
|
"assembly": "",
|
|
"bytecode": {
|
|
"functionDebugData": {},
|
|
"generatedSources": [],
|
|
"linkReferences": {},
|
|
"object": "",
|
|
"opcodes": "",
|
|
"sourceMap": ""
|
|
},
|
|
"deployedBytecode": {
|
|
"functionDebugData": {},
|
|
"generatedSources": [],
|
|
"immutableReferences": {},
|
|
"linkReferences": {},
|
|
"object": "",
|
|
"opcodes": "",
|
|
"sourceMap": ""
|
|
},
|
|
"gasEstimates": null,
|
|
"legacyAssembly": null,
|
|
"methodIdentifiers": {}
|
|
},
|
|
"metadata": "{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"stateVariables\":{\"original\":{\"details\":\"The original address of this contract\"}},\"title\":\"Prevents delegatecall to a contract\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Base contract that provides a modifier for preventing delegatecall to methods in a child contract\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/NoDelegateCall.sol\":\"NoDelegateCall\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/NoDelegateCall.sol\":{\"keccak256\":\"0x8b81cce8fcad1fd5b4763f75f043fb530c706a95d4cd854a8dde61057f0a8a1b\",\"license\":\"BUSL-1.1\",\"urls\":[\"bzz-raw://22593ea1fcb31ee917efd8d7d3f2963535405f966dbae8bcd18a7ea02d44d1f4\",\"dweb:/ipfs/QmXbnwiaT2EoiPRzuAetmzUUz8LZrihkfZKuUD2XB15GGE\"]}},\"version\":1}",
|
|
"storageLayout": {
|
|
"storage": [],
|
|
"types": null
|
|
},
|
|
"userdoc": {
|
|
"kind": "user",
|
|
"methods": {},
|
|
"notice": "Base contract that provides a modifier for preventing delegatecall to methods in a child contract",
|
|
"version": 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"sources": {
|
|
"contracts/NoDelegateCall.sol": {
|
|
"ast": {
|
|
"absolutePath": "contracts/NoDelegateCall.sol",
|
|
"exportedSymbols": {
|
|
"NoDelegateCall": [
|
|
39
|
|
]
|
|
},
|
|
"id": 40,
|
|
"license": "BUSL-1.1",
|
|
"nodeType": "SourceUnit",
|
|
"nodes": [
|
|
{
|
|
"id": 1,
|
|
"literals": [
|
|
"solidity",
|
|
"=",
|
|
"0.8",
|
|
".26"
|
|
],
|
|
"nodeType": "PragmaDirective",
|
|
"src": "38:24:0"
|
|
},
|
|
{
|
|
"abstract": true,
|
|
"baseContracts": [],
|
|
"canonicalName": "NoDelegateCall",
|
|
"contractDependencies": [],
|
|
"contractKind": "contract",
|
|
"documentation": {
|
|
"id": 2,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "66:159:0",
|
|
"text": "@title Prevents delegatecall to a contract\n @notice Base contract that provides a modifier for preventing delegatecall to methods in a child contract"
|
|
},
|
|
"fullyImplemented": true,
|
|
"id": 39,
|
|
"linearizedBaseContracts": [
|
|
39
|
|
],
|
|
"name": "NoDelegateCall",
|
|
"nameLocation": "243:14:0",
|
|
"nodeType": "ContractDefinition",
|
|
"nodes": [
|
|
{
|
|
"constant": false,
|
|
"documentation": {
|
|
"id": 3,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "265:46:0",
|
|
"text": "@dev The original address of this contract"
|
|
},
|
|
"id": 5,
|
|
"mutability": "immutable",
|
|
"name": "original",
|
|
"nameLocation": "343:8:0",
|
|
"nodeType": "VariableDeclaration",
|
|
"scope": 39,
|
|
"src": "317:34:0",
|
|
"stateVariable": true,
|
|
"storageLocation": "default",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"typeName": {
|
|
"id": 4,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "317:7:0",
|
|
"stateMutability": "nonpayable",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"visibility": "private"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 15,
|
|
"nodeType": "Block",
|
|
"src": "374:243:0",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"id": 13,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftHandSide": {
|
|
"id": 8,
|
|
"name": "original",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 5,
|
|
"src": "585:8:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"nodeType": "Assignment",
|
|
"operator": "=",
|
|
"rightHandSide": {
|
|
"arguments": [
|
|
{
|
|
"id": 11,
|
|
"name": "this",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 4294967268,
|
|
"src": "604:4:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_NoDelegateCall_$39",
|
|
"typeString": "contract NoDelegateCall"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_contract$_NoDelegateCall_$39",
|
|
"typeString": "contract NoDelegateCall"
|
|
}
|
|
],
|
|
"id": 10,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"lValueRequested": false,
|
|
"nodeType": "ElementaryTypeNameExpression",
|
|
"src": "596:7:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_type$_t_address_$",
|
|
"typeString": "type(address)"
|
|
},
|
|
"typeName": {
|
|
"id": 9,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "596:7:0",
|
|
"typeDescriptions": {}
|
|
}
|
|
},
|
|
"id": 12,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "typeConversion",
|
|
"lValueRequested": false,
|
|
"nameLocations": [],
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "596:13:0",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"src": "585:24:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"id": 14,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "585:24:0"
|
|
}
|
|
]
|
|
},
|
|
"id": 16,
|
|
"implemented": true,
|
|
"kind": "constructor",
|
|
"modifiers": [],
|
|
"name": "",
|
|
"nameLocation": "-1:-1:-1",
|
|
"nodeType": "FunctionDefinition",
|
|
"parameters": {
|
|
"id": 6,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "371:2:0"
|
|
},
|
|
"returnParameters": {
|
|
"id": 7,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "374:0:0"
|
|
},
|
|
"scope": 39,
|
|
"src": "360:257:0",
|
|
"stateMutability": "nonpayable",
|
|
"virtual": false,
|
|
"visibility": "internal"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 29,
|
|
"nodeType": "Block",
|
|
"src": "898:53:0",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"arguments": [
|
|
{
|
|
"commonType": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
},
|
|
"id": 26,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"lValueRequested": false,
|
|
"leftExpression": {
|
|
"arguments": [
|
|
{
|
|
"id": 23,
|
|
"name": "this",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 4294967268,
|
|
"src": "925:4:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_contract$_NoDelegateCall_$39",
|
|
"typeString": "contract NoDelegateCall"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_contract$_NoDelegateCall_$39",
|
|
"typeString": "contract NoDelegateCall"
|
|
}
|
|
],
|
|
"id": 22,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": true,
|
|
"lValueRequested": false,
|
|
"nodeType": "ElementaryTypeNameExpression",
|
|
"src": "917:7:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_type$_t_address_$",
|
|
"typeString": "type(address)"
|
|
},
|
|
"typeName": {
|
|
"id": 21,
|
|
"name": "address",
|
|
"nodeType": "ElementaryTypeName",
|
|
"src": "917:7:0",
|
|
"typeDescriptions": {}
|
|
}
|
|
},
|
|
"id": 24,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "typeConversion",
|
|
"lValueRequested": false,
|
|
"nameLocations": [],
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "917:13:0",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"nodeType": "BinaryOperation",
|
|
"operator": "==",
|
|
"rightExpression": {
|
|
"id": 25,
|
|
"name": "original",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 5,
|
|
"src": "934:8:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_address",
|
|
"typeString": "address"
|
|
}
|
|
},
|
|
"src": "917:25:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
}
|
|
}
|
|
],
|
|
"expression": {
|
|
"argumentTypes": [
|
|
{
|
|
"typeIdentifier": "t_bool",
|
|
"typeString": "bool"
|
|
}
|
|
],
|
|
"id": 20,
|
|
"name": "require",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [
|
|
4294967278,
|
|
4294967278,
|
|
4294967278
|
|
],
|
|
"referencedDeclaration": 4294967278,
|
|
"src": "909:7:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
|
|
"typeString": "function (bool) pure"
|
|
}
|
|
},
|
|
"id": 27,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"nameLocations": [],
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "909:34:0",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_tuple$__$",
|
|
"typeString": "tuple()"
|
|
}
|
|
},
|
|
"id": 28,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "909:34:0"
|
|
}
|
|
]
|
|
},
|
|
"documentation": {
|
|
"id": 17,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "625:222:0",
|
|
"text": "@dev Private method is used instead of inlining into modifier because modifiers are copied into each method,\n and the use of immutable means the address bytes are copied in every place the modifier is used."
|
|
},
|
|
"id": 30,
|
|
"implemented": true,
|
|
"kind": "function",
|
|
"modifiers": [],
|
|
"name": "checkNotDelegateCall",
|
|
"nameLocation": "862:20:0",
|
|
"nodeType": "FunctionDefinition",
|
|
"parameters": {
|
|
"id": 18,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "882:2:0"
|
|
},
|
|
"returnParameters": {
|
|
"id": 19,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "898:0:0"
|
|
},
|
|
"scope": 39,
|
|
"src": "853:98:0",
|
|
"stateMutability": "view",
|
|
"virtual": false,
|
|
"visibility": "private"
|
|
},
|
|
{
|
|
"body": {
|
|
"id": 37,
|
|
"nodeType": "Block",
|
|
"src": "1049:53:0",
|
|
"statements": [
|
|
{
|
|
"expression": {
|
|
"arguments": [],
|
|
"expression": {
|
|
"argumentTypes": [],
|
|
"id": 33,
|
|
"name": "checkNotDelegateCall",
|
|
"nodeType": "Identifier",
|
|
"overloadedDeclarations": [],
|
|
"referencedDeclaration": 30,
|
|
"src": "1060:20:0",
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_function_internal_view$__$returns$__$",
|
|
"typeString": "function () view"
|
|
}
|
|
},
|
|
"id": 34,
|
|
"isConstant": false,
|
|
"isLValue": false,
|
|
"isPure": false,
|
|
"kind": "functionCall",
|
|
"lValueRequested": false,
|
|
"nameLocations": [],
|
|
"names": [],
|
|
"nodeType": "FunctionCall",
|
|
"src": "1060:22:0",
|
|
"tryCall": false,
|
|
"typeDescriptions": {
|
|
"typeIdentifier": "t_tuple$__$",
|
|
"typeString": "tuple()"
|
|
}
|
|
},
|
|
"id": 35,
|
|
"nodeType": "ExpressionStatement",
|
|
"src": "1060:22:0"
|
|
},
|
|
{
|
|
"id": 36,
|
|
"nodeType": "PlaceholderStatement",
|
|
"src": "1093:1:0"
|
|
}
|
|
]
|
|
},
|
|
"documentation": {
|
|
"id": 31,
|
|
"nodeType": "StructuredDocumentation",
|
|
"src": "959:58:0",
|
|
"text": "@notice Prevents delegatecall into the modified method"
|
|
},
|
|
"id": 38,
|
|
"name": "noDelegateCall",
|
|
"nameLocation": "1032:14:0",
|
|
"nodeType": "ModifierDefinition",
|
|
"parameters": {
|
|
"id": 32,
|
|
"nodeType": "ParameterList",
|
|
"parameters": [],
|
|
"src": "1046:2:0"
|
|
},
|
|
"src": "1023:79:0",
|
|
"virtual": false,
|
|
"visibility": "internal"
|
|
}
|
|
],
|
|
"scope": 40,
|
|
"src": "225:880:0",
|
|
"usedErrors": [],
|
|
"usedEvents": []
|
|
}
|
|
],
|
|
"src": "38:1069:0"
|
|
},
|
|
"id": 0
|
|
}
|
|
}
|
|
}
|
|
} |