Giter VIP home page Giter VIP logo

evm's Introduction

RMRK Solidity

A set of Solidity smart contracts implementing RMRK legos and the compatible extensions for them.

For each of the MultiAsset, Nestable and Equippable lego combinations, both simple and advanced sample uses are presented in the sample RMRK EVM contracts repository.

NOTE: RMRK smart contract documentation as well as usage instructions and examples can be found in the RMRK EVM developer documentation

Usage

To use the RMRK legos and smart contracts contained in this repository, simply add them to your project:

yarn add @rmrk-team/evm-contract

or

npm -i @rmrk-team/evm-contracts

Once the dependency is added to your project, simply import the smart contracts you wish to utilize into your own smart contract.

RMRK Legos

RMRK is a set of NFT standards which compose several "NFT 2.0 lego" primitives. Putting these legos together allows a user to create NFT systems of arbitrary complexity.

There are various possibilities on how to combine these legos, all of which are ERC721 compatible:

  1. MultiAsset (Context-Dependent Multi-Asset Tokens)
    • Only uses the MultiAsset RMRK lego
  2. Nestable (Parent-Governed Nestable Non-Fungible Tokens)
    • Only uses the Nestable RMRK lego
  3. Nestable with MultiAsset
    • Uses both Nestable and MultiAsset RMRK legos
  4. Equippable MultiAsset with Nestable and Catalog
    • Merged equippable is a more compact RMRK lego composite that uses less smart contracts, but has less space for custom logic implementation
    • Split equippable is a more customizable RMRK lego composite that uses more smart contracts, but has more space for custom logic implementation

RMRK Legos infographic

While we strongly encourage to refer to the documentation, we provide some quick-start notes for the use of our legos:

  1. Deploy the MultiAsset contract.
  2. Admin must add assets on a per-token basis. This could be very gas-intensive, so we recommend adding them in batches.
  3. Mint the tokens using your preferred method.
  1. Deploy like a regular ERC-721 compliant smart contract.

That's it! This contract can receive and be nested by other instances of RMRKNestable.

NOTE: A smart contract that is only Nestable WILL NOT be compatible with other equippable contracts as a standalone.

Nestable with MultiAsset

A combintation of Nestable and MultiAsset lego is a powerful way of designing Non-Fungible Tokens. To quickstart this implementation (RMRKNestableMultiAsset), you only need to follow the steps outlined for the MultiAsset lego.

RMRK Equippable lego composite comes in two configurations: Merged and Split Equippable. The former is a single contract designed to handle the full implementation of MultiAsset, Nestable, and Equippable. The latter separates Nestable and Equippable with MultiAsset into two mutually dependent contracts to allow for more custom logic in each, if necessary.

Quick-start Merged Equippable

  1. Deploy the RMRKEquippable. This contract implements minting, burning and asset management logic.
  2. Deploy the RMRKCatalog.
  3. Initialize your catalog parts (fixed and slot). Address of the RMRKCatalog along with the catalog part IDs need to be passed when initializing your assets in RMRKEquippable.
  4. Assign token assets in RMRKEquippable as you would in the MultiAsset above, with the added ExtendedAsset params, equippableRefId and catalogAddress.

Quick-start Split Equippable

  1. Deploy the RMRKNestableExternalEquippable. This contract contains core transfer and minting logic.
  2. Deploy the RMRKExternalEquip. This contract contains equippable and asset management logic.
  3. Initialize the address of RMRKExternalEquippable in RMRKNestableExternalEquippable via an exposed setEquippalbeAddress method. If you're not using a prefab RMRK top-level implementation (found in the implementations directory), you will need to expose this yourself.
  4. Deploy RMRKCatalog.
  5. Initialize your catalog parts (fixed and slot). Address of the RMRKCatalog along with the catalog part IDs need to be passed when initializing your assets in RMRKExternalEquip.
  6. Assign token assets in RMRKExternalEquippable as you would in the MultiAsset above, with the added ExtendedAsset params, equippableRefId and catalogAddress.

NOTE: Please be aware that RMRKEquippable is likely very close to the maximum smart contract deployment size allowed by most EVM environments. If you need more space for custom business logic implementation, we suggest you consider RMRKNestableExternalEquippable.

Emotable

One of the extensions present in this repository is Emotable. It provides the ability for users to react to NFTs using Unicode emojis.

To use it, just import the Emotable smart contract into the one you wish to utilize it.

Interfaces

The interfaces of all of the smart contracts are included in this repository. They are prefixed with an I; so the interface for the RMRKNestable is IRMRKNestable. If you wish to interact with any of the RMRK smart contracts from your own, you only need to import the desired interface.

Implementations

In addition to the raw RMRK legos and extensions, this repository also contains implementations of all of them in the implementations/ directory. These implementations are opinionated and utilize the extensions that we feel provide the most utility for each of the implementations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.