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

feat: leverage + historacle #1654

Merged
merged 44 commits into from
Jan 1, 2023
Merged

feat: leverage + historacle #1654

merged 44 commits into from
Jan 1, 2023

Conversation

toteki
Copy link
Member

@toteki toteki commented Dec 12, 2022

Description

Ensure that every MsgBorrow, MsgDecollateralize, and MsgWithdraw is valid under both current and recent historacle prices.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@codecov-commenter
Copy link

codecov-commenter commented Dec 12, 2022

Codecov Report

Merging #1654 (7d867cf) into main (be0b601) will increase coverage by 2.76%.
The diff coverage is 77.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1654      +/-   ##
==========================================
+ Coverage   55.05%   57.82%   +2.76%     
==========================================
  Files          73       73              
  Lines        7523     7587      +64     
==========================================
+ Hits         4142     4387     +245     
+ Misses       3053     2857     -196     
- Partials      328      343      +15     
Impacted Files Coverage Δ
x/leverage/keeper/supply.go 45.23% <57.14%> (+5.95%) ⬆️
x/leverage/keeper/oracle.go 62.96% <72.00%> (-1.17%) ⬇️
x/leverage/keeper/keeper.go 69.10% <75.00%> (+2.82%) ⬆️
x/leverage/keeper/grpc_query.go 62.55% <76.92%> (+0.16%) ⬆️
x/leverage/keeper/borrows.go 79.66% <77.50%> (-1.83%) ⬇️
x/leverage/keeper/msg_server.go 81.49% <79.66%> (+74.69%) ⬆️
x/leverage/keeper/collateral.go 66.03% <100.00%> (ø)
x/leverage/keeper/iter.go 60.86% <100.00%> (ø)
x/leverage/keeper/limits.go 43.01% <100.00%> (+1.89%) ⬆️
x/leverage/keeper/liquidate.go 83.62% <100.00%> (ø)
... and 4 more

@adamewozniak
Copy link
Collaborator

@toteki would you like a review here? Is it just in draft because we haven't cut v3.3 yet?

@toteki
Copy link
Member Author

toteki commented Dec 20, 2022

@adamewozniak I've got a massive diff locally on the unit tests that I need to finish first - then a few other things to clean up (modify QueryMaxWithdraw to do both prices, add a parameter) and I'll mark R4R.

Also some new queries (as opposed to modified above) will be a separate PR

@toteki toteki marked this pull request as ready for review December 21, 2022 16:00
@toteki toteki requested a review from a team as a code owner December 21, 2022 16:00
x/leverage/keeper/borrows.go Outdated Show resolved Hide resolved
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

thanks for adding tests. I suggest to make them more readable by breaking down repeated code into reusable functions.

x/leverage/keeper/oracle.go Show resolved Hide resolved
x/leverage/keeper/msg_server_test.go Outdated Show resolved Hide resolved
x/leverage/keeper/msg_server_test.go Show resolved Hide resolved
x/leverage/keeper/msg_server_test.go Show resolved Hide resolved
x/leverage/keeper/msg_server_test.go Show resolved Hide resolved
x/leverage/keeper/msg_server_test.go Outdated Show resolved Hide resolved
x/leverage/keeper/msg_server_test.go Outdated Show resolved Hide resolved
x/leverage/keeper/msg_server_test.go Outdated Show resolved Hide resolved
x/leverage/keeper/oracle.go Show resolved Hide resolved
x/leverage/keeper/oracle_test.go Show resolved Hide resolved
@toteki
Copy link
Member Author

toteki commented Dec 29, 2022

Extracted style comments to new issue
#1681
to accelerate review

@toteki toteki requested a review from a team as a code owner December 30, 2022 02:57
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

utACK. The main change is here: https://github.com/umee-network/umee/pull/1654/files#diff-9257a67f3050fe241bb803e3f669921d63c9091d7fe50d3c243d5bf255d96c7aR21
Minimum tests have been added to cover the historacle case.
We discussed to add more unit tests as well as reduce code duplication in tests in a followup PR.

@mergify mergify bot merged commit 7263edc into main Jan 1, 2023
@mergify mergify bot deleted the adam/hist branch January 1, 2023 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants