{"id":44937190,"url":"https://github.com/dojoengine/world-factory","last_synced_at":"2026-02-18T07:33:21.722Z","repository":{"id":321158410,"uuid":"1082805002","full_name":"dojoengine/world-factory","owner":"dojoengine","description":"A smart contract to deploy Dojo worlds from the chain itself.","archived":false,"fork":false,"pushed_at":"2025-11-12T05:40:52.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-12T07:18:05.811Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Cairo","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dojoengine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-24T19:51:04.000Z","updated_at":"2025-11-12T05:40:56.000Z","dependencies_parsed_at":"2025-10-28T06:14:19.446Z","dependency_job_id":"f3b33c1c-ebd5-436c-925f-2aadad111ef2","html_url":"https://github.com/dojoengine/world-factory","commit_stats":null,"previous_names":["dojoengine/world-factory"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dojoengine/world-factory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dojoengine%2Fworld-factory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dojoengine%2Fworld-factory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dojoengine%2Fworld-factory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dojoengine%2Fworld-factory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dojoengine","download_url":"https://codeload.github.com/dojoengine/world-factory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dojoengine%2Fworld-factory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29572428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T06:19:27.422Z","status":"ssl_error","status_checked_at":"2026-02-18T06:18:44.348Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-02-18T07:33:21.146Z","updated_at":"2026-02-18T07:33:21.712Z","avatar_url":"https://github.com/dojoengine.png","language":"Cairo","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dojo World Factory\n\nContract-first factory for deploying Dojo worlds directly on-chain, with built-in support for large projects that need to spread setup work across many transactions. The factory keeps its own cursor state, so clients can keep hitting the `deploy` entrypoint until everything is registered.\n\nThe source is heavily commented—start in `src/factory.cairo` for orchestration, `src/factory_models.cairo` for configuration shape, and `src/world_models.cairo` for the data the factory publishes.\n\n## Quick Start\n- Install the Dojo toolchain (`sozo`, `katana`, `torii`).\n- Build and deploy the factory:\n  ```bash\n  sozo -P \u003cPROFILE\u003e build\n  sozo -P \u003cPROFILE\u003e migrate\n  ```\n\n## Factory Configuration\nConfiguration is stored on-chain in the `FactoryConfig` model. Each config version is keyed by `version`, so you can keep multiple setups side-by-side.\n\n| Field | What it controls |\n| --- | --- |\n| `version` | Registry key for this config. Pass it to `deploy`. |\n| `max_actions` | Safety valve for gas per call. Use `20` for most projects, bump down if you hit limits. |\n| `world_class_hash` | Declared world contract class hash. |\n| `default_namespace` | Namespace automatically registered for the world. |\n| `default_namespace_writer_all` | When `true`, every contract listed below gets writer access to the namespace. |\n| `contracts` | Array of `FactoryConfigContract` describing each Dojo contract to register and optionally initialize. |\n| `models` / `events` | Class hashes of the models and events you need live in the world. |\n| `libraries` | Array of `FactoryConfigLibrary` describing each Dojo library to register. |\n\n`FactoryConfigContract` lets you tailor per-contract behavior:\n- `selector`: Dojo selector used during registration.\n- `class_hash`: Declared class hash to deploy.\n- `init_args`: Arguments passed to the contract’s `dojo_init`.\n- `writer_of_resources` / `owner_of_resources`: Extra granular permissions beyond the default namespace. You can ignore these if you are using `default_namespace_writer_all`.\n\n`FactoryConfigLibrary` lets you tailor per-library behavior:\n- `class_hash`: Declared class hash to register.\n- `name`: Name of the library.\n- `version`: Version of the library, without the prefix `v`.\n\n### Setting the configuration\nIf you want to test your config, you can use the `sozo inspect --output-factory` command to produce the serialized config string.\n\n1. Produce the serialized config string, either manually or via `sozo inspect --output-factory` (sozo 1.7.2+). You will want to run `sozo inspect` inside your project directory, and not the factory directory.\n2. Call the factory:\n   ```bash\n   sozo -P \u003cPROFILE\u003e execute factory set_config \u003cVERSION\u003e \u003c...serialized config values...\u003e\n   ```\n3. Double-check what is stored:\n   ```bash\n   sozo -P \u003cPROFILE\u003e model get FactoryConfig \u003cVERSION\u003e\n   ```\n\n### Current limitation\n`FactoryConfig` is one large Dojo model. Because Dojo models are capped at ~300 felts, extremely large projects with many contracts, models, or events may bump into that serialization ceiling. Until we split the config across multiple models, keep an eye on growth and trim unused resources if you get close to the limit.\n\n## Deploying a World once the configuration is set\n```bash\n# First transaction\nsozo -P \u003cPROFILE\u003e execute factory deploy sstr:\u003cWORLD_NAME\u003e \u003cVERSION\u003e\n\n# Repeat until the world is fully registered\nsozo -P \u003cPROFILE\u003e execute factory deploy sstr:\u003cWORLD_NAME\u003e \u003cVERSION\u003e\n```\nThe call sequence walks through these stages automatically: world deployment, namespace registration, contract deployment, model/event registration, permission grants, and finally `dojo_init` for each contract. `max_actions` governs how many of those actions happen per transaction.\n\nTrack progress with:\n```bash\nsozo -P \u003cPROFILE\u003e model get FactoryDeploymentCursor \u003cVERSION\u003e\n```\nOnce `completed` is `true`, the factory also writes:\n- `WorldDeployed` with block number and tx hash for auditing.\n- `WorldContract` records mapping each contract selector back to the deployed address.\n\n## Working on the Project\n- Run `sozo build` before committing changes; it exercises the same pipeline the factory drives.\n- Run `snforge test` to run the tests, main test file is `tests/lib.cairo`.\n- The main contract lives in `src/factory.cairo`; configuration models are in `src/factory_models.cairo`; interfaces and storage helpers are in `src/interface.cairo` and `src/world_models.cairo`.\n- Comments in the source explain the cursor mechanics, permission sequencing, and known optimization opportunities. If you add new behavior, keep those comments in sync.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdojoengine%2Fworld-factory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdojoengine%2Fworld-factory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdojoengine%2Fworld-factory/lists"}