openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

ERC998 addition

Open 3scava1i3r opened this issue 2 years ago β€’ 5 comments

🧐 Motivation

For the problem statement i would say we don't have any specific boilerplate to make NFTs that contain ERC20s so might as well start this here in openzepplin.(FYI This is something similar to what charged particles protocol provides) I found aavegotchi project pretty amazing and thought of making something like it.ERC998 has been one of the most promising draft for an extension of ERC721.

πŸ“ Details

Here are some of the features we seem to add -

  • An ERC998ERC721 top-down composable is an ERC721 token with additional functionality for owning other ERC721 tokens.
  • An ERC998ERC20 top-down composable is an ERC721 token with additional functionality for owning ERC20 tokens.
  • An ERC998ERC721 bottom-up composable is an ERC721 token with additional functionality for being owned by an ERC721 token.
  • An ERC998ERC20 bottom-up composable is an ERC20 token with additional functionality for being owned by an ERC721 token.

you can get more information about the same here - https://github.com/ethereum/EIPs/blob/master/EIPS/eip-998.md. I was thinking of updating the contracts and adding a new ERC under token section here.I would surely need a lot of help from the community for the same.I have finished my work with topdown composables right now.Adding the PR for the same soon

3scava1i3r avatar Dec 30 '21 09:12 3scava1i3r

Hello @3scava1i3r

I see that ERC998 is still a draft. It was created over 2 years ago, and has not received any meaningful update since sept 2018. I'm curious what lead you to consider this ERC today.

Are you aware of any implementation/usage of this ERC in production?

AFAIK, there are efforts to "shard" NFTs and other assets. I can think of niftex that allow users to shard a smartwallet. Shards are ERC20 tokens, and the smartwallet can be manage any class of asset (ERC20, ERC721, ERC1155, ...)

Amxx avatar Dec 30 '21 13:12 Amxx

Hi, @Amxx I wish to talk about this now as there is no implementation from openzepplin for the same and i see a lot of potential in GameFi using ERC998, also i had this hackathon and thought why not make a boilerplate for everybody else.

Yes some of the the implementations of this ERC in projects are as follows -

  • Aavegotchi(AFAIK, had coderdan on the same server and had some conversation on the same, somethings are added in their contracts though)
  • https://mokens.io/
  • https://www.caesarstriumph.com/
  • https://www.bitguild.io/

also for the case of sharding, i worked with niftex like a year ago and had fractional nfts being made out of our nfts, so we have to give an sc our nft and that is converted to a set amount of ERC20 tokens - 5 tokens for protocol.This implementation is very different from the above stated

I wish to implement something like defi+nfts so i think this ERC could have a greater impact for the same cause.We can check charged particle protocol for interest bearing nfts seems like a fun project to meπŸ™‚

3scava1i3r avatar Dec 31 '21 07:12 3scava1i3r

Hi guys!

I was working for BitGuild back in 2018 and I really really want to see this standard implemented in OZ but I'm afraid it has less to no sense of doing this. Let me briefly explain why.

  • in the official implementation you can't use a token with id 0, it is just broken, you have to burn it right away, or you have to rework several checks to support it.
  • its a pain to move tokens inside the tree, especially if it is just plain 721, you will have to have a mix of top-down and bottom-up. sometimes both at the same time.
  • in real-world applications, you most likely will not use contracts, not from your ecosystem. say you have a character with some gears, where this character is 998 and gears are 721. you most likely will not allow users to equip CryptoKitty as a sword or shield. This means you have to add a white list for contracts that could be used as children. You most likely will not allow users to wear 10 swords at a time, so you have to add a limit too. In the most complicated scenario, you have a 3-dimensional array tokenId->address->amount which will cost you a hell ton of gas and storage space

so to summarize you have 721 base, 7 OZ extensions, 998+721td, 998+721bu, 998+20, 998+1155, filter+limit, maybe something else. The total size of bytecode is way more than any public blockchain limit, you just won't be able to deploy this monster. In fact, you can barely fit 721 base, access control, burnable, enumerable, 998+721td, and 998+20.

speaking of your particular case, if you develop the game and want to use 998 I can help you.

TrejGun avatar Jan 20 '22 13:01 TrejGun

I'd like to work on a project that would require 998 and i would most certainly like to work here to implement it through OZ as well @TrejGun

3scava1i3r avatar Jan 25 '22 17:01 3scava1i3r

I don't think this ERC is a good candidate to be included given it's a Draft and the author has no plans to keep working on it.

frangio avatar Feb 08 '22 23:02 frangio

Closing for the reasons stated above.

frangio avatar Sep 16 '22 20:09 frangio