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

Consider module max withdraw in max_withdraw query #2462

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion x/leverage/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,12 @@ func (q Querier) MaxWithdraw(
// will be nil and the resulting value will be what
// can safely be withdrawn even with missing prices.
// On non-nil error here, max withdraw is zero.
uToken, _, err := q.userMaxWithdraw(ctx, addr, denom)
uToken, _, err := q.Keeper.userMaxWithdraw(ctx, addr, denom)
if err == nil {
var moduleMaxWithdraw sdk.Int
moduleMaxWithdraw, err = q.Keeper.ModuleMaxWithdraw(ctx, uToken)
uToken.Amount = sdk.MinInt(uToken.Amount, moduleMaxWithdraw)
}
robert-zaremba marked this conversation as resolved.
Show resolved Hide resolved
if err == nil && uToken.IsPositive() {
token, err := q.ToToken(ctx, uToken)
if err != nil {
Expand Down