Skip to content

Instantly share code, notes, and snippets.

@sobhanb-eth
Last active December 13, 2022 15:26
Show Gist options
  • Save sobhanb-eth/2cc8d9a2dd66a41c8c3f311db4240f2d to your computer and use it in GitHub Desktop.
Save sobhanb-eth/2cc8d9a2dd66a41c8c3f311db4240f2d to your computer and use it in GitHub Desktop.
Multiverse NFT EIP-5606
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* Interface of the Multiverse NFT standard as defined in the EIP.
*/
interface IMultiverseNFT {
/**
* struct to store delegate token details
*
*/
struct DelegateData {
uint256 tokenId;
uint256 quantity;
address contractAddress;
}
/**
* Emitted when one or more new delegate NFTs are added to a Multiverse NFT
*
*/
event Bundled(
DelegateData[] delegateData,
uint256 multiverseTokenID,
address ownerAddress
);
/**
* Emitted when one or more delegate NFTs are removed from a Multiverse NFT
*/
event Unbundled(uint256 multiverseTokenID, DelegateData[] delegateData);
/**
* Accepts the tokenId of the Multiverse NFT and returns an array of delegate token data
*/
function delegateTokens(uint256 multiverseTokenID)
external
view
returns (DelegateData[] memory);
/**
* Removes one or more delegate NFTs from a Multiverse NFT
* This function accepts the delegate NFT details, and transfer those NFTs out of the Multiverse NFT contract to the owner's wallet
*/
function unbundle(
DelegateData[] memory delegateData,
uint256 multiverseTokenID
) external;
/**
* Adds one or more delegate NFTs to a Multiverse NFT
* This function accepts the delegate NFT details, and transfers those NFTs to the Multiverse NFT contract
* Need to ensure that approval is given to this Multiverse NFT contract for the delegate NFTs so that they can be transferred programmatically
*/
function bundle(
DelegateData[] memory delegateData,
uint256 multiverseTokenID
) external;
/**
* Initializes a new bundle, mints a Multiverse NFT and assigns it to msg.sender
* Returns the token ID of a new Multiverse NFT
* Note - When a new Multiverse NFT is initialized, it is empty, it does not contain any delegate NFTs
*/
function initBundle(DelegateData[] memory delegateData) external;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment