{"id":16742977,"url":"https://github.com/dk1a/solecslib","last_synced_at":"2025-03-21T22:31:38.072Z","repository":{"id":63415178,"uuid":"561756871","full_name":"dk1a/solecslib","owner":"dk1a","description":"ERC1155 and ERC721 Systems that use components to store data","archived":true,"fork":false,"pushed_at":"2025-02-11T17:23:38.000Z","size":675,"stargazers_count":22,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-11T17:29:07.823Z","etag":null,"topics":["erc1155","erc721","mud","solecs","solidity"],"latest_commit_sha":null,"homepage":"","language":"Solidity","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/dk1a.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-11-04T12:26:31.000Z","updated_at":"2025-02-11T17:24:10.000Z","dependencies_parsed_at":"2024-10-28T11:53:21.019Z","dependency_job_id":null,"html_url":"https://github.com/dk1a/solecslib","commit_stats":{"total_commits":42,"total_committers":1,"mean_commits":42.0,"dds":0.0,"last_synced_commit":"0fb1916f500e48aa17a3e1f42dc6a23fbf97ace0"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dk1a%2Fsolecslib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dk1a%2Fsolecslib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dk1a%2Fsolecslib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dk1a%2Fsolecslib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dk1a","download_url":"https://codeload.github.com/dk1a/solecslib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880260,"owners_count":20525505,"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":["erc1155","erc721","mud","solecs","solidity"],"created_at":"2024-10-13T01:25:31.249Z","updated_at":"2025-03-21T22:31:38.064Z","avatar_url":"https://github.com/dk1a.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED\n\nThis package was relevant for an old version of MUD. Use MUD's built-in ERC modules.\n\n# solecslib\nERC1155 and ERC721 Subsystems that use components to store data\n\nExperimental additions to [@latticexyz/solecs](https://github.com/latticexyz/mud/tree/main/packages/solecs)\n\nSee [mud.dev](https://mud.dev/) first for context on solecs and what a System is.\n\nA Subsystem is a System that inherits OwnableWritable instead of Ownable.\nCall `Subsystem.authorizeWriter(systemAddress)` to allow a System to execute a Subsystem.\n\n### Development\n\nInstall dependencies via node\n\n```bash\nyarn install\n```\n\nRun tests via both forge and hardhat\n\n```bash\nyarn test\n```\n\n[Forge](https://book.getfoundry.sh/forge/writing-tests) is used for tests internally. Except ERC tests are entirely taken from [@solidstate/spec](https://github.com/solidstate-network/solidstate-solidity/tree/master/spec), which is why hardhat is also used.\n\n----------\n\n## Tokens\n\n### ERC1155, ERC721\n\nThey have similar contracts with shared suffixes:\n- VData - Virtual data abstraction, like an internal interface\n- Internal - ERC internals, inherits VData\n- Logic - ERC public+internal methods, inherits Internal. This is a full ERC implementation, lacking only a data provider.\n- DataComponents - data provider (only simple setters/getters), inherits VData.\n- ERC__Subsystem - Logic + DataComponents + Subsystem + constructor + default execute implementation.\n\n#### ERC1155BaseSubsystem, ERC721BaseSubsystem\nFull ERC1155/721 and Subsystem implementation, with a default execute and sub-executes (mint,burn,transfer all share 1 contract). Its components may be read by anyone without even awareness of ERC1155/721, but writes must always go through ERC__BaseSubsystem (this is mostly because of events, only 1 contract should emit them).\n\n#### Notes on VData and Logic\nData and Logic separation isn't really necessary, but this was an interesting use case for it. For example by having *Logic + DataStorage + constructor* you could get an ordinary ERC1155/721 implementation (where DataStorage implements VData but just uses normal contract storage). And imo keeping components away from Logic makes it easier to compare to @solidstate/contracts (I tried to keep it very similar, and even reuse tests via @solidstate/spec).\n\n#### Forwarder systems, like OperatorApprovalSystem\nThese exist as an optional addition to ERC__BaseSubsystem. They are pure-ECS wrappers for transfers and approvals. I'm not sure they're useful.\n\n----------\n\n## FromPrototype\n\nInstantiates prototypes, ensures a reverse mapping.\n\n`instanceContext` is encoded with `protoEntity` to get instanced entity in `newInstance` and other methods.\n\n[ScopedValueFromPrototype](contracts/scoped-value/ScopedValueFromPrototype.sol) has an example.\n\n----------\n\n## ScopedValue, ScopedValueFromPrototype\n\nFromPrototype-wrapped version is likely more useful.\n\nInteract with batches (identified by scope) of entity values, or individual entity values.\n\nScope is for doing batched read/increase/decrease without looping through everything.\n\nValue is any kind of entity to counter mapping.\n\n[ScopedValueFromPrototypeTest](contracts/test/scoped-value/ScopedValueFromPrototype.t.sol) has an example.\n\n----------","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdk1a%2Fsolecslib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdk1a%2Fsolecslib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdk1a%2Fsolecslib/lists"}