-
Notifications
You must be signed in to change notification settings - Fork 170
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(proto)!: Condense redundant queries into market_summary #1188
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1188 +/- ##
=======================================
Coverage ? 47.95%
=======================================
Files ? 65
Lines ? 7551
Branches ? 0
=======================================
Hits ? 3621
Misses ? 3684
Partials ? 246
|
- **Total Supplied** queries the [Total Supplied](01_concepts.md#Total-Supplied) of a specified denomination. | ||
- **Total Supplied Value** queries the equivalent USD value of [Total Supplied](01_concepts.md#Total-Supplied) of a specified denomination. | ||
- **Market Summary** combines several asset-specifying queries for more efficient frontend access. | ||
- **Market Summary** collects data on a given `Token` denomination. A description of each response field can be found in the [QueryMarketSummaryResponse proto definition](../../../proto/umee/leverage/v1/query.proto) |
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.
Since the line numbers in the destination file are unstable whether I use the proto
or the pb.go
, the best I can do right now is link to the smaller one and put the relevant type name in the displayed text for the link.
Heads up analytics (@khoerling) frontend (@EbrahimUmee) - query changes here, most importantly eliminating solo queries for anything that is a field in market summary. For frontend, note that just like In addition, a lot of the new market summary fields could make good graphs if we're really getting into market details (e.g. graphing Note: This only takes effect when v3 binaries are released, assuming this gets merged. |
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.
Right now, if this was merged, the user cannot retrieve what we have in the TODO's
neither with the specific queries
Maybe we could let the specific ones, until we finish the TODO's or even let both
@@ -224,33 +216,6 @@ func GetCmdQuerySuppliedValue() *cobra.Command { | |||
return cmd | |||
} | |||
|
|||
// GetCmdQueryReserveAmount creates a Cobra command to query for the | |||
// reserved amount of a specific token. | |||
func GetCmdQueryReserveAmount() *cobra.Command { |
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.
I like the idea of condensing queries, but why remove the specific ones?
Sometimes the user can need only part of that full information '-'
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.
but why remove the specific ones?
The idea is to reduce the API surface so there's less to maintain - that said, it's possible that this measure is a bit aggressive. We could keep the specific ones as well as the improved market summary.
edit: Also eliminates the possibility of the queries and the market summary ever being out of sync, and ensures that downstream every use case started with the same data.
The cons are of course doing extra computation when only one thing is needed (might be a gas problem in wasm?) and having to get the specific thing out of a struct field.
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.
It could increase the gas consumption if someone doesn't need all those fields, but I don't know if that is a big problem
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.
The part of less to maintain is definitely significant on all sides...
availableBorrow := q.Keeper.GetAvailableToBorrow(ctx, req.Denom) // TODO #1162 #1163 - update implementation | ||
|
||
resp := types.QueryMarketSummaryResponse{ | ||
SymbolDenom: token.SymbolDenom, | ||
Exponent: token.Exponent, | ||
UTokenExchangeRate: rate, | ||
Supply_APY: supplyAPY, | ||
Borrow_APY: borrowAPY, | ||
Supplied: supplied.Amount, | ||
Reserved: reserved, | ||
Collateral: uCollateral, | ||
Borrowed: borrowed.Amount, | ||
Liquidity: balance.Sub(reserved), | ||
MaximumBorrow: supplied.Amount, // TODO #1162 #1163 - implement limits | ||
MaximumCollateral: uSupply.Amount, // TODO #1163 - implement limits | ||
MinimumLiquidity: sdk.ZeroInt(), // TODO #1163 - implement limits | ||
UTokenSupply: uSupply.Amount, | ||
AvailableBorrow: availableBorrow, | ||
AvailableWithdraw: uSupply.Amount, // TODO #1163 - implement limits | ||
AvailableCollateralize: uSupply.Amount.Sub(uCollateral), // TODO #1163 - implement limits | ||
} |
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.
Note that the current fields in market summary are all working - only the new ones having to do with safety limits have TODOs.
I would prefer to do them in a separate PR, since they'll require some math and module behavior changes. This PR would meanwhile merge everything proto-breaking, reducing the impact of the implementation PR.
Description
market_summary
.market_summary
.closes: #1164
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...