Quickstart
Overview
Modular contracts are a composable set of contracts that can be combined to create a feature complete protocol. To learn more, refer to How it works
In this Quickstart, learn how to go over how to create an ERC-721 modular contract with fixed mint pricing
Create a new forge project and install the modular-contracts package
Install Forge from this guide from Foundry
Create the core contract
In the
/src
folder, create a new file calledERC721Start.sol
with the following code. This will inherit the prebuiltERC721Core
contract.Deploy the core contract
In your terminal, run the following command
Then select
ERC721Start
After signing in, it should open up to the following page to deploy theERC721Start
contractAfter filling in the fields, select the Sepolia testnet chain and then hit Deploy
If you need funds to deploy the contract, head over to the Sepolia faucet here
After deploying the contract, you should be redirected to the deployed contract page
Hold onto this page as you will need it for later
Create the extension contract
Back in your forge project, in the
/src
folder, create a file calledPricedExtension.sol
and paste in the following code.For a better understanding of how extension contracts work, refer to the starter template code
Publish the extension contract
In your terminal, run the following command
npx thirdweb publish
Then select
PricedMint
it should open up to the following page to publish thePricedMint
contractAccept the defaults and then hit "next" It should then redirect you to choose which chain to deploy on. Here we'll leave it on the Sepolia testnet Afterwards, hit "Publish Contract"
Install the Extension onto the Core contract
Back to the deployed core contract page, then go and click on the "Manage" tab
It should then redirect to the edit extensions page
Here, fill out the info as needed and then hit "Install"
After it has finished installing, it should then show up under the "Installed Extension" section
Test the modular contract
Now with the modular contract fully up and ready to go, we can test that it setup properly by running the following script