Extensions Deployment Guide
This guide will walk you through some common extension use cases that will hopefully give you a base for writing your own! The first thing to understand really is the relationship between your "core" contract and any "extensions" attached to it.
Tokens minted directly on your core contract (using functions like
mintBaseBatchare managed by your core contract. Meaning - the tokenURI, ownership, etc is all managed by the base contract. In basic terms - this is just a regular NFT. Nothing special. Then there are tokens minted on your core contract via an extension (using functions like
mintExtensionBatch). Tokens minted in this fashion are managed by the extension. This can have any arbitrary logic in it to handle the token, such as making it non-transferrable, making dynamic metadata, etc. It is important to note that extensions themselves do not manage tokens. This means that if you want to write an extension, you'll want to deploy a core contract first.
Before we get into concrete examples, I'll give you some analogies to help you better understand the relationship between extensions and core contracts.
Let's say you are a global brand called Miké. You have various sub-brands, like Wknd. As a global brand, you want to delegate product definitions to the various other entities, while still keeping a unified brand. For example - let's say I buy a pair of Air Wknds (which are tokens vended through the Wknd extension contract). These would be minted, as, let's say token #2 in the Miké store. Whenever a website wants to display this token, they can make a request to get the info for it from the Miké core contract. However - this contract has delegated the logic for displaying this token to its subsidiary, the Wknd extension contract. All that Miké knows is that token #2 is managed by Wknd, and to ask Wknd for the info. This is just one example of how tokens are managed by extensions. Let's take a look at another example now.
Let's say that you run a froyo shop. You could, of course, pour some froyo and then sell it to a customer. This is akin to minting on your base contract. However, as you might guess, this is not very scalable. So maybe you want self-server froyo machines - this is where extensions come in. With an extension, people can simply pour their own froyo, pay for it, and leave. You could have rules like - you can only purchase 1 cup of froyo at a time. Or - you can only purchase blueberry flavor if you are wearing blue jeans. Or - if this is your 2nd cup of froyo for the day, you get a 50% discount. As you can see in this case, extensions are also super helpful for different minting methods.
Hopefully these examples give you a good peek into what is possible with extensions! I think the power of them is that you can think more about app development and business logic and less about solidity-specific details.