Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
  • Loading branch information
shrenujb committed Mar 6, 2024
1 parent 4a7d3a9 commit 78ebcda
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 45 deletions.
2 changes: 1 addition & 1 deletion protocol/x/subaccounts/keeper/subaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (k Keeper) GetCollateralPoolForSubaccount(ctx sdk.Context, subaccountId typ
}

// GetCollateralPoolForSubaccountWithPerpetuals returns the collateral pool address based on the
// perpetual passes in as an argument.
// perpetual passed in as an argument.
func (k Keeper) GetCollateralPoolFromPerpetualId(ctx sdk.Context, perpetualId uint32) (sdk.AccAddress, error) {
perpetual, err := k.perpetualsKeeper.GetPerpetual(ctx, perpetualId)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions protocol/x/subaccounts/keeper/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,18 @@ func (k Keeper) TransferFeesToFeeCollectorModule(
}

// Send coins from `subaccounts` to the `auth` module fee collector account.
fromModule := collateralPoolAddr
toModule := authtypes.NewModuleAddress(authtypes.FeeCollectorName)
fromModuleAddr := collateralPoolAddr
toModuleAddr := authtypes.NewModuleAddress(authtypes.FeeCollectorName)

if quantums.Sign() < 0 {
// In the case of a liquidation, net fees can be negative if the maker gets a rebate.
fromModule, toModule = toModule, fromModule
fromModuleAddr, toModuleAddr = toModuleAddr, fromModuleAddr
}

if err := k.bankKeeper.SendCoins(
ctx,
fromModule,
toModule,
fromModuleAddr,
toModuleAddr,
[]sdk.Coin{coinToTransfer},
); err != nil {
return err
Expand Down
Loading

0 comments on commit 78ebcda

Please sign in to comment.