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

Function addMTPKey

x/margin/keeper/keeper_test.go:1066–1090  ·  view source on GitHub ↗
(t testing.TB, ctx sdk.Context, app *sifapp.SifchainApp, marginKeeper types.Keeper, collateralAsset string, custodyAsset string, address string, position types.Position, id uint64, health sdk.Dec)

Source from the content-addressed store, hash-verified

1064 return ctx, app, marginKeeper
1065}
1066func addMTPKey(t testing.TB, ctx sdk.Context, app *sifapp.SifchainApp, marginKeeper types.Keeper, collateralAsset string, custodyAsset string, address string, position types.Position, id uint64, health sdk.Dec) types.MTP {
1067 storeKey := app.GetKey(types.StoreKey)
1068 store := ctx.KVStore(storeKey)
1069 key := types.GetMTPKey(address, id)
1070
1071 newMTP := types.MTP{
1072 Id: id,
1073 Address: address,
1074 CollateralAsset: collateralAsset,
1075 Liabilities: sdk.NewUint(1000),
1076 InterestPaidCollateral: sdk.ZeroUint(),
1077 InterestPaidCustody: sdk.ZeroUint(),
1078 InterestUnpaidCollateral: sdk.NewUint(1000),
1079 CollateralAmount: sdk.NewUint(1000),
1080 CustodyAsset: custodyAsset,
1081 CustodyAmount: sdk.NewUint(1000),
1082 Leverage: sdk.NewDec(10),
1083 MtpHealth: health,
1084 Position: position,
1085 }
1086
1087 store.Set(key, types.ModuleCdc.MustMarshal(&newMTP))
1088
1089 return newMTP
1090}

Callers 14

TestKeeper_GetMTPFunction · 0.85
TestKeeper_GetMTPsFunction · 0.85
TestKeeper_DestroyMTPFunction · 0.85
TestKeeper_BorrowFunction · 0.85
TestKeeper_TakeInCustodyFunction · 0.85
TestKeeper_RepayFunction · 0.85

Calls 1

GetKeyMethod · 0.80

Tested by

no test coverage detected