Skip to content

Commit

Permalink
remove inctypes from imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Jul 6, 2023
1 parent 10da1dc commit 70460d4
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 57 deletions.
50 changes: 25 additions & 25 deletions app/wasm/query/handle_incentive.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,104 +4,104 @@ import (
"context"

"github.com/gogo/protobuf/proto"
inctypes "github.com/umee-network/umee/v5/x/incentive"
"github.com/umee-network/umee/v5/x/incentive"
)

// HandleLeverageParams handles the get the x/leverage module's parameters.
func (q UmeeQuery) HandleIncentiveParams(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.Params(ctx, &inctypes.QueryParams{})
return qs.Params(ctx, &incentive.QueryParams{})
}

// HandleTotalBonded handles the get the sum of all bonded collateral uTokens.
func (q UmeeQuery) HandleTotalBonded(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.TotalBonded(ctx, &inctypes.QueryTotalBonded{Denom: q.TotalBonded.Denom})
return qs.TotalBonded(ctx, &incentive.QueryTotalBonded{Denom: q.TotalBonded.Denom})
}

// HandleTotalUnbonding handles the get the sum of all unbonding collateral uTokens.
func (q UmeeQuery) HandleTotalUnbonding(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.TotalUnbonding(ctx, &inctypes.QueryTotalUnbonding{Denom: q.TotalUnbonding.Denom})
return qs.TotalUnbonding(ctx, &incentive.QueryTotalUnbonding{Denom: q.TotalUnbonding.Denom})
}

// HandleAccountBonds handles the get all bonded collateral and unbondings associated with an account.
func (q UmeeQuery) HandleAccountBonds(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.AccountBonds(ctx, &inctypes.QueryAccountBonds{Address: q.AccountBonds.Address})
return qs.AccountBonds(ctx, &incentive.QueryAccountBonds{Address: q.AccountBonds.Address})
}

// HandlePendingRewards handles the gets all unclaimed incentive rewards associated with an account.
func (q UmeeQuery) HandlePendingRewards(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.PendingRewards(ctx, &inctypes.QueryPendingRewards{Address: q.PendingRewards.Address})
return qs.PendingRewards(ctx, &incentive.QueryPendingRewards{Address: q.PendingRewards.Address})
}

// HandleCompletedIncentivePrograms handles the get all incentives programs that have been passed
// by governance,
func (q UmeeQuery) HandleCompletedIncentivePrograms(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.CompletedIncentivePrograms(ctx, &inctypes.QueryCompletedIncentivePrograms{})
return qs.CompletedIncentivePrograms(ctx, &incentive.QueryCompletedIncentivePrograms{})
}

// HandleOngoingIncentivePrograms handles the get all incentives programs that have been passed
// by governance, funded, and started but not yet completed.
func (q UmeeQuery) HandleOngoingIncentivePrograms(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.OngoingIncentivePrograms(ctx, &inctypes.QueryOngoingIncentivePrograms{})
return qs.OngoingIncentivePrograms(ctx, &incentive.QueryOngoingIncentivePrograms{})
}

// HandleUpcomingIncentivePrograms handles the get all incentives programs that have been passed
// by governance, but not yet started. They may or may not have been funded.
func (q UmeeQuery) HandleUpcomingIncentivePrograms(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.UpcomingIncentivePrograms(ctx, &inctypes.QueryUpcomingIncentivePrograms{})
return qs.UpcomingIncentivePrograms(ctx, &incentive.QueryUpcomingIncentivePrograms{})
}

// HandleIncentiveProgram handles the get a single incentive program by ID.
func (q UmeeQuery) HandleIncentiveProgram(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.IncentiveProgram(ctx, &inctypes.QueryIncentiveProgram{Id: q.IncentiveProgram.Id})
return qs.IncentiveProgram(ctx, &incentive.QueryIncentiveProgram{Id: q.IncentiveProgram.Id})
}

// HandleCurrentRates handles the get current rates of given denom
func (q UmeeQuery) HandleCurrentRates(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.CurrentRates(ctx, &inctypes.QueryCurrentRates{UToken: q.CurrentRates.UToken})
return qs.CurrentRates(ctx, &incentive.QueryCurrentRates{UToken: q.CurrentRates.UToken})
}

// HandleActualRates handles the get the actutal rates of given denom
func (q UmeeQuery) HandleActualRates(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.ActualRates(ctx, &inctypes.QueryActualRates{UToken: q.CurrentRates.UToken})
return qs.ActualRates(ctx, &incentive.QueryActualRates{UToken: q.CurrentRates.UToken})
}

// HandleLastRewardTime handles the get last block time at which incentive rewards were calculated.
func (q UmeeQuery) HandleLastRewardTime(
ctx context.Context,
qs inctypes.QueryServer,
qs incentive.QueryServer,
) (proto.Message, error) {
return qs.LastRewardTime(ctx, &inctypes.QueryLastRewardTime{})
return qs.LastRewardTime(ctx, &incentive.QueryLastRewardTime{})
}
4 changes: 2 additions & 2 deletions app/wasm/query/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/gogo/protobuf/proto"

inctypes "github.com/umee-network/umee/v5/x/incentive"
"github.com/umee-network/umee/v5/x/incentive"
inckeeper "github.com/umee-network/umee/v5/x/incentive/keeper"
lvkeeper "github.com/umee-network/umee/v5/x/leverage/keeper"
lvtypes "github.com/umee-network/umee/v5/x/leverage/types"
Expand All @@ -21,7 +21,7 @@ import (
type Plugin struct {
lvQueryServer lvtypes.QueryServer
ocQueryServer ocpes.QueryServer
incQueryServer inctypes.QueryServer
incQueryServer incentive.QueryServer
}

// NewQueryPlugin creates a plugin to query native modules.
Expand Down
26 changes: 13 additions & 13 deletions app/wasm/query/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

wasmvmtypes "github.com/CosmWasm/wasmvm/types"
inctypes "github.com/umee-network/umee/v5/x/incentive"
"github.com/umee-network/umee/v5/x/incentive"
lvtypes "github.com/umee-network/umee/v5/x/leverage/types"
octypes "github.com/umee-network/umee/v5/x/oracle/types"
)
Expand Down Expand Up @@ -60,36 +60,36 @@ type UmeeQuery struct {

// incentive queries
// Incentive module params .
IncentiveParameters *inctypes.QueryParams `json:"incentive_parameters,omitempty"`
IncentiveParameters *incentive.QueryParams `json:"incentive_parameters,omitempty"`
// TotalBonded queries the sum of all bonded collateral uTokens.
TotalBonded *inctypes.QueryTotalBonded `json:"total_bonded,omitempty"`
TotalBonded *incentive.QueryTotalBonded `json:"total_bonded,omitempty"`
// TotalUnbonding queries the sum of all unbonding collateral uTokens.
TotalUnbonding *inctypes.QueryTotalUnbonding `json:"total_unbonding,omitempty"`
TotalUnbonding *incentive.QueryTotalUnbonding `json:"total_unbonding,omitempty"`
// AccountBonds queries all bonded collateral and unbondings associated with an account.
AccountBonds *inctypes.QueryAccountBonds `json:"account_bonds,omitempty"`
AccountBonds *incentive.QueryAccountBonds `json:"account_bonds,omitempty"`
// PendingRewards queries unclaimed incentive rewards associated with an account.
PendingRewards *inctypes.QueryPendingRewards `json:"pending_rewards,omitempty"`
PendingRewards *incentive.QueryPendingRewards `json:"pending_rewards,omitempty"`
// CompletedIncentivePrograms queries for all incentives programs that have been passed
// by governance,
CompletedIncentivePrograms *inctypes.QueryCompletedIncentivePrograms `json:"completed_incentive_programs,omitempty"`
CompletedIncentivePrograms *incentive.QueryCompletedIncentivePrograms `json:"completed_incentive_programs,omitempty"`
// OngoingIncentivePrograms queries for all incentives programs that have been passed
// by governance, funded, and started but not yet completed.
OngoingIncentivePrograms *inctypes.QueryOngoingIncentivePrograms `json:"ongoing_incentive_programs,omitempty"`
OngoingIncentivePrograms *incentive.QueryOngoingIncentivePrograms `json:"ongoing_incentive_programs,omitempty"`
// UpcomingIncentivePrograms queries for all incentives programs that have been passed
// by governance, but not yet started. They may or may not have been funded.
UpcomingIncentivePrograms *inctypes.QueryUpcomingIncentivePrograms `json:"upcoming_incentive_programs,omitempty"`
UpcomingIncentivePrograms *incentive.QueryUpcomingIncentivePrograms `json:"upcoming_incentive_programs,omitempty"`
// IncentiveProgram queries a single incentive program by ID.
IncentiveProgram *inctypes.QueryIncentiveProgram `json:"incentive_program,omitempty"`
IncentiveProgram *incentive.QueryIncentiveProgram `json:"incentive_program,omitempty"`
// CurrentRates queries the hypothetical return of a bonded uToken denomination
// if current incentive rewards continued for one year. The response is an sdk.Coins
// of base token rewards, per reference amount (usually 10^exponent of the uToken.)
CurrentRates *inctypes.QueryCurrentRates `json:"current_rates,omitempty"`
CurrentRates *incentive.QueryCurrentRates `json:"current_rates,omitempty"`
// ActualRates queries the hypothetical return of a bonded uToken denomination
// if current incentive rewards continued for one year. The response is an sdk.Dec
// representing an oracle-adjusted APY.
ActualRates *inctypes.QueryActualRates `json:"actual_rates,omitempty"`
ActualRates *incentive.QueryActualRates `json:"actual_rates,omitempty"`
// LastRewardTime queries the last block time at which incentive rewards were calculated.
LastRewardTime *inctypes.QueryLastRewardTime `json:"last_reward_time,omitempty"`
LastRewardTime *incentive.QueryLastRewardTime `json:"last_reward_time,omitempty"`
}

// MarshalResponse marshals any response.
Expand Down
26 changes: 13 additions & 13 deletions app/wasm/query/whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"

inctypes "github.com/umee-network/umee/v5/x/incentive"
"github.com/umee-network/umee/v5/x/incentive"
ltypes "github.com/umee-network/umee/v5/x/leverage/types"
otypes "github.com/umee-network/umee/v5/x/oracle/types"
ugovtypes "github.com/umee-network/umee/v5/x/ugov"
Expand Down Expand Up @@ -119,21 +119,21 @@ func init() {
setWhitelistedQuery(uibcBaseQueryPath+"AllOutflows", &uibctypes.QueryAllOutflowsResponse{})

// incentive
setWhitelistedQuery(incentiveBaseQueryPath+"Params", &inctypes.QueryParamsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"TotalBonded", &inctypes.QueryTotalBondedResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"TotalUnbonding", &inctypes.QueryTotalUnbondingResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"AccountBonds", &inctypes.QueryAccountBondsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"PendingRewards", &inctypes.QueryPendingRewardsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"Params", &incentive.QueryParamsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"TotalBonded", &incentive.QueryTotalBondedResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"TotalUnbonding", &incentive.QueryTotalUnbondingResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"AccountBonds", &incentive.QueryAccountBondsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"PendingRewards", &incentive.QueryPendingRewardsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"CompletedIncentivePrograms",
&inctypes.QueryCompletedIncentiveProgramsResponse{})
&incentive.QueryCompletedIncentiveProgramsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"OngoingIncentivePrograms",
&inctypes.QueryOngoingIncentiveProgramsResponse{})
&incentive.QueryOngoingIncentiveProgramsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"UpcomingIncentivePrograms",
&inctypes.QueryUpcomingIncentiveProgramsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"IncentiveProgram", &inctypes.QueryIncentiveProgramResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"CurrentRates", &inctypes.QueryCurrentRatesResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"ActualRates", &inctypes.QueryActualRates{})
setWhitelistedQuery(incentiveBaseQueryPath+"LastRewardTime", &inctypes.QueryLastRewardTimeResponse{})
&incentive.QueryUpcomingIncentiveProgramsResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"IncentiveProgram", &incentive.QueryIncentiveProgramResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"CurrentRates", &incentive.QueryCurrentRatesResponse{})
setWhitelistedQuery(incentiveBaseQueryPath+"ActualRates", &incentive.QueryActualRates{})
setWhitelistedQuery(incentiveBaseQueryPath+"LastRewardTime", &incentive.QueryLastRewardTimeResponse{})
}

// GetWhitelistedQuery returns the whitelisted query at the provided path.
Expand Down
8 changes: 4 additions & 4 deletions app/wasm/test/umee_cw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
appparams "github.com/umee-network/umee/v5/app/params"
wm "github.com/umee-network/umee/v5/app/wasm/msg"
wq "github.com/umee-network/umee/v5/app/wasm/query"
inctypes "github.com/umee-network/umee/v5/x/incentive"
"github.com/umee-network/umee/v5/x/incentive"
lvtypes "github.com/umee-network/umee/v5/x/leverage/types"
"github.com/umee-network/umee/v5/x/oracle/types"
)
Expand Down Expand Up @@ -260,13 +260,13 @@ func (s *IntegrationTestSuite) TestIncentiveQueries() {
{
Name: "incentive query params",
CQ: s.genCustomQuery(wq.UmeeQuery{
IncentiveParameters: &inctypes.QueryParams{},
IncentiveParameters: &incentive.QueryParams{},
}),
ResponseCheck: func(data []byte) {
var rr inctypes.QueryParamsResponse
var rr incentive.QueryParamsResponse
err := json.Unmarshal(data, &rr)
assert.NilError(s.T, err)
assert.DeepEqual(s.T, rr.Params, inctypes.DefaultParams())
assert.DeepEqual(s.T, rr.Params, incentive.DefaultParams())
},
},
}
Expand Down

0 comments on commit 70460d4

Please sign in to comment.