implement suggested exchange rate feature
noot opened this issue · 2 comments
currently, to make an offer, you must provide an exchange rate for the swap. this requires the user to manually calculate it themselves. it would be nice to add a subcommand for fetching a suggested exchange rate from an external API (coingecko or something like that?) this would be pretty centralized (unless we hit up many APIs and average them), so this should also notify the user to double check that they're okay with the rate.
Chainlink has oracle services for aggregated on-chain data feeds that are easy to query from an Ethereum node: https://data.chain.link/ethereum/mainnet
Since we already require access to an Ethereum node, this might be a reasonably decentralized solution that in addition minimizes any privacy issues. There is an XMR-USD feed we could use.
The XMR-USD feed is updated every time the price deviates by 1% or every 24 hours and just requires a call to latestRoundData()
at contract 0xFA66458Cce7Dd15D8650015c4fce4D278271618F.