{"id":19607105,"url":"https://github.com/jbx-protocol/juice-delegate-metadata-lib","last_synced_at":"2025-08-25T15:05:04.656Z","repository":{"id":180711662,"uuid":"665457432","full_name":"jbx-protocol/juice-delegate-metadata-lib","owner":"jbx-protocol","description":"Library providing a standard metadata format and a parsing mechanism for data passed to the delegate via pay/redeem","archived":false,"fork":false,"pushed_at":"2023-08-07T09:30:59.000Z","size":105,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-09T09:26:21.940Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbx-protocol.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}},"created_at":"2023-07-12T08:46:00.000Z","updated_at":"2023-08-28T15:27:29.000Z","dependencies_parsed_at":"2025-01-10T08:33:24.809Z","dependency_job_id":null,"html_url":"https://github.com/jbx-protocol/juice-delegate-metadata-lib","commit_stats":null,"previous_names":["jbx-protocol/juice-delegate-metadata-lib"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-delegate-metadata-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-delegate-metadata-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-delegate-metadata-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-delegate-metadata-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbx-protocol","download_url":"https://codeload.github.com/jbx-protocol/juice-delegate-metadata-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240895014,"owners_count":19874911,"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-11-11T10:08:54.588Z","updated_at":"2025-02-26T16:44:39.753Z","avatar_url":"https://github.com/jbx-protocol.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JBDelegateMetadataLib\n\n## Description\n\nThis library allows to store metadata for delegates. It allows to store metadata for a large number of delegates, and to retrieve the metadata for a specific delegate, using a lookup table.\n\n## Delegate ID\n\nEach new delegate should define a 4 byte ID used to retrieve its metadata. This ID should be unique. We suggest using the first 4 bytes of the code keccak256 hash (using `cast k $bytecode` or `emit log_bytes32(keccak256(type(MyDelegate).creationCode));` for instance).\n\n## Metadata structure\n\nMetadata are built as:\n- 32B of reserved space for the protocol (left empty)\n- a lookup table `delegateId: offset`, defining the offset of the metadata for each delegate.\n  The offset fits 1 bytes and is the number of word since the begining of the metadata.\n  The ID fits 4 bytes. This table is padded to 32B.\n- the metadata for each delegate, padded to 32B each\n\n```\n   +-----------------------+ offset: 0\n   | 32B reserved          |\n   +-----------------------+ offset: 1 = end of first 32B\n   | (delegate1 ID,offset1)|\n   | (delegate2 ID,offset2)|\n   | 0's padding           |\n   +-----------------------+ offset: offset1 = 1 + number of words taken by the padded table\n   | delegate 1 metadata1  |\n   | 0's padding           |\n   +-----------------------+ offset: offset2 = offset1 + number of words taken by the metadata1\n   | delegate 2 metadata2  |\n   | 0's padding           |\n   +-----------------------+ (...)\n```\n\n## Usage\n\nDelegate should parse their metadata using the `getMetadata` function, which takes the delegate id as parameter and returns the metadata as a bytes array.\n\nFrontend should use the helper contract to build metadatas. The `createMetadata` function takes an array of delegate ids and an array of data, which can be any data type casted to bytes, and returns the encoded metadata.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbx-protocol%2Fjuice-delegate-metadata-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbx-protocol%2Fjuice-delegate-metadata-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbx-protocol%2Fjuice-delegate-metadata-lib/lists"}