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

shield: implement distribution params #380

Merged
merged 18 commits into from
Jun 8, 2022
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ certik
# Test
coverage.out
launch/localnet
custom

# IDE
.idea/
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ linters:
- prealloc
- scopelint
- structcheck
- typecheck
# - typecheck
- unconvert
- unparam
- varcheck
Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ func NewShentuApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)

app.setUpgradeHandler()
app.setv230UpgradeHandler()
app.setShieldV2UpgradeHandler()

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
Expand Down
40 changes: 36 additions & 4 deletions app/upgrade_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ibcconnectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"

shieldtypes "github.com/certikfoundation/shentu/v2/x/shield/types"
)

const upgradeName = "Shentu-v230"
const (
v230Upgrade = "Shentu-v230"
shieldv2 = "Shield-V2"
)

func (app ShentuApp) setUpgradeHandler() {
func (app ShentuApp) setv230UpgradeHandler() {
app.upgradeKeeper.SetUpgradeHandler(
upgradeName,
v230Upgrade,
func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) {
app.ibcKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams())

Expand Down Expand Up @@ -50,7 +55,7 @@ func (app ShentuApp) setUpgradeHandler() {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}

if upgradeInfo.Name == upgradeName && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
if upgradeInfo.Name == v230Upgrade && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{authz.ModuleName, feegrant.ModuleName},
}
Expand All @@ -59,3 +64,30 @@ func (app ShentuApp) setUpgradeHandler() {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}

func (app ShentuApp) setShieldV2UpgradeHandler() {
app.upgradeKeeper.SetUpgradeHandler(
shieldv2,
func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) {
fromVM := make(map[string]uint64)
for moduleName := range app.mm.Modules {
fromVM[moduleName] = 2
}

fromVM[shieldtypes.ModuleName] = 1
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
},
)

upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}

if upgradeInfo.Name == shieldv2 && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
46 changes: 28 additions & 18 deletions proto/shentu/shield/v1alpha1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
import "gogoproto/gogo.proto";
import "shentu/shield/v1alpha1/shield.proto";

