Mint
This section will demonstrate the process of minting and fractionalizing NFTs.
Minting Fractionalized NFTs
In this tutorial, you'll learn how to mint fractionalized NFTs (Non-Fungible Tokens) using the Concordium blockchain. Fractionalizing NFTs involves splitting them into smaller fractions, allowing for shared ownership and trading of digital assets.
Follow the steps below to mint fractionalized NFTs.
Step 1: Mint a CIS-2 NFT
Follow the tutorial to mint a CIS-2 NFT using the
cis2-multi
smart contract.Use the
mint()
function within thecis2-multi
contract. The screenshot below shows only themint()
function:
Check the state by calling the
view()
function with this command:
When you run the command, you should see the following in your terminal:
Step 2: Transfer the NFT to the Fractionalizer Contract
You have successfully minted a CIS-2 NFT, and can now transfer it to the fractionalizer contract. To do that, follow these steps:
Call the
transfer()
function from the token's contract using its index and schema file.Create a JSON file with input parameters specifying the token ID, amount, sender, receiver (fractionalizer contract), and any additional data:
Note the following:
You need to use the token’s schema to change its state.
Keep both schemas in the same project folder for the sake of organization.
You created a section for the cis2-multi contracts schema file, so you can either copy the schema file from cis2-multi to your fractionalizer directory or call it from that file using the JSON provided above.
You are creating a file and copying and pasting the schema from cis2-multi.
Run the following command to transfer the token to the fractionalizer:
When you run the command, you will see the following in your terminal:
Check the token contract’s state:
Notice that the fractionalizer contract has one token and your account has the rest.
Check the fractionalizer’s state:
Notice that you have locked the “NFT 01” token as received_token_amount with token_id:01 from the cis2-multi contract.
Step 3: Mint Fractions
Now, you can start minting fractions of it. Use the following steps:
Create a JSON file specifying the owner, token details (ID, amount, metadata), and contract index:
Mint new tokens based on the collateralized one using the
mint()
function by specifying the exact token_id and contract index:
When you run the command, you'll see the following in your terminal:
Check the fractionalizer’s state with the following command:
When you run the command, you'll see the following:
Note: New fraction’s are CIS-2 tokens, you can transfer them or sell them on a marketplace. Any functionality applicable to a CIS-2 token extends to these fractions as well.
You've now locked an NFT and created 1000 fractions that represent the token.
Last updated