cartesi / rollups

Cartesi Rollups
30 stars 12 forks source link

ERC-1155 Support #2

Closed juztamau5 closed 1 year ago

juztamau5 commented 2 years ago

Description

This PR adds ERC-1155 support and the accompanying tests and deployment scripts. Support is based on the current ERC-721 implementation.

The first commit increases the default input size, as ERC-1155 function signatures are slightly longer than ERC-721.

Motivation and context

ERC-1155 is more flexible and more gas efficient for batch transactions. It is supported by all major wallets these days. My last project actually used ERC-1155 for regular NFTs. It makes sense to support ERC-1155 in Cartesi.

How has this been tested?

All test cases succeed.

I started to create an ERC-1155 example in the rollups-example repo for testing. Let me know if this is wanted and I'll finish it.

tuler commented 1 year ago

Hello @juztamau5 thanks for the contribution! We have more in-depth changes to our onchain code for an upcoming release, so I'll ask to hold on, and after we release that we can come back to add ERC-1155 support. Are you planning to use ERC-1155 in ultrachess?

juztamau5 commented 1 year ago

I'm planning on using NFTs in ultrachesss, and there's not really any good reason to use ERC-721 because we'll want batch transfers.

juztamau5 commented 1 year ago

@tuler If you're interested, I've detailed the plan we've developed so far for how we're using ERC-1155 in Ultrachess: https://github.com/Ultrachess/contracts/pull/1

juztamau5 commented 1 year ago

Closing as obsolete since ERC-1155 support was added in https://github.com/cartesi/rollups/commit/ca98148bb60fc82a15357c4e7eebe55087001a48.

juztamau5 commented 1 year ago

FWIW, the current plan for NFTs in Ultrachess is to have ERC-721 bots, and the bots use Clones.cloneDeterministic() to create an ETH wallet address that can store and withdraw any ERC-20, ERC-721 or ERC-1155 token. So the ERC-721 bot token's metadata will initially be just the contents of its wallet