In this tutorial, we're going to create a marketplace that uses both the fungible and non-fungible token (NFTs) contracts that we have learned about in previous tutorials. This page requires you to execute a series of transactions to setup your accounts to complete the Marketplace tutorial. The next page contains the main content of the tutorial.
When you are done with the tutorial, check out the NFTStorefront repo for an example of a production ready marketplace that you can use right now on testnet or mainnet!
Open the starter code for this tutorial in the Flow Playground:
The tutorial will be asking you to take various actions to interact with this code.
If you have already completed the Marketplace tutorial, please move on to Composable Resources: Kitty Hats.
This guide will help you quickly get the playground to the state you need to complete the Marketplace tutorial. The marketplace tutorial uses the Fungible Token and Non-Fungible token contracts to allow users to buy and sell NFTs with fungible tokens.
The state of the accounts is the same as if you had completed the Fungible Token and Non-Fungible Token tutorials in the same playground session. Having your playground in this state is necessary to follow the Composable Smart Contracts: Marketplace tutorial.
- Open account
0x01. Make sure the Fungible Token definitions in
ExampleToken.cdcfrom the fungible token tutorial are in this account.
- Deploy the ExampleToken code to account
- Switch to the ExampleNFT contract (Contract 2)
- Make sure you have the NFT definitions in
ExampleNFT.cdcfrom the Non-fungible token tutorial in account
- Deploy the NFT code to account
0x02by selecting it as the deploying signer.
- Run the transaction in Transaction 1. This is the
SetupAccount1Transaction.cdcfile. Use account
0x01as the only signer to set up account
- Run the transaction in Transaction 2. This is the
SetupAccount2Transaction.cdcfile. Use account
0x02as the only signer to set up account
- Run the transaction in Transaction 3. This is the
SetupAccount1TransactionMinting.cdcfile. Use account
0x01as the only signer to mint fungible tokens for account 1 and 2.
- Run the script
CheckSetupScript.cdcfile in Script 1 to ensure everything is set up.
- The script should not panic and you should see something like this output
_10"Account 1 Balance"_1040.00000000_10"Account 2 Balance"_1020.00000000_10"Account 1 NFTs"_10_10"Account 2 NFTs"_10
With your playground now in the correct state, you're ready to continue with the next tutorial.
You do not need to open a new playground session for the marketplace tutorial. You can just continue using this one.