yearn-api-archived icon indicating copy to clipboard operation
yearn-api-archived copied to clipboard

remove coingecko api calls for Price and use an on-chain source

Open miguel567 opened this issue 4 years ago • 3 comments

on the holdings/save endpoint we are using coingecko. Let's use an on-chain source.

miguel567 avatar Dec 05 '20 16:12 miguel567

https://etherscan.io/address/0x73353801921417f465377c8d898c6f4c0270282c#readContract

This is Keep3r's on-chain oracle; you can see the pairs here: https://feeds.uniquote.finance

We could ask Andre to update this any future pairs that Yearn may need (such as zLOT).

All current volatile pairs we need price data for (YFI, LINK, ETH, WBTC, CRV) are already supported.

dudesahn avatar Dec 05 '20 19:12 dudesahn

Code will be simple:

Note: WETH, YFI, CRV, LINK have 18 decimals, WBTC has 8, USDC has 6

WETH: current(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 1000000000000000000, 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)/1e6

WBTC: current(0x2260fac5e5542a773aa44fbcfedf7c193bc2c599, 100000000, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)/1e18*WETH

YFI: current(0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e, 1000000000000000000, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)/1e18*WETH

CRV: current(0xd533a949740bb3306d119cc777fa900ba034cd52, 1000000000000000000, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)/1e18*WETH

LINK: current(0x514910771af9ca656af840dff83e8264ecf986ca, 1000000000000000000, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)/1e18*WETH

dudesahn avatar Dec 05 '20 19:12 dudesahn

https://hackmd.io/@dudesahn/BkxKfTzqw#Prices-on-chain-from-Uniquote

miguel567 avatar Dec 06 '20 11:12 miguel567