ADR-54: Use an Oracle for MANA pricing according to USD rate

More details about this document
Latest published version:
GitHub decentraland/adr (pull requests, new issue, open issues)
Edit this documentation:
GitHub View commits View commits on

Statement of the problem

Some features require the user to pay a certain amount of MANA for execution. These features include:

Lately, The community has been using the DAO to define the price in MANA but pegged to the USD dollar. For example, the price per item for publishing a collection has been reduced from 500 MANA to 100 MANA to achieve it.

Proposed solution

Chainlink MANA/USD Data Feed allows our contracts to obtain the rate of MANA in USD on both the Ethereum and Polygon chains. This can be used, given an original price in USD, to calculate how much MANA is required by the user to perform a certain transaction.

For more information about Chainlink go check their homepage or their whitepaper.

In summary, Chainlink is a solution in which via Oracles, one can obtain off-chain data in a tamper-proof and still decentralized manner to be used on-chain.

To implement these price feeds we will create a new contract ChainlinkOracle with a getRate function. This oracle will be consumed by other contracts which require the rate of MANA/USD to reflect a price accordingly. This ChainlinkOracle will receive both a Data Feed (Represented as an AggregatorV3Interface by the Chainlink docs).

A contract consuming this oracle can then do the following calculation to obtain and use/return and amount of MANA converted from USD.

uint256 priceInUSD = 100000000000000000000; // 100 USD
uint256 rate = oracle.getRate(); // 5000000000000000000 -> 5 USD per MANA
uint256 finalPrice = priceInUSD.mul(1 ether).div(rate); // 20000000000000000000 -> 20 MANA

MANA/USD Data Feed addresses






Copyright and related rights waived via CC0-1.0. Living