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

Function TestKeeper_Open

x/margin/keeper/msg_server_test.go:31–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestKeeper_Open(t *testing.T) {
32 table := []struct {
33 name string
34 msgOpen types.MsgOpen
35 poolAsset string
36 token string
37 poolEnabled bool
38 fundedAccount bool
39 err error
40 errString error
41 }{
42 {
43 name: "pool does not exist",
44 msgOpen: types.MsgOpen{
45 Signer: "xxx",
46 CollateralAsset: "xxx",
47 CollateralAmount: sdk.NewUint(1000),
48 BorrowAsset: "xxx",
49 Position: types.Position_LONG,
50 },
51 poolAsset: "rowan",
52 token: "somethingelse",
53 errString: sdkerrors.Wrap(clptypes.ErrPoolDoesNotExist, "xxx"),
54 },
55 {
56 name: "same collateral and native asset but pool does not exist",
57 msgOpen: types.MsgOpen{
58 Signer: "xxx",
59 CollateralAsset: "rowan",
60 CollateralAmount: sdk.NewUint(1000),
61 BorrowAsset: "xxx",
62 Position: types.Position_LONG,
63 },
64 poolAsset: "rowan",
65 token: "somethingelse",
66 errString: sdkerrors.Wrap(clptypes.ErrPoolDoesNotExist, "xxx"),
67 },
68 {
69 name: "same collateral and native asset but pool exists",
70 msgOpen: types.MsgOpen{
71 Signer: "xxx",
72 CollateralAsset: "rowan",
73 CollateralAmount: sdk.NewUint(1000),
74 BorrowAsset: "rowan",
75 Position: types.Position_LONG,
76 },
77 poolAsset: "rowan",
78 token: "somethingelse",
79 errString: sdkerrors.Wrap(types.ErrMTPDisabled, "rowan"),
80 },
81 {
82 name: "margin enabled but denom does not exist but pool health too low",
83 msgOpen: types.MsgOpen{
84 Signer: "xxx",
85 CollateralAsset: "xxx",
86 CollateralAmount: sdk.NewUint(1000),
87 BorrowAsset: "xxx",
88 Position: types.Position_LONG,

Callers

nothing calls this directly

Calls 12

CreateTestAppMarginFunction · 0.92
NewMsgServerImplFunction · 0.92
SetTokenMethod · 0.65
SetEnabledPoolsMethod · 0.65
SetPoolMethod · 0.65
ClpKeeperMethod · 0.65
MintCoinsMethod · 0.65
WhitelistAddressMethod · 0.65
OpenMethod · 0.65
RunMethod · 0.45
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected