(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestMsgServer_AdminCloseAll(t *testing.T) { |
| 20 | table := []struct { |
| 21 | msgOpen types.MsgOpen |
| 22 | msgAdminCloseAll types.MsgAdminCloseAll |
| 23 | health sdk.Dec |
| 24 | name string |
| 25 | poolAsset string |
| 26 | token string |
| 27 | overrideForceCloseThreadshold string |
| 28 | err error |
| 29 | errString error |
| 30 | err2 error |
| 31 | errString2 error |
| 32 | }{ |
| 33 | { |
| 34 | name: "admin close and take funds", |
| 35 | msgAdminCloseAll: types.MsgAdminCloseAll{Signer: "sif1azpar20ck9lpys89r8x7zc8yu0qzgvtp48ng5v", TakeMarginFund: true}, |
| 36 | msgOpen: types.MsgOpen{ |
| 37 | CollateralAsset: "rowan", |
| 38 | BorrowAsset: "xxx", |
| 39 | Position: types.Position_LONG, |
| 40 | }, |
| 41 | health: sdk.NewDecWithPrec(1, 2), |
| 42 | poolAsset: "xxx", |
| 43 | token: "xxx", |
| 44 | err2: types.ErrMTPDoesNotExist, |
| 45 | }, |
| 46 | { |
| 47 | name: "admin close and not take funds", |
| 48 | msgAdminCloseAll: types.MsgAdminCloseAll{Signer: "sif1azpar20ck9lpys89r8x7zc8yu0qzgvtp48ng5v", TakeMarginFund: false}, |
| 49 | msgOpen: types.MsgOpen{ |
| 50 | CollateralAsset: "rowan", |
| 51 | BorrowAsset: "xxx", |
| 52 | Position: types.Position_LONG, |
| 53 | }, |
| 54 | health: sdk.NewDecWithPrec(1, 2), |
| 55 | poolAsset: "xxx", |
| 56 | token: "xxx", |
| 57 | err2: types.ErrMTPDoesNotExist, |
| 58 | }, |
| 59 | } |
| 60 | for _, tt := range table { |
| 61 | tt := tt |
| 62 | t.Run(tt.name, func(t *testing.T) { |
| 63 | asset := clptypes.Asset{Symbol: tt.poolAsset} |
| 64 | |
| 65 | ctx, app := test.CreateTestAppMarginFromGenesis(false, func(app *sifapp.SifchainApp, genesisState sifapp.GenesisState) sifapp.GenesisState { |
| 66 | gs1 := &admintypes.GenesisState{ |
| 67 | AdminAccounts: []*admintypes.AdminAccount{ |
| 68 | { |
| 69 | AdminType: admintypes.AdminType_MARGIN, |
| 70 | AdminAddress: tt.msgAdminCloseAll.Signer, |
| 71 | }, |
| 72 | { |
| 73 | AdminType: admintypes.AdminType_CLPDEX, |
| 74 | AdminAddress: tt.msgAdminCloseAll.Signer, |
| 75 | }, |
| 76 | { |
nothing calls this directly
no test coverage detected