Stream Unlockable NFTs (SUNFT) are 1 or more NFTs locked into a smart contract that can only be unlocked by streaming tokens into the contract for a set duration. 1 SNUFT contains a sequence of NFTs that each become unlocked after streaming at a rate for a duration of time.
3 Cyrpto Corgis are wrapped together and locked in a contract to create a single SUNFT, each corgi gets locked and is available once DAIx has been stream for a period of time specified by the creator of this SUNFT
- Queens Gambit protocol supports minting and managing a SUNFT
- The original protocol is used for making SUNFTs using Crypto Corgis
- A SUNFT is define using a sequence of tuples containing:
- The base NFT
contractAddress
- The
tokenId
of the NFT to include - The minimum
rate
that needs to be streamed to unlocked - The
duration
that the stream needs to be before unlocking [(contractAddress, tokenId, rate, duration), ... ]
- The base NFT
- Each SUNFT...
- is minted by passing in the first NFT to add to the SUNFT
- can have more NFTs appended to it
- is funded by streaming in DAIx into the SUNFT
- can be unlocked to recover the art after streaming for the specified rate and duration
- must be destroyed to recover the deposits
- can be destroyed early before the locked NFTs are unlocked, the NFTs will return to this SUNFT's creator
address contractAddress
- The contract address of the NFT to includeuint256 tokenId
- The ID of the NFT from the contract atcontractAddress
int96 rate
- The minimum rate required to start the unlockuint256 duration
- The duration in seconds required to stream at leastrate
to unlock the NFTsbool locked
- Status field for whether this NFT is (un)locked
mapping (uint256 => LockableNFT) nfts
- The sequence ofLockableNFT
that make up this SUNFTaddress creator
- The minter of this SUNFTuint256 progress
- The amount of time in seconds that the stream has been opened, resets after each NFT in thenfts
sequence becomes unlockeduint256 lastStartedAt
- The timestamp when the last stream was started/updateduint256 nextUnlockedIndex
- An index tracking which of thenfts
is currently being worked onuint256 owner
- The account that owns this SUNFTuint256 principal
- The principal amount deposited (i.e. the net total streamed)
address queen
- The owner of the contract and the address authorized to collect feesmapping (uint256 => StreamUnlockableNFT) sunfts
- A mapping of SUNFTtokenId
s to their respectiveStreamUnlockableNFT
address depositToken
- The token used to feed the corgi NFTsuint256 mintingFee
- The fee to mint a SUNFTaddress mintingFeeToken
- The token accepted as the minting fee, 0x0 for ETH
onlyRoyalty
- modifies methods so they can only be called by thequeen
- Parameters
nftToLock
- A sequence of NFTs to lock into this SUNFT
- Pre-conditions
msg.sender
has approved this contract to transfernftToLock
msg.sender
has approved this contract to transfermintingFee
ofmintingFeeToken
s
- Post-conditions
- all
nftsToLock
are transferred to this contract - 1 SUNFT is transferred to
msg.sender
- all
- Parameters
sunftId
- The id of the SUNFT to start streamingfeedToken
to
- Pre-conditions
- None
- Post-conditions
- Opens a superfluid stream to this contract
- Sets
lastStartedAt
to now
- Parameters
sunftId
- The id of the SUNFT to try to unlock/update
- Pre-conditions
- None
- Post-conditions
- Computes the net amount streamed and updates
principal
- Updates progress with the
block.timestamp - lastStartedAt
- If
progress >= nfts[nextUnlockedIndex].duration
andmsg.sender == owner
- Unlock the nft at
nextUnlockedIndex
and transfer it to the SUNFTs owner - Increment
nextUnlockedIndex
- Reset progress to 0
- Unlock the nft at
- Computes the net amount streamed and updates
- Parameters
sunftId
- The id of the SUNFT to stop streamingdepositToken
to
- Pre-conditions
- None
- Post-conditions
- Closes a superfluid stream to this contract
- Call
tryUnlock
- Parameters
sunftId
- The id of the SUNFT to destroy
- Pre-conditions
- The message sender is the
owner
of the SUNFT atsunftId
- The message sender is the
- Post-conditions
- The NFT is burned
- If any
nfts
are still not unlockedprincipal * 0.95
amount ofdepositToken
is transfered tomsg.sender
principal * 0.05
amount ofdepositToken
is transfered toqueen
(early withdraw penalty)- Transfer them back to the
creator
- Otherwise
principal
amount offeedToken
is transfered tomsg.sender