{"id":18568376,"url":"https://github.com/polysensus/diamond-deploy","last_synced_at":"2025-09-13T00:38:49.925Z","repository":{"id":80668299,"uuid":"601303015","full_name":"polysensus/diamond-deploy","owner":"polysensus","description":"ERC 2535 deployment package. cli tool and package","archived":false,"fork":false,"pushed_at":"2023-08-28T20:18:17.000Z","size":690,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-19T21:56:38.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/polysensus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-13T19:35:41.000Z","updated_at":"2023-02-13T21:04:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"66462c3f-1ff4-40a3-90bb-d8f1efb3971c","html_url":"https://github.com/polysensus/diamond-deploy","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/polysensus/diamond-deploy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polysensus%2Fdiamond-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polysensus%2Fdiamond-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polysensus%2Fdiamond-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polysensus%2Fdiamond-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polysensus","download_url":"https://codeload.github.com/polysensus/diamond-deploy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polysensus%2Fdiamond-deploy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274902370,"owners_count":25371074,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-06T22:29:18.803Z","updated_at":"2025-09-13T00:38:49.899Z","avatar_url":"https://github.com/polysensus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# diamond-deploy\n\nERC 2535 deployment package. cli tool and package\n\nThe tool provides commands for discovering and deploying smart contract facets\nwritten to the ERC 2535 standard.\n\nThe `list` command finds deployable contract artifacts in foundry build outputs\nand can produce an 'exclusions' file to reconcile function selector collisions\nacross diamond facet implementations.\n\nThe `diamond-new` command uses the outputs of list to deploy a new diamond instance.\n\nExample workflow follows\n\n## Run a list to find the artifacts\n\nThis example lists the contracts whose names end with `Facet` and additionally\nfind the `Diamond` and `DiamondNew` artifacts. By default the output is human\nreadable and relatively concise\n\n    \u003e\u003e node deploycli.js list -i ./contracts/build/forge/out -I facet -n Diamond DiamondNew\n\n    0x1f931c1c diamondCut((address,uint8,bytes4[])[],address,bytes) DiamondCutFacet DiamondCutFacet.sol/DiamondCutFacet.json\n    0xcdffacc6 facetAddress(bytes4) DiamondLoupeFacet DiamondLoupeFacet.sol/DiamondLoupeFacet.json\n    0x52ef6b2c facetAddresses() DiamondLoupeFacet DiamondLoupeFacet.sol/DiamondLoupeFacet.json\n    0xadfca15e facetFunctionSelectors(address) DiamondLoupeFacet DiamondLoupeFacet.sol/DiamondLoupeFacet.json\n    0x7a0ed627 facets() DiamondLoupeFacet DiamondLoupeFacet.sol/DiamondLoupeFacet.json\n    0x01ffc9a7 supportsInterface(bytes4) DiamondLoupeFacet DiamondLoupeFacet.sol/DiamondLoupeFacet.json\n    0x4e41cf1e init((string[])) DiamondNew DiamondNew.sol/DiamondNew.json\n    0x6dcfd841 accountsByToken(uint256) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x00fdd58e balanceOf(address,uint256) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x4e1273f4 balanceOfBatch(address[],uint256[]) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0xa52169a4 createGame(uint256,string) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0xe985e9c5 isApprovedForAll(address,address) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x731133e9 mint(address,uint256,uint256,bytes) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x1f7fdffa mintBatch(address,uint256[],uint256[],bytes) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x2eb2c2d6 safeBatchTransferFrom(address,address,uint256[],uint256[],bytes) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0xf242432a safeTransferFrom(address,address,uint256,uint256,bytes) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0xa22cb465 setApprovalForAll(address,bool) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x02fe5305 setURI(string) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x01ffc9a7 supportsInterface(bytes4) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x85bff2e7 tokensByAccount(address) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x13ba55df totalHolders(uint256) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0xbd85b039 totalSupply(uint256) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x0e89341c uri(uint256) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n    0x8da5cb5b owner() OwnershipFacet OwnershipFacet.sol/OwnershipFacet.json\n    0xf2fde38b transferOwnership(address) OwnershipFacet OwnershipFacet.sol/OwnershipFacet.json\n    *** collisions ***\n    0x01ffc9a7 supportsInterface(bytes4) DiamondLoupeFacet DiamondLoupeFacet.sol/DiamondLoupeFacet.json\n    0x01ffc9a7 supportsInterface(bytes4) ERC1155ArenaFacet ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\n\n## Run a list to find the the colliding selectors and make an exclusion file\n\nTo get a list of just the exclusions and to format the output in json do\n\n    \u003e\u003e node deploycli.js list -i ./contracts/build/forge/out -I facet -n Diamond DiamondNew --collisions-only --format json\n\n    [\n      {\n        \"selector\": \"0x01ffc9a7\",\n        \"signature\": \"supportsInterface(bytes4)\",\n        \"name\": \"DiamondLoupeFacet\",\n        \"commonName\": \"DiamondLoupeFacet.sol/DiamondLoupeFacet.json\",\n        \"fileName\": \"/home/robin/polysensus/chaintrap-contracts/build/forge/out/DiamondLoupeFacet.sol/DiamondLoupeFacet.json\"\n      },\n      {\n        \"selector\": \"0x01ffc9a7\",\n        \"signature\": \"supportsInterface(bytes4)\",\n        \"name\": \"ERC1155ArenaFacet\",\n        \"commonName\": \"ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\",\n        \"fileName\": \"/home/robin/polysensus/chaintrap-contracts/build/forge/out/ERC1155ArenaFacet.sol/ERC1155ArenaFacet.json\"\n      }\n    ]\n\nStore the out put from the previous command in a .json file and delete the entry you want to keep. The resulting file is a list of the selectors to _exclude_ which can be passed to the deployment commands. And also the the list commands so that they can reconcile colisions.\n\n## Run list with the exclusions reconciling the selectors to discard\n\nAssuming you called the file `exclude.json` do\n\n    \u003e\u003e node deploycli.js list -i ./contracts/build/forge/out -I facet -n Diamond DiamondNew --exclusions exclude.json\n\nNo collisions will be reported.\n\n## Deploy the reconciled contract artifacts\n\nNow do (assuming hard hat server running on http://localhost:8545)\n\n    \u003e\u003e node deploycli.js list -i ./contracts/build/forge/out -I facet -n Diamond DiamondNew --exclusions exclude.json --format json | tee facets.json\n    ... json formatted list of things to deploy\n    \u003e\u003e node deploycli.js diamond-new -u http://localhost:8545 --deploykey hardhat --facets facets.json\n\n    deployed facet ArenaCallsFacet@0xeF31027350Be2c7439C1b0BE022d49421488b72C\n    deployed facet ArenaFacet@0x12Bcb546bC60fF39F1Adfc7cE4605d5Bd6a6A876\n    deployed facet ArenaTranscriptsFacet@0xaC47e91215fb80462139756f43438402998E4A3a\n    deployed facet DiamondCutFacet@0x9BcC604D4381C5b0Ad12Ff3Bf32bEdE063416BC7\n    deployed facet DiamondLoupeFacet@0x63fea6E447F120B8Faf85B53cdaD8348e645D80E\n    deployed facet DiamondNew@0xdFdE6B33f13de2CA1A75A6F7169f50541B14f75b\n    deployed facet ERC1155ArenaFacet@0xaC9fCBA56E42d5960f813B9D0387F3D3bC003338\n    deployed facet OwnershipFacet@0x38A70c040CA5F5439ad52d0e821063b0EC0B52b6\n    deployed facet Diamond@0x54B8d8E2455946f2A5B8982283f2359812e815ce\n    Diamond upgrade success: 0x6a9c48d24b831e8b1e694c8143e0d6a827bbd57d4c38420d91622b8b0a96fd85\n\nFor deployment the init parameters for the nominated DiamondInit contract can be\nsupplied on the command line. See `--diamond-init-args` and related options.\n\nThe tool has a copy of the well known hard hat keys for convenience. You can\nalso provide your own via ENV or option.\n\n# things under consideration\n\n- write a lot of tests\n- diamond-upgrade command\n- diamond deploy multi-init lib support\n- list support for hardhat and other tooling\n- list support for npm based online packages\n- conditional upgrade support based on runtime code hash\n- create2 based deployment\n\nThe list command can be used to detect function selector collisions across\ndiamond facet implementations. And solidity compiler outputs from foundry and\nreconcile function selectors where two diamond facet implementations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolysensus%2Fdiamond-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolysensus%2Fdiamond-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolysensus%2Fdiamond-deploy/lists"}