UNPKG

hardlydifficult-ethereum-contracts

Version:
406 lines 16.4 kB
{ "contractName": "Clone2Probe", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.17+commit.d19bba13\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/circleci/repo/contracts/proxies/Clone2Probe.sol\":\"Clone2Probe\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"/home/circleci/repo/contracts/proxies/Clone2Probe.sol\":{\"keccak256\":\"0x8deae8274c8fe85a34c589216b3f4081a449da2190ee5601cd38a9c53af0afa1\",\"urls\":[\"bzz-raw://86372d82fbdc52a99737977d150962365ed19052742244269f1b0322b44a7c0b\",\"dweb:/ipfs/Qmc1vGbFSoc3ssuH1Ejef2YmBdNjcCdLRZJrNJQbQb9Yv2\"]}},\"version\":1}", "bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820839b9d3fdd0cc6de3a8cf46d2afdc416bb4af0663d740305166f80ce858265c064736f6c63430005110032", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820839b9d3fdd0cc6de3a8cf46d2afdc416bb4af0663d740305166f80ce858265c064736f6c63430005110032", "sourceMap": "145:1008:9:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", "deployedSourceMap": "145:1008:9:-;;;;;;;;", "source": "pragma solidity ^0.5.0;\n\n\n// https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/ProxyFactory.sol\nlibrary Clone2Probe\n{\n function getClone2Address(\n address target,\n bytes32 salt\n ) internal view\n returns (address cloneAddress)\n {\n // solium-disable-next-line\n assembly\n {\n let pointer := mload(0x40)\n\n // Create the bytecode for deployment based on the Minimal Proxy Standard (EIP-1167)\n mstore(pointer, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\n mstore(add(pointer, 0x14), shl(96, target))\n mstore(add(pointer, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\n\n // Calculate the hash\n let contractCodeHash := keccak256(pointer, 0x37)\n\n // 0xff\n mstore(pointer, 0xff00000000000000000000000000000000000000000000000000000000000000)\n // this (byte 1 - 21)\n mstore(add(pointer, 0x1), shl(96, address))\n\n // salt\n mstore(add(pointer, 0x15), salt)\n\n // hash\n mstore(add(pointer, 0x35), contractCodeHash)\n\n cloneAddress := keccak256(pointer, 0x55)\n }\n }\n}\n", "sourcePath": "/home/circleci/repo/contracts/proxies/Clone2Probe.sol", "ast": { "absolutePath": "/home/circleci/repo/contracts/proxies/Clone2Probe.sol", "exportedSymbols": { "Clone2Probe": [ 1366 ] }, "id": 1367, "nodeType": "SourceUnit", "nodes": [ { "id": 1354, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:9" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 1366, "linearizedBaseContracts": [ 1366 ], "name": "Clone2Probe", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 1364, "nodeType": "Block", "src": "288:863:9", "statements": [ { "externalReferences": [ { "target": { "declaration": 1356, "isOffset": false, "isSlot": false, "src": "597:6:9", "valueSize": 1 } }, { "cloneAddress": { "declaration": 1361, "isOffset": false, "isSlot": false, "src": "1101:12:9", "valueSize": 1 } }, { "salt": { "declaration": 1358, "isOffset": false, "isSlot": false, "src": "1022:4:9", "valueSize": 1 } } ], "id": 1363, "nodeType": "InlineAssembly", "operations": "{\n let pointer := mload(0x40)\n mstore(pointer, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\n mstore(add(pointer, 0x14), shl(96, target))\n mstore(add(pointer, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\n let contractCodeHash := keccak256(pointer, 0x37)\n mstore(pointer, 0xff00000000000000000000000000000000000000000000000000000000000000)\n mstore(add(pointer, 0x1), shl(96, address()))\n mstore(add(pointer, 0x15), salt)\n mstore(add(pointer, 0x35), contractCodeHash)\n cloneAddress := keccak256(pointer, 0x55)\n}", "src": "326:821:9" } ] }, "documentation": null, "id": 1365, "implemented": true, "kind": "function", "modifiers": [], "name": "getClone2Address", "nodeType": "FunctionDefinition", "parameters": { "id": 1359, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1356, "name": "target", "nodeType": "VariableDeclaration", "scope": 1365, "src": "200:14:9", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1355, "name": "address", "nodeType": "ElementaryTypeName", "src": "200:7:9", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1358, "name": "salt", "nodeType": "VariableDeclaration", "scope": 1365, "src": "220:12:9", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 1357, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "220:7:9", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "src": "194:42:9" }, "returnParameters": { "id": 1362, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1361, "name": "cloneAddress", "nodeType": "VariableDeclaration", "scope": 1365, "src": "264:20:9", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1360, "name": "address", "nodeType": "ElementaryTypeName", "src": "264:7:9", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "263:22:9" }, "scope": 1366, "src": "169:982:9", "stateMutability": "view", "superFunction": null, "visibility": "internal" } ], "scope": 1367, "src": "145:1008:9" } ], "src": "0:1154:9" }, "legacyAST": { "absolutePath": "/home/circleci/repo/contracts/proxies/Clone2Probe.sol", "exportedSymbols": { "Clone2Probe": [ 1366 ] }, "id": 1367, "nodeType": "SourceUnit", "nodes": [ { "id": 1354, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:9" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 1366, "linearizedBaseContracts": [ 1366 ], "name": "Clone2Probe", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 1364, "nodeType": "Block", "src": "288:863:9", "statements": [ { "externalReferences": [ { "target": { "declaration": 1356, "isOffset": false, "isSlot": false, "src": "597:6:9", "valueSize": 1 } }, { "cloneAddress": { "declaration": 1361, "isOffset": false, "isSlot": false, "src": "1101:12:9", "valueSize": 1 } }, { "salt": { "declaration": 1358, "isOffset": false, "isSlot": false, "src": "1022:4:9", "valueSize": 1 } } ], "id": 1363, "nodeType": "InlineAssembly", "operations": "{\n let pointer := mload(0x40)\n mstore(pointer, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\n mstore(add(pointer, 0x14), shl(96, target))\n mstore(add(pointer, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\n let contractCodeHash := keccak256(pointer, 0x37)\n mstore(pointer, 0xff00000000000000000000000000000000000000000000000000000000000000)\n mstore(add(pointer, 0x1), shl(96, address()))\n mstore(add(pointer, 0x15), salt)\n mstore(add(pointer, 0x35), contractCodeHash)\n cloneAddress := keccak256(pointer, 0x55)\n}", "src": "326:821:9" } ] }, "documentation": null, "id": 1365, "implemented": true, "kind": "function", "modifiers": [], "name": "getClone2Address", "nodeType": "FunctionDefinition", "parameters": { "id": 1359, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1356, "name": "target", "nodeType": "VariableDeclaration", "scope": 1365, "src": "200:14:9", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1355, "name": "address", "nodeType": "ElementaryTypeName", "src": "200:7:9", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 1358, "name": "salt", "nodeType": "VariableDeclaration", "scope": 1365, "src": "220:12:9", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 1357, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "220:7:9", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "src": "194:42:9" }, "returnParameters": { "id": 1362, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1361, "name": "cloneAddress", "nodeType": "VariableDeclaration", "scope": 1365, "src": "264:20:9", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1360, "name": "address", "nodeType": "ElementaryTypeName", "src": "264:7:9", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "263:22:9" }, "scope": 1366, "src": "169:982:9", "stateMutability": "view", "superFunction": null, "visibility": "internal" } ], "scope": 1367, "src": "145:1008:9" } ], "src": "0:1154:9" }, "compiler": { "name": "solc", "version": "0.5.17+commit.d19bba13.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.23", "updatedAt": "2020-04-07T20:17:34.944Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } }