hardlydifficult-eth
Version:
A collection of reusable contracts and Javascript helpers for Ethereum.
586 lines • 23.2 kB
JSON
{
"contractName": "CloneFactory",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.6.10+commit.00c0fcaf\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"project:/contracts/proxies/CloneFactory.sol\":\"CloneFactory\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":2000000},\"remappings\":[]},\"sources\":{\"project:/contracts/proxies/CloneFactory.sol\":{\"keccak256\":\"0x3f2547f3b4f8b1d9bb4ca67a07a2e701ef11c66fab48c6f9fda8aa617d8592db\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc9e8341cca63da70ba239fd04bba128ceb70f3c12d7568a88aea9309d161528\",\"dweb:/ipfs/QmeNfUzw9giPwBaUxE723AZWoav5NbWohqW2x1mdxNvCyg\"]}},\"version\":1}",
"bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122031b019c22b007cdcc3c3ee2d6cd0f218e2f08b06d97f234b3700ccd9bedcd8a764736f6c634300060a0033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122031b019c22b007cdcc3c3ee2d6cd0f218e2f08b06d97f234b3700ccd9bedcd8a764736f6c634300060a0033",
"immutableReferences": {},
"sourceMap": "183:721:20:-:0;;;;;;;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "183:721:20:-:0;;;;;;;;",
"source": "// SPDX-License-Identifier: MIT\npragma solidity ^0.6.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": "project:/contracts/proxies/CloneFactory.sol",
"exportedSymbols": {
"CloneFactory": [
3782
]
},
"id": 3783,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 3771,
"literals": [
"solidity",
"^",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "32:23:20"
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 3782,
"linearizedBaseContracts": [
3782
],
"name": "CloneFactory",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 3780,
"nodeType": "Block",
"src": "535:367:20",
"statements": [
{
"AST": {
"nodeType": "YulBlock",
"src": "586:312:20",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "594:24:20",
"value": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "613:4:20",
"type": "",
"value": "0x40"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "607:5:20"
},
"nodeType": "YulFunctionCall",
"src": "607:11:20"
},
"variables": [
{
"name": "clone",
"nodeType": "YulTypedName",
"src": "598:5:20",
"type": ""
}
]
},
{
"expression": {
"arguments": [
{
"name": "clone",
"nodeType": "YulIdentifier",
"src": "632:5:20"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "639:66:20",
"type": "",
"value": "0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "625:6:20"
},
"nodeType": "YulFunctionCall",
"src": "625:81:20"
},
"nodeType": "YulExpressionStatement",
"src": "625:81:20"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "clone",
"nodeType": "YulIdentifier",
"src": "724:5:20"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "731:4:20",
"type": "",
"value": "0x14"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "720:3:20"
},
"nodeType": "YulFunctionCall",
"src": "720:16:20"
},
{
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "742:2:20",
"type": "",
"value": "96"
},
{
"name": "target",
"nodeType": "YulIdentifier",
"src": "746:6:20"
}
],
"functionName": {
"name": "shl",
"nodeType": "YulIdentifier",
"src": "738:3:20"
},
"nodeType": "YulFunctionCall",
"src": "738:15:20"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "713:6:20"
},
"nodeType": "YulFunctionCall",
"src": "713:41:20"
},
"nodeType": "YulExpressionStatement",
"src": "713:41:20"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "clone",
"nodeType": "YulIdentifier",
"src": "772:5:20"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "779:4:20",
"type": "",
"value": "0x28"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "768:3:20"
},
"nodeType": "YulFunctionCall",
"src": "768:16:20"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "786:66:20",
"type": "",
"value": "0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "761:6:20"
},
"nodeType": "YulFunctionCall",
"src": "761:92:20"
},
"nodeType": "YulExpressionStatement",
"src": "761:92:20"
},
{
"nodeType": "YulAssignment",
"src": "860:32:20",
"value": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "877:1:20",
"type": "",
"value": "0"
},
{
"name": "clone",
"nodeType": "YulIdentifier",
"src": "880:5:20"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "887:4:20",
"type": "",
"value": "0x37"
}
],
"functionName": {
"name": "create",
"nodeType": "YulIdentifier",
"src": "870:6:20"
},
"nodeType": "YulFunctionCall",
"src": "870:22:20"
},
"variableNames": [
{
"name": "result",
"nodeType": "YulIdentifier",
"src": "860:6:20"
}
]
}
]
},
"evmVersion": "istanbul",
"externalReferences": [
{
"declaration": 3777,
"isOffset": false,
"isSlot": false,
"src": "860:6:20",
"valueSize": 1
},
{
"declaration": 3774,
"isOffset": false,
"isSlot": false,
"src": "746:6:20",
"valueSize": 1
}
],
"id": 3779,
"nodeType": "InlineAssembly",
"src": "573:325:20"
}
]
},
"documentation": {
"id": 3772,
"nodeType": "StructuredDocumentation",
"src": "208:239:20",
"text": " @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": 3781,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "createClone",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 3775,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3774,
"mutability": "mutable",
"name": "target",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 3781,
"src": "476:14:20",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 3773,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "476:7:20",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "470:24:20"
},
"returnParameters": {
"id": 3778,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3777,
"mutability": "mutable",
"name": "result",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 3781,
"src": "517:14:20",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 3776,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "517:7:20",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "516:16:20"
},
"scope": 3782,
"src": "450:452:20",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
}
],
"scope": 3783,
"src": "183:721:20"
}
],
"src": "32:873:20"
},
"legacyAST": {
"attributes": {
"absolutePath": "project:/contracts/proxies/CloneFactory.sol",
"exportedSymbols": {
"CloneFactory": [
3782
]
},
"license": "MIT"
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.6",
".0"
]
},
"id": 3771,
"name": "PragmaDirective",
"src": "32:23:20"
},
{
"attributes": {
"abstract": false,
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
3782
],
"name": "CloneFactory",
"scope": 3783
},
"children": [
{
"attributes": {
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "createClone",
"overrides": null,
"scope": 3782,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
"children": [
{
"attributes": {
"text": " @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": 3772,
"name": "StructuredDocumentation",
"src": "208:239:20"
},
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "target",
"overrides": null,
"scope": 3781,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 3773,
"name": "ElementaryTypeName",
"src": "476:7:20"
}
],
"id": 3774,
"name": "VariableDeclaration",
"src": "476:14:20"
}
],
"id": 3775,
"name": "ParameterList",
"src": "470:24:20"
},
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "result",
"overrides": null,
"scope": 3781,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 3776,
"name": "ElementaryTypeName",
"src": "517:7:20"
}
],
"id": 3777,
"name": "VariableDeclaration",
"src": "517:14:20"
}
],
"id": 3778,
"name": "ParameterList",
"src": "516:16:20"
},
{
"children": [
{
"attributes": {
"evmVersion": "istanbul",
"externalReferences": [
{
"declaration": 3777,
"isOffset": false,
"isSlot": false,
"src": "860:6:20",
"valueSize": 1
},
{
"declaration": 3774,
"isOffset": false,
"isSlot": false,
"src": "746:6:20",
"valueSize": 1
}
],
"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}"
},
"children": [],
"id": 3779,
"name": "InlineAssembly",
"src": "573:325:20"
}
],
"id": 3780,
"name": "Block",
"src": "535:367:20"
}
],
"id": 3781,
"name": "FunctionDefinition",
"src": "450:452:20"
}
],
"id": 3782,
"name": "ContractDefinition",
"src": "183:721:20"
}
],
"id": 3783,
"name": "SourceUnit",
"src": "32:873:20"
},
"compiler": {
"name": "solc",
"version": "0.6.10+commit.00c0fcaf.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.4.1",
"updatedAt": "2021-07-08T17:04:13.868Z",
"devdoc": {
"methods": {}
},
"userdoc": {
"methods": {}
}
}