Pricing oracle for NFT collections with pricing individual traits On-Chain! This allows to create custom NFT Pawn Shops and price NFTs based on rarity with ability to proof and verify the data.
We've used hacking-scripts to scrape specific collection data of most popular NFT collections to create pricing templates for different traits of NFT tokens.
Then, by utilizing merkle-trees approach we are storing this data inside oracle smart-contract with ability to verify the input based on tokenId and collectionAddress for specific NFTs.
By using ChainLink oracle price feed for collections as a base to get the floor price (https://docs.chain.link/data-feeds/nft-floor-price/addresses) we apply specific percentage for the NFT token trait to keep the pricing value relative to the floor price data and cap it with maximum possible pricing.
This allows us to create custom PawnShop contract with Solidity to call more powerful Traits Oracle and apply a price for different NFT tokens based on their rarity and traits for each token that can be verified on-chain!
As a Demo we've created a contract that allows to borrow funds with NFTs based on the rarity of some traits that shop owner sets relative to floor price. User can repay the loan later on retrieving their NFTs.
We are scraping initial collection data from Alchemy API and storing this all in data folder. This allows us to have data on all tokens and their traits.
Then we parse this data to create unique pricing template for each NFT collection allowing the pricing oracle master (or NFTPawn shop owner) to price specific traits.
After traits are price via providing relative percent (%) to the collection floor price and maximum value shop would accept we generate merkle-tree and store merkle-root in the Oracle contract. This then is applied on top of floor-price that is guaranteed by ChainLink floor price oracle. This way our traits oracle to price NFT tokens relative to the floor price based on each tokens individual trait (if it was priced)
As a result we've used create-react-dapp to produce short demo for allowing users take loans using their NFTs as collateral and utilize ability to price some NFTs higher than the floor price (or below) depending on preference of the shop owner.
The pricing template before merkle-tree gets generates is also uploaded to IPFS for reference of input data and onChain verification