Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
hwray committed Nov 19, 2024
1 parent 4a39816 commit e2cd331
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion protocol/testutil/keeper/listing.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ func ListingKeepers(
},
)

return ctx, keeper, storeKey, mockTimeProvider, pricesKeeper, perpetualsKeeper, clobKeeper, marketMapKeeper, assetsKeeper, bankKeeper_out, subaccountsKeeper
return ctx, keeper, storeKey, mockTimeProvider, pricesKeeper, perpetualsKeeper,
clobKeeper, marketMapKeeper, assetsKeeper, bankKeeper_out, subaccountsKeeper
}

func createListingKeeper(
Expand Down
6 changes: 4 additions & 2 deletions protocol/x/listing/keeper/listing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ func TestCreateClobPair(t *testing.T) {
t.Run(
name, func(t *testing.T) {
mockIndexerEventManager := &mocks.IndexerEventManager{}
ctx, keeper, _, _, pricesKeeper, perpetualsKeeper, clobKeeper, marketMapKeeper, _, _, _ := keepertest.ListingKeepers(
ctx, keeper, _, _, pricesKeeper, perpetualsKeeper, clobKeeper, marketMapKeeper,
_, _, _ := keepertest.ListingKeepers(
t,
&mocks.BankKeeper{},
mockIndexerEventManager,
Expand Down Expand Up @@ -482,7 +483,8 @@ func TestUpgradeIsolatedPerpetualToCross(t *testing.T) {
name, func(t *testing.T) {
mockIndexerEventManager := &mocks.IndexerEventManager{}

ctx, keeper, _, _, pricesKeeper, perpetualsKeeper, _, _, assetsKeeper, bankKeeper, subaccountsKeeper := keepertest.ListingKeepers(
ctx, keeper, _, _, pricesKeeper, perpetualsKeeper, _, _, assetsKeeper,
bankKeeper, subaccountsKeeper := keepertest.ListingKeepers(
t,
&mocks.BankKeeper{},
mockIndexerEventManager,
Expand Down
9 changes: 7 additions & 2 deletions protocol/x/subaccounts/keeper/transfer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper

import (
"fmt"
"math/big"

errorsmod "cosmossdk.io/errors"
Expand Down Expand Up @@ -521,14 +522,18 @@ func (k Keeper) TransferIsolatedInsuranceFundToCross(ctx sdk.Context, perpetualI
return nil
}

_, exists := k.assetsKeeper.GetAsset(ctx, assettypes.AssetUsdc.Id)
if !exists {
return fmt.Errorf("USDC asset not found in state")
}

_, coinToTransfer, err := k.assetsKeeper.ConvertAssetToCoin(
ctx,
assettypes.AssetUsdc.Id,
isolatedInsuranceFundBalance,
)
if err != nil {
// Panic if USDC does not exist.
panic(err)
return err
}

isolatedInsuranceFundAddr, err := k.perpetualsKeeper.GetInsuranceFundModuleAddress(ctx, perpetualId)
Expand Down

0 comments on commit e2cd331

Please sign in to comment.