Submission for: https://gitcoin.co/issue/Zilliqa/Zilliqa/2715/100026477 (1st place winner)
Collective NFT allows NFT owners on Zilliqa network to lock up their NFTs as collateral, and mint fungible tokens representing a share of the locked-up NFTs. This allows them to make their NFTs more liquid and multiple lenders can then have a share. This contract also allows lenders to earn interest.
There are six possible phases for the contract:
- Not started: contract has just been created; no NFT is locked up.
- Active: there is at least one locked-up NFT; lenders can buy tokens.
- Cancelled: owner has cancelled the contract; only possible if there is no token in circulation (most probably nobody had bought any).
- Closed: owner has got enough loan and stopped selling tokens.
- Expired: everything went well; lenders can claim back their loan with interest; owner can unlock all NFTs.
- Null: owner hadn't fulfilled his part of the contract, therefore he has lost all locked-up NFTs.
If you're a developer or auditor, for more details, please visit this page.
Learn: NFT Owner Walkthrough | Lenders Walkthrough
Use: Telegram Bot (testnet) | CollectiveNFT Web dApp
Telegram bot is recommended. You can make your own Telegram bot as well.
1. Deploy CollectiveNFT.scilla with your desired immutables
contract_owner: ByStr20,
name : String,
symbol: String,
decimals: Uint32,
init_price: Uint128,
interest_ratio: Uint128,
burn_ratio: Uint128,
expiration_block: BNum
init_price
is the price of your token in ZIL. If you set it to 2
, each of
your tokens will be sold for 2
ZIL (if decimals = 12
).
interest_ratio
is the percentage of interest buyer will get when the
contract period is over.
burn_ratio
is the percentage of ZIL the contract refunds when burning
tokens before the end of contract period.
For example, if you set it to 70
, the contract will send back 70% of ZIL to
token burners (instead of a full refund).
expiration_block
is the block number at which the contract expires, and
token owners get paid back with interest.
If there is not enough Zil liquidity at that time, contract owner will lose
all the locked NFTs.
The contract will automatically list all received NFTs in a mutable map
(i.e. wrapped_nft
). Anybody can send NFTs to the contract.
Note: You can't mint NFT for the smart contract directly. It won't be
accepted. This is because RecipientAcceptMint
message from the standard
NFT contract doesn't contain token_id
. No corresponding event is emitted
by the standard contract either.
Lenders can call BuyTokens
with some Zil attached to buy your tokens.
CollectiveNFT contract can have six different phases. Learn more about each phase to get a better understanding of how the contract flows.
The contract owner can unlock all NFTs (i.e. send them away to another
address) only if the contract is expired or cancelled. If you locked up
your NFT and didn't sell any token, you can then CancelContract
to be able to
unlock and move your NFT. Cancelling contract is also possible if all buyers
decide to burn their tokens, resulting in total_supply = zero
. Obviously,
when the contract expires and all buyers are paid back, you can move away
your NFT as well.
Please check the walkthroughs for more specific QAs.
-
Let the contract owner set a limit for the amount of loan (Right now there is no hard limit for the maximum amount of loan. The contract owner can close the contract when he thinks he has got enough loan).
-
Check approved spenders of a NFT explicitly to prevent non-standard NFT contracts from manipulating the collateralization (Right now we assume only standard NFT contracts are interacting with this contract).
-
If contract ended up in null status, token owners should be able to move all tokens to one account to unlock the NFTs. (Right now, when the owner loses the NFTs, minted tokens will represent the NFT, and can be traded).
-
Add reminder/notification feature to the Telegram bot and the dApp to notify interested parties when the expiration time is close.