-
Notifications
You must be signed in to change notification settings - Fork 109
itest: add RPC oracle with spread based asset rates #883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c05b20d to
fc9d94e
Compare
eb2784e to
af9c9bd
Compare
fc9d94e to
28c99fa
Compare
This commit adds a fully configurable RPC oracle that can serve asset rates that differ for buy and sell. We then add a test that shows and asserts proper asset conversion to satoshis and back.
28c99fa to
ba9afdb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Took me a sec to be convinced that the rates are being used correctly but the comments are very thorough.
| var id asset.ID | ||
| copy(id[:], assetID) | ||
|
|
||
| // Let's assume the current USD price for 1 BTC is 66,548.40. We'll take |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great explainers!
| // | ||
| // Example use case: | ||
| // | ||
| // Alice is trying to pay an invoice by spending an asset. Alice therefore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
Depends on #848.
This commit adds a fully configurable RPC oracle that can serve asset rates that differ for buy and sell.
We then add a test that shows and asserts proper asset conversion to satoshis and back.