8000 Oracle index by DrPresident · Pull Request #143 · securesecrets/shade · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Oracle index #143

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

Merged
merged 11 commits into from
Dec 14, 2021
Merged

Oracle index #143

merged 11 commits into from
Dec 14, 2021

Conversation

DrPresident
Copy link
Collaborator
@DrPresident DrPresident commented Dec 9, 2021

Initial testing looks good, I can test more thoroughly once we have BAND on pulsar-1. Currently uses a basic weighted average

price | weight
1.00  | .5
7.5    | .5
sum((price * weight), ...) / total_weight = price
((1.0 * .5) + (7.5 * .5)) / (.5 + .5) = 4.25
price | weight
1.00  | .2
7.5    | .5
sum((price * weight), ...) / total_weight = price
((1.0 * .2) + (7.5 * .5)) / (.2 + .5) = 5.642857142857143

I used this site to build test cases https://www.rapidtables.com/calc/math/weighted-average-calculator.html
This still needs testing with sswap pairs and such, but using band it is working well

@DrPresident DrPresident changed the base branch from main to dev December 10, 2021 00:25
@@ -0,0 +1,62 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the indexes are self contained equations, could you make unit tests in addition to these integration tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically all the functions require queries to either band or secretswap

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could those functions be moved into individual functions so you can spoof that data?

@FloppyDisck FloppyDisck added the oracle New feature or request for the oracle contract label Dec 13, 2021
Co-authored-by: Guy S Garcia <34169809+FloppyDisck@users.noreply.github.com>
@DrPresident DrPresident merged commit 73b506a into dev Dec 14, 2021
@DrPresident DrPresident deleted the oracle-index branch December 14, 2021 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
oracle New feature or request for the oracle contract
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0