Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builld: upgrade to PRBMath V4 and update minimum pragma #432

Merged
merged 11 commits into from
Apr 13, 2023
468 changes: 225 additions & 243 deletions .gas-snapshot

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
path = "lib/prb-contracts"
url = "https://github.com/PaulRBerg/prb-contracts"
[submodule "lib/prb-math"]
branch = "v3"
branch = "v4"
path = "lib/prb-math"
url = "https://github.com/PaulRBerg/prb-math"
[submodule "lib/prb-test"]
Expand Down
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"rules": {
"avoid-low-level-calls": "off",
"code-complexity": ["error", 9],
"compiler-version": ["error", ">=0.8.13"],
"compiler-version": ["error", ">=0.8.19"],
"contract-name-camelcase": "off",
"const-name-snakecase": "off",
"func-name-mixedcase": "off",
Expand Down
2 changes: 1 addition & 1 deletion lib/prb-contracts
Submodule prb-contracts updated 40 files
+1 −1 .github/workflows/ci.yml
+20 −0 CHANGELOG.md
+1 −1 lib/forge-std
+1 −1 lib/prb-test
+4 −5 package.json
+83 −128 pnpm-lock.yaml
+0 −1 remappings.txt
+2 −2 src/access/Orchestratable.sol
+2 −2 src/token/erc20/ERC20Permit.sol
+2 −2 src/token/erc20/ERC20Recover.sol
+3 −5 test/access/adminable/renounce-admin/renounceAdmin.t.sol
+3 −2 test/access/adminable/renounce-admin/renounceAdmin.tree
+7 −11 test/access/adminable/transfer-admin/transferAdmin.t.sol
+4 −2 test/access/adminable/transfer-admin/transferAdmin.tree
+3 −8 test/token/erc20-normalizer/compute-scalar/computeScalar.t.sol
+9 −14 test/token/erc20-normalizer/denormalize/denormalize.t.sol
+11 −16 test/token/erc20-normalizer/normalize/normalize.t.sol
+0 −1 test/token/erc20-permit/domain-separator/domainSeparator.t.sol
+0 −1 test/token/erc20-permit/permit-typehash/permitTypehash.t.sol
+35 −40 test/token/erc20-permit/permit/permit.t.sol
+0 −1 test/token/erc20-permit/version/version.t.sol
+0 −1 test/token/erc20-recover/ERC20Recover.t.sol
+0 −3 test/token/erc20-recover/get-token-denylist/getTokenDenylist.t.sol
+0 −2 test/token/erc20-recover/is-token-denylist-set/isTokenDenylistSet.t.sol
+27 −16 test/token/erc20-recover/recover/recover.t.sol
+13 −13 test/token/erc20-recover/set-token-denylist/setTokenDenylist.t.sol
+0 −1 test/token/erc20/ERC20.t.sol
+14 −11 test/token/erc20/approve/approve.t.sol
+1 −1 test/token/erc20/approve/approve.tree
+2 −4 test/token/erc20/balance-of/balanceOf.t.sol
+2 −2 test/token/erc20/balance-of/balanceOf.tree
+10 −15 test/token/erc20/burn/burn.t.sol
+0 −1 test/token/erc20/decimals/decimals.t.sol
+4 −7 test/token/erc20/decrease-allowance/decreaseAllowance.t.sol
+10 −7 test/token/erc20/increase-allowance/increaseAllowance.t.sol
+16 −22 test/token/erc20/mint/mint.t.sol
+0 −1 test/token/erc20/name/name.t.sol
+0 −1 test/token/erc20/symbol/symbol.t.sol
+6 −11 test/token/erc20/transfer-from/transferFrom.t.sol
+19 −27 test/token/erc20/transfer/transfer.t.sol
2 changes: 1 addition & 1 deletion lib/prb-math
Submodule prb-math updated 160 files
2 changes: 1 addition & 1 deletion lib/prb-test
2 changes: 1 addition & 1 deletion lib/solarray
Submodule solarray updated 2 files
+1 −1 .gitmodules
+1 −1 lib/prb-math
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"url": "https://github.com/sablierhq/v2-core/issues"
},
"devDependencies": {
"prettier": "^2.8.4",
"rimraf": "^4.4.0",
"prettier": "^2.8.7",
"solhint": "^3.4.1"
},
"files": [
Expand All @@ -24,6 +23,7 @@
"keywords": [
"asset-streaming",
"blockchain",
"cryptoasset-streaming",
"cryptoassets",
"ethereum",
"foundry",
Expand All @@ -46,7 +46,7 @@
"build": "forge build",
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"build:smt": "FOUNDRY_PROFILE=smt forge build",
"clean": "rimraf broadcast cache docs optimized-out out",
"clean": "rm -rf broadcast cache docs optimized-out out",
"gas:report": "forge test --gas-report --match-path \"./test/{fuzz,unit}/**/*.sol\" --no-match-test \"test(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot": "forge snapshot --match-path \"./test/{fuzz,unit}/**/*.sol\" --no-match-test \"test(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot:optimized": "pnpm build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --match-path \"./test/{fuzz,unit}/**/*.sol\" --no-match-test \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"",
Expand Down
56 changes: 6 additions & 50 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ erc3156/=lib/ERC3156/contracts/
forge-std/=lib/forge-std/src/
solarray/=lib/solarray/src/
solidity-generators/=lib/solidity-generators/src/
src/=src/
8 changes: 4 additions & 4 deletions script/bootstrap/BootstrapProtocol.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { UD60x18, ud } from "@prb/math/UD60x18.sol";
import { Script } from "forge-std/Script.sol";
import { Solarray } from "solarray/Solarray.sol";

import { ISablierV2Comptroller } from "src/interfaces/ISablierV2Comptroller.sol";
import { ISablierV2LockupDynamic } from "src/interfaces/ISablierV2LockupDynamic.sol";
import { ISablierV2LockupLinear } from "src/interfaces/ISablierV2LockupLinear.sol";
import { Broker, LockupLinear, LockupDynamic } from "src/types/DataTypes.sol";
import { ISablierV2Comptroller } from "../../src/interfaces/ISablierV2Comptroller.sol";
import { ISablierV2LockupDynamic } from "../../src/interfaces/ISablierV2LockupDynamic.sol";
import { ISablierV2LockupLinear } from "../../src/interfaces/ISablierV2LockupLinear.sol";
import { Broker, LockupLinear, LockupDynamic } from "../../src/types/DataTypes.sol";

import { BaseScript } from "../shared/Base.s.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/SablierV2Comptroller.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.18;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/SablierV2LockupDynamic.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.18;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/SablierV2LockupLinear.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.18;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/SablierV2NFTDescriptor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.18;
pragma solidity >=0.8.19;

import { IERC721Metadata } from "@openzeppelin/token/ERC721/extensions/IERC721Metadata.sol";
import { ISablierV2NFTDescriptor } from "./interfaces/ISablierV2NFTDescriptor.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/Adminable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IAdminable } from "../interfaces/IAdminable.sol";
import { Errors } from "../libraries/Errors.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/NoDelegateCall.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { Errors } from "../libraries/Errors.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/SablierV2Base.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.18;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/SablierV2FlashLoan.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.18;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/SablierV2Lockup.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.18;
pragma solidity >=0.8.19;

import { ERC721 } from "@openzeppelin/token/ERC721/ERC721.sol";
import { IERC721Metadata } from "@openzeppelin/token/ERC721/extensions/IERC721Metadata.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IAdminable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

/// @title IAdminable
/// @notice Contract module that provides a basic access control mechanism, with an admin that can be
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISablierV2Base.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISablierV2Comptroller.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISablierV2Lockup.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { IERC721Metadata } from "@openzeppelin/token/ERC721/extensions/IERC721Metadata.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISablierV2LockupDynamic.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISablierV2LockupLinear.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISablierV2NFTDescriptor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC721Metadata } from "@openzeppelin/token/ERC721/extensions/IERC721Metadata.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/hooks/ISablierV2LockupRecipient.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

/// @title ISablierV2LockupRecipient
/// @notice Interface for recipient contracts capable of reacting to cancellations, renouncements, and withdrawals.
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/hooks/ISablierV2LockupSender.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

/// @title ISablierV2LockupSender
/// @notice Interface for sender contracts capable of reacting to cancellations.
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Errors.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Helpers.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { UD60x18, ud } from "@prb/math/UD60x18.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/types/DataTypes.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD2x18 } from "@prb/math/UD2x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/types/Math.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

// This file simply re-exports all PRBMath types needed in v2-core. It is provided for convenience so
// that users don't have to install PRBMath separately.
Expand Down
2 changes: 1 addition & 1 deletion src/types/Tokens.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.13;
pragma solidity >=0.8.19;

// This file simply re-exports all token interfaces needed in v2-core. It is provided for convenience so
// that users don't have to install OpenZeppelin's contracts library separately.
Expand Down
4 changes: 2 additions & 2 deletions test/fork/lockup/dynamic/Dynamic.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ abstract contract Dynamic_Fork_Test is Fork_Test {
/// - It may cancel the stream
/// - It may emit a {CancelLockupStream} event
///
/// The fuzzing ensures that all of the following scenarios are tested:
/// Given enough test runs, all of the following scenarios will be fuzzed:
///
/// - Multiple values for the funder, recipient, sender, and broker
/// - Multiple values for the total amount
Expand All @@ -119,7 +119,7 @@ abstract contract Dynamic_Fork_Test is Fork_Test {

// Fuzz the segment amounts and calculate the create amounts (total, deposit, protocol fee, and broker fee).
Vars memory vars;
(vars.totalAmount, vars.createAmounts) = fuzzSegmentAmountsAndCalculateCreateAmounts({
(vars.totalAmount, vars.createAmounts) = fuzzDynamicStreamAmounts({
upperBound: uint128(initialHolderBalance),
segments: params.segments,
protocolFee: params.protocolFee,
Expand Down
2 changes: 1 addition & 1 deletion test/fork/lockup/linear/Linear.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ abstract contract Linear_Fork_Test is Fork_Test {
/// - It may cancel the stream
/// - It may emit a {CancelLockupStream} event
///
/// The fuzzing ensures that all of the following scenarios are tested:
/// Given enough test runs, all of the following scenarios will be fuzzed:
///
/// - Multiple values for the the sender, recipient, and broker
/// - Multiple values for the total amount
Expand Down
2 changes: 1 addition & 1 deletion test/fuzz/flash-loan/flash-fee/flashFee.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { UD60x18, ud } from "@prb/math/UD60x18.sol";
import { FlashLoan_Fuzz_Test } from "../FlashLoan.t.sol";

contract FlashFee_Fuzz_Test is FlashLoan_Fuzz_Test {
/// @dev The fuzzing ensures that all of the following scenarios are tested:
/// @dev Given enough test runs, all of the following scenarios will be fuzzed:
///
/// - Multiple values for the comptroller flash fee, including zero
/// - Multiple values for the flash loan amount, including zero
Expand Down
Loading