mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
Remove some redunancy in RepayPrinciple (#577)
* fix exhibit 30 - remove redunant conversions in adding principle to fee amount, and store debt denom in local var to avoid calling getter several times * add deleted comment back
This commit is contained in:
parent
5ba2706d56
commit
25abdd10b5
@ -106,12 +106,17 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, denom stri
|
||||
|
||||
// burn the corresponding amount of debt coins
|
||||
cdpDebt := k.getModAccountDebt(ctx, types.ModuleName)
|
||||
paymentAmount := feePayment.Amount.Add(principalPayment.Amount)
|
||||
coinsToBurn := sdk.NewCoin(k.GetDebtDenom(ctx), paymentAmount)
|
||||
paymentAmount := feePayment.Add(principalPayment).Amount
|
||||
|
||||
debtDenom := k.GetDebtDenom(ctx)
|
||||
coinsToBurn := sdk.NewCoin(debtDenom, paymentAmount)
|
||||
|
||||
if paymentAmount.GT(cdpDebt) {
|
||||
coinsToBurn = sdk.NewCoin(k.GetDebtDenom(ctx), cdpDebt)
|
||||
coinsToBurn = sdk.NewCoin(debtDenom, cdpDebt)
|
||||
}
|
||||
err = k.BurnDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), coinsToBurn)
|
||||
|
||||
err = k.BurnDebtCoins(ctx, types.ModuleName, debtDenom, coinsToBurn)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user