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!: MaxBorrow query and modify MaxWithdraw to return all denoms #1683

Merged
merged 12 commits into from
Jan 5, 2023

Conversation

toteki
Copy link
Member

@toteki toteki commented Jan 3, 2023

Description

In addition to the existing historacle-enabled MaxWithdraw query, this PR implements the following:

  • MaxBorrow

In addition, the Denom field in those queries is now optional, and they return sdk.Coins instead of sdk.Coin. If denom is not specified, calculates max borrow/withdraw for ALL registered tokens.

See proto file for query urls and data types.


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 Jan 3, 2023

Codecov Report

Merging #1683 (dd08df6) into main (13745da) will increase coverage by 0.15%.
The diff coverage is 61.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1683      +/-   ##
==========================================
+ Coverage   57.82%   57.97%   +0.15%     
==========================================
  Files          73       73              
  Lines        7589     7821     +232     
==========================================
+ Hits         4388     4534     +146     
- Misses       2858     2934      +76     
- Partials      343      353      +10     
Impacted Files Coverage Δ
x/leverage/types/query.pb.gw.go 0.00% <0.00%> (ø)
x/leverage/keeper/limits.go 50.00% <51.61%> (+6.98%) ⬆️
x/leverage/keeper/oracle.go 62.93% <62.50%> (-0.04%) ⬇️
x/leverage/keeper/grpc_query.go 64.84% <72.60%> (+2.29%) ⬆️
x/leverage/client/tests/tests.go 100.00% <100.00%> (ø)

@toteki toteki marked this pull request as ready for review January 3, 2023 18:41
@toteki toteki requested review from a team as code owners January 3, 2023 18:41
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.

  • Let's simplify and merge All* queries by making the denom optional and always returning a list.
  • let's write at least one simple test for the Query RPC.

proto/umee/leverage/v1/query.proto Outdated Show resolved Hide resolved
proto/umee/leverage/v1/query.proto Outdated Show resolved Hide resolved
proto/umee/leverage/v1/query.proto Outdated Show resolved Hide resolved
proto/umee/leverage/v1/query.proto Outdated Show resolved Hide resolved
@toteki toteki changed the title feat: AllMaxWithdraw, MaxBorrow, AllMaxBorrow queries feat!: AllMaxWithdraw, MaxBorrow, AllMaxBorrow queries Jan 4, 2023
@toteki toteki changed the title feat!: AllMaxWithdraw, MaxBorrow, AllMaxBorrow queries feat!: MaxBorrow query and modify MaxWithdraw to return all denoms Jan 4, 2023
@toteki
Copy link
Member Author

toteki commented Jan 4, 2023

Merged queries and added basic tests.

Note that PR is now proto-breaking (only for the MaxWithdraw query and response)

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.

preapproving. As noted in the comment, let's remove the optional flag. According to the proto documentation it doesn't change anything, but makes the implementation a bit more obscure.

proto/umee/leverage/v1/query.proto Outdated Show resolved Hide resolved
@mergify mergify bot merged commit d76c155 into main Jan 5, 2023
@mergify mergify bot deleted the adam/queries branch January 5, 2023 15:05
This was referenced Apr 19, 2024
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.

3 participants