Copy .secret.template to .secret and fill in private keys of wallets required for deployment. NEVER share these keys unless you truly understand the risks.
Run yarn flatten first to merge Solidity sources.
Run yarn compile to compile the contracts (this includes flatten step).
Run yarn dev to start ganache dev blockchain
Run yarn test to do all the tests and simulations (can take up to 30 minutes to complete)
- Each REIT NFT represents a fund certificate, so it has to have the functionalities of a fund certificate.
- The purpose of REIT NFT smart contract is to record the ownership of shareholders and to pay dividends and clearances in crypto currencies to them.
- The INO smart contract is used for initial offering of REIT NFT.
- The governor can assign administrator roles for some parts of the smart contract. The primary role of governor is to withdraw funds to trusted addresses. Normally governor wallet is multi-sig and requires several approvals from Board of Director members to execute.
- Administrator govern less critical parts of the smart contract like KYC, Loyalty Program, Whitelisting.
- REIT NFT creator manages a REIT Fund. There can be many REIT NFT creators that manage many different REIT funds.
- Creation and initiation of REIT NFT.
- Initial NFT offering event where investors can buy REIT NFT at initial unit price.
- REIT NFT creator (manager) pays yield dividends at aggreed timings.
- REIT NFT shareholders claim the yield dividends any time they want.
- REIT NFT creator pays the clearance shares.
- REIT NFT shareholders claim their clearance shares and forfeit all NFT ownership.
- Investors can stake MEI tokens to gain better loyalty level.
- Main benefits of loyalty program are: higher purchase limit at INO and lower transfer tax.
- When transfer REIT NFT, it is required to pay for transfer tax. The tax rate depends on the loyalty level of REIT NFT holder.
- The final owner of the REIT NFT is payer of the transfer tax.
- If 2 wallets are KYC-ed to be the same people, they can transfer without tax.
- All yield dividends except the clearance shares are given to the previous owner before the transfer happens.
- Run
deploy:usd:testnetto deploy testnet mock USD for testing. This will create 3 mock stable-coins: MUSDT, MUSDC and MBUSD. - Run
deploy:nft:testnetto deploy the NFT smart contract. This is the core contract of REIT NFT. - Run
deploy:ino:testnetto deploy the INO smart contract. This is the contract that do the Initial NFT Offering.
- Deployment needs to be done before this step.
- Run
npx hardhat setupTestnet --network testnet --id 1in order to setup the REIT NFT and a sample INO. Detail steps can be found in comments of the source filetools/setupTestnet.js.
- First, NFT creator needs to add an account to KYC list by calling
addToKYC. - The account can call
purchaseWithTokento INO smart contract to buy to REIT NFT afterward. - If
purchaseWithTokenis done before KYC, the holder needs to be KYC-ed and then callclaimPendingBalancesto INO smart contract to unlock their NFTs.
- After a while, it is mandatory for REIT NFT creator to pay dividends to the share-holders.
- Run
npx hardhat testPayDividend --time 0 --network testnet, with time being the time index of the payment. Details is explained in the source filetools/testPayDividend.js - NFT share holders can run function
claimDividendsto get their share.
- When it is time to clear the asset and pay back capital and profits to share-holders, the REIT NFT creator will fund the liquidations.
- Run
npx hardhat testPayLiquidation --amount 1000000 --share 20 --network testnet, with share being the liquidated value of each share. Details is explained in the source filetools/testPayDividend.js - NFT creator will run
allowLiquidationClaimsto allow several accounts to claim the clearance (this is to further protect the funds from unknown possible vulnerabilities). - Allowed accounts can run
claimLiquidationsto get their final clearance shares.
BSC Testnet: https://testnet.binance.org/faucet-smart