(goCtx context.Context, msg *types.MsgAdminCloseAll)
| 58 | } |
| 59 | |
| 60 | func (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, ¶ms) |
| 77 | k.EmitAdminCloseAll(ctx, msg.TakeMarginFund) |
| 78 | |
| 79 | return &types.MsgAdminCloseAllResponse{}, nil |
| 80 | } |
nothing calls this directly
no test coverage detected