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

Add new query #6855

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/CosmWasm/wasmd v0.31.0
github.com/cometbft/cometbft v0.38.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.47.5
github.com/cosmos/cosmos-sdk v0.50.1
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.0
github.com/cosmos/ibc-apps/modules/async-icq/v4 v4.1.0
Expand Down Expand Up @@ -43,6 +43,7 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb
google.golang.org/grpc v1.58.2
gopkg.in/yaml.v2 v2.4.0
gotest.tools v2.2.0+incompatible
mvdan.cc/gofumpt v0.5.0
)

Expand Down
12 changes: 12 additions & 0 deletions proto/osmosis/superfluid/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ service Query {
"account_undelegating_cl_positions/"
"{delegator_address}";
}

rpc RestSupply(QueryRestSupplyRequest) returns (QueryRestSupplyResponse) {
option (google.api.http).get = "/osmosis/superfluid/v1beta1/supply";
}
}

message QueryParamsRequest {}
Expand Down Expand Up @@ -320,3 +324,11 @@ message UserConcentratedSuperfluidPositionsUndelegatingResponse {
repeated ConcentratedPoolUserPositionRecord cl_pool_user_position_records = 1
[ (gogoproto.nullable) = false ];
}

// THIS QUERY IS TEMPORARY
message QueryRestSupplyRequest { string denom = 1; }

message QueryRestSupplyResponse {
// amount is the supply of the coin.
cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ];
}
10 changes: 10 additions & 0 deletions x/superfluid/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,13 @@ func (q Querier) filterConcentratedPositionLocks(ctx sdk.Context, positions []mo
}
return clPoolUserPositionRecords, nil
}

// TEMPORARY CODE
func (q Querier) RestSupply(goCtx context.Context, req *types.QueryRestSupplyRequest) (*types.QueryRestSupplyResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

supply := q.bk.GetSupply(sdk.UnwrapSDKContext(goCtx), req.Denom)
return &types.QueryRestSupplyResponse{Amount: supply}, nil
}
1 change: 1 addition & 0 deletions x/superfluid/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type BankKeeper interface {
AddSupplyOffset(ctx sdk.Context, denom string, offsetAmount osmomath.Int)
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
GetSupply(ctx sdk.Context, denom string) sdk.Coin
}

// StakingKeeper expected staking keeper.
Expand Down
Loading