1/ First of all, what is SuperSea? SuperSea is a collection of 100 NFTs that grants its holder lifetime access to nonfungible.tools member-only features.
Holding an NFT is equivalent to owning a lifetime deal. The contract also powers the tool's subscription service.
2/ First, let's see how subscription works with SuperSea's contract. It's fascinating.
As a start, the contract defines the available subscriptions in a map and defines them during contract deployment from inside the contract's constructor.
3/ Here, we see there are 2 subscription plans, the 30 days subscription at the price of 0.1 ether and 365 days subscription plan at 0.5 ether.
Auto-charging wallet is not possible within the contract. Hence offering an annual subscription at a discount is a good incentive.
4/ This is how subscription works in a smart contract. Follow on closely.
I will first share the code for you to digest before breaking it down in the next tweet.
5/ Ready? First, we get the relevant subscription plan based on its index. We know the plan exists by checking if the duration property is greater than 0.
The unit "days" is a special unit supported by the ethereum virtual machine denoting time.
6/ Then, we note down the current time using "block.timestamp". Since we know the current time, we can set the expiry date of the subscription. We do it by adding the duration of the plan to the current time.
Finally, we save and assign the expiry date to the user address.
7/ So if I'm buying the 1 monthly subscription, the contract will first check the available plans. Then it checks what time is it today (in milliseconds) and adds 1 month. Now we have the expiry date and the contract will save it and remembers that's me.
8/ A smart addition here is to check if the user had subscribed before or not. If they have, we read the expiry date of their existing subscription and add the plan duration to that instead. Then we assign the result as the new expiry date, practically extending the subscription.
9/ To check if a user has a subscription or not, we call the hasActiveSubscription function. This function is simple, we take the user's address, get the expiry date and see if it's greater than the current timestamp or not.
10/ By doing this, we can now support subscriptions and collect payment all through the blockchain! I think it's cool.
This is what SuperSea does in their website and apps to give users access.
Next, let's see how the lifetime deal works. It's actually very simple.
11/ First, we mint a token to the address. In this case, it's a simple minting function that assigns a token id to the address.
I talked about this in greater detail in my CoolCatsNFT breakdown if you want to check that out.
12/ Next, to know if someone has the NFT, we call the balanceOf() function provided by Open Zeppelin's ERC721 library to know how many tokens/NFTs an address has.
If the address has more than 0 tokens, they're a lifetime member! That's it!
13/ The NFT community has been craving for NFTs that is more than pixelated images and have a real use case.
Using NFT as a membership and smart contract for a subscription is a use case that I can see more people adopting.
I see a future where this is the default for all SaaS.
14/ Some other projects I found doing this includes:
- @pixelbeastsnft - unlocks access to tools
- @_rareblocks - lifetime access to UI blocks
- @BoredApeYC - access to THE BATHROOM
- @trends_vc - lifetime access to the newsletter
15/ For stats, this contract was a lot more expensive than the average NFT contract to deploy. It cost 0.2 ether to deploy or ~$700 based on eth price during its deployment date at 3 October 2021.
16/ ✨Free SuperSea Template✨
I created a template for those who want to build on top of SuperSea's contract. I think it's awesome to support membership and subscriptions from the blockchain.
I was talking to @pencilflip about how @alphagirlclub can allow minting for low gas fees. This prompted me to look into the contract further.
On a good day, we can drive minting gas to $8?!
Read through. It'll be useful for your project.
1/ First of all, I want to acknowledge and credit prior research into this. The guts of the minting contract that @alphagirlclub used were written by @squeebo_nft.
Additionally, there was also another extensive breakdown written on this by @nftchance
2/ As we all know, gas has been a problem and has been prohibitive for the ethereum network. Lately, however, we've been seeing projects taking this into account and attempting to optimize their contract to be gas efficient in the effort to make their project more accessible.
Spending Sunday afternoon working on @_buildspace Solana NFT project!
Trying out my new Wacom One too 😂
I'll post progress updates on this thread for anyone interested 🙂
@_buildspace Sneak peek at my Solana NFT collection. Will have 300 of them to mint via Solana Devnet!
If you follow the @_buildspace tutorial, we're taught to do .json metadata manually. I'm able to generate 300 easily because I use niftygenerator.xyz check it out!
Uploaded 300 pngs to arweave, takes a while. Imagine uploading 3000 of them? or 10000 even.
Good news is metaplex remembers the progress, if it fails just rerun the cli and it'll pick up where you left off.
Every day feels like a new risk-based game launches. One of the pioneers of this trend is @wolfdotgame. Following suit, others also seem to create their passive staking functionalities.
Today we'll see how risk-based game works on the blockchain.
1/ And believe me, there's a lot of risk-based games. Either similar games launched or NFT projects build passive staking functionality into their NFT. Here's a short list I compiled:
@chain_runners seems like all that everyone talked about during the weekend as it surged to 2 eth floor. What's special is this 32x32 art is all stored on chain.
Today, we'll see how on chain pixels work.
1/ A quick rundown for today breakdown, we'll look into:
- Chain Runners DNA
- Rarity & Weights
- How layers are stored
- How layers are constructed
- Pixel Colors
- Layouting the layers
Let's get into it :)
2/ Through the weekend, we see an influx of people adopting a runner! Only last week, each runner sat at around 0.1 eth and now it's at around 2 eth! We also see many figures in the tech and VC space getting a runner like Figma CEO @zoink and @greylockVC partner @saranormous
The @ConstituionDAO has now raised over 11,000 eth or ~$45 million in their fundraising to purchase the US Constitution. But how secure are the funds?
Today, let's see how multisig works and how your donation is stored.
1/ @ConstitutionDAO showcases an unprecedented use case of crypto. It brought people together for one simple idea: "whether the people can purchase the US constitution if they all bind together."
The Constitution will be auctioned off by Sotheby's today.
2/ For the past 4 days, the fundraising has happened at the fundraising platform juicebox.money. However, the funds have now moved. It is stored in a smart contract called the multisig, or multiple signatures.
This ensures that one individual doesn't control the funds.
Not my usual contract breakdown schedule, but I can't help but breakdown Corruption(s*) by @dhof while it's hot.
Today, we'll see how Corruption(s*)'s insight stabilizing and destabilizing works and what makes this NFT special.
1/ As context, Corruption(s*) is a new NFT stealthily deployed by @dhof. 0.08 eth mint price. 4,196 corruptions were released and sold out in 15 minutes, trading at 0.7 eth floor at its peak.
2/ The contract says: 1. Corruptions gain insight over time 2. Insight accelerates if corruption is stabilized (left alone) 3. Insight decelerates if corruption is destabilized (moved)
There are many mysteries around this NFT, but we'll learn as much as we can from the contract.