mirror of
				https://github.com/Instadapp/aave-protocol-v2.git
				synced 2024-07-29 21:47:30 +00:00 
			
		
		
		
	Added checks on liquidationBonus
This commit is contained in:
		
							parent
							
								
									18446c7ecd
								
							
						
					
					
						commit
						80997ea965
					
				| 
						 | 
				
			
			@ -388,11 +388,14 @@ contract LendingPoolConfigurator is VersionedInitializable {
 | 
			
		|||
 | 
			
		||||
    if (liquidationThreshold != 0) {
 | 
			
		||||
      //liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
 | 
			
		||||
      //collateral than needed to cover the debt
 | 
			
		||||
      require(
 | 
			
		||||
        liquidationBonus > PercentageMath.PERCENTAGE_FACTOR,
 | 
			
		||||
        Errors.LPC_INVALID_CONFIGURATION
 | 
			
		||||
      );
 | 
			
		||||
      //collateral than needed to cover the debt.
 | 
			
		||||
      uint256 absoluteBonus = liquidationBonus.sub(PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION);
 | 
			
		||||
      require(absoluteBonus > 0, Errors.LPC_INVALID_CONFIGURATION);
 | 
			
		||||
 | 
			
		||||
      //we also need to require that the liq threshold is lower or equal than the liquidation bonus, to ensure that
 | 
			
		||||
      //there is always enough margin for liquidators to receive the bonus.
 | 
			
		||||
      require(liquidationThreshold.add(absoluteBonus) <= PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION);
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
      require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION);
 | 
			
		||||
      //if the liquidation threshold is being set to 0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1285,4 +1285,4 @@
 | 
			
		|||
      "address": "0xaDF23b1cAa6a7B3b077c432794FfF80A4b935cdF"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user