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: add inspector queries #2085

Merged
merged 34 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
59a640c
add inspector queries
toteki Jun 6, 2023
402c325
simplify query structure for web interaction
toteki Jun 6, 2023
ee53cde
Revert "simplify query structure for web interaction"
toteki Jun 6, 2023
5d76ffd
retry reverted commit
toteki Jun 6, 2023
cd6f68b
lint
toteki Jun 6, 2023
42e66b6
depguard
toteki Jun 6, 2023
d127dbd
fix web urls
toteki Jun 6, 2023
a819b60
++
toteki Jun 6, 2023
cb3b855
Merge branch 'main' into adam/inspector2
toteki Jun 6, 2023
21d8a2f
suggestion++
toteki Jun 7, 2023
e97f767
Merge branch 'main' into adam/inspector2
toteki Jun 7, 2023
edc9f45
Merge branch 'main' into adam/inspector2
toteki Jun 13, 2023
8b236b4
suggestion
toteki Jun 15, 2023
93cae07
comment++
toteki Jun 15, 2023
8044094
simplify risk and inspector queries into one
toteki Jun 15, 2023
4e126aa
tests for decimal neatify
toteki Jun 15, 2023
8a9a1a8
edge case test
toteki Jun 15, 2023
5937a4f
fix
toteki Jun 15, 2023
ecdea8a
fix uToken display
toteki Jun 15, 2023
570c8f9
fix exponent display in DecBalances
toteki Jun 15, 2023
7e86d26
changelog
toteki Jun 15, 2023
5c8f563
Merge branch 'main' into adam/inspector2
toteki Jun 16, 2023
a628c88
Merge branch 'main' into adam/inspector2
toteki Jun 19, 2023
5b2718d
Merge branch 'main' into adam/inspector2
toteki Jun 20, 2023
8689c8b
filter on first iterate
toteki Jun 20, 2023
e840178
simplify sort
toteki Jun 20, 2023
86b725a
Merge branch 'main' into adam/inspector2
toteki Jun 20, 2023
fe191a0
simplify cli query construction
toteki Jun 20, 2023
0075f02
proto update
toteki Jun 20, 2023
473cec2
better proto doc
toteki Jun 20, 2023
118dac7
struct suggestion++
toteki Jun 20, 2023
ebc9784
update mock keepers for unit test
toteki Jun 21, 2023
e32f0e9
Revert "update mock keepers for unit test"
toteki Jun 21, 2023
9935dbf
fix refactor and add unit test
toteki Jun 21, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

- [2085](https://github.com/umee-network/umee/pull/2085) Add `inspect` query to leverage module, which msut be enabled on a node by running with `-l` liquidator query flag.
- [1952](https://github.com/umee-network/umee/pull/1952) Add `x/incentive` module.
- [2015](https://github.com/umee-network/umee/pull/2015), [2050](https://github.com/umee-network/umee/pull/2050) Add `x/ugov` module.
- [2078](https://github.com/umee-network/umee/pull/2078) Upgrade `ibc-go` to v6.2.
Expand Down
59 changes: 59 additions & 0 deletions proto/umee/leverage/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ service Query {
returns (QueryMaxBorrowResponse) {
option (google.api.http).get = "/umee/leverage/v1/max_borrow";
}

// Inspect is the customizable inspector query.
toteki marked this conversation as resolved.
Show resolved Hide resolved
rpc Inspect(QueryInspect)
returns (QueryInspectResponse) {
option (google.api.http).get = "/umee/leverage/v1/inspect";
}
}

// QueryParams defines the request structure for the Params gRPC service
Expand Down Expand Up @@ -320,3 +326,56 @@ message QueryMaxBorrowResponse {
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}

// QueryInspect defines the request structure for the Inspect gRPC service handler.
message QueryInspect {
// Symbol selects a symbol denom to sort accounts by borrowed value. Use "all" to ignore.
toteki marked this conversation as resolved.
Show resolved Hide resolved
string symbol = 1;
// Borrowed is the minimum USD value an account must have borrowed to show. Use 0 to ignore.
double borrowed = 2;
// Collateral is the minimum USD value of collateral an account must have to show. Use 0 to ignore.
double collateral = 3;
// Danger is the minimum progress toward liquidation an account must have to show. Use 0 to ignore.
// Measured as the ratio (borrowed value / liquidation threshold), where > 1 is liquidation-eligible.
double danger = 4;
// LTV is the minimum ratio (borrowed value / collateral value) an account must have to show. Use 0 to ignore.
double ltv = 5;
}

// QueryInspectResponse defines the response structure for the Inspect gRPC service handler.
message QueryInspectResponse {
repeated InspectAccount borrowers = 1 [
(gogoproto.nullable) = false
];
}

// InspectAccount contains risk and balance info for a single account for the inspector query.
message InspectAccount {
string address = 1;
RiskInfo analysis = 2;
DecBalances position = 3;
}

// RiskInfo defines a borrower's account health without requiring sdk.Dec formatting.
message RiskInfo {
// Borrowed is account's borrowed value in USD.
double Borrowed = 1;
// Liquidation is account's liquidation threshold in USD.
double Liquidation = 2;
// Value is account's collateral value in USD.
double Value = 3;
}

// DecBalances contains an account's position denoted in symbol denom tokens.
message DecBalances {
// Collateral contains all uTokens the account has collateralized. It has been converted from uTokens to tokens.
repeated cosmos.base.v1beta1.DecCoin collateral = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"
];
// Borrowed contains all tokens the account has borrowed, including interest owed.
repeated cosmos.base.v1beta1.DecCoin borrowed = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"
];
}
Loading