You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below we show that there are not functional differences between the ./incentives/lib/Context.sol file and the one that comes with OpenZeppelin:
$ diff -uN --ignore-all-space ./incentives/lib/Context.sol ../node_modules/@openzeppelin/contracts/GSN/Context.sol
--- ./incentives/lib/Context.sol 2021-10-22 08:00:48.000000000 +0700+++ ../node_modules/@openzeppelin/contracts/GSN/Context.sol 2021-10-22 13:39:41.000000000 +0700@@ -1,10 +1,9 @@
// SPDX-License-Identifier: MIT
-pragma solidity 0.6.12;+pragma solidity ^0.6.0;-/**- * @dev From https://github.com/OpenZeppelin/openzeppelin-contracts- * Provides information about the current execution context, including the+/*+ * @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
SafeMath.sol is identical but the diff is bigger because of different code formatting:
$ diff -uN --ignore-all-space ./incentives/lib/SafeMath.sol ../node_modules/@openzeppelin/contracts/math/SafeMath.sol
--- ./incentives/lib/SafeMath.sol 2021-10-22 08:00:48.000000000 +0700+++ ../node_modules/@openzeppelin/contracts/math/SafeMath.sol 2021-10-22 13:39:41.000000000 +0700@@ -1,9 +1,9 @@-// SPDX-License-Identifier: agpl-3.0-pragma solidity 0.6.12;+// SPDX-License-Identifier: MIT++pragma solidity ^0.6.0;
/**
- * @dev From https://github.com/OpenZeppelin/openzeppelin-contracts- * Wrappers over Solidity's arithmetic operations with added overflow+ * @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
@@ -23,11 +23,12 @@
* Counterpart to Solidity's `+` operator.
*
* Requirements:
+ *
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
- require(c >= a, 'SafeMath: addition overflow');+ require(c >= a, "SafeMath: addition overflow");
return c;
}
@@ -39,10 +40,11 @@
* Counterpart to Solidity's `-` operator.
*
* Requirements:
+ *
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
- return sub(a, b, 'SafeMath: subtraction overflow');+ return sub(a, b, "SafeMath: subtraction overflow");
}
/**
@@ -52,13 +54,10 @@
* Counterpart to Solidity's `-` operator.
*
* Requirements:
+ *
* - Subtraction cannot overflow.
*/
- function sub(- uint256 a,- uint256 b,- string memory errorMessage- ) internal pure returns (uint256) {+ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
@@ -72,6 +71,7 @@
* Counterpart to Solidity's `*` operator.
*
* Requirements:
+ *
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
@@ -83,7 +83,7 @@
}
uint256 c = a * b;
- require(c / a == b, 'SafeMath: multiplication overflow');+ require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
@@ -97,10 +97,11 @@
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
+ *
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
- return div(a, b, 'SafeMath: division by zero');+ return div(a, b, "SafeMath: division by zero");
}
/**
@@ -112,14 +113,10 @@
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
+ *
* - The divisor cannot be zero.
*/
- function div(- uint256 a,- uint256 b,- string memory errorMessage- ) internal pure returns (uint256) {- // Solidity only automatically asserts when dividing by 0+ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
@@ -136,10 +133,11 @@
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
+ *
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
- return mod(a, b, 'SafeMath: modulo by zero');+ return mod(a, b, "SafeMath: modulo by zero");
}
/**
@@ -151,13 +149,10 @@
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
+ *
* - The divisor cannot be zero.
*/
- function mod(- uint256 a,- uint256 b,- string memory errorMessage- ) internal pure returns (uint256) {+ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
Recommendation
Remove the following contracts from ./code/contracts/incentives/lib/ folder and make use of the version provided with OpenZeppelin: Context, ERC20, MintableErc20, SafeMath.
The text was updated successfully, but these errors were encountered:
Description
In most cases the code makes use of the OpenZeppelin's standard libraries:
review-xave-lending-market-2021-10/code/contracts/buyback/Treasury.sol
Lines 7 to 9 in 15d777b
In other cases, however, the code uses copy-pasted versions of the same libraries:
review-xave-lending-market-2021-10/code/contracts/incentives/RnbwIncentivesController.sol
Lines 6 to 8 in 15d777b
Below we show that there are not functional differences between the
./incentives/lib/Context.sol
file and the one that comes with OpenZeppelin:SafeMath.sol
is identical but the diff is bigger because of different code formatting:Recommendation
Remove the following contracts from
./code/contracts/incentives/lib/
folder and make use of the version provided with OpenZeppelin:Context
,ERC20
,MintableErc20
,SafeMath
.The text was updated successfully, but these errors were encountered: