Skip to content
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

Add SDR calculation #30

Merged
merged 15 commits into from
Sep 17, 2024
Merged

Add SDR calculation #30

merged 15 commits into from
Sep 17, 2024

Conversation

StrathCole
Copy link
Collaborator

@StrathCole StrathCole commented Sep 29, 2023

To address missing price sources for SDR, this implements a price calculation based on the SDR currency basket as a fallback if all sources fail to provide a SDR price.

#28

@StrathCole
Copy link
Collaborator Author

@nghuyenthevinh2000

@StrathCole
Copy link
Collaborator Author

[INFO][Fri, 29 Sep 2023 11:32:58 GMT] [VOTE] Requesting prices from price server http://oracle-price-server:8532/latest
[INFO][Fri, 29 Sep 2023 11:32:58 GMT] [VOTE] SDR price: 1.31140786
[INFO][Fri, 29 Sep 2023 11:32:58 GMT] [VOTE] Create transaction and sign
[INFO][Fri, 29 Sep 2023 11:32:58 GMT] [PREVOTE] msg: ["{\"@type\":\"/terra.oracle.v1beta1.MsgAggregateExchangeRateVote\",\"exchange_rates\":\"0.000098681498928411uaud,0.00008504989229897ucad,0.000057939360514083uchf,0.000460890895542999ucny,0.00044638106543924udkk,0.000059869023246832ueur,0.000051688345703151ugbp,0.000493863209140862uhkd,0.985874431247445781uidr,0.005244884754766129uinr,0.009417307999975601ujpy,0.08526481567545477ukrw,0.0umnt,0.000297061975517121umyr,0.000677504172660115unok,0.00359111915764579uphp,0.000048113150396885usdr,0.000694889466958552usek,0.000086397321100694usgd,0.002314598811439344uthb,0.0utwd,0.000063095963599837uusd\",\"feeder\":\"terra184wr7j2qgpgvk3vqdg79vpvdw5ave2n22ndq9g\",\"salt\":\"ca07\",\"validator\":\"terravaloper1cvypxvg8xa4n34rtk8408p5wxcdchan7fjvwmv\"}","{\"@type\":\"/terra.oracle.v1beta1.MsgAggregateExchangeRatePrevote\",\"feeder\":\"terra184wr7j2qgpgvk3vqdg79vpvdw5ave2n22ndq9g\",\"hash\":\"d574d9d7796a7bc19b117e85de7d0499a5132bba\",\"validator\":\"terravaloper1cvypxvg8xa4n34rtk8408p5wxcdchan7fjvwmv\"}"]

[INFO][Fri, 29 Sep 2023 11:33:03 GMT] [VOTE] Broadcast success 4D967F35E79CEABCFF9D071FA5B431C00CA534CD1D09DF8F0BEC9810AFF73129
[INFO][Fri, 29 Sep 2023 11:33:07 GMT] [VOTE] Included at height: 16358971

Copy link

@faffyswap faffyswap left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏼
Just need to be a bit careful with the testing.

feeder/src/vote.ts Outdated Show resolved Hide resolved
@StrathCole StrathCole changed the title Add SDR calculation Draft: Add SDR calculation Sep 29, 2023
@StrathCole StrathCole marked this pull request as draft September 29, 2023 12:10
@StrathCole
Copy link
Collaborator Author

Looks good 👍🏼 Just need to be a bit careful with the testing.

I reworked it after a suggestion from PFC and moved all logic to the price server.

@StrathCole StrathCole changed the title Draft: Add SDR calculation Add SDR calculation Sep 29, 2023
@StrathCole StrathCole marked this pull request as ready for review September 29, 2023 12:27
@StrathCole
Copy link
Collaborator Author

Alternative or additional approach: aeuser999/test_oracle_feeder@141872a

@inon-man
Copy link

#31 added a fallback provider IMF for SDR/USD

@StrathCole StrathCole merged commit a238d31 into classic-terra:main Sep 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants