🎭ERC1155

ERC1155 is an optional module that can be included in your dapp if you need to conform to the ERC1155 standard.

Installation

libs:
  ...
  yours:
    registry: https://github.com/megayours/yours-protocol.git
    path: src/lib/yours
    tagOrBranch: main
    rid: x"---"
    insecure: false
  erc1155:
    registry: https://github.com/megayours/yours-protocol.git
    path: src/lib/erc1155
    tagOrBranch: main
    rid: x"---"
    insecure: false

It's important to note that ERC1155 is an extension of Yours Protocol and cannot be used as a standalone module.

Usage

ERC1155 needs to be attached to the tokens that you want to implement it.

namespace yours {
  import lib.yours.*;
  import lib.erc1155;
}

function attach_erc1155(yours.token, description: text, image: text, animation: text) {
  yours.erc1155.attach(token);
  yours.erc1155.set_descriptgion(token, description);
  yours.erc1155.set_image(token, image);
  yours.erc1155.set_animation(token, animation);
}

Now the metadata can be fetched according to ERC1155 standard externally by querying:

// erc1155 mount
query metadata(project: name, collection: name, token_id: big_integer)
query metadata_by_uid(uid: byte_array)

Last updated

Was this helpful?