chiru-labs / ERC721A

https://ERC721A.org
MIT License
2.51k stars 842 forks source link

Cross-chain NFT #482

Open mypeaceduck opened 6 months ago

mypeaceduck commented 6 months ago

Hello.

I create cross-chain NFT:

ETH: 1-100 NFT IDs BSC: 101-200 NFT IDs FIL: 201-300 NFT IDs

https://github.com/chiru-labs/ERC721A/blob/main/contracts/ERC721A.sol#L977

The coinage restriction does not allow NFT to be burned on ETH and minted on FIL. It is possible to make the restriction not tokenId <= _sequentialUpTo() to tokenId > _startTokenId() && tokenId <= _sequentialUpTo()

If I burn the token, can I mint _mintSpot it with the same ID within the range?

Thx.

Nlferu commented 3 weeks ago

Hi @mypeaceduck

I have the same problem, but I see your architecture is different. To understand your approach better, are you minting all 300 NFTS among 3 blockchains on the same time? So lets say user on ETH is minting 1-100 NFT's cross-chain message is sent to BSC and FIL and there we mint 101-200 and 201-300 NFT's?

I have taken approach where I mint some NFT's for user on source chain then only on cross-chain tokens transfer i mint the same amount on destination chain (locking those tokenIds on source chain), but indeed I had to make source chain to _startTokenId return 2 then on destination chain i had to override _sequentialUpTo retrun 1... This doesnt look good i know but I can use _spotMint now for 1st NFT token created (which is tokenId = 2) otherwise if we wouldnt change startId then we couldnt transfer tokenId = 0 and we couldnt even transfer tokenId = 1 as _sequentialUpTo needs to be greater than _startTokenId. I do also think minting straight away on all chains is just unnecessarily expensive.