Fractional NFTs Give Security to Real Estate Trading

 

Smart Contract of a non-fungible token (NFT) or ERC721:

A set of instructions deployed on the Ethereum (or Ethereum-compatible) blockchain, containing data and mathematical expressions as functions, one of the functions allows the creation of unique and non-exchangeable (non-fungible) items. For example:

CryptoZombie_game NFT: We illustrate a code segment of a _createZombie () function that creates a game item called zombie:

Here are screenshots of three NFTs from this game:

The isOwner () function recognizes who is the owner of the NFT.

At the end of the SC, it will send the NFT to the owner through a cryptocurrency such as Metamask, in an account or Address.

NFT of an asset such as Real Estate: Real estate is a good candidate for tokenization as an NFT. Instead of holding title to the property with the attorney, the owner can create an NFT to represent the owner.

There are three important terms used in this article:

Owner or owner of the Smart Contract: his is the individual or legal entity responsible for the property that commissions the developers to create 1 NFT of that property, which we will call FNFT.

  • Partner or co-buyer: People who buy participation through shares or tokens, which we will call fnft.

  • Share: A share represents an interest equal to one fnft.

The Owner and co-buyers must each have an Ethereum blockchain account or address that will receive the tokens. In the end we will have an example involving one Owner and three co-buyers, four Ethereum accounts or addresses.

 

Step 1: Organize the property data in a JSON (JavaScript Object Notation) file:

  • JSON is used to structure data in text form.

It allows the exchange of information between applications in a simple, light and fast way.

The JSON file is assigned to the metadataNFT variable:

 

Step 2: With a web3 API (in JavaScript or Python) you will:

  • It sends the file to the Interplanetary File System (IPFS), which is a decentralized file system that seeks to ensure the security, privacy and censorship resistance of your data.

  • In IPFS, the metadataNFT file is assigned a TokenURI that uniquely identifies it. The URI is a unique network Uniform Resource Identifier (IPFS).

 

Step 3: now the property information file is available to be retrieved with a JavaScript program and used anywhere in the world for:

  • Publish the FNFT data of the property in a Marketplace such as open Sea.

  • Use the file in a ERC721 Smart Contract.

 

Step 4: Two ERC721 SCs are used to generate the FNFT representing ownership and the fnft representing shares:

  • fractionalNFT.sol

  • fractionalClaim.sol

Smart contract fractionalNFT.sol

This SC has data, variables and functions. Below, we present a data structure and four functions:

The _fnft data structure {}: fnft tokens are represented by an identification number tokenId and an address of the smart contract that mints or creates them.

The Constructor (): is a special function that allows:

  • Name the token “FractionalNFT” (your NFT will have its own name).

  • The symbol that identifies the “FNFT” token (your NFT will have its own symbol).

The safeMint () function assigns the FNFT token to the owner's account to.

The transferFNFToken function allows the owner to transfer participation shares or fnft tokens to co-buyers:

  • Account or Address of a co-buyer _to.

  • The metadata of the FNFT identified with the unique link _tokenURI.

  • The amount of shares to buy _amount for each co-buyer.

The mint () function allows creating or mining shares or fnft tokens (ERC20 tokens) to the address of the contract owner:

From line 66 to 68 assign:

  • The Address of the contract owner _to.

  • The unique binding tokenURI_.

  • _totalFractionalTokens is equal to the total fnft tokens.

From lines 72 to 77 the SC performs the tasks: (only the owner of the contract or property can do it).

  • Line 72 starts the creation of the fnft tokens (TokenERC20) associated with the property's actions.

  • Line 73, in the account of the contract owner msg. sender, the SC mints and sends the fnft tokens. The amount minted is _totalFractionalTokens. If the property has ten shares the SC mints ten fnft tokens, if it has one hundred shares the SC mints one hundred fnft tokens.

·         In lines 76 and 77, the SC address of the fnft tokens is linked to the SC address of the FNFT token.

So far, the first SC has created 1 FNFT token representing ownership and the number of fnft tokens representing shares.

Smart contract fractionalClaim.sol

This SC executes the task of distributing the fnft tokens, which it does in three stages or states assigned to the ClaimState variable:

  • Start of distribution.

  • acceptance of the distribution.

  • Closing of the distribution.

Stage 1. Start of distribution:

The Constructor ():

  • This contract receives from the previous contract the fnft tokens represented by the number tokenID and the Address fractionalToken:

  • The owner of this second contract must be the same as the first, through the Address msg. sender.

  • With these three parameters, the contract starts the distribution (line 8).

Stage 2.- acceptance or execution of the distribution.

The fund () function:

  • Create the ERC20 token supply using the supply variable (line 19).

  • Indicates the address of the tokenAddress token (line 17).

  • The value or amount of funds, the SC assigns to the owner's address msg.value.

  • Issues a notification that funds are available funded () (line 20).

  • The SC with these data reaches the state of claimState = acceptance (line 18).

Stage 3.- Closing or completion of the distribution:

The claim () function:

  • In line 27, the contract owner msg. sender, delivers to the co-buyer Address(this), the amount of shares:

  •  Or tokens purchased (zeroes represent the eighteen decimal places assigned to tokens).

  • The SC for each fnft share or token delivered to each co-buyer burns or eliminates it, so that it is impossible to deliver the same fnft share or token twice to another buyer.

  • When the SC delivers all the fnft tokens (line 30) it is closed, and only the first SC (fractionalNFT.sol) can perform transactions with the fnft tokens.

 

Step 5: Example of Smart Contract implemented in the Ethereum ropsten testnet:

The first SC fractionalNFT.sol can be viewed in Etherscan's ropsten explorer:

  • Address Contract:
    0x628E055d8ad209eC15aBaD0B1EC0529B45FCc2fa

  • Name of the token: FractionalNFT

  • Supply: 1 FNFT.

  • Address or account of the owner of the project:
    0x02d4806b89913ed833010ac3282be2eaac2d2bae

  • Transactions: 1.

The second SC fractionalClaim.sol can also be viewed in Etherscan's ropsten explorer:

  • Address Contract: 0xfBc0120197DA5Aa78e6336feC2790F767645e53c

  • Token name: FNFToken.

  • Supply: 0 FNFT (this SC is not the creator but the distributor)

In the transactions of this second SC, we find:

  • An In transaction that receives the 4 fnft tokens when they are minted.

  • Three OUT transactions that send the fnft to the co-buyers.

  • Note that a co-buyer receives 2 fnft tokens that is 2 parts of 4 in which the property is divided.

Finally, the owner can see in his Metamask wallet:

  • The FNFT touch that represents ownership.

  • ·The 4 fnft tokens (Etherscan and Metamask represents it as FNT) that represent the 4 parts or shares to be sold.

  • From your wallet to each co-buyer or fraction owner to the address they credited.

  • The co-buyer receives the amount of fnft tokens (FNT) in his Metamask wallet.

 
Carlos Sampson