Skip to content

Commit

Permalink
address comments and fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Shrenuj Bansal <[email protected]>
  • Loading branch information
shrenujb committed Mar 4, 2024
1 parent f62f84d commit 8372175
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
13 changes: 1 addition & 12 deletions protocol/testutil/constants/perpetuals.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,18 +350,7 @@ var TestMarketPerpetuals = []perptypes.Perpetual{
},
FundingIndex: dtypes.ZeroInt(),
},
{
Params: perptypes.PerpetualParams{
Id: 3,
Ticker: "ISO-USD",
MarketId: uint32(3),
AtomicResolution: int32(-9),
DefaultFundingPpm: int32(0),
LiquidityTier: uint32(3),
MarketType: perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_ISOLATED,
},
FundingIndex: dtypes.ZeroInt(),
},
IsoUsd_IsolatedMarket,
}

// AddPremiumVotes messages.
Expand Down
2 changes: 1 addition & 1 deletion protocol/x/clob/keeper/deleveraging.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (k Keeper) GetInsuranceFundBalance(ctx sdk.Context, perpetualId uint32) (ba
func (k Keeper) GetCrossInsuranceFundBalance(ctx sdk.Context) (balance *big.Int) {
usdcAsset, exists := k.assetsKeeper.GetAsset(ctx, assettypes.AssetUsdc.Id)
if !exists {
panic("GetInsuranceFundBalance: Usdc asset not found in state")
panic("GetCrossInsuranceFundBalance: Usdc asset not found in state")
}
insuranceFundBalance := k.bankKeeper.GetBalance(
ctx,
Expand Down
14 changes: 14 additions & 0 deletions protocol/x/clob/keeper/liquidations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,13 @@ func TestPlacePerpetualLiquidation_Deleveraging(t *testing.T) {
mock.Anything,
mock.Anything,
).Return(nil)
bankKeeper.On(
"SendCoins",
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
).Return(nil)
bankKeeper.On(
"GetBalance",
mock.Anything,
Expand Down Expand Up @@ -4625,6 +4632,13 @@ func TestMaybeGetLiquidationOrder(t *testing.T) {
mock.Anything,
mock.Anything,
).Return(nil)
mockBankKeeper.On(
"SendCoinsFromModuleToModule",
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
).Return(nil)
// Give the insurance fund a 1M USDC balance.
mockBankKeeper.On(
"GetBalance",
Expand Down
7 changes: 7 additions & 0 deletions protocol/x/clob/keeper/mev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,13 @@ func TestRecordMevMetrics(t *testing.T) {
mock.Anything,
mock.Anything,
).Return(nil)
mockBankKeeper.On(
"SendCoins",
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
).Return(nil)
mockBankKeeper.On(
"GetBalance",
mock.Anything,
Expand Down

0 comments on commit 8372175

Please sign in to comment.