{"id":13767048,"url":"https://github.com/clabby/huff-clones","last_synced_at":"2025-05-10T22:31:28.135Z","repository":{"id":41551782,"uuid":"510177872","full_name":"clabby/huff-clones","owner":"clabby","description":"clones-with-immutable-args by wighawag written in Huff.","archived":true,"fork":false,"pushed_at":"2022-09-15T19:35:31.000Z","size":42,"stargazers_count":27,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T15:54:34.412Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clabby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-04T01:42:08.000Z","updated_at":"2023-07-14T01:13:41.000Z","dependencies_parsed_at":"2023-01-18T09:15:46.345Z","dependency_job_id":null,"html_url":"https://github.com/clabby/huff-clones","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clabby%2Fhuff-clones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clabby%2Fhuff-clones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clabby%2Fhuff-clones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clabby%2Fhuff-clones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clabby","download_url":"https://codeload.github.com/clabby/huff-clones/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492529,"owners_count":21916959,"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":[],"created_at":"2024-08-03T16:01:03.999Z","updated_at":"2025-05-10T22:31:27.827Z","avatar_url":"https://github.com/clabby.png","language":"Solidity","funding_links":[],"categories":["Huff projects you can learn from and contribute to"],"sub_categories":[],"readme":"# huff-clones ![Tests](https://img.shields.io/github/workflow/status/clabby/clones-with-immutable-args-huff/Tests/master?label=Tests) ![License](https://img.shields.io/github/license/clabby/clones-with-immutable-args-huff?label=License)\n\nRewrite of [clones-with-immutable-args](https://github.com/wighawag/clones-with-immutable-args) in [Huff](https://github.com/huff-language).\n\n\u003e **Note**\n\u003e This implementation now lives in [Huffmate](https://github.com/pentagonxyz/huffmate). All future updates will happen there.\n\n---\n\nEnables creating clone contracts with immutable arguments.\n\nThe immutable arguments are stored in the code region of the created proxy contract, and whenever the proxy is called, it reads the arguments into memory, and then appends them to the calldata of the delegate call to the implementation contract. The implementation contract can thus read the arguments straight from calldata.\n\nBy doing so, the gas cost of creating parametrizable clones is reduced, since there's no need to store the parameters in storage, which you need to do with [EIP-1167](https://eips.ethereum.org/EIPS/eip-1167). The cost of using such clones is also reduced, since storage loads are replaced with calldata reading, which is far cheaper.\n\nIn other words, if you know you are not gonna need parametrization and just want exact copies, then you can keep using EIP-1167, otherwise, clones-with-immutables is cheaper.\n\n## Usage\n\nClone factory contracts should use the [`HuffCloneLib`](src/HuffCloneLib.huff) library. `CLONE` is the main macro for creating clones.\n\nContracts intended to be cloned should include [`HuffClone`](src/HuffClone.huff) to get access to the helper macros for reading immutable args.\n\nTo see an example usage of the library, check out [`ExampleClone`](src/ExampleClone.huff) and [`ExampleCloneFactory`](src/ExampleCloneFactory.huff).\n\n## Installation\n\nTo install with [Foundry](https://github.com/foundry-rs/foundry):\n\n```\nforge install clabby/huff-clones\n```\n\n## Local development\n\nThis project uses [Foundry](https://github.com/foundry-rs/foundry) as the development framework.\n\n### Dependencies\n```\nforge update\n```\n\n### Compilation\n\n```\nforge build\n```\n\n### Testing\n\n```\nforge test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclabby%2Fhuff-clones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclabby%2Fhuff-clones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclabby%2Fhuff-clones/lists"}