Mint
Mint Fractionalize NFTs
We have deployed fractionalizer and are ready to mint some NFTs as a fraction of another one. We will follow these steps:
Mint a CIS-2 NFT
Transfer NFT to the fractionalizer contract and lock it.
Mint fractions
Check state
Transfer some
Burn all of them
Check the state
Mint a Regular NFT (To be collateralized)
Remember our fractionalization logic starts with collateralizing the CIS-2 NFT. In order to mint a CIS-2 NFT you can follow this tutorial. As previously mentioned in this tutorial, we will use cis2-multi smart contract for minting our token and you can find the full code here. The screenshot below shows only the mint() function. You can find build/deploy processes in the tutorial.
Letâs check the state by calling the view() function below.
Transfer CIS-2 NFT
Nice. We have successfully minted a CIS-2 NFT and now we can transfer it to the fractionalizer contract. In order to do that, you need to call the transfer() function from the tokenâs contract using its index and schema file. Create a JSON file to give the input parameters like the below and specify the fractionalizer contract index value.
Please don't confuse in this part, you need to use the tokenâs schema to change its state. We want to keep both schemas in the same project folder for the sake of the order. That's why we 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 you can call it from that file using the JSON above. We will do it the first way, create a file and copy & paste the schema from cis2-multi.
Run the command below to transfer the token to the fractionalizer.
Nice. Letâs check the token contractâs state.
Super cool! As you can see the fractionalizer contract has one token and our account has the rest.
Now, letâs check the fractionalizerâs state.
Even nicer! As you can see, we have locked the âNFT 01â token as received_token_amount with token_id:01 from the cis2-multi contract.
Mint Fractions
We are ready to mint fractions of it now. Create a JSON file like below.
We need to mint new tokens based on the collateralized one, so specify the exact token_id and contract index. We will specify the amount that sets how many fractions are going to be minted.
Now, letâs check the fractionalizerâs state.
Congrats! You have now locked an NFT and created 1000 fractions that represent the token.
New fractionâs are CIS-2 tokens, you can transfer them or sell them on a marketplace. Anything that can apply to a CIS-2 token is available for these fractions too.
Last updated