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

Method AdminCloseAll

x/margin/keeper/admin_msg_server.go:60–80  ·  view source on GitHub ↗
(goCtx context.Context, msg *types.MsgAdminCloseAll)

Source from the content-addressed store, hash-verified

58}
59
60func (k msgServer) AdminCloseAll(goCtx context.Context, msg *types.MsgAdminCloseAll) (*types.MsgAdminCloseAllResponse, error) {
61 ctx := sdk.UnwrapSDKContext(goCtx)
62 signer, err := sdk.AccAddressFromBech32(msg.Signer)
63 if err != nil {
64 return nil, err
65 }
66 if !k.AdminKeeper().IsAdminAccount(ctx, admintypes.AdminType_MARGIN, signer) {
67 return nil, sdkerrors.Wrap(admintypes.ErrPermissionDenied, fmt.Sprintf("signer not authorised: %s", msg.Signer))
68 }
69
70 params := k.GetParams(ctx)
71 params.SafetyFactor = sdk.NewDec(100)
72 if !msg.TakeMarginFund {
73 params.ForceCloseFundPercentage = sdk.ZeroDec()
74 }
75
76 k.SetParams(ctx, &params)
77 k.EmitAdminCloseAll(ctx, msg.TakeMarginFund)
78
79 return &types.MsgAdminCloseAllResponse{}, nil
80}

Callers

nothing calls this directly

Calls 5

SetParamsMethod · 0.95
IsAdminAccountMethod · 0.65
AdminKeeperMethod · 0.65
GetParamsMethod · 0.65
EmitAdminCloseAllMethod · 0.65

Tested by

no test coverage detected