0

There're 2 future NFT collections.

Is it possible to create the contracts for them in such a way that whenever an NFT of collection_1 c1 gets, some NFTs from collection_2 c2 of the same account get transfered automatically to the receiver as well?

Meaning, even when a user decides to send an NFT from c1 from his wallet manually, without calling a special function myTransferNFTOf2Collections(...) which I may create. In other words, it should occur in all possible cases, without any additional effort from the user.

option #1:

the contract for collection_1 has been created in the past, and therefore can't be changed now. Would this be possible still?

1 Answer 1

0

It is possible to create NFTs bound to other NFTs. Let's say you have an original collection A and a "mirrored" collection B.

By borrowing the ownerOf function from A, we can make one in B like this:

function ownerOf(
    uint256 tokenId
) public view virtual override returns (address) {
    return IERC721(originalCollection).ownerOf(tokenId);
}

you've effectively bound all new NFTs to the owners of the original collection. This is how Cyberkongz have "airdropped" a copy of the original version with on-chain metadata to every holder. When an original is transferred, the internal mapping update happens in one smart-contract, but it is reflected in both. You don't have to use any expensive storage at all which makes it very cheap to deploy.

Note that you may have to fire a specific "batch mint" event when the new contract is deployed in order for off-chain indexers to display the NFTs in user wallets. You can read more about it in a blog by 0xInuarashi.

4
  • I don't understand. Where will function ownerOf(...) have to be placed?
    – Nondi
    Commented Jun 8, 2023 at 19:34
  • The ownerOf function is part of the IERC721 standard, every NFT smart-contract needs to have it. Dive deeper into the implementation on OpenZeppelin's GitHub and it will all make more sense.
    – Ape Toshi
    Commented Jun 8, 2023 at 19:48
  • That's not what I asked about
    – Nondi
    Commented Jun 8, 2023 at 21:10
  • I've asked about 1-n rather than 1-1
    – Nondi
    Commented Jun 8, 2023 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.