2

I need a way to pass an arbitrary ERC-20 token symbol and get a price for it in return. The Solidity interface should look something like this:

function getPrice(string memory symbol) external view returns (uint256);

I browsed through the Chainlink docs but I didn't find something that answers my question. I only saw bespoke instances of asset price aggregators, like this contract that provides ETH/USD data on Kovan.

Does Chainlink provide an aggregator contract for AggregatorV3Interface instances?

1 Answer 1

1

It looks like you're looking for an on-chain mapping of Symbol -> USD price.

I'm not sure it makes sense to aggregate aggregators if you're looking for an interface as described.

You have two options to get a mapping of Symbol -> USD Price.

  1. Create the mapping yourself This is what Aave currently does

It would be nice if there was a library for all this... which leads us to #2

  1. Use ENS

This way you can just append the Symbol of the string you want to -usd.data.eth

ie, if you want ETH / USD:

eth-usd.data.eth

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.