This is a simple project illustrating the fractionalization of an ERC721 with ERC20 tokens.
On a high level, the process is as follows
- A
collectorowns anERC721from a particularcollection - The
collectordeploys theFractionalizercontract which is a modifiedERC20 - The
collectorapproves theFractionalizecontract to transfer theirERC721 - The
collectorthen calls thefractionalizemethod on the deployedFractionalizercontract - The
collectorreceives a specified number ofERC20tokens denoting 100% ownership of theERC721 - The
ERC721is transferred from thecollectorto theFractionalizercontract - The
collectorcan then sell theERC20tokens on the market via AMM or similar - The
collectorcan choose to list theERC721for sale for a specified price in ETH
- The
holderpurchasesERC20tokens on the market as a representative share of ownership - If the
ERC721is sold to thebuyertheholdercan redeem theirERC20tokens forethbased on their ownership ratio from theFractionalizercontract.
- The
buyerpurchases the listedERC721for the price in eth and transfers it to theFractionalizercontract. - If the
buyersomehow is able to acquire all the tokens on the market, they can justredeemall of them for the nft itself. This is probably a low possibility, though. I just included it as it was in the specs.
# Install dependencies
npm i
# Setup .env
mv .env.example .env
# Run Tests
npx hardhat test
# Make sure you update the .env with your Goerli pk
# Deploy to Goerli
npx hardhat deploy --network goerli
# Verify contract
npx hardhat verify-contract --network goerli --address <deployed address>
- The
ownerof theFractionalizershould be a third party - not thecollector. I just did it this way for thecollectorto deploy their own fractionalization implementation. - The sale price should be a weighted average of a price indicated by
holdersbased on their token holdings. ie. Ifholder aholds half the supply, their price should weigh more thanholder bwith a quarter of the supply. I had thecollectorset the price for simplicity in the example.
- Implement a
factorythat uses theminimal proxypattern to reduce gas costs if we are deploying a single contract per fractionalized nft. - See weighted average price issue above
- Maybe use an auction style of sale?
- Research adding
withdrawfunctions for nft/tokens to prevent unexpected locking within contract - If
Fractionalizeris managed by a third party, add acuratorfee - Potentially add
permiteip draft for gassless approvals