Price Oracle

How Pawnfi gets token price for Cross-Margin Lending Market

Similar to Aave and Compound, Pawnfi Non-Custodial Lending Market relies heavily on oracle price feeding to provide the real-time price reference for underlying tokens. These prices are related to collateral value, borrowing amount, and when to trigger liquidations.

P-Token Price Feeding

By design, P-Token price should come directly from Uniswap Oracle based on its trading behavior. However, due to the possible low trading volume and liquidity at the beginning of P-Token coming up in the market, it makes sense to have a proxy mechanism to serve as a P-Token price reference in Pawnfi Lending Market.

In Pawnfi, one NFT always equals 1,000 corresponding P-Token (please see Key Vehicle: P-Token for more information). That is, the underlying NFT floor Price will be the best proxy of the P-Token price. Specifically, in the beginning, use Chainlink's NFT Price Oracle as a core enhancement and safety-focused primitive for proxy price feed for P-Token in Lending Market. For some NFTs that haven't been supported by Chainlink, Pawnfi will rely on Pawnfi NFT oracle to fetch NFT floor price from OpenSea, LooksRare, X2Y2 and other trading markets. Gradually, when the P-Token market becomes more mature, Pawnfi will put more weight on Uniswap Oracle to provide the most accurate P-Token price.

P-Token Price = X% x Oracle Price/1,000 + (1-X%) x Uniswap Oracle Price

Pawnfi NFT oracle design and running mechanism:

  1. The off-chain node obtains the raw floor price of NFTs from OpenSea, LooksRare, X2Y2 and other trading markets;

  2. Filter the raw floor price data, such as driving out outliers;

  3. Calculate the floor price according to a pre-defined formula: X*OpenSea floor price + Y*LooksRare floor price + Z*X2Y2 floor price + K*Other trading markets;

  4. Calculate the time-weighted average price (TWAP) off-chain to weight the floor price within certain time frame, and call the contract interface to upload the floor price to the on-chain contract;

  5. On-chain contract will perform another time-weighted average to weight the floor price, ensuring the final price feed is reasonable;

  6. After dividing the final price feed by 1,000, we will get the P-Token price from Pawnfi NFT oracle.

NFT/ P-Token Price Feeding

Other ERC-20 Token Price Feeding

For the following tokens, we use price feed provided by Chainlink:

  • ETH

  • WBTC

  • USDT

  • USDC

  • DAI

  • stETH

sAPE Price Feeding

In the case of sAPE, which represents staked APE within the Pawnfi APE Pool, our approach to obtaining its price feed differs.

  1. Initially, we utilize the APE price feed supplied by Chainlink.

  2. Subsequently, we apply the exchange rate between APE and sAPE to ascertain the final sAPE price.

Please note: The generation of sAPE is similar to iToken in Pawnfi lending market. sAPE accrues interest through their exchange rate — over time, each sAPE becomes convertible into an increasing amount of APE supplied in Pawnfi APE Pool, even while the amount of sAPE in your wallet stays the same.

As a trusted provider of reliable price oracles for leading DeFi and crypto protocols, Chainlink has facilitated over $6.7 Trillion in transactions. Chainlink Labs and Coinbase have recently filled a crucial void in the NFT-Fi sector by launching their first NFT Floor Price oracle feeds. Despite some limitations, these NFT Collection Floor Prices provide a sturdy foundation for NFT borrowing and lending, as affirmed by our research.

We’re excited to announce that Pawnfi has integrated Chainlink to help access accurate and reliable NFT floor price data for leading NFT collections. By integrating the decentralized oracle network, Pawnfi has access to high-quality, tamper-proof NFT floor price information needed to conduct collateral calculation on a more accurate and fair basis so as to secure user's rights and interests.

About Chainlink

Chainlink is the industry-standard Web3 services platform that has enabled trillions of dollars in transaction volume across DeFi, insurance, gaming, NFTs, and other major industries. As the leading decentralized oracle network, Chainlink enables developers to build feature-rich Web3 applications with seamless access to real-world data and off-chain computation across any blockchain and provides global enterprises with a universal gateway to all blockchains.

Learn more about Chainlink by visiting chain.link or reading the developer documentation at docs.chain.link.

Last updated