Skip to content

Commit

Permalink
Use OZ's "non-upgradable" libraries (semantic change)
Browse files Browse the repository at this point in the history
  • Loading branch information
barak manos committed Jan 29, 2024
1 parent 7cc9579 commit 589e3fb
Show file tree
Hide file tree
Showing 136 changed files with 1,675,885 additions and 9 deletions.
7,048 changes: 7,048 additions & 0 deletions cache_forge/solidity-files-cache.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions contracts/carbon/Strategies.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity 0.8.19;
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { EnumerableSetUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import { SafeMathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import { SafeCastUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { MathEx } from "../utility/MathEx.sol";
import { InvalidIndices } from "../utility/Utils.sol";
Expand Down Expand Up @@ -127,9 +127,9 @@ uint8 constant STRATEGY_UPDATE_REASON_TRADE = 1;
abstract contract Strategies is Initializable {
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
using Address for address payable;
using MathUpgradeable for uint256;
using SafeMathUpgradeable for uint256;
using SafeCastUpgradeable for uint256;
using Math for uint256;
using SafeMath for uint256;
using SafeCast for uint256;

error NativeAmountMismatch();
error BalanceMismatch();
Expand Down Expand Up @@ -776,12 +776,12 @@ abstract contract Strategies is Initializable {

uint256 factor1 = MathEx.minFactor(temp1, temp1);
uint256 factor2 = MathEx.minFactor(temp3, A);
uint256 factor = MathUpgradeable.max(factor1, factor2);
uint256 factor = Math.max(factor1, factor2);

uint256 temp4 = MathEx.mulDivC(temp1, temp1, factor);
uint256 temp5 = MathEx.mulDivC(temp3, A, factor);

(bool safe, uint256 sum) = SafeMathUpgradeable.tryAdd(temp4, temp5);
(bool safe, uint256 sum) = SafeMath.tryAdd(temp4, temp5);
if (safe) {
return MathEx.mulDivF(temp2, temp3 / factor, sum);
}
Expand Down Expand Up @@ -820,7 +820,7 @@ abstract contract Strategies is Initializable {

uint256 factor1 = MathEx.minFactor(temp1, temp1);
uint256 factor2 = MathEx.minFactor(temp2, temp3);
uint256 factor = MathUpgradeable.max(factor1, factor2);
uint256 factor = Math.max(factor1, factor2);

uint256 temp4 = MathEx.mulDivC(temp1, temp1, factor);
uint256 temp5 = MathEx.mulDivF(temp2, temp3, factor);
Expand Down

Large diffs are not rendered by default.

4,808 changes: 4,808 additions & 0 deletions out/AccessControlUpgradeable.sol/AccessControlUpgradeable.json

Large diffs are not rendered by default.

Loading

0 comments on commit 589e3fb

Please sign in to comment.