mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
fix: apply penalty to partial deposits (#350)
This commit is contained in:
parent
024001888c
commit
84fa0ef51d
@ -142,11 +142,13 @@ func (k Keeper) CreateAuctionFromPartialDeposits(ctx sdk.Context, partialDeps pa
|
|||||||
|
|
||||||
returnAddrs := []sdk.AccAddress{}
|
returnAddrs := []sdk.AccAddress{}
|
||||||
returnWeights := []sdk.Int{}
|
returnWeights := []sdk.Int{}
|
||||||
|
depositDenom := partialDeps[0].Amount[0].Denom
|
||||||
for _, pd := range partialDeps {
|
for _, pd := range partialDeps {
|
||||||
returnAddrs = append(returnAddrs, pd.Depositor)
|
returnAddrs = append(returnAddrs, pd.Depositor)
|
||||||
returnWeights = append(returnWeights, pd.DebtShare)
|
returnWeights = append(returnWeights, pd.DebtShare)
|
||||||
}
|
}
|
||||||
_, err = k.auctionKeeper.StartCollateralAuction(ctx, types.LiquidatorMacc, sdk.NewCoin(partialDeps[0].Amount[0].Denom, auctionSize), sdk.NewCoin(bidDenom, partialDeps.SumDebt()), returnAddrs, returnWeights, sdk.NewCoin(k.GetDebtDenom(ctx), partialDeps.SumDebt()))
|
penalty := k.ApplyLiquidationPenalty(ctx, depositDenom, partialDeps.SumDebt())
|
||||||
|
_, err = k.auctionKeeper.StartCollateralAuction(ctx, types.LiquidatorMacc, sdk.NewCoin(partialDeps[0].Amount[0].Denom, auctionSize), sdk.NewCoin(bidDenom, partialDeps.SumDebt().Add(penalty)), returnAddrs, returnWeights, sdk.NewCoin(k.GetDebtDenom(ctx), partialDeps.SumDebt()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sdk.ZeroInt(), sdk.ZeroInt(), err
|
return sdk.ZeroInt(), sdk.ZeroInt(), err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user