7. Marketplace Setup
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!
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.
Some of the code in these setup instructions has intentional errors built into it. You should understand enough about Cadence to be able to fix these tutorials on your own. All of the errors involve concepts that you have learned in previous tutorials
- Open the
ExampleToken
contract. This is the same contract from the fungible token tutorial. - Deploy the
ExampleToken
code to account0x06
. - Switch to the
ExampleNFT
contract (Contract 2) - Deploy the NFT code to account
0x07
by selecting it as the deploying signer. - Run the transaction in "Setup 6". This is the
SetupAccount6Transaction.cdc
file. Use account0x06
as the only signer to set up account0x06
's storage.
- Run the second transaction, "Setup 7". This is the
SetupAccount7Transaction.cdc
file. Use account0x07
as the only signer to set up account0x07
's storage.
- Run the transaction in "Setup 6". This is the
SetupAccount6TransactionMinting.cdc
file. Use account0x06
as the only signer to mint fungible tokens for account 6 and 7.
- Run the script
CheckSetupScript.cdc
file in Script 1 to ensure everything is set up.
- The script should not panic and you should see something like this output
_10"Account 6 Balance"_1040.00000000_10"Account 7 Balance"_1020.00000000_10"Account 6 NFTs"_10[1]_10"Account 7 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.