Skip to content

Commit

Permalink
Merge branch 'main' into sai/quota_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 authored Nov 4, 2023
2 parents aa7e8fb + e48adc9 commit bad905b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
6 changes: 3 additions & 3 deletions app/wasm/query/handle_metoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ func (q UmeeQuery) HandleMeTokenIndexBalances(
return qs.IndexBalances(ctx, &req)
}

// HandleMeTokenIndexPrice handles the get for x/metoken indexe price.
func (q UmeeQuery) HandleMeTokenIndexPrice(
// HandleMeTokenIndexPrices handles the get for x/metoken indexe price.
func (q UmeeQuery) HandleMeTokenIndexPrices(
ctx context.Context,
qs metoken.QueryServer,
) (proto.Message, error) {
req := metoken.QueryIndexPrices{MetokenDenom: q.IndexPrice.MetokenDenom}
req := metoken.QueryIndexPrices{MetokenDenom: q.IndexPrices.MetokenDenom}
return qs.IndexPrices(ctx, &req)
}
6 changes: 3 additions & 3 deletions app/wasm/query/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (plugin *Plugin) CustomQuerier() func(ctx sdk.Context, request json.RawMess
case smartcontractQuery.LastRewardTime != nil:
resp, err = smartcontractQuery.HandleLastRewardTime(ctx, plugin.incQueryServer)

// metoken
// metoken
case smartcontractQuery.MeTokenParameters != nil:
resp, err = smartcontractQuery.HandleMeTokenParams(ctx, plugin.metokenQueryServer)
case smartcontractQuery.Indexes != nil:
Expand All @@ -135,8 +135,8 @@ func (plugin *Plugin) CustomQuerier() func(ctx sdk.Context, request json.RawMess
resp, err = smartcontractQuery.HandleMeTokenRedeemFee(ctx, plugin.metokenQueryServer)
case smartcontractQuery.IndexBalances != nil:
resp, err = smartcontractQuery.HandleMeTokenIndexBalances(ctx, plugin.metokenQueryServer)
case smartcontractQuery.IndexPrice != nil:
resp, err = smartcontractQuery.HandleMeTokenIndexPrice(ctx, plugin.metokenQueryServer)
case smartcontractQuery.IndexPrices != nil:
resp, err = smartcontractQuery.HandleMeTokenIndexPrices(ctx, plugin.metokenQueryServer)

default:
return nil, wasmvmtypes.UnsupportedRequest{Kind: "invalid umee query"}
Expand Down
2 changes: 1 addition & 1 deletion app/wasm/query/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type UmeeQuery struct {
SwapFee *metoken.QuerySwapFee `json:"metoken_swapfee,omitempty"`
RedeemFee *metoken.QueryRedeemFee `json:"metoken_redeemfee,omitempty"`
IndexBalances *metoken.QueryIndexBalances `json:"metoken_indexbalances,omitempty"`
IndexPrice *metoken.QueryIndexPrices `json:"metoken_indexprice,omitempty"`
IndexPrices *metoken.QueryIndexPrices `json:"metoken_indexprices,omitempty"`
}

// MarshalResponse marshals any response.
Expand Down
41 changes: 20 additions & 21 deletions app/wasm/test/umee_cw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,27 +199,26 @@ func (s *IntegrationTestSuite) TestStargateQueries() {
assert.DeepEqual(s.T, lvtypes.DefaultParams(), rr.Params)
},
},
// TODO: enable this once metoken is stable
// {
// name: "stargate: metoken queries ",
// sq: func() StargateQuery {
// data := metoken.QueryParams{}
// d, err := data.Marshal()
// assert.NilError(s.T, err)
// sq := StargateQuery{}
// sq.Chain.Stargate = wasmvmtypes.StargateQuery{
// Path: "/umee.metoken.v1.Query/Params",
// Data: d,
// }
// return sq
// },
// resp: func(resp wasmtypes.QuerySmartContractStateResponse) {
// var rr metoken.QueryParamsResponse
// err := s.encfg.Codec.UnmarshalJSON(resp.Data, &rr)
// assert.NilError(s.T, err)
// assert.DeepEqual(s.T, metoken.DefaultParams(), rr.Params)
// },
// },
{
name: "stargate: metoken queries ",
sq: func() StargateQuery {
data := metoken.QueryParams{}
d, err := data.Marshal()
assert.NilError(s.T, err)
sq := StargateQuery{}
sq.Chain.Stargate = wasmvmtypes.StargateQuery{
Path: "/umee.metoken.v1.Query/Params",
Data: d,
}
return sq
},
resp: func(resp wasmtypes.QuerySmartContractStateResponse) {
var rr metoken.QueryParamsResponse
err := s.encfg.Codec.UnmarshalJSON(resp.Data, &rr)
assert.NilError(s.T, err)
assert.DeepEqual(s.T, metoken.DefaultParams(), rr.Params)
},
},
{
name: "stargate: leverage market summary",
sq: func() StargateQuery {
Expand Down

0 comments on commit bad905b

Please sign in to comment.