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

build: upgrade to Solidity v0.8.18 #316

Merged
merged 6 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ useTabs: false
overrides:
- files: "*.sol"
options:
compiler: "0.8.17"
compiler: "0.8.18"
tabWidth: 4
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"rules": {
"avoid-low-level-calls": "off",
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.13"],
"compiler-version": ["error", ">=0.8.18"],
"contract-name-camelcase": "off",
"const-name-snakecase": "off",
"func-name-mixedcase": "off",
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"solidity.compileUsingRemoteVersion": "v0.8.18+commit.87f61d96",
"solidity.formatter": "prettier",
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib"
Expand Down
6 changes: 4 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[profile.default]
auto_detect_solc = false
bytecode_hash = "none"
cbor_metadata = false
fs_permissions = [{ access = "read", path = "./optimized-out" }]
libs = ["lib"]
gas_reports = [
Expand All @@ -8,10 +10,10 @@
"SablierV2LockupPro",
]
optimizer = true
optimizer_runs = 10_000
optimizer_runs = 5_000
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
out = "out"
script = "script"
solc = "0.8.17"
solc = "0.8.18"
src = "src"
test = "test"

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"husky": "^8.0.2",
"lint-staged": "^12.5.0",
"prettier": "^2.8.1",
"prettier-plugin-solidity": "^1.1.0",
"prettier-plugin-solidity": "^1.1.2",
"rimraf": "^3.0.2",
"solhint": "^3.3.7",
"solhint-plugin-prettier": "^0.0.5"
Expand All @@ -40,7 +40,7 @@
"gas:report": "forge test --gas-report --no-match-path \"./test/e2e/**/*.sol\" --no-match-test \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot": "forge snapshot --desc --no-match-path \"./test/e2e/**/*.sol\" --no-match-test \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot:optimized": "yarn build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --desc --no-match-path \"./test/e2e/**/*.sol\" --no-match-test \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"",
"lint": "yarn lint:sol && yarn prettier:check",
"lint": "yarn prettier:check",
"lint:sol": "yarn solhint \"{script,src,test}/**/*.sol\"",
"postinstall": "husky install",
"prettier:write": "prettier --write \"**/*.{json,md,sol,yml}\"",
Expand Down
2 changes: 1 addition & 1 deletion script/DeployComptroller.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";

Expand Down
2 changes: 1 addition & 1 deletion script/DeployDeterministicComptroller.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";

Expand Down
2 changes: 1 addition & 1 deletion script/DeployDeterministicLockupLinear.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/DeployDeterministicLockupPro.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/DeployDeterministicProtocol.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/DeployLockupLinear.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/DeployLockupPro.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/DeployProtocol.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/DeployTestAsset.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

import { ERC20GodMode } from "@prb/contracts/token/erc20/ERC20GodMode.sol";

Expand Down
2 changes: 1 addition & 1 deletion script/helpers/Common.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Script } from "forge-std/Script.sol";

Expand Down
6 changes: 3 additions & 3 deletions src/SablierV2Comptroller.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
Expand Down Expand Up @@ -44,10 +44,10 @@ contract SablierV2Comptroller is
//////////////////////////////////////////////////////////////////////////*/

/// @dev ERC-20 assets that can be flash loaned.
mapping(IERC20 => bool) internal _flashAssets;
mapping(IERC20 asset => bool supported) internal _flashAssets;

/// @dev Global fees mapped by ERC-20 asset addresses.
mapping(IERC20 => UD60x18) internal _protocolFees;
mapping(IERC20 asset => UD60x18) internal _protocolFees;

/*//////////////////////////////////////////////////////////////////////////
CONSTRUCTOR
Expand Down
4 changes: 2 additions & 2 deletions src/SablierV2LockupLinear.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down Expand Up @@ -51,7 +51,7 @@ contract SablierV2LockupLinear is
//////////////////////////////////////////////////////////////////////////*/

/// @dev Sablier V2 linear lockup streams mapped by unsigned integers.
mapping(uint256 => LockupLinear.Stream) internal _streams;
mapping(uint256 id => LockupLinear.Stream) internal _streams;

/*//////////////////////////////////////////////////////////////////////////
CONSTRUCTOR
Expand Down
6 changes: 3 additions & 3 deletions src/SablierV2LockupPro.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down Expand Up @@ -61,8 +61,8 @@ contract SablierV2LockupPro is
INTERNAL STORAGE
//////////////////////////////////////////////////////////////////////////*/

/// @dev Sablier V2 pro streams mapped by unsigned integers.
mapping(uint256 => LockupPro.Stream) internal _streams;
/// @dev Sablier V2 pro streams mapped by unsigned integers ids.
mapping(uint256 id => LockupPro.Stream) internal _streams;

/*//////////////////////////////////////////////////////////////////////////
CONSTRUCTOR
Expand Down
2 changes: 1 addition & 1 deletion src/abstracts/SablierV2Adminable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

import { ISablierV2Adminable } from "../interfaces/ISablierV2Adminable.sol";
import { Errors } from "../libraries/Errors.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/abstracts/SablierV2Config.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down Expand Up @@ -38,7 +38,7 @@ abstract contract SablierV2Config is
//////////////////////////////////////////////////////////////////////////*/

/// @dev Protocol revenues mapped by ERC-20 asset addresses.
mapping(IERC20 => uint128) internal _protocolRevenues;
mapping(IERC20 asset => uint128) internal _protocolRevenues;

/*//////////////////////////////////////////////////////////////////////////
CONSTRUCTOR
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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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/ISablierV2Adminable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

/// @title ISablierV2Adminable
/// @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/ISablierV2Comptroller.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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/ISablierV2Config.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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/ISablierV2LockupLinear.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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/ISablierV2LockupPro.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD2x18 } from "@prb/math/UD2x18.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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

/// @title ISablierV2LockupRecipient
/// @notice Interface for Sablier V2 recipient contracts that can react to cancellations 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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

/// @title ISablierV2LockupSender
/// @notice Interface for Sablier V2 sender contracts that can react 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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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/Events.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

/// This file simply re-exports all PRBMath types needed in v2-core. It is provided for convenience to
/// users so that they 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: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.18;

/// This file simply re-exports all token interfaces needed in v2-core. It is provided for convenience to
/// users so that they don't have to install openzeppelin-contracts and prb-contracts separately.
Expand Down
2 changes: 1 addition & 1 deletion test/Base.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { ERC20 } from "@openzeppelin/token/ERC20/ERC20.sol";
import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/E2eTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

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

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/lockup/linear/Linear.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD60x18, ud } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/lockup/pro/Pro.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { UD60x18, ud } from "@prb/math/UD60x18.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tokens/DAI.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

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

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tokens/SHIB.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

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

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tokens/USDC.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

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

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tokens/USDT.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

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

Expand Down
2 changes: 1 addition & 1 deletion test/fuzz/Fuzz.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Base_Test } from "../Base.t.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/fuzz/adminable/Adminable.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { ISablierV2Adminable } from "src/interfaces/ISablierV2Adminable.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/fuzz/adminable/transfer-admin/transferAdmin.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13 <0.9.0;
pragma solidity >=0.8.18 <0.9.0;

import { Errors } from "src/libraries/Errors.sol";
import { Events } from "src/libraries/Events.sol";
Expand Down
Loading