yearn / yearn-api-archived

Collection of serverless API
23 stars 24 forks source link

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

Open miguel567 opened 3 years ago

miguel567 commented 3 years ago

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

dudesahn commented 3 years ago

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 commented 3 years ago

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

miguel567 commented 3 years ago

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