Skip to content

Commit

Permalink
example alias diff
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Aug 22, 2023
1 parent 9d67558 commit 065c2cd
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions x/ccv/consumer/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

types "github.com/cosmos/interchain-security/v3/x/ccv/types"
ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types"
)

// GetParams returns the params for the consumer ccv module
// NOTE: it is different from the GetParams method which is required to implement StakingKeeper interface
func (k Keeper) GetConsumerParams(ctx sdk.Context) types.Params {
return types.NewParams(
func (k Keeper) GetConsumerParams(ctx sdk.Context) ccvtypes.Params {
return ccvtypes.NewParams(
k.GetEnabled(ctx),
k.GetBlocksPerDistributionTransmission(ctx),
k.GetDistributionTransmissionChannel(ctx),
Expand All @@ -29,7 +29,7 @@ func (k Keeper) GetConsumerParams(ctx sdk.Context) types.Params {
}

// SetParams sets the paramset for the consumer module
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
func (k Keeper) SetParams(ctx sdk.Context, params ccvtypes.Params) {
k.paramStore.SetParamSet(ctx, &params)
}

Expand All @@ -44,51 +44,51 @@ func (k Keeper) GetParams(ctx sdk.Context) stakingtypes.Params {
// GetEnabled returns the enabled flag for the consumer module
func (k Keeper) GetEnabled(ctx sdk.Context) bool {
var enabled bool
k.paramStore.Get(ctx, types.KeyEnabled, &enabled)
k.paramStore.Get(ctx, ccvtypes.KeyEnabled, &enabled)
return enabled
}

func (k Keeper) GetBlocksPerDistributionTransmission(ctx sdk.Context) int64 {
var bpdt int64
k.paramStore.Get(ctx, types.KeyBlocksPerDistributionTransmission, &bpdt)
k.paramStore.Get(ctx, ccvtypes.KeyBlocksPerDistributionTransmission, &bpdt)
return bpdt
}

func (k Keeper) SetBlocksPerDistributionTransmission(ctx sdk.Context, bpdt int64) {
k.paramStore.Set(ctx, types.KeyBlocksPerDistributionTransmission, bpdt)
k.paramStore.Set(ctx, ccvtypes.KeyBlocksPerDistributionTransmission, bpdt)
}

func (k Keeper) GetDistributionTransmissionChannel(ctx sdk.Context) string {
var s string
k.paramStore.Get(ctx, types.KeyDistributionTransmissionChannel, &s)
k.paramStore.Get(ctx, ccvtypes.KeyDistributionTransmissionChannel, &s)
return s
}

func (k Keeper) SetDistributionTransmissionChannel(ctx sdk.Context, channel string) {
k.paramStore.Set(ctx, types.KeyDistributionTransmissionChannel, channel)
k.paramStore.Set(ctx, ccvtypes.KeyDistributionTransmissionChannel, channel)
}

func (k Keeper) GetProviderFeePoolAddrStr(ctx sdk.Context) string {
var s string
k.paramStore.Get(ctx, types.KeyProviderFeePoolAddrStr, &s)
k.paramStore.Get(ctx, ccvtypes.KeyProviderFeePoolAddrStr, &s)
return s
}

func (k Keeper) SetProviderFeePoolAddrStr(ctx sdk.Context, addr string) {
k.paramStore.Set(ctx, types.KeyProviderFeePoolAddrStr, addr)
k.paramStore.Set(ctx, ccvtypes.KeyProviderFeePoolAddrStr, addr)
}

// GetCCVTimeoutPeriod returns the timeout period for sent ccv related ibc packets
func (k Keeper) GetCCVTimeoutPeriod(ctx sdk.Context) time.Duration {
var p time.Duration
k.paramStore.Get(ctx, types.KeyCCVTimeoutPeriod, &p)
k.paramStore.Get(ctx, ccvtypes.KeyCCVTimeoutPeriod, &p)
return p
}

// GetTransferTimeoutPeriod returns the timeout period for sent transfer related ibc packets
func (k Keeper) GetTransferTimeoutPeriod(ctx sdk.Context) time.Duration {
var p time.Duration
k.paramStore.Get(ctx, types.KeyTransferTimeoutPeriod, &p)
k.paramStore.Get(ctx, ccvtypes.KeyTransferTimeoutPeriod, &p)
return p
}

Expand All @@ -97,44 +97,44 @@ func (k Keeper) GetTransferTimeoutPeriod(ctx sdk.Context) time.Duration {
// decimal number. For example "0.75" would represent 75%.
func (k Keeper) GetConsumerRedistributionFrac(ctx sdk.Context) string {
var str string
k.paramStore.Get(ctx, types.KeyConsumerRedistributionFrac, &str)
k.paramStore.Get(ctx, ccvtypes.KeyConsumerRedistributionFrac, &str)
return str
}

// GetHistoricalEntries returns the number of historical info entries to persist in store
func (k Keeper) GetHistoricalEntries(ctx sdk.Context) int64 {
var n int64
k.paramStore.Get(ctx, types.KeyHistoricalEntries, &n)
k.paramStore.Get(ctx, ccvtypes.KeyHistoricalEntries, &n)
return n
}

// Only used to set an unbonding period in diff tests
func (k Keeper) SetUnbondingPeriod(ctx sdk.Context, period time.Duration) {
k.paramStore.Set(ctx, types.KeyConsumerUnbondingPeriod, period)
k.paramStore.Set(ctx, ccvtypes.KeyConsumerUnbondingPeriod, period)
}

func (k Keeper) GetUnbondingPeriod(ctx sdk.Context) time.Duration {
var period time.Duration
k.paramStore.Get(ctx, types.KeyConsumerUnbondingPeriod, &period)
k.paramStore.Get(ctx, ccvtypes.KeyConsumerUnbondingPeriod, &period)
return period
}

// GetSoftOptOutThreshold returns the percentage of validators at the bottom of the set
// that can opt out of running the consumer chain
func (k Keeper) GetSoftOptOutThreshold(ctx sdk.Context) string {
var str string
k.paramStore.Get(ctx, types.KeySoftOptOutThreshold, &str)
k.paramStore.Get(ctx, ccvtypes.KeySoftOptOutThreshold, &str)
return str
}

func (k Keeper) GetRewardDenoms(ctx sdk.Context) []string {
var denoms []string
k.paramStore.Get(ctx, types.KeyRewardDenoms, &denoms)
k.paramStore.Get(ctx, ccvtypes.KeyRewardDenoms, &denoms)
return denoms
}

func (k Keeper) GetProviderRewardDenoms(ctx sdk.Context) []string {
var denoms []string
k.paramStore.Get(ctx, types.KeyProviderRewardDenoms, &denoms)
k.paramStore.Get(ctx, ccvtypes.KeyProviderRewardDenoms, &denoms)
return denoms
}

0 comments on commit 065c2cd

Please sign in to comment.