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

Function TestBalanceModuleAccountCheck

x/clp/keeper/invariants_test.go:12–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestBalanceModuleAccountCheck(t *testing.T) {
13 tt := []struct {
14 name string
15 Pools []*types.Pool
16 moduleBalances sdk.Coins
17 stop bool
18 }{
19 {
20 name: "ok without margin",
21 Pools: []*types.Pool{
22 {
23 ExternalAsset: &types.Asset{Symbol: "ceth"},
24 NativeAssetBalance: sdk.NewUint(1000),
25 ExternalAssetBalance: sdk.NewUint(2000),
26 ExternalCustody: sdk.ZeroUint(),
27 NativeCustody: sdk.ZeroUint(),
28 },
29 },
30 moduleBalances: sdk.NewCoins(
31 sdk.NewCoin("rowan", sdk.NewInt(1000)),
32 sdk.NewCoin("ceth", sdk.NewInt(2000)),
33 ),
34 stop: false,
35 },
36 {
37 name: "ok with margin",
38 Pools: []*types.Pool{
39 {
40 ExternalAsset: &types.Asset{Symbol: "ceth"},
41 NativeAssetBalance: sdk.NewUint(1000),
42 ExternalAssetBalance: sdk.NewUint(2000),
43 ExternalCustody: sdk.NewUint(1000),
44 NativeCustody: sdk.NewUint(500),
45 },
46 },
47 moduleBalances: sdk.NewCoins(
48 sdk.NewCoin("rowan", sdk.NewInt(1500)),
49 sdk.NewCoin("ceth", sdk.NewInt(3000)),
50 ),
51 stop: false,
52 },
53 {
54 name: "native balance not ok without margin",
55 Pools: []*types.Pool{
56 {
57 ExternalAsset: &types.Asset{Symbol: "ceth"},
58 NativeAssetBalance: sdk.NewUint(1000),
59 ExternalAssetBalance: sdk.NewUint(2000),
60 ExternalCustody: sdk.ZeroUint(),
61 NativeCustody: sdk.ZeroUint(),
62 },
63 },
64 moduleBalances: sdk.NewCoins(
65 sdk.NewCoin("rowan", sdk.NewInt(9000)),
66 sdk.NewCoin("ceth", sdk.NewInt(2000)),
67 ),
68 stop: true,
69 },

Callers

nothing calls this directly

Calls 6

CreateTestAppFunction · 0.92
SetPoolMethod · 0.65
MintCoinsMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected