MOPS is the package manager akin to NPM in node. If the participants have installed and it works then the DeComm NFT canister will work.

The NFTCanister (directory) contains 4 files:

Once users are comfortable with the workflow of how NFTs work. They can then refactor the main DeComm aaplication.

There are several ways to implement this based on how the participants would like to approach it. One way (but not the only way!) is to refactor the main code base allowing sellers to define their own NFT which can be bought with the Knowledge Token and buyers to be subowners of the Knowledge Token NFT once they have purchased the product.

  1. Import the NFTCanister in the main/main.mo. (Define it as a dependency for the backend in dfx.json).

  2. A seller will invoke the createProduct from the frontend. Define a new NFT which can be done in a similar fashion to the test_create_collection. Passing it arguments rather than being hard coded.
    1. In the backend createProduct function take in the (_msg) message caller as an argument or any sort of identifier that can be used to identify that the user will be the owner of the NFT.
    2. Create the product and once the product has been created successfully, call the relevant function in NFTCanister/main.mo in this case a modified test_create_collection that takes in arguments and pass it the relevant arguments such as the name of the NFT the url of the image etc.
    3. Then mint the NFT and verify that it has been minted.
    4. Return true to the user if the above step has been done successfully.

  3. A buyer would like to purchase the NFT:
    1. Once a user invokes the purchase method, call the relevant function from NFTCanister/main.mo which will add the person who purchased the NFT to be added as a the new owner or a subowner of the NFT.
    2. This can be done in a similar fashion to the test_workflow function. Where they can use the same exact function modify it a bit in order to take arguments such as an identifier of who is purchasing the NFT.
      1. The token can either be transfered to that buyer or they can be added as a subowner. Code it as you see fit.
    3. You can call the relevant NFT functions in the for loop of the purchase method in the main/main.mo

  4. I'm emphasizing the importance of the test_workflow and test_create_collection here. As deploying them and running them through the candid UI will better help you visualize how the whole process works.

  5. Lastly get acquainted with identifiers such as the _msg, pricinpals, and Principal.fromActor(this), ICRC7.Account, etc... These are all key identifiers on who calls the functions and who owns or will be the owners of the NFTs.