MegaYours Docs
  • 🚀MegaYours
    • Extending your on chain data
  • 💾Megadata
    • Solana Integration
  • 🌎Yours Protocol
    • 🤔Getting Started
      • Setting up Your Project
      • Creating Your First Module
      • Creating & Minting Tokens
      • Composable Tokens
      • Making Your Tokens Interoperable
    • 💱Tokens
      • Types
      • Functions
      • Unique Identifier
    • 🧩Modules
      • 🔌Attaching Modules
      • 🌈Relationships
      • 🎭ERC1155
      • 📚Declaration
      • 👾External
    • 📄Metadata
    • 🔗Interoperability
    • 🔄Migration from Originals
      • FT3
      • Interfaces
      • Prototype
  • 👾Import Existing Tokens from any Chain
    • 🛰️Gamma Chain
  • 🔗Links
    • Github: Yours Protocol
Powered by GitBook
On this page
  • Installation
  • Usage

Was this helpful?

  1. Yours Protocol
  2. Modules

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)
PreviousRelationshipsNextDeclaration

Last updated 6 months ago

Was this helpful?

🌎
🧩
🎭