{"id":18775505,"url":"https://github.com/0age/spawner","last_synced_at":"2025-04-13T09:31:09.317Z","repository":{"id":44086327,"uuid":"198528216","full_name":"0age/Spawner","owner":"0age","description":"Spawn EIP 1167 minimal proxies with an included initialization step during contract creation.","archived":false,"fork":false,"pushed_at":"2023-04-16T06:43:08.000Z","size":941,"stargazers_count":41,"open_issues_count":12,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-01T21:44:30.323Z","etag":null,"topics":["ethereum-contract","initializer","library","proxy","spawner"],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0age.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-07-24T00:30:42.000Z","updated_at":"2024-08-01T15:42:20.000Z","dependencies_parsed_at":"2024-01-25T18:06:24.938Z","dependency_job_id":"7d1f49ce-90ae-4926-9287-d9a3a6af6430","html_url":"https://github.com/0age/Spawner","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0age%2FSpawner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0age%2FSpawner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0age%2FSpawner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0age%2FSpawner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0age","download_url":"https://codeload.github.com/0age/Spawner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223579673,"owners_count":17168480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum-contract","initializer","library","proxy","spawner"],"created_at":"2024-11-07T19:43:02.177Z","updated_at":"2024-11-07T19:43:02.741Z","avatar_url":"https://github.com/0age.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spawner (eip1167-spawner)\n\n[![npm](https://img.shields.io/npm/v/eip1167-spawner.svg?color=brightgreen)](https://www.npmjs.com/package/eip1167-spawner)\n[![GitHub](https://img.shields.io/github/license/0age/Spawner.svg?colorB=brightgreen)](https://github.com/0age/Spawner/blob/master/LICENSE.md)\n[![Build Status](https://travis-ci.org/0age/Spawner.svg?branch=master)](https://travis-ci.org/0age/Spawner)\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-brightgreen.svg)](https://github.com/RichardLitt/standard-readme)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n\n\u003e Spawn EIP 1167 minimal proxies with an included initialization step during contract creation.\n\nThese contracts demonstrate a technique for initializing and deploying [EIP 1167](https://eips.ethereum.org/EIPS/eip-1167) minimal proxies that point to designated logic contracts. Logic contracts should make an initialization function available that only allows it to be called during contract construction (i.e. `assembly { if extcodesize(address) { revert(0, 0) } }`).\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\nTo include Spawner as a dependency in your project:\n```\n$ yarn add eip1167-spawner\n```\n\nTo install locally, you'll need Node.js 10+ and Yarn *(or npm)*. To get everything set up:\n```sh\n$ git clone https://github.com/0age/Spawner.git\n$ cd Spawner\n$ yarn install\n$ yarn build\n```\n\n## Usage\nImport Spawner and inherit it on a contract, then call `_spawn` with the desired logic contract and ABI-encoded initialization calldata:\n```Solidity\npragma solidity ^0.5.0;\n\nimport \"eip1167-spawner/contracts/Spawner.sol\";\nimport \"./MyLogicContract.sol\";\n\n\ncontract MyFactory is Spawner {\n  function spawnIt() public returns (address spawnedContract) {\n    MyLogicContract logic = MyLogicContract(address(...));\n    \n    bytes memory myInitializationCalldata = abi.encodeWithSelector(\n      logic.initialize.selector,\n      \"argumentOne\",\n      \"argumentTwo\"\n    );\n    \n    spawnedContract =  _spawn(\n      address(logicContract),\n      myInitializationCalldata\n    );\n  }\n}\n```\n\nYou can also use `_spawnCompact` *(for logic contracts with at least five leading zero bytes or ten zeroes)*, `_spawnOldSchool` *(for deploying with `CREATE` rather than `CREATE2`)*, or `_spawnCompactOldSchool`. In addition, you can compute addresses spawned with `CREATE2` ahead of time by using the supplied `_computeNextAddress` and `_computeNextCompactAddress` internal view functions.\n\nNote: Spawner will be careful not to deploy to any address that already has code at it, but watch out - if the code that the minimal proxy points to can cause a `SELFDESTRUCT`, it is possible that Spawner may *redeploy* a minimal proxy to an address it has already deployed to in the past. This may or may not be the intended behavior, so feel free to put in extra safeguards if you're worried about this.\n\nTo run tests locally, start the testRPC, trigger the tests, and tear down the testRPC *(you can do all of this at once via* `yarn all` *if you prefer)*:\n```sh\n$ yarn start\n$ yarn test\n$ yarn stop\n```\n\n## Maintainers\n\n[@0age](https://github.com/0age)\n\n## Contribute\n\nPRs accepted gladly - make sure the tests pass. *(Changes to the contracts themselves should bump the version number and be marked as pre-release.)*\n\n## License\n\nMIT © 2019 0age\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0age%2Fspawner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0age%2Fspawner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0age%2Fspawner/lists"}