UNPKG

hardlydifficult-ethereum-contracts

Version:
336 lines 13.4 kB
{ "contractName": "CloneFactory", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.17+commit.d19bba13\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/circleci/repo/contracts/proxies/CloneFactory.sol\":\"CloneFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"/home/circleci/repo/contracts/proxies/CloneFactory.sol\":{\"keccak256\":\"0xb23450ec646fe4c1417ed869683a2020f0f83b02263e452eeb17a9e86f713389\",\"urls\":[\"bzz-raw://30c056fd32bffd39f6e63604b08bccca45dadd2ef1597efeb328ac4094d6f342\",\"dweb:/ipfs/Qmey1PvM58jNRH4yyWUjnNci7H1TA6DzpKEtEgy5BEmydq\"]}},\"version\":1}", "bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820c9b87ae55884cc5ce913185120958adac30007b1069609d7385b1f1531e8274564736f6c63430005110032", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820c9b87ae55884cc5ce913185120958adac30007b1069609d7385b1f1531e8274564736f6c63430005110032", "sourceMap": "151:721:10:-;;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": "151:721:10:-;;;;;;;;", "source": "pragma solidity ^0.5.0;\n\n\n// From https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol\n// Updated to support Solidity 5\nlibrary CloneFactory\n{\n /**\n * @notice Uses create to deploy a clone to a nonce-based address.\n * @param target the address of the template contract, containing the logic for this contract.\n * @return result the address of the newly deployed contract.\n */\n function createClone(\n address target\n ) internal\n returns (address result)\n {\n // solium-disable-next-line\n assembly\n {\n let clone := mload(0x40)\n mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\n mstore(add(clone, 0x14), shl(96, target))\n mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\n result := create(0, clone, 0x37)\n }\n }\n}\n", "sourcePath": "/home/circleci/repo/contracts/proxies/CloneFactory.sol", "ast": { "absolutePath": "/home/circleci/repo/contracts/proxies/CloneFactory.sol", "exportedSymbols": { "CloneFactory": [ 1378 ] }, "id": 1379, "nodeType": "SourceUnit", "nodes": [ { "id": 1368, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:10" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 1378, "linearizedBaseContracts": [ 1378 ], "name": "CloneFactory", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 1376, "nodeType": "Block", "src": "503:367:10", "statements": [ { "externalReferences": [ { "result": { "declaration": 1373, "isOffset": false, "isSlot": false, "src": "828:6:10", "valueSize": 1 } }, { "target": { "declaration": 1370, "isOffset": false, "isSlot": false, "src": "714:6:10", "valueSize": 1 } } ], "id": 1375, "nodeType": "InlineAssembly", "operations": "{\n let clone := mload(0x40)\n mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\n mstore(add(clone, 0x14), shl(96, target))\n mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\n result := create(0, clone, 0x37)\n}", "src": "541:325:10" } ] }, "documentation": "@notice Uses create to deploy a clone to a nonce-based address.\n@param target the address of the template contract, containing the logic for this contract.\n@return result the address of the newly deployed contract.", "id": 1377, "implemented": true, "kind": "function", "modifiers": [], "name": "createClone", "nodeType": "FunctionDefinition", "parameters": { "id": 1371, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1370, "name": "target", "nodeType": "VariableDeclaration", "scope": 1377, "src": "444:14:10", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1369, "name": "address", "nodeType": "ElementaryTypeName", "src": "444:7:10", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "438:24:10" }, "returnParameters": { "id": 1374, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1373, "name": "result", "nodeType": "VariableDeclaration", "scope": 1377, "src": "485:14:10", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1372, "name": "address", "nodeType": "ElementaryTypeName", "src": "485:7:10", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "484:16:10" }, "scope": 1378, "src": "418:452:10", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 1379, "src": "151:721:10" } ], "src": "0:873:10" }, "legacyAST": { "absolutePath": "/home/circleci/repo/contracts/proxies/CloneFactory.sol", "exportedSymbols": { "CloneFactory": [ 1378 ] }, "id": 1379, "nodeType": "SourceUnit", "nodes": [ { "id": 1368, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:10" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 1378, "linearizedBaseContracts": [ 1378 ], "name": "CloneFactory", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 1376, "nodeType": "Block", "src": "503:367:10", "statements": [ { "externalReferences": [ { "result": { "declaration": 1373, "isOffset": false, "isSlot": false, "src": "828:6:10", "valueSize": 1 } }, { "target": { "declaration": 1370, "isOffset": false, "isSlot": false, "src": "714:6:10", "valueSize": 1 } } ], "id": 1375, "nodeType": "InlineAssembly", "operations": "{\n let clone := mload(0x40)\n mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\n mstore(add(clone, 0x14), shl(96, target))\n mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\n result := create(0, clone, 0x37)\n}", "src": "541:325:10" } ] }, "documentation": "@notice Uses create to deploy a clone to a nonce-based address.\n@param target the address of the template contract, containing the logic for this contract.\n@return result the address of the newly deployed contract.", "id": 1377, "implemented": true, "kind": "function", "modifiers": [], "name": "createClone", "nodeType": "FunctionDefinition", "parameters": { "id": 1371, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1370, "name": "target", "nodeType": "VariableDeclaration", "scope": 1377, "src": "444:14:10", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1369, "name": "address", "nodeType": "ElementaryTypeName", "src": "444:7:10", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "438:24:10" }, "returnParameters": { "id": 1374, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1373, "name": "result", "nodeType": "VariableDeclaration", "scope": 1377, "src": "485:14:10", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 1372, "name": "address", "nodeType": "ElementaryTypeName", "src": "485:7:10", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "484:16:10" }, "scope": 1378, "src": "418:452:10", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" } ], "scope": 1379, "src": "151:721:10" } ], "src": "0:873:10" }, "compiler": { "name": "solc", "version": "0.5.17+commit.d19bba13.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.0.23", "updatedAt": "2020-04-07T20:17:34.946Z", "devdoc": { "methods": {} }, "userdoc": { "methods": {} } }