Skip to content

Commit

Permalink
Fix liquidation logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
LybraFinance committed Aug 12, 2023
1 parent 0ac9cd7 commit bbcf186
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions contracts/lybra/pools/base/LybraEUSDVaultBase.sol
Expand Up @@ -151,7 +151,7 @@ abstract contract LybraEUSDVaultBase {
require(onBehalfOfCollateralRatio < badCollateralRatio, "Borrowers collateral ratio should below badCollateralRatio");

require(assetAmount * 2 <= depositedAsset[onBehalfOf], "a max of 50% collateral can be liquidated");
require(EUSD.allowance(provider, address(this)) != 0, "provider should authorize to provide liquidation eUSD");
require(EUSD.allowance(provider, address(this)) != 0 || msg.sender == provider, "provider should authorize to provide liquidation eUSD");
uint256 eusdAmount = (assetAmount * assetPrice) / 1e18;

_repay(provider, onBehalfOf, eusdAmount);
Expand Down Expand Up @@ -196,7 +196,7 @@ abstract contract LybraEUSDVaultBase {
if (onBehalfOfCollateralRatio >= 1e20) {
eusdAmount = (eusdAmount * 1e20) / onBehalfOfCollateralRatio;
}
require(EUSD.allowance(provider, address(this)) != 0, "provider should authorize to provide liquidation eUSD");
require(EUSD.allowance(provider, address(this)) != 0 || msg.sender == provider, "provider should authorize to provide liquidation eUSD");

_repay(provider, onBehalfOf, eusdAmount);

Expand Down
2 changes: 1 addition & 1 deletion contracts/lybra/pools/base/LybraPeUSDVaultBase.sol
Expand Up @@ -126,7 +126,7 @@ abstract contract LybraPeUSDVaultBase {
require(onBehalfOfCollateralRatio < configurator.getBadCollateralRatio(address(this)), "Borrowers collateral ratio should below badCollateralRatio");

require(assetAmount * 2 <= depositedAsset[onBehalfOf], "a max of 50% collateral can be liquidated");
require(PeUSD.allowance(provider, address(this)) != 0, "provider should authorize to provide liquidation peUSD");
require(PeUSD.allowance(provider, address(this)) != 0 || msg.sender == provider, "provider should authorize to provide liquidation peUSD");
uint256 peusdAmount = (assetAmount * assetPrice) / 1e18;

_repay(provider, onBehalfOf, peusdAmount);
Expand Down

0 comments on commit bbcf186

Please sign in to comment.