diff --git a/x/cdp/keeper/cdp.go b/x/cdp/keeper/cdp.go index 6445062e..b79d7074 100644 --- a/x/cdp/keeper/cdp.go +++ b/x/cdp/keeper/cdp.go @@ -116,21 +116,13 @@ func (k Keeper) SetCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.CDP, ra // MintDebtCoins mints debt coins in the cdp module account func (k Keeper) MintDebtCoins(ctx sdk.Context, moduleAccount string, denom string, principalCoins sdk.Coin) error { debtCoins := sdk.NewCoins(sdk.NewCoin(denom, principalCoins.Amount)) - err := k.supplyKeeper.MintCoins(ctx, moduleAccount, debtCoins) - if err != nil { - return err - } - return nil + return k.supplyKeeper.MintCoins(ctx, moduleAccount, debtCoins) } // BurnDebtCoins burns debt coins from the cdp module account func (k Keeper) BurnDebtCoins(ctx sdk.Context, moduleAccount string, denom string, paymentCoins sdk.Coin) error { debtCoins := sdk.NewCoins(sdk.NewCoin(denom, paymentCoins.Amount)) - err := k.supplyKeeper.BurnCoins(ctx, moduleAccount, debtCoins) - if err != nil { - return err - } - return nil + return k.supplyKeeper.BurnCoins(ctx, moduleAccount, debtCoins) } // GetCdpID returns the id of the cdp corresponding to a specific owner and collateral denom diff --git a/x/cdp/keeper/deposit.go b/x/cdp/keeper/deposit.go index 3b06562a..8c2caa93 100644 --- a/x/cdp/keeper/deposit.go +++ b/x/cdp/keeper/deposit.go @@ -47,11 +47,7 @@ func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddre cdp.Collateral = cdp.Collateral.Add(collateral) collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees)) - err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) - if err != nil { - return err - } - return nil + return k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) } // WithdrawCollateral removes collateral from a cdp if it does not put the cdp below the liquidation ratio diff --git a/x/cdp/keeper/draw.go b/x/cdp/keeper/draw.go index 2616e4c9..666dbcec 100644 --- a/x/cdp/keeper/draw.go +++ b/x/cdp/keeper/draw.go @@ -68,11 +68,7 @@ func (k Keeper) AddPrincipal(ctx sdk.Context, owner sdk.AccAddress, denom string // set cdp state and indexes in the store collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees)) - err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) - if err != nil { - return err - } - return nil + return k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) } // RepayPrincipal removes debt from the cdp @@ -164,11 +160,7 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, denom stri // set cdp state and update indexes collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees)) - err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) - if err != nil { - return err - } - return nil + return k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) } // ValidatePaymentCoins validates that the input coins are valid for repaying debt