MCPcopy Create free account
hub / github.com/Sifchain/sifnode / UpdateParams

Method UpdateParams

x/margin/keeper/msg_server.go:307–327  ·  view source on GitHub ↗
(goCtx context.Context, msg *types.MsgUpdateParams)

Source from the content-addressed store, hash-verified

305}
306
307func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
308 ctx := sdk.UnwrapSDKContext(goCtx)
309 signer, err := sdk.AccAddressFromBech32(msg.Signer)
310 if err != nil {
311 return nil, err
312 }
313 if !k.AdminKeeper().IsAdminAccount(ctx, admintypes.AdminType_MARGIN, signer) {
314 return nil, sdkerrors.Wrap(admintypes.ErrPermissionDenied, fmt.Sprintf("signer not authorised: %s", msg.Signer))
315 }
316
317 params := k.GetParams(ctx)
318 msg.Params.Pools = params.Pools
319 k.SetParams(ctx, msg.Params)
320
321 ctx.EventManager().EmitEvent(sdk.NewEvent(types.EventMarginUpdateParams,
322 sdk.NewAttribute(types.AttributeKeyMarginParams, params.String()),
323 sdk.NewAttribute(clptypes.AttributeKeyHeight, strconv.FormatInt(ctx.BlockHeight(), 10)),
324 ))
325
326 return &types.MsgUpdateParamsResponse{}, nil
327}
328
329func (k msgServer) UpdatePools(goCtx context.Context, msg *types.MsgUpdatePools) (*types.MsgUpdatePoolsResponse, error) {
330 ctx := sdk.UnwrapSDKContext(goCtx)

Callers

nothing calls this directly

Calls 5

SetParamsMethod · 0.95
IsAdminAccountMethod · 0.65
AdminKeeperMethod · 0.65
GetParamsMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected