Skip to content

Commit

Permalink
Merge pull request #15 from InverseFinance/fix-liquidation-fee
Browse files Browse the repository at this point in the history
Fix liquidation fee
  • Loading branch information
nourharidy committed Dec 8, 2022
2 parents 2158f99 + df167bf commit 57a8534
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Market.sol
Expand Up @@ -632,8 +632,11 @@ contract Market {
escrow.pay(msg.sender, liquidatorReward);
if(liquidationFeeBps > 0) {
uint liquidationFee = repaidDebt * 1 ether / price * liquidationFeeBps / 10000;
if(escrow.balance() >= liquidationFee) {
uint balance = escrow.balance();
if(balance >= liquidationFee) {
escrow.pay(gov, liquidationFee);
} else if(balance > 0) {
escrow.pay(gov, balance);
}
}
emit Liquidate(user, msg.sender, repaidDebt, liquidatorReward);
Expand Down

0 comments on commit 57a8534

Please sign in to comment.