Onchain Schemas
Contracts supporting onchain Patchwork metadata must implement theschema()
function as documented below
schema()
call must return a MetadataSchema
as specified here:
- IDs must be unique
- Keys must be unique
- Field slots and offsets must be accurately described in the schema
- Fields, including arrays, than span multiple slots must start at an offset of 0 in the first slot. Spanned slots must be contiguous and must not have any other fields specified in overlapping space of the contiguous slot space.
- Dynamic fields, such as dynamic length arrays and dynamic length strings, may not be packed into static metadata but must be in separate storage.
- Dynamic fields, such as dynamic length arrays and dynamic length strings, must be marked slot 0, offset 0, length 0 in the schema
- Individual fields that are not arrays must be marked as length 1 in metadata