UNPKG

hardlydifficult-eth

Version:

A collection of reusable contracts and Javascript helpers for Ethereum.

872 lines 33.6 kB
{ "contractName": "Create2Probe", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"project:/contracts/proxies/Create2Probe.sol\":\"Create2Probe\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"project:/contracts/proxies/Create2Probe.sol\":{\"keccak256\":\"0xeb9f0df0022fb3af7afbda072058209adfc3778ed7be55f84c2fa3efbd1e6862\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2b08208b38130508ac6a2acf8ac9655ce525d372c87770270fdcb22e3b6b53a\",\"dweb:/ipfs/QmP8HuAF6FmgT6Vp57poQr1AVxCsCJXvPsjdJ8HfRmgBpb\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212204d6ff3a80bfd21bc7bd60e67fdcbb5f6ae048df61ffdecab11b0e07d927e685264736f6c634300060a0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212204d6ff3a80bfd21bc7bd60e67fdcbb5f6ae048df61ffdecab11b0e07d927e685264736f6c634300060a0033", "immutableReferences": {}, "sourceMap": "177:336:21:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "177:336:21:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: MIT\npragma solidity ^0.6.0;\n\n\n// https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/ProxyFactory.sol\nlibrary Create2Probe\n{\n function isAddressAvailable(\n address contractAddress\n ) internal view\n returns (bool)\n {\n if(contractAddress == address(0))\n {\n return false;\n }\n uint size;\n // solium-disable-next-line\n assembly\n {\n size := extcodesize(contractAddress)\n }\n\n return size == 0;\n }\n}\n", "sourcePath": "/home/circleci/repo/contracts/proxies/Create2Probe.sol", "ast": { "absolutePath": "project:/contracts/proxies/Create2Probe.sol", "exportedSymbols": { "Create2Probe": [ 3811 ] }, "id": 3812, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 3784, "literals": [ "solidity", "^", "0.6", ".0" ], "nodeType": "PragmaDirective", "src": "32:23:21" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 3811, "linearizedBaseContracts": [ 3811 ], "name": "Create2Probe", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 3809, "nodeType": "Block", "src": "298:213:21", "statements": [ { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 3796, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3791, "name": "contractAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3786, "src": "307:15:21", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 3794, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "334:1:21", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 3793, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "326:7:21", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 3792, "name": "address", "nodeType": "ElementaryTypeName", "src": "326:7:21", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 3795, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "326:10:21", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "307:29:21", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": null, "id": 3800, "nodeType": "IfStatement", "src": "304:65:21", "trueBody": { "id": 3799, "nodeType": "Block", "src": "342:27:21", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "66616c7365", "id": 3797, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "357:5:21", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, "functionReturnParameters": 3790, "id": 3798, "nodeType": "Return", "src": "350:12:21" } ] } }, { "assignments": [ 3802 ], "declarations": [ { "constant": false, "id": 3802, "mutability": "mutable", "name": "size", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3809, "src": "374:9:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3801, "name": "uint", "nodeType": "ElementaryTypeName", "src": "374:4:21", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 3803, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "374:9:21" }, { "AST": { "nodeType": "YulBlock", "src": "434:50:21", "statements": [ { "nodeType": "YulAssignment", "src": "442:36:21", "value": { "arguments": [ { "name": "contractAddress", "nodeType": "YulIdentifier", "src": "462:15:21" } ], "functionName": { "name": "extcodesize", "nodeType": "YulIdentifier", "src": "450:11:21" }, "nodeType": "YulFunctionCall", "src": "450:28:21" }, "variableNames": [ { "name": "size", "nodeType": "YulIdentifier", "src": "442:4:21" } ] } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 3786, "isOffset": false, "isSlot": false, "src": "462:15:21", "valueSize": 1 }, { "declaration": 3802, "isOffset": false, "isSlot": false, "src": "442:4:21", "valueSize": 1 } ], "id": 3804, "nodeType": "InlineAssembly", "src": "421:63:21" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3807, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3805, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3802, "src": "497:4:21", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 3806, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "505:1:21", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "497:9:21", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 3790, "id": 3808, "nodeType": "Return", "src": "490:16:21" } ] }, "documentation": null, "id": 3810, "implemented": true, "kind": "function", "modifiers": [], "name": "isAddressAvailable", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 3787, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3786, "mutability": "mutable", "name": "contractAddress", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3810, "src": "235:23:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 3785, "name": "address", "nodeType": "ElementaryTypeName", "src": "235:7:21", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "229:33:21" }, "returnParameters": { "id": 3790, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3789, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 3810, "src": "290:4:21", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 3788, "name": "bool", "nodeType": "ElementaryTypeName", "src": "290:4:21", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "289:6:21" }, "scope": 3811, "src": "202:309:21", "stateMutability": "view", "virtual": false, "visibility": "internal" } ], "scope": 3812, "src": "177:336:21" } ], "src": "32:482:21" }, "legacyAST": { "attributes": { "absolutePath": "project:/contracts/proxies/Create2Probe.sol", "exportedSymbols": { "Create2Probe": [ 3811 ] }, "license": "MIT" }, "children": [ { "attributes": { "literals": [ "solidity", "^", "0.6", ".0" ] }, "id": 3784, "name": "PragmaDirective", "src": "32:23:21" }, { "attributes": { "abstract": false, "baseContracts": [ null ], "contractDependencies": [ null ], "contractKind": "library", "documentation": null, "fullyImplemented": true, "linearizedBaseContracts": [ 3811 ], "name": "Create2Probe", "scope": 3812 }, "children": [ { "attributes": { "documentation": null, "implemented": true, "isConstructor": false, "kind": "function", "modifiers": [ null ], "name": "isAddressAvailable", "overrides": null, "scope": 3811, "stateMutability": "view", "virtual": false, "visibility": "internal" }, "children": [ { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "contractAddress", "overrides": null, "scope": 3810, "stateVariable": false, "storageLocation": "default", "type": "address", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "address", "stateMutability": "nonpayable", "type": "address" }, "id": 3785, "name": "ElementaryTypeName", "src": "235:7:21" } ], "id": 3786, "name": "VariableDeclaration", "src": "235:23:21" } ], "id": 3787, "name": "ParameterList", "src": "229:33:21" }, { "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "", "overrides": null, "scope": 3810, "stateVariable": false, "storageLocation": "default", "type": "bool", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "bool", "type": "bool" }, "id": 3788, "name": "ElementaryTypeName", "src": "290:4:21" } ], "id": 3789, "name": "VariableDeclaration", "src": "290:4:21" } ], "id": 3790, "name": "ParameterList", "src": "289:6:21" }, { "children": [ { "attributes": { "falseBody": null }, "children": [ { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "==", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 3786, "type": "address", "value": "contractAddress" }, "id": 3791, "name": "Identifier", "src": "307:15:21" }, { "attributes": { "argumentTypes": null, "isConstant": false, "isLValue": false, "isPure": true, "isStructConstructorCall": false, "lValueRequested": false, "names": [ null ], "tryCall": false, "type": "address payable", "type_conversion": true }, "children": [ { "attributes": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "type": "type(address)" }, "children": [ { "attributes": { "name": "address", "type": null }, "id": 3792, "name": "ElementaryTypeName", "src": "326:7:21" } ], "id": 3793, "name": "ElementaryTypeNameExpression", "src": "326:7:21" }, { "attributes": { "argumentTypes": null, "hexvalue": "30", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "number", "type": "int_const 0", "value": "0" }, "id": 3794, "name": "Literal", "src": "334:1:21" } ], "id": 3795, "name": "FunctionCall", "src": "326:10:21" } ], "id": 3796, "name": "BinaryOperation", "src": "307:29:21" }, { "children": [ { "attributes": { "functionReturnParameters": 3790 }, "children": [ { "attributes": { "argumentTypes": null, "hexvalue": "66616c7365", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "bool", "type": "bool", "value": "false" }, "id": 3797, "name": "Literal", "src": "357:5:21" } ], "id": 3798, "name": "Return", "src": "350:12:21" } ], "id": 3799, "name": "Block", "src": "342:27:21" } ], "id": 3800, "name": "IfStatement", "src": "304:65:21" }, { "attributes": { "assignments": [ 3802 ], "initialValue": null }, "children": [ { "attributes": { "constant": false, "mutability": "mutable", "name": "size", "overrides": null, "scope": 3809, "stateVariable": false, "storageLocation": "default", "type": "uint256", "value": null, "visibility": "internal" }, "children": [ { "attributes": { "name": "uint", "type": "uint256" }, "id": 3801, "name": "ElementaryTypeName", "src": "374:4:21" } ], "id": 3802, "name": "VariableDeclaration", "src": "374:9:21" } ], "id": 3803, "name": "VariableDeclarationStatement", "src": "374:9:21" }, { "attributes": { "evmVersion": "istanbul", "externalReferences": [ { "declaration": 3786, "isOffset": false, "isSlot": false, "src": "462:15:21", "valueSize": 1 }, { "declaration": 3802, "isOffset": false, "isSlot": false, "src": "442:4:21", "valueSize": 1 } ], "operations": "{\n size := extcodesize(contractAddress)\n}" }, "children": [], "id": 3804, "name": "InlineAssembly", "src": "421:63:21" }, { "attributes": { "functionReturnParameters": 3790 }, "children": [ { "attributes": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "operator": "==", "type": "bool" }, "children": [ { "attributes": { "argumentTypes": null, "overloadedDeclarations": [ null ], "referencedDeclaration": 3802, "type": "uint256", "value": "size" }, "id": 3805, "name": "Identifier", "src": "497:4:21" }, { "attributes": { "argumentTypes": null, "hexvalue": "30", "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "subdenomination": null, "token": "number", "type": "int_const 0", "value": "0" }, "id": 3806, "name": "Literal", "src": "505:1:21" } ], "id": 3807, "name": "BinaryOperation", "src": "497:9:21" } ], "id": 3808, "name": "Return", "src": "490:16:21" } ], "id": 3809, "name": "Block", "src": "298:213:21" } ], "id": 3810, "name": "FunctionDefinition", "src": "202:309:21" } ], "id": 3811, "name": "ContractDefinition", "src": "177:336:21" } ], "id": 3812, "name": "SourceUnit", "src": "32:482:21" }, "compiler": { "name": "solc", "version": "0.6.10+commit.00c0fcaf.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.4.1", "updatedAt": "2021-07-08T17:04:13.869Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } }