diff --git a/source/mainnet/conf.py b/source/mainnet/conf.py index c41b9a7d29..79304e9418 100644 --- a/source/mainnet/conf.py +++ b/source/mainnet/conf.py @@ -432,9 +432,9 @@ "./net/guides/create-proofs": "docs/network/guides/create-proofs.html", "./net/web3-id/concordia": "docs/network/web3-id/concordia.html", "./net/guides/run-local-chain": "docs/network/guides/run-local-chain.html", - "./net/guides/low-code-nft-marketplace/introduction": "docs/network/low-code-nft-marketplace/introduction.html", - "./net/guides/low-code-nft-marketplace/marketplace": "docs/network/low-code-nft-marketplace/marketplace.html", - "./net/guides/low-code-nft-marketplace/minting-tool": "docs/network/low-code-nft-marketplace/minting-tool.html", + "./net/guides/low-code-nft-marketplace/introduction": "tutorials/low-code-nft-marketplace/introduction.html", + "./net/guides/low-code-nft-marketplace/marketplace": "tutorials/low-code-nft-marketplace/marketplace.html", + "./net/guides/low-code-nft-marketplace/minting-tool": "tutorials/low-code-nft-marketplace/minting-tool.html", "./net/indexers/intro": "docs/network/indexers/intro.html", "./net/indexers/suoquery": "docs/network/indexers/subquery.html", "./net/nodes/node-requirements": "docs/network/nodes/node-requirements.html", @@ -499,8 +499,6 @@ "./smart-contracts/tutorials/fungible-tokens/index": "tutorials/fungible-tokens/index.html", "./smart-contracts/tutorials/fungible-tokens/smart-contract": "tutorials/fungible-tokens/smart-contract.html", "./.smart-contracts/tutorials/fungible-tokens/mint-xfer": "tutorials/fungible-tokens/mint-xfer.html", - "./smart-contracts/tutorials/nft-marketplace-tokens/index": "tutorials/nft-marketplace/index.html", - "./smart-contracts/tutorials/nft-marketplace-tokens/smart-contract": "tutorials/nft-marketplace/smart-contract.html", "./smart-contracts/tutorials/eSealing/index": "tutorials/eSealing/index.html", "./smart-contracts/tutorials/eSealing/eSealing-dapp": "tutorials/eSealing/eSealing-dapp.html", "./smart-contracts/tutorials/sponsoredTransactions/index": "tutorials/sponsoredTransactions/index.html", diff --git a/source/mainnet/docs/help-and-faq/snippets/tokens.rst b/source/mainnet/docs/help-and-faq/snippets/tokens.rst index 41de5a5b19..a6f4ff6d99 100644 --- a/source/mainnet/docs/help-and-faq/snippets/tokens.rst +++ b/source/mainnet/docs/help-and-faq/snippets/tokens.rst @@ -3,4 +3,3 @@ - `multi contract `_ - :ref:`nft-index` - :ref:`sft-index` -- :ref:`nft-marketplace-index` diff --git a/source/mainnet/docs/index.rst b/source/mainnet/docs/index.rst index 14ccfe245f..073fdd3aec 100644 --- a/source/mainnet/docs/index.rst +++ b/source/mainnet/docs/index.rst @@ -89,7 +89,6 @@ Explore our developer resources, including detailed documentation, tutorials, an Run a node on Concordium Use Concordium's ID layer Run a local chain - Concordium low-code NFT framework Indexers diff --git a/source/mainnet/net/guides/new-to-concordium.rst b/source/mainnet/net/guides/new-to-concordium.rst index 98afcdb4da..e1e92cd47e 100644 --- a/source/mainnet/net/guides/new-to-concordium.rst +++ b/source/mainnet/net/guides/new-to-concordium.rst @@ -73,4 +73,4 @@ Getting started with Concordium .. dropdown:: I want to make an NFT marketplace - See the :ref:`NFT marketplace tutorial`. + See the :ref:`NFT marketplace tutorial`. diff --git a/source/mainnet/smart-contracts/snippets/tokens.rst b/source/mainnet/smart-contracts/snippets/tokens.rst index 41de5a5b19..a6f4ff6d99 100644 --- a/source/mainnet/smart-contracts/snippets/tokens.rst +++ b/source/mainnet/smart-contracts/snippets/tokens.rst @@ -3,4 +3,3 @@ - `multi contract `_ - :ref:`nft-index` - :ref:`sft-index` -- :ref:`nft-marketplace-index` diff --git a/source/mainnet/tutorials/index.rst b/source/mainnet/tutorials/index.rst index bb56163650..11a6b19ad1 100644 --- a/source/mainnet/tutorials/index.rst +++ b/source/mainnet/tutorials/index.rst @@ -47,7 +47,7 @@ Advanced Applications Learn how to create decentralized solutions for voting and NFT trading. * :ref:`Voting dApp ` - Build a complete voting system - * :ref:`NFT Marketplace ` - Create a marketplace for trading NFTs + * :ref:`Low Code NFT Marketplace ` - Create a marketplace for trading NFTs Document Sealing ---------------- @@ -88,7 +88,7 @@ Additional Resources nft-minting/index sft-minting/index fungible-tokens/index - nft-marketplace/index + Concordium low-code NFT framework <./low-code-nft-marketplace/introduction.rst> eSealing <./eSealing/index> Sponsored Transactions <./sponsoredTransactions/index> Smart Contract Upgrade <./smartContractUpgrade/index> diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/add-sft-metadata-url.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/add-sft-metadata-url.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/add-sft-metadata-url.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/add-sft-metadata-url.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/connect-pinata-skip.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/connect-pinata-skip.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/connect-pinata-skip.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/connect-pinata-skip.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/connect-pinata.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/connect-pinata.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/connect-pinata.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/connect-pinata.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/edit-metadata-create.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/edit-metadata-create.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/edit-metadata-create.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/edit-metadata-create.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/fetch-pinata-metadata.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/fetch-pinata-metadata.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/fetch-pinata-metadata.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/fetch-pinata-metadata.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/metadata-nearly-complete.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/metadata-nearly-complete.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/metadata-nearly-complete.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/metadata-nearly-complete.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mint-error.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mint-error.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mint-error.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mint-error.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mint-from-contract-index.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mint-from-contract-index.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mint-from-contract-index.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mint-from-contract-index.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mint-sft-sc.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mint-sft-sc.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mint-sft-sc.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mint-sft-sc.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mint-sft-wallet-conf.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mint-sft-wallet-conf.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mint-sft-wallet-conf.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mint-sft-wallet-conf.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mint-w-metadata.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mint-w-metadata.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mint-w-metadata.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mint-w-metadata.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mint-w-wallet-popup.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mint-w-wallet-popup.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mint-w-wallet-popup.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mint-w-wallet-popup.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-add-metadata-file.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-add-metadata-file.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-add-metadata-file.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-add-metadata-file.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-add-metadata-file1.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-add-metadata-file1.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-add-metadata-file1.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-add-metadata-file1.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-add-metadata-file2.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-add-metadata-file2.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-add-metadata-file2.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-add-metadata-file2.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-clone-repo.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-clone-repo.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-clone-repo.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-clone-repo.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-deploy-new.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-deploy-new.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-deploy-new.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-deploy-new.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-mint-submit.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-mint-submit.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-mint-submit.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-mint-submit.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-mint.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-mint.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-mint.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-mint.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-set-quantity.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-set-quantity.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-set-quantity.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-set-quantity.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-skip-pinata.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-skip-pinata.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-skip-pinata.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-skip-pinata.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-success.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-success.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-success.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-success.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-wallet-sign.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-wallet-sign.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool-wallet-sign.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool-wallet-sign.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/minting-tool.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/minting-tool.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/minting-tool.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-buy-nft-quantity.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-buy-nft-quantity.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-buy-nft-quantity.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-buy-nft-quantity.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-buy-nft-wallet.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-buy-nft-wallet.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-buy-nft-wallet.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-buy-nft-wallet.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-buy-nft.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-buy-nft.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-buy-nft.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-buy-nft.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-bw-account-details.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-bw-account-details.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-bw-account-details.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-bw-account-details.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-bw-transaction-details.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-bw-transaction-details.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-bw-transaction-details.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-bw-transaction-details.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-configure-index.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-configure-index.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-configure-index.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-configure-index.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-configure-mp-flag.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-configure-mp-flag.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-configure-mp-flag.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-configure-mp-flag.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-connect-wallet.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-connect-wallet.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-connect-wallet.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-connect-wallet.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-create-mp.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-create-mp.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-create-mp.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-create-mp.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-deploy-new.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-deploy-new.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-deploy-new.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-deploy-new.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-home-page.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-home-page.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-home-page.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-home-page.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-mint-nft.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-mint-nft.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-mint-nft.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-mint-nft.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-new-mp-contract-index.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-new-mp-contract-index.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-new-mp-contract-index.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-new-mp-contract-index.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-new-mp-wallet.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-new-mp-wallet.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-new-mp-wallet.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-new-mp-wallet.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-details.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-details.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-details.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-details.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-success.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-success.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-success.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-success.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-verify.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-verify.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-verify.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-verify.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-wallet-confirm.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-wallet-confirm.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-wallet-confirm.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-wallet-confirm.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-wallet.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-wallet.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft-wallet.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft-wallet.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/mp-sell-nft.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/mp-sell-nft.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/pinata.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/pinata.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/pinata.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/pinata.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/prepare-sft-metadata-qty.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/prepare-sft-metadata-qty.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/prepare-sft-metadata-qty.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/prepare-sft-metadata-qty.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/set-metadata-url.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/set-metadata-url.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/set-metadata-url.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/set-metadata-url.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/set-token-id-qty.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/set-token-id-qty.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/set-token-id-qty.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/set-token-id-qty.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/upload-images.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/upload-images.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/upload-images.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/upload-images.png diff --git a/source/mainnet/docs/network/images/low-code-nft-framework/upload-set-token-id.png b/source/mainnet/tutorials/low-code-nft-marketplace/images/upload-set-token-id.png similarity index 100% rename from source/mainnet/docs/network/images/low-code-nft-framework/upload-set-token-id.png rename to source/mainnet/tutorials/low-code-nft-marketplace/images/upload-set-token-id.png diff --git a/source/mainnet/docs/network/low-code-nft-marketplace/introduction.rst b/source/mainnet/tutorials/low-code-nft-marketplace/introduction.rst similarity index 97% rename from source/mainnet/docs/network/low-code-nft-marketplace/introduction.rst rename to source/mainnet/tutorials/low-code-nft-marketplace/introduction.rst index adf2b14743..7998eba839 100644 --- a/source/mainnet/docs/network/low-code-nft-marketplace/introduction.rst +++ b/source/mainnet/tutorials/low-code-nft-marketplace/introduction.rst @@ -1,4 +1,4 @@ -.. include:: ../../../variables.rst +.. include:: ../../variables.rst .. _low-code-nft-mp-intro: diff --git a/source/mainnet/docs/network/low-code-nft-marketplace/marketplace.rst b/source/mainnet/tutorials/low-code-nft-marketplace/marketplace.rst similarity index 86% rename from source/mainnet/docs/network/low-code-nft-marketplace/marketplace.rst rename to source/mainnet/tutorials/low-code-nft-marketplace/marketplace.rst index 43116e8550..df3c94a63f 100644 --- a/source/mainnet/docs/network/low-code-nft-marketplace/marketplace.rst +++ b/source/mainnet/tutorials/low-code-nft-marketplace/marketplace.rst @@ -1,4 +1,4 @@ -.. include:: ../../../variables.rst +.. include:: ../../variables.rst .. _low-code-nft-mp: @@ -66,7 +66,7 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod #. Connect to the application with your |bw|. - .. image:: ../images/low-code-nft-framework/mp-connect-wallet.png + .. image:: images/mp-connect-wallet.png :width: 100% :alt: marketplace web page with wallet popup @@ -76,25 +76,25 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod #. Click **Create My Marketplace**. - .. image:: ../images/low-code-nft-framework/mp-create-mp.png + .. image:: images/mp-create-mp.png :width: 100% :alt: marketplace web page with create marketplace highlighted #. A form appears that allows you to create a marketplace instance with two options. First, you can either create a marketplace instance from the one which is already deployed by you. Second, you can create your marketplace contract instance from the smart contract deployed by Concordium. Specify the commission and click **Deploy New**. This calls the initialize function of the marketplace contract and that instance will be your account's. - .. image:: ../images/low-code-nft-framework/mp-deploy-new.png + .. image:: images/mp-deploy-new.png :width: 100% :alt: marketplace web page with deploy new highlighted #. The |bw| presents a pop up and asks for your approval. To approve the traansaction click **Sign & submit**. - .. image:: ../images/low-code-nft-framework/mp-new-mp-wallet.png + .. image:: images/mp-new-mp-wallet.png :width: 100% :alt: marketplace web page with wallet popup shown When the transaction is finalized, you have your own, empty marketplace. You see the contract instance address in the address bar of the browser or you can check it from your |bw| as described in the following. - .. image:: ../images/low-code-nft-framework/mp-new-mp-contract-index.png + .. image:: images/mp-new-mp-contract-index.png :width: 100% :alt: empty marketplace with contract address highlighted in address bar @@ -102,11 +102,11 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod #. Click on an account so that you see the account details and transaction log. - .. image:: ../images/low-code-nft-framework/mp-bw-account-details.png + .. image:: images/mp-bw-account-details.png :width: 50% :alt: concordium wallet for web showing account details - .. image:: ../images/low-code-nft-framework/mp-bw-transaction-details.png + .. image:: images/mp-bw-transaction-details.png :width: 50% :alt: concordium wallet for web showing transaction details @@ -118,19 +118,19 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod Now you have to configure your code base accordingly. Go to your project's folder/market-ui and open the **Constants.ts** file in a code editor. Update the ``MARKETPLACE_CONTRACT_ADDRESS`` with your contract instance address value generated in the previous section. In this file in general you will find all constant files, such as address, schema, and module references. You can find more details about these constant variables in this section. - .. image:: ../images/low-code-nft-framework/mp-configure-index.png + .. image:: images/mp-configure-index.png :width: 100% :alt: constants.ts file open in code editor with address highlighted When you specify the contract instance address value, the template will be interacting with your instance, meaning it will have a clean marketplace like below to remove new instance creation from your marketplace and change the ``CREATE_NEW__MARKETPLACE`` flag to false. - .. image:: ../images/low-code-nft-framework/mp-configure-mp-flag.png + .. image:: images/mp-configure-mp-flag.png :width: 100% :alt: constants.ts file open in code editor with create new marketplace flag highlighted You now have your own marketplace with the commission rate you specified. - .. image:: ../images/low-code-nft-framework/mp-home-page.png + .. image:: images/mp-home-page.png :width: 100% :alt: marketplace home page @@ -140,17 +140,17 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod Click **MINT** in the top navigation bar. You have two options in this step. First, if you already know an NFT contract instance's address and you are the owner, you can specify it in the **Find** section or click to deploy a new button to create a new instance of an already deployed NFT contract. - .. image:: ../images/low-code-nft-framework/mp-mint-nft.png + .. image:: images/mp-mint-nft.png :width: 100% :alt: marketplace home page This opens the |bw| where you click **Sign & submit** to approve the request. After the transaction is finalized you can check your wallet to find out what your token contract instance address is. It is under the **Transaction Log** section and see the details by clicking it. - .. image:: ../images/low-code-nft-framework/mp-bw-account-details.png + .. image:: images/mp-bw-account-details.png :width: 50% :alt: concordium wallet for web showing account details - .. image:: ../images/low-code-nft-framework/mp-bw-transaction-details.png + .. image:: images/mp-bw-transaction-details.png :width: 50% :alt: concordium wallet for web showing transaction details @@ -205,25 +205,25 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod #. At the Connect Pinana screen click **SKIP**. Pinata is described in the next section. - .. image:: ../images/low-code-nft-framework/connect-pinata-skip.png + .. image:: images/connect-pinata-skip.png :width: 100% :alt: marketplace with connect pinata screen #. In the **Set metadata Url** text box, provide the URL that redirects you to the JSON formatted metadata. If you also want to store the hash value of the file check **Include Hash?** but remember this storing extra data on-chain comes with an extra cost. - .. image:: ../images/low-code-nft-framework/set-metadata-url.png + .. image:: images/set-metadata-url.png :width: 100% :alt: marketplace with metadata url screen #. Set the tokenID and the token quantity which has to be 1 to create a unique Non-Fungible Token. Click **DONE**. - .. image:: ../images/low-code-nft-framework/set-token-id-qty.png + .. image:: images/set-token-id-qty.png :width: 100% :alt: marketplace with screen to set token id and quantity #. You see a final screen to review before minting your token. When you click **MINT** your |bw| prompts you for your signature. Click **Sign & submit** to start the transaction. Once it's finalized you will see another pop-up that says **All Minted**. - .. image:: ../images/low-code-nft-framework/mint-w-metadata.png + .. image:: images/mint-w-metadata.png :width: 100% :alt: marketplace with token ready to mint @@ -235,43 +235,43 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod Since IPFS and Pinata are widely used in the space, Concordium NFT Marketplace Template has built-in integration with them. To use this functionality create an API key on the platform and copy the JWT (JSON Web Token) to use in the marketplace while minting. - .. image:: ../images/low-code-nft-framework/pinata.png + .. image:: images/pinata.png :width: 100% :alt: pinata key screen Now paste the API key in the textbox as shown below. - .. image:: ../images/low-code-nft-framework/connect-pinata.png + .. image:: images/connect-pinata.png :width: 100% :alt: marketplace web page with connect to pinata screen shown Click **CONNECT**. When the connection is established, you will be able to upload images either by selecting them from a folder or just dragging and dropping them. You are not limited to uploading 1-2 images, and thanks to the template, the metadata generator is easier than creating one for every item. - .. image:: ../images/low-code-nft-framework/upload-images.png + .. image:: images/upload-images.png :width: 100% :alt: marketplace web page with upload screen shown Set your token IDs and click **Upload** for each. - .. image:: ../images/low-code-nft-framework/upload-set-token-id.png + .. image:: images/upload-set-token-id.png :width: 100% :alt: marketplace web page with selected images to set token id The template's backend will use your API key to upload the data, and retrieves the IPFS link of it and then you will just complete the details about your tokens as described below. - .. image:: ../images/low-code-nft-framework/edit-metadata-create.png + .. image:: images/edit-metadata-create.png :width: 100% :alt: editing metadata and create option for each image Fill out them and the marketplace will create metadata for you when you click **CREATE** for each of the tokens. Specify the quantity as **1** and click **DONE**. - .. image:: ../images/low-code-nft-framework/fetch-pinata-metadata.png + .. image:: images/fetch-pinata-metadata.png :width: 100% :alt: marketplace web page with images and metadata Click **MINT**. Your |bw| prompts you to click **Sign and Submit** to approve the transaction and mint your NFTs. - .. image:: ../images/low-code-nft-framework/mint-w-wallet-popup.png + .. image:: images/mint-w-wallet-popup.png :width: 100% :alt: mint option shown in background dimmed with wallet popup visible @@ -285,7 +285,7 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod The app asks you either to create your own NFT contract instance or provide the contract instance address that you own. Specify your contract address, such as 2319,0. - .. image:: ../images/low-code-nft-framework/mint-sft-sc.png + .. image:: images/mint-sft-sc.png :width: 100% :alt: contract lookup screen in marketplace @@ -295,19 +295,19 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod Click **Find**. When prompted to ontinue with Pinata or metadata option, click **SKIP** and then click **ADD USING METADATA URL**. Paste your metadata JSON file URL in the text box and specify a token ID for your token. Specify the **QUANTITY** of your token which is the amount of this semi-fungible token you will be minting. - .. image:: ../images/low-code-nft-framework/prepare-sft-metadata-qty.png + .. image:: images/prepare-sft-metadata-qty.png :width: 100% :alt: enter quantity to mint screen Click **Metadata URL** in the preview tocheck the created metadata. Click **DONE**. - .. image:: ../images/low-code-nft-framework/add-sft-metadata-url.png + .. image:: images/add-sft-metadata-url.png :width: 100% :alt: add metadata url to sft screen Click **MINT**. Your |bw| prompts you for your signature. Click **Sign & submit** to start the transaction. You can control the information you've provided until this step such as tokenID, owner account, quantity, and URL before minting them. - .. image:: ../images/low-code-nft-framework/mint-sft-wallet-conf.png + .. image:: images/mint-sft-wallet-conf.png :width: 100% :alt: sft minting in marketplace in background with wallet confirmation popup visible @@ -317,19 +317,19 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod #. Navigate to the **BUY** page and you will see the listed NFTs for sale. - .. image:: ../images/low-code-nft-framework/mp-buy-nft.png + .. image:: images/mp-buy-nft.png :width: 100% :alt: marketplace with buy page open #. Click the shopping basket on the NFT you wish to buy. If you are the owner of this asset, instead of a basket you will see a checkmark. It will show you how many available amounts are on sale in this marketplace. Since this is a semi-fungible token you can see below that there are 999 available items with a cost of 10000 CCDs. Specify the amount that you'd like to buy and click **BUY**. - .. image:: ../images/low-code-nft-framework/mp-buy-nft-quantity.png + .. image:: images/mp-buy-nft-quantity.png :width: 100% :alt: marketplace with buy page open and specify quantity popup visible #. In the |bw| pop-up it shows the amount of CCDs required to pay. Click **Sign & submit** to approve the transaction. - .. image:: ../images/low-code-nft-framework/mp-buy-nft-wallet.png + .. image:: images/mp-buy-nft-wallet.png :width: 100% :alt: marketplace with buy page open and concordium wallet for web popup shown @@ -343,36 +343,36 @@ To make it quicker and easier to develop and run an NFT marketplace, the Low-Cod #. Specify the token contract instance address. The token smart contract will have all the tokens minted with their owners and other relevant data. After you specify the token contract instance address click **FIND**. - .. image:: ../images/low-code-nft-framework/mp-sell-nft.png + .. image:: images/mp-sell-nft.png :width: 100% :alt: marketplace with sell page open and fields to enter contract instance address #. When the |bw| pop-up prompts you, click **Sign & submit**. It will check if there is an asset on that particular contract, and then you will give permission to the marketplace contract to act on your behalf when someone wants to buy your asset. The tokens will still be owned by your account. - .. image:: ../images/low-code-nft-framework/mp-sell-nft-wallet.png + .. image:: images/mp-sell-nft-wallet.png :width: 100% :alt: marketplace with sell page open and wallet popup shown #. Enter the token ID to verify that you have some amount of that asset. Click **OK**. - .. image:: ../images/low-code-nft-framework/mp-sell-nft-verify.png + .. image:: images/mp-sell-nft-verify.png :width: 100% :alt: marketplace with sell page open and verification dialog shown #. If you have a balance then the **Add Token** window appears. In this screen, you can specify the CCD amount, royalty percentage (creator commission from all secondary sales on this marketplace), and how many of your assets will be put on sale. For example, if you have minted 10000 Semi-Fungible tokens with this ID you might only have 999 be available to sell. Click **ADD**. - .. image:: ../images/low-code-nft-framework/mp-sell-nft-details.png + .. image:: images/mp-sell-nft-details.png :width: 100% :alt: marketplace with sell page open and token details for the sale #. In the |bw| pop-up click **Sign & submit** to allow the marketplace to sell your assets on your behalf. - .. image:: ../images/low-code-nft-framework/mp-sell-nft-wallet-confirm.png + .. image:: images/mp-sell-nft-wallet-confirm.png :width: 100% :alt: marketplace with sell page open and concordium wallet for web confirmation popup Once finalized, if everything is configured correctly, then you see the digital asset listed in the **Buy** section. - .. image:: ../images/low-code-nft-framework/mp-sell-nft-success.png + .. image:: images/mp-sell-nft-success.png :width: 100% :alt: marketplace with buy page open and nft shown diff --git a/source/mainnet/docs/network/low-code-nft-marketplace/minting-tool.rst b/source/mainnet/tutorials/low-code-nft-marketplace/minting-tool.rst similarity index 91% rename from source/mainnet/docs/network/low-code-nft-marketplace/minting-tool.rst rename to source/mainnet/tutorials/low-code-nft-marketplace/minting-tool.rst index a6a62ae7cb..ec5f8221ca 100644 --- a/source/mainnet/docs/network/low-code-nft-marketplace/minting-tool.rst +++ b/source/mainnet/tutorials/low-code-nft-marketplace/minting-tool.rst @@ -1,4 +1,4 @@ -.. include:: ../../../variables.rst +.. include:: ../../variables.rst .. _minting-tool: @@ -43,7 +43,7 @@ Once you have the above installed, do the following: cd Low-Code-NFT-Framework/mint-ui && yarn install - .. image:: ../images/low-code-nft-framework/minting-tool-clone-repo.png + .. image:: images/minting-tool-clone-repo.png :width: 100% :alt: black screen of code editor with terminal window open at bottom @@ -55,7 +55,7 @@ Once you have the above installed, do the following: It will start the minting screen in the example dApp in ``localhost:3000`` automatically, starting with the dashboard page. -.. image:: ../images/low-code-nft-framework/minting-tool.png +.. image:: images/minting-tool.png :width: 100% :alt: minting tool front page @@ -109,19 +109,19 @@ Concordium provides a `library of sample images you can download `. If you are not the owner of the contract, then you will end up with the error shown below. - .. image:: ../images/low-code-nft-framework/mint-error.png + .. image:: images/mint-error.png :width: 100% :alt: error shown if you are not the owner of the contract you are executing diff --git a/source/mainnet/tutorials/nft-marketplace/images/build-sc.png b/source/mainnet/tutorials/nft-marketplace/images/build-sc.png deleted file mode 100644 index 749ccc3c4e..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/build-sc.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/deploy-sc.png b/source/mainnet/tutorials/nft-marketplace/images/deploy-sc.png deleted file mode 100644 index 90f6142a5b..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/deploy-sc.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/init-sc.png b/source/mainnet/tutorials/nft-marketplace/images/init-sc.png deleted file mode 100644 index baf8e8d712..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/init-sc.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/mp-no-tokens.png b/source/mainnet/tutorials/nft-marketplace/images/mp-no-tokens.png deleted file mode 100644 index b6a53d9c5b..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/mp-no-tokens.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/token-added.png b/source/mainnet/tutorials/nft-marketplace/images/token-added.png deleted file mode 100644 index 238a430055..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/token-added.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/token-contract-view.png b/source/mainnet/tutorials/nft-marketplace/images/token-contract-view.png deleted file mode 100644 index caaf38aa6a..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/token-contract-view.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/token-listed.png b/source/mainnet/tutorials/nft-marketplace/images/token-listed.png deleted file mode 100644 index a13b197888..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/token-listed.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/transfer-success.png b/source/mainnet/tutorials/nft-marketplace/images/transfer-success.png deleted file mode 100644 index 2ebbd2b075..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/transfer-success.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/images/update-operator.png b/source/mainnet/tutorials/nft-marketplace/images/update-operator.png deleted file mode 100644 index a3ca7c7049..0000000000 Binary files a/source/mainnet/tutorials/nft-marketplace/images/update-operator.png and /dev/null differ diff --git a/source/mainnet/tutorials/nft-marketplace/index.rst b/source/mainnet/tutorials/nft-marketplace/index.rst deleted file mode 100644 index abc3550db8..0000000000 --- a/source/mainnet/tutorials/nft-marketplace/index.rst +++ /dev/null @@ -1,25 +0,0 @@ -.. _nft-marketplace-index: - -======================================= -NFT marketplace smart contract tutorial -======================================= - -In this tutorial you will create an NFT Marketplace. The `contract `_ provides some functionalities, such as minting semi-fungible, and non-fungible tokens, buying and selling NFTs with fixed prices, setting commissions for your marketplace, and setting royalties for your NFTs to get some fees from secondary sales in this marketplace. Before you start, it is important to note that this is not a beginner-level tutorial; it does not cover the basics like downloads, node configurations, wallet setup and export, and so on. - -This tutorial will be the first part of the Marketplace. There will be no UI interaction, so you will have to invoke the functions with ``concordium-client``. In the end, while implementing a dApp, what you have to do is implement a client that connects your backend with the blockchain. ``concordium-client`` is that client and does that. - -You can download the contract from `this link `_. The contract is in the ``cis2-market`` folder. Be sure to examine the functions of both the contract file ``lib.rs`` and its helpers. The ``errors.rs`` file contains the custom errors. The ``state.rs`` file includes the state structs of the marketplace and tokens. The ``params.rs`` file includes the parameter structs. Finally, the ``cis2_client.rs`` file contains the marketplace’s client in order to talk with a CIS-2 token contract. In order to call another contract’s function (because the marketplace will need to invoke the transfer() function of the NFT contract to be able to transfer tokens), your marketplace smart contract needs a client. - -This client is a sort of intermediary layer between those two contracts. It allows the parent contract to abstract away the logic of calling the child contract for the methods. Check the client code and see the ``invoke_contract_read_only()`` to understand how contract invocation works from another contract. It needs to implement the functions that you will invoke and requires some parameters, such as the address of the contract, entrypoint, and so on. Basically, the parent has to implement the child's function and provide all necessary inputs. That function connects with the child contract, gets the response, and conveys it to the master contract after deserializing it. - -.. Attention:: - - Before starting the next steps, make sure that you have :ref:`setup the developer environment` with the tools needed. - -To continue with the tutorial, click :ref:`here`. - -.. toctree:: - :maxdepth: 1 - :hidden: - - smart-contract diff --git a/source/mainnet/tutorials/nft-marketplace/smart-contract.rst b/source/mainnet/tutorials/nft-marketplace/smart-contract.rst deleted file mode 100644 index 3f9bc27de8..0000000000 --- a/source/mainnet/tutorials/nft-marketplace/smart-contract.rst +++ /dev/null @@ -1,253 +0,0 @@ -.. _nft-mp-sc: - -=================================== -Build and deploy the smart contract -=================================== - -The flow will be the same as in the previous tutorials. You will build the contract, deploy it, and then create an instance of it. While selling your NFTs, there will be some additional steps. - -Now, you have the smart contract and helpers in your project’s folder. In that folder, create another one called ``dist/marketplace-contract`` for your output files. Then run the command below to build the contract WASM module. Note that we embed the schema in the contract by using the ``--schema-embed`` option. - -.. code-block:: console - - cargo concordium build --out dist/marketplace-contract/module.wasm.v1 --schema-embed - -.. image:: images/build-sc.png - :width: 75% - -Deploy the compiled WASM module with the following command. - -.. code-block:: console - - concordium-client module deploy dist/marketplace-contract/module.wasm.v1 --sender --name --grpc-port 20001 - -.. image:: images/deploy-sc.png - :width: 75% - -Initialize the marketplace smart contract -========================================= - -Create an instance of the marketplace contract with the command below. Look at the ``init`` function. As you can see in the code below, it expects an ``InitParam`` input which will be used to set the commission value in the ``State::new()`` function while initializing your marketplace state. - -.. code-block:: Rust - - /// Initializes a new Marketplace Contract - /// - /// This function can be called by using InitParams. - /// The commission should be less than the maximum allowed value of 10000 basis points - #[init(contract = "Market-NFT", parameter = "InitParams")] - fn init( - ctx: &InitContext, - state_builder: &mut StateBuilder, - ) -> InitResult> { - let params: InitParams = ctx - .parameter_cursor() - .get() - .map_err(|_e| MarketplaceError::ParseParams)?; - - if params.commission > MAX_BASIS_POINTS { - return InitResult::Err(Reject::from(MarketplaceError::InvalidCommission)); - } - - Ok(State::new(state_builder, params.commission)) - } - -Run the following command to initialize the contract. - -.. code-block:: console - - concordium-client contract init market --contract Market-NFT --parameter-json ../sample-artifacts/marketplace/init.json --sender --energy 3000 --grpc-port 20001 - -.. image:: images/init-sc.png - :width: 75% - -UpdateOperator and add token -============================ - -Now you are going to sell your NFT. In order to do that, you need to give the marketplace permission to transfer the token to a particular address. You do this with ``updateOperator()`` function in CIS-2, which is a standard function. What you need to be careful about is that you need to call your token contract with its schema. Then you should be able to do an ``add()`` operation. Go to the sample artifacts and ``update-operator.json`` to change the marketplace address. You are allowing the marketplace contract to act on your behalf. If you want to test the logic behind it, skip this and try to call ``add()`` directly from the contract. It won't work because your token’s state is not updated yet. As you can see below, the ``UpdateOperator()`` function updates the state of the token. - -.. code-block:: Rust - - /// Logs an `UpdateOperator` event. - /// - /// It rejects if: - /// - It fails to parse the parameter. - /// - Fails to log event. - #[receive( - contract = "cis-2", - name = "updateOperator", - parameter = "UpdateOperatorParams", - error = "ContractError", - enable_logger, - mutable - )] - fn contract_update_operator( - ctx: &ReceiveContext, - host: &mut Host, - logger: &mut Logger, - ) -> ContractResult<()> { - // Parse the parameter. - let UpdateOperatorParams(params) = ctx.parameter_cursor().get()?; - // Get the sender who invoked this contract function. - let sender = ctx.sender(); - - let (state, builder) = host.state_and_builder(); - for param in params { - // Update the operator in the state. - match param.update { - OperatorUpdate::Add => state.add_operator(&sender, ¶m.operator, builder), - OperatorUpdate::Remove => state.remove_operator(&sender, ¶m.operator), - } - - // Log the appropriate event - logger.log( - &Cis2Event::::UpdateOperator( - UpdateOperatorEvent { - owner: sender, - operator: param.operator, - update: param.update, - }, - ), - )?; - } - Ok(()) - } - -Now run the command below. - -.. code-block:: console - - concordium-client contract update --entrypoint updateOperator --parameter-json ../sample-artifacts/marketplace/update-operator.json --sender --energy 6000 --grpc-port 20001 - -If successful, you will see something similar to below. - -.. image:: images/update-operator.png - :width: 75% - -Before calling the add function, update your ``sample-artifacts/marketplace/add.json`` file with the *index*, *tokenID*, *price*, *royalty* and *amount*. Now call the ``add`` function with the command below. - -.. code-block:: console - - concordium-client contract update --entrypoint add --parameter-json ../sample-artifacts/marketplace/add.json --sender --energy 10000 --grpc-port 20001 - -Now you have successfully added your token to marketplace. - -.. image:: images/token-added.png - :width: 75% - -To check if the token is in the marketplace, call the ``list()`` function with the command below. - -.. code-block:: console - - concordium-client contract invoke --entrypoint list --grpc-port 20001 - -In the image below you can see that the token is listed. - -.. image:: images/token-listed.png - :width: 75% - -Transfer the token -================== - -Now you are ready to sell it from the marketplace. If you look what it does you see that it takes the ``token_info`` from input, gets the token’s ``quantity``, ``price``, and ``royalty`` values from its state. With 2 ``ensure!()`` it checks first whether the quantity that user wants to buy is sufficient or not and the amount is enough to buy them. Then through ``Cis2Client::transfer()`` it completes the token’s transfer operation, handles the payment with royalties, and removes token from the list. - - -.. code-block:: Rust - - /// Allows for transferring the token specified by TransferParams. - /// - /// This function is the typical buy function of a Marketplace where one account can transfer an Asset by paying a price. - /// The transfer will fail of the Amount paid is < token_quantity * token_price - #[receive( - contract = "Market-NFT", - name = "transfer", - parameter = "TransferParams", - mutable, - payable - )] - fn transfer( - ctx: &ReceiveContext, - host: &mut Host, - amount: Amount, - ) -> ContractResult<()> { - let params: TransferParams = ctx - .parameter_cursor() - .get() - .map_err(|_e| MarketplaceError::ParseParams)?; - - let token_info = &TokenInfo { - id: params.token_id, - address: params.nft_contract_address, - }; - - let listed_token = host - .state() - .get_listed(token_info, ¶ms.owner) - .ok_or(MarketplaceError::TokenNotListed)?; - - let listed_quantity = listed_token.1.quantity; - let price_per_unit = listed_token.1.price; - let token_royalty_state = listed_token.0; - - ensure!( - listed_quantity.cmp(¶ms.quantity).is_ge(), - MarketplaceError::InvalidTokenQuantity - ); - - let price = price_per_unit.mul(params.quantity.0); - ensure!( - amount.cmp(&price).is_ge(), - MarketplaceError::InvalidAmountPaid - ); - - Cis2Client::transfer( - host, - params.token_id, - params.nft_contract_address, - params.quantity, - params.owner, - concordium_cis2::Receiver::Account(params.to), - ) - .map_err(MarketplaceError::Cis2ClientError)?; - - distribute_amounts( - host, - amount, - ¶ms.owner, - &token_royalty_state, - &ctx.owner(), - )?; - - host.state_mut().decrease_listed_quantity( - &TokenOwnerInfo::from(token_info, ¶ms.owner), - params.quantity, - ); - ContractResult::Ok(()) - } - -Run the command below to invoke the ``transfer()`` function. - -.. code-block:: console - - concordium-client contract update --entrypoint transfer --parameter-json ../sample-artifacts/marketplace/transfer.json --sender --energy 6000 --amount --grpc-port 20001 - -Below you can see a successful transfer. - -.. image:: images/transfer-success.png - :width: 75% - -Finally check the marketplace state once more with the ``list()`` function. - -.. image:: images/mp-no-tokens.png - :width: 75% - -And cross check with the token contract’s latest state with its ``view()`` function command below. - -.. code-block:: console - - concordium-client contract invoke --entrypoint view --grpc-port 20001 - -As you can see, the first account has no balance anymore with the given token ID but the second one has. - -.. image:: images/token-contract-view.png - :width: 75%