-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: params upgrade message + new min_funding_multiple param
- Loading branch information
1 parent
07dd3b9
commit 2866707
Showing
11 changed files
with
1,324 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
|
||
"cosmossdk.io/errors" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
// Delegation | ||
"github.com/KYVENetwork/chain/x/funders/types" | ||
// Gov | ||
govTypes "github.com/cosmos/cosmos-sdk/x/gov/types" | ||
) | ||
|
||
func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { | ||
if k.authority != msg.Authority { | ||
return nil, errors.Wrapf(govTypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) | ||
} | ||
|
||
ctx := sdk.UnwrapSDKContext(goCtx) | ||
oldParams := k.GetParams(ctx) | ||
|
||
newParams := oldParams | ||
_ = json.Unmarshal([]byte(msg.Payload), &newParams) | ||
k.SetParams(ctx, newParams) | ||
|
||
_ = ctx.EventManager().EmitTypedEvent(&types.EventUpdateParams{ | ||
OldParams: oldParams, | ||
NewParams: newParams, | ||
Payload: msg.Payload, | ||
}) | ||
|
||
return &types.MsgUpdateParamsResponse{}, nil | ||
} |
Oops, something went wrong.