mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixes PVE002
This commit is contained in:
parent
e0f5c5fb7f
commit
b57a59ea6d
|
@ -78,6 +78,10 @@ library WadRayMath {
|
||||||
function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) {
|
function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||||
require(b != 0, Errors.DIVISION_BY_ZERO);
|
require(b != 0, Errors.DIVISION_BY_ZERO);
|
||||||
|
|
||||||
|
if (a == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint256 halfB = b / 2;
|
uint256 halfB = b / 2;
|
||||||
|
|
||||||
uint256 result = a * WAD;
|
uint256 result = a * WAD;
|
||||||
|
@ -98,7 +102,7 @@ library WadRayMath {
|
||||||
* @return the result of a*b, in ray
|
* @return the result of a*b, in ray
|
||||||
**/
|
**/
|
||||||
function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
|
function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||||
if (a == 0) {
|
if (a == 0 || b == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +126,10 @@ library WadRayMath {
|
||||||
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
|
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||||
require(b != 0, Errors.DIVISION_BY_ZERO);
|
require(b != 0, Errors.DIVISION_BY_ZERO);
|
||||||
|
|
||||||
|
if (a == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint256 halfB = b / 2;
|
uint256 halfB = b / 2;
|
||||||
|
|
||||||
uint256 result = a * RAY;
|
uint256 result = a * RAY;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user