CDR #043: Relative Finance | NFTs Price Feed

INTRODUCTION

Protocol: Relative Finance

Website: relative.fi

Integration: NFT Floor Price oracles on Polygon network

Use case: derivatives trading

Blockchain: Polygon

REQUEST INFORMATION

Assets

The following assets will be included in the Oracle:

Methodology

  • 3 days (lookbackSeconds) Moving Average with 30 minute window (floorWindow) interval will be calculated for each collection
  • 120sec oracle update frequency

DELIVERY INFORMATION

  • Delivery method: Oracle on Polygon mainnet
  • Testnet required: No

NOTES

Additional relevant information: N/A


Thank you for requesting a DIA CDR. We confirm the CDR specifications were requested correctly. Find the oracle / API endpoint below:

Markets

By querying for blockchain and asset, the API provides the markets used for calculating this feed.

API endpoint

By querying for blockchain and asset, the API provides the asset quotation for each asset in the feed.

Oracle

The oracle is deployed and can be accessed here.

You can query for assets by calling the read function getValue() with parameters such as “Ethereum-0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D-Floor". It will return two values:

  1. The price of the asset queried with 8 decimals
  2. The timestamp of the last update

Please make sure to top up the gas wallets very soon, as we only put in some gas to deploy and start the oracle.
Gas wallet: 0xfdf0499fC1b0080472540cACF3FeF5ebf8a09e44

Also make sure they always have sufficient funding.

We deployed the request-based NFT oracle for you.
The oracle delivers the moving average of a collection’s floor price from our API at the requested timestamp.

It is deployed at this address on

To request a price, call the Write function “requestForUpdate()” with parameters assetAddress, blockchain and timestamp.

assetAddress is the address of the collection, e.g., 0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb
blockchain is a string of the chain where the collection resides, e.g., “Ethereum”
timestamp is a unix timestamp (UTC, resolution: seconds), e.g., 1687497100

After the request is posted, our feeder will pick it up and post an update. As soon as the update transaction went through, you can query read function “timebasedvalues()” with a string that represents your query.
For the above-mentioned query the string looks like this:

“Ethereum-0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb-1687497100”

Please be aware that the address formatting in the query string is NOT EIP55, but all lowercase. As it is an actual string in this function, case matters here.

If the request hasn’t been served, the oracle will return null values.

The response format is the following:

  • Symbol: In the case of the NFT oracle it is always “NFT”
  • Address: The address of the collection
  • Blockchain: The blockchain of the collection
  • Price: The moving average of the collection’s floor price (i.e. the value you’re actually interested in), with 8 decimals
  • Time: The timestamp of the API response
  • Signature: A signature from our API that is used in the contract to verify it is an actual DIA update.
  • TimeRequest: The timestamp that was asked in the request

For production later on we recommend to always check the timestamps and the address of the return value.