option go_package = "github.com/certikfoundation/shentu/x/shield/types";
Expand All @@ -19,23 +18,24 @@ message GenesisState {
uint64 next_pool_id = 2 [ (gogoproto.moretags) = "yaml:\"next_pool_id\"" ];
uint64 next_purchase_id = 3 [ (gogoproto.moretags) = "yaml:\"next_purchase_id\"" ];
PoolParams pool_params = 4 [ (gogoproto.moretags) = "yaml:\"pool_params\"", (gogoproto.nullable) = false ];
ClaimProposalParams claim_proposal_params = 5 [ (gogoproto.moretags) = "yaml:\"claim_proposal_params\"", (gogoproto.nullable) = false ];
string total_collateral = 6 [ (gogoproto.moretags) = "yaml:\"total_collateral\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
string total_withdrawing = 7 [ (gogoproto.moretags) = "yaml:\"total_withdrawing\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
string total_shield = 8 [ (gogoproto.moretags) = "yaml:\"total_shield\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
string total_claimed = 9 [ (gogoproto.moretags) = "yaml:\"total_claimed\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
MixedDecCoins service_fees = 10 [ (gogoproto.moretags) = "yaml:\"service_fees\"", (gogoproto.nullable) = false ];
MixedDecCoins remaining_service_fees = 11 [ (gogoproto.moretags) = "yaml:\"remaining_service_fees\"", (gogoproto.nullable) = false ];
repeated Pool pools = 12 [ (gogoproto.moretags) = "yaml:\"pools\"", (gogoproto.nullable) = false ];
repeated Provider providers = 13 [ (gogoproto.moretags) = "yaml:\"providers\"", (gogoproto.nullable) = false ];
repeated PurchaseList purchase_lists = 14 [ (gogoproto.moretags) = "yaml:\"purchases\"", (gogoproto.nullable) = false ];
repeated Withdraw withdraws = 15 [ (gogoproto.moretags) = "yaml:\"withdraws\"", (gogoproto.nullable) = false ];
google.protobuf.Timestamp last_update_time = 16 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"last_update_time\""];
string shield_staking_rate = 17 [ (gogoproto.moretags) = "yaml:\"shield_staking_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ];
string global_staking_pool = 18 [ (gogoproto.moretags) = "yaml:\"global_staking_pool\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
repeated ShieldStaking stake_for_shields = 19 [ (gogoproto.moretags) = "yaml:\"stake_for_shields\"", (gogoproto.nullable) = false ];
repeated OriginalStaking original_stakings = 20 [ (gogoproto.moretags) = "yaml:\"original_stakings\"", (gogoproto.nullable) = false ];
repeated ProposalIDReimbursementPair proposalID_reimbursement_pairs = 21 [ (gogoproto.moretags) = "yaml:\"proposalID_reimbursement_pairs\"", (gogoproto.nullable) = false ];
ClaimProposalParams claim_proposal_params = 5 [ (gogoproto.moretags) = "yaml:\"claim_proposal_params\"", (gogoproto.nullable) = false ];
DistributionParams distribution_params = 6 [ (gogoproto.moretags) = "yaml:\"distribution_params\"", (gogoproto.nullable) = false ];
string total_collateral = 7 [ (gogoproto.moretags) = "yaml:\"total_collateral\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
string total_withdrawing = 8 [ (gogoproto.moretags) = "yaml:\"total_withdrawing\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
string total_shield = 9 [ (gogoproto.moretags) = "yaml:\"total_shield\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
string total_claimed = 10 [ (gogoproto.moretags) = "yaml:\"total_claimed\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
MixedDecCoins service_fees = 11 [ (gogoproto.moretags) = "yaml:\"service_fees\"", (gogoproto.nullable) = false ];
MixedDecCoins remaining_service_fees = 12 [ (gogoproto.moretags) = "yaml:\"remaining_service_fees\"", (gogoproto.nullable) = false ];
repeated Pool pools = 13 [ (gogoproto.moretags) = "yaml:\"pools\"", (gogoproto.nullable) = false ];
repeated Provider providers = 14 [ (gogoproto.moretags) = "yaml:\"providers\"", (gogoproto.nullable) = false ];
repeated PurchaseList purchase_lists = 15 [ (gogoproto.moretags) = "yaml:\"purchases\"", (gogoproto.nullable) = false ];
repeated Withdraw withdraws = 16 [ (gogoproto.moretags) = "yaml:\"withdraws\"", (gogoproto.nullable) = false ];
google.protobuf.Timestamp last_update_time = 17 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"last_update_time\""];
string shield_staking_rate = 18 [ (gogoproto.moretags) = "yaml:\"shield_staking_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ];
string global_staking_pool = 19 [ (gogoproto.moretags) = "yaml:\"global_staking_pool\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ];
repeated ShieldStaking stake_for_shields = 20 [ (gogoproto.moretags) = "yaml:\"stake_for_shields\"", (gogoproto.nullable) = false ];
repeated OriginalStaking original_stakings = 21 [ (gogoproto.moretags) = "yaml:\"original_stakings\"", (gogoproto.nullable) = false ];
repeated ProposalIDReimbursementPair proposalID_reimbursement_pairs = 22 [ (gogoproto.moretags) = "yaml:\"proposalID_reimbursement_pairs\"", (gogoproto.nullable) = false ];
}

message OriginalStaking {
Expand Down Expand Up @@ -86,3 +86,13 @@ message ClaimProposalParams {
string deposit_rate = 4 [ (gogoproto.moretags) = "yaml:\"deposit_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ];
string fees_rate = 5 [ (gogoproto.moretags) = "yaml:\"fees_rate\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ];
}

// DistributionParams defines the parameters for shield block reward.
message DistributionParams {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string model_param_a = 1 [ (gogoproto.moretags) = "yaml:\"model_param_a\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ];
string model_param_b = 2 [ (gogoproto.moretags) = "yaml:\"model_param_b\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ];
string max_leverage = 3 [ (gogoproto.moretags) = "yaml:\"max_leverage\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ];
}
12 changes: 12 additions & 0 deletions proto/shentu/shield/v1alpha1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ service Query {
option (google.api.http).get = "/shentu/shield/v1alpha1/claim_params";
}

rpc DistrParams(QueryDistrParamsRequest) returns (QueryDistrParamsResponse) {
option (google.api.http).get = "/shentu/shield/v1alpha1/distr_params";
}

rpc ShieldStatus(QueryShieldStatusRequest) returns (QueryShieldStatusResponse) {
option (google.api.http).get = "/shentu/shield/v1alpha1/status";
}
Expand Down Expand Up @@ -162,6 +166,14 @@ message QueryClaimParamsResponse {
ClaimProposalParams params = 1 [(gogoproto.nullable) = false];
}

message QueryDistrParamsRequest {
}

message QueryDistrParamsResponse {
DistributionParams params = 1 [(gogoproto.nullable) = false];
}



message QueryShieldStatusRequest {
}
Expand Down
1 change: 0 additions & 1 deletion proto/shentu/shield/v1alpha1/shield.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/timestamp.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/certikfoundation/shentu/x/shield/types";

Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/gov.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/gov/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/gov/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions x/mint/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
}

communityPoolRatio := k.GetCommunityPoolRatio(ctx)
communityPoolCoins := k.GetPoolMint(ctx, communityPoolRatio, mintedCoin)
communityPoolCoin := k.GetPoolMint(ctx, communityPoolRatio, mintedCoin)
communityPoolCoins := sdk.NewCoins(communityPoolCoin)
remainderCoin := mintedCoin.Sub(communityPoolCoin)

shieldStakeForShieldPoolRatio := k.GetShieldStakeForShieldPoolRatio(ctx)
SPPCoins := k.GetPoolMint(ctx, shieldStakeForShieldPoolRatio, mintedCoin)
shieldBlockRewardRatio := k.GetShieldRatio(ctx)
SPPCoin := k.GetPoolMint(ctx, shieldBlockRewardRatio, remainderCoin)
SPPCoins := sdk.NewCoins(SPPCoin)
collectedFeesCoins := mintedCoins.Sub(communityPoolCoins).Sub(SPPCoins)

// send the minted coins to the fee collector account
Expand Down
2 changes: 1 addition & 1 deletion x/mint/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestBeginBlocker(t *testing.T) {
ctx := app.BaseApp.NewContext(false, tmproto.Header{Time: time.Now().UTC()})
k := app.MintKeeper

p := minttypes.DefaultParams()
p := mint.DefaultGenesisState().GetParams()
k.SetParams(ctx, p)
type args struct {
minter minttypes.Minter
Expand Down
15 changes: 5 additions & 10 deletions x/mint/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,15 @@ func (k Keeper) GetCommunityPoolRatio(ctx sdk.Context) sdk.Dec {
return sdk.NewDec(0)
}

// GetShieldStakeForShieldPoolRatio returns the current ratio of
// GetShieldRatio returns the current ratio of
// shield staking pool compared to the total supply.
func (k Keeper) GetShieldStakeForShieldPoolRatio(ctx sdk.Context) sdk.Dec {
pool := k.shieldKeeper.GetGlobalShieldStakingPool(ctx)
totalBondedTokensDec := k.StakingTokenSupply(ctx).ToDec()
if totalBondedTokensDec.IsZero() {
return sdk.ZeroDec()
}
return pool.ToDec().Quo(totalBondedTokensDec)
func (k Keeper) GetShieldRatio(ctx sdk.Context) sdk.Dec {
return k.shieldKeeper.GetShieldBlockRewardRatio(ctx)
}

// GetPoolMint returns Coins that are about to be minted towards the community pool.
func (k Keeper) GetPoolMint(ctx sdk.Context, ratio sdk.Dec, mintedCoin sdk.Coin) sdk.Coins {
func (k Keeper) GetPoolMint(ctx sdk.Context, ratio sdk.Dec, mintedCoin sdk.Coin) sdk.Coin {
communityPoolMintDec := ratio.MulInt(mintedCoin.Amount)
amount := communityPoolMintDec.TruncateInt()
return sdk.Coins{sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), amount)}
return sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), amount)
}
1 change: 1 addition & 0 deletions x/mint/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ type DistributionKeeper interface {
type ShieldKeeper interface {
GetGlobalShieldStakingPool(ctx sdk.Context) sdk.Int
FundShieldBlockRewards(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
GetShieldBlockRewardRatio(ctx sdk.Context) sdk.Dec
}
27 changes: 27 additions & 0 deletions x/shield/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func GetQueryCmd() *cobra.Command {
GetCmdProviders(),
GetCmdPoolParams(),
GetCmdClaimParams(),
GetCmdDistrParams(),
GetCmdStatus(),
GetCmdStaking(),
GetCmdShieldStakingRate(),
Expand Down Expand Up @@ -391,6 +392,32 @@ func GetCmdClaimParams() *cobra.Command {
return cmd
}

// GetCmdDistrParams returns the command for querying distribution parameters.
func GetCmdDistrParams() *cobra.Command {
cmd := &cobra.Command{
Use: "distr-params",
Short: "get distribution parameters",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(cliCtx)

res, err := queryClient.DistrParams(cmd.Context(), &types.QueryDistrParamsRequest{})
if err != nil {
return err
}

return cliCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)
return cmd
}

// GetCmdStatus returns the command for querying shield status.
func GetCmdStatus() *cobra.Command {
cmd := &cobra.Command{
Expand Down
4 changes: 3 additions & 1 deletion x/shield/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) []abci.ValidatorUpdate {
k.SetPoolParams(ctx, data.PoolParams)
k.SetClaimProposalParams(ctx, data.ClaimProposalParams)
k.SetDistributionParams(ctx, data.DistributionParams)

adminAddr := sdk.AccAddress{}
var err error
Expand Down Expand Up @@ -77,6 +78,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) []ab
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
poolParams := k.GetPoolParams(ctx)
claimProposalParams := k.GetClaimProposalParams(ctx)
distrParams := k.GetDistributionParams(ctx)
shieldAdmin := k.GetAdmin(ctx)
totalCollateral := k.GetTotalCollateral(ctx)
totalWithdrawing := k.GetTotalWithdrawing(ctx)
Expand All @@ -97,7 +99,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
originalStaking := k.GetAllOriginalStakings(ctx)
reimbursements := k.GetAllProposalIDReimbursementPairs(ctx)

return types.NewGenesisState(shieldAdmin, nextPoolID, nextPurchaseID, poolParams, claimProposalParams,
return types.NewGenesisState(shieldAdmin, nextPoolID, nextPurchaseID, poolParams, claimProposalParams, distrParams,
totalCollateral, totalWithdrawing, totalShield, totalClaimed, serviceFees, remainingServiceFees, pools,
providers, purchaseLists, withdraws, lastUpdateTime, stakingPurchaseRate, globalStakingPool, stakingPurchases, originalStaking, reimbursements)
}
10 changes: 10 additions & 0 deletions x/shield/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ func (q Keeper) ClaimParams(c context.Context, req *types.QueryClaimParamsReques
return &types.QueryClaimParamsResponse{Params: q.GetClaimProposalParams(ctx)}, nil
}

// DistrParams queries shield distribution parameters.
func (q Keeper) DistrParams(c context.Context, req *types.QueryDistrParamsRequest) (*types.QueryDistrParamsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)

return &types.QueryDistrParamsResponse{Params: q.GetDistributionParams(ctx)}, nil
}

// ShieldStatus queries the global status of the shield module.
func (q Keeper) ShieldStatus(c context.Context, req *types.QueryShieldStatusRequest) (*types.QueryShieldStatusResponse, error) {
if req == nil {
Expand Down
26 changes: 26 additions & 0 deletions x/shield/keeper/migrations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package keeper

import (
"github.com/gogo/protobuf/grpc"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/certikfoundation/shentu/v2/x/shield/legacy/v232"
)

// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
keeper Keeper
queryServer grpc.Server
}

// NewMigrator returns a new Migrator.
func NewMigrator(keeper Keeper, queryServer grpc.Server) Migrator {
return Migrator{keeper: keeper, queryServer: queryServer}
}

// Migrate1to2 migrates from version 1 to 2.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
v232.MigrateStore(ctx, m.keeper.paramSpace)
return nil
}
11 changes: 11 additions & 0 deletions x/shield/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,14 @@ func (k Keeper) GetShieldStakingRate(ctx sdk.Context) (rate sdk.Dec) {
func (k Keeper) SetShieldStakingRate(ctx sdk.Context, rate sdk.Dec) {
k.paramSpace.Set(ctx, types.ParamStoreKeyStakingShieldRate, &rate)
}

// GetDistributionParams returns distribution parameters.
func (k Keeper) GetDistributionParams(ctx sdk.Context) (distrParams types.DistributionParams) {
k.paramSpace.Get(ctx, types.ParamStoreKeyDistribution, &distrParams)
return
}

// SetDistributionParams sets distribution parameters.
func (k Keeper) SetDistributionParams(ctx sdk.Context, dp types.DistributionParams) {
k.paramSpace.Set(ctx, types.ParamStoreKeyDistribution, &dp)
}
Loading