Skip to content
Open
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
31 changes: 12 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,24 @@ jobs:
flags:
- ""
- --via-ir
- --use solc:0.8.17 --via-ir
- --use solc:0.8.17
- --use solc:0.8.0
- --use solc:0.7.6
- --use solc:0.7.0
- --use solc:0.6.2
- --use solc:0.6.12
- --use solc:0.8.31 --via-ir
- --use solc:0.8.31
- --use solc:0.8.13 --via-ir
- --use solc:0.8.13
exclude:
- toolchain: stable
flags: --use solc:0.8.31 --via-ir
- toolchain: stable
flags: --use solc:0.8.31
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: foundry-rs/foundry-toolchain@v1
with:
version: ${{ matrix.toolchain }}
- run: forge --version
- run: |
case "${{ matrix.flags }}" in
*"solc:0.8.0"* | *"solc:0.7"* | *"solc:0.6"*)
forge build --skip test --skip Config --skip StdConfig --skip LibVariable --deny-warnings ${{ matrix.flags }}
;;
*)
forge build --skip test --deny-warnings ${{ matrix.flags }}
;;
esac
# via-ir compilation time checks.
- if: contains(matrix.flags, '--via-ir')
run: forge build --skip test --deny-warnings ${{ matrix.flags }} --contracts 'test/compilation/*'
- run: forge build -vvvvv --skip test --deny warnings ${{ matrix.flags }} --contracts 'test/compilation/*'

test:
runs-on: ubuntu-latest
Expand Down
12 changes: 0 additions & 12 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,3 @@ needs_undefined_env_var = "${UNDEFINED_RPC_URL_PLACEHOLDER}"

[lint]
lint_on_build = false

[fmt]
# These are all the `forge fmt` defaults.
line_length = 120
tab_width = 4
bracket_spacing = false
int_types = 'long'
multiline_func_header = 'attributes_first'
quote_style = 'double'
number_underscore = 'preserve'
single_line_statement_blocks = 'preserve'
ignore = ["src/console.sol", "src/console2.sol"]
14 changes: 2 additions & 12 deletions scripts/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def main():

pp = CheatcodesPrinter(
spdx_identifier="MIT OR Apache-2.0",
solidity_requirement=">=0.6.2 <0.9.0",
abicoder_pragma=True,
solidity_requirement=">=0.8.13 <0.9.0",
)
pp.p_prelude()
pp.prelude = False
Expand Down Expand Up @@ -412,7 +411,6 @@ class CheatcodesPrinter:
prelude: bool
spdx_identifier: str
solidity_requirement: str
abicoder_v2: bool

block_doc_style: bool

Expand All @@ -429,7 +427,6 @@ def __init__(
prelude: bool = True,
spdx_identifier: str = "UNLICENSED",
solidity_requirement: str = "",
abicoder_pragma: bool = False,
block_doc_style: bool = False,
indent_level: int = 0,
indent_with: int | str = 4,
Expand All @@ -439,7 +436,6 @@ def __init__(
self.prelude = prelude
self.spdx_identifier = spdx_identifier
self.solidity_requirement = solidity_requirement
self.abicoder_v2 = abicoder_pragma
self.block_doc_style = block_doc_style
self.buffer = buffer
self.indent_level = indent_level
Expand Down Expand Up @@ -500,17 +496,11 @@ def p_prelude(self, contract: Cheatcodes | None = None):

if self.solidity_requirement != "":
req = self.solidity_requirement
elif contract and len(contract.errors) > 0:
req = ">=0.8.4 <0.9.0"
else:
req = ">=0.6.0 <0.9.0"
req = ">=0.8.13 <0.9.0"
self._p_str(f"pragma solidity {req};")
self._p_nl()

if self.abicoder_v2:
self._p_str("pragma experimental ABIEncoderV2;")
self._p_nl()

self._p_nl()

def p_errors(self, errors: list[Error]):
Expand Down
2 changes: 1 addition & 1 deletion src/Base.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

import {StdStorage} from "./StdStorage.sol";
import {Vm, VmSafe} from "./Vm.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/Script.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

// 💬 ABOUT
// Forge Std's default Script.
Expand Down
3 changes: 1 addition & 2 deletions src/StdAssertions.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

import {Vm} from "./Vm.sol";

Expand Down
6 changes: 2 additions & 4 deletions src/StdChains.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

import {VmSafe} from "./Vm.sol";

Expand Down Expand Up @@ -176,8 +175,7 @@ abstract contract StdChains {
(errHash != keccak256(oldNotFoundError) && errHash != keccak256(newNotFoundError))
|| bytes(chain.rpcUrl).length == 0
) {
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
revert(add(32, err), mload(err))
}
}
Expand Down
16 changes: 5 additions & 11 deletions src/StdCheats.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;

pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

import {StdStorage, stdStorage} from "./StdStorage.sol";
import {console2} from "./console2.sol";
Expand Down Expand Up @@ -501,8 +499,7 @@ abstract contract StdCheatsSafe {
// e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))`
function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) {
bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
addr := create(0, add(bytecode, 0x20), mload(bytecode))
}

Expand All @@ -511,8 +508,7 @@ abstract contract StdCheatsSafe {

function deployCode(string memory what) internal virtual returns (address addr) {
bytes memory bytecode = vm.getCode(what);
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
addr := create(0, add(bytecode, 0x20), mload(bytecode))
}

Expand All @@ -522,8 +518,7 @@ abstract contract StdCheatsSafe {
/// @dev deploy contract with value on construction
function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) {
bytes memory bytecode = abi.encodePacked(vm.getCode(what), args);
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
addr := create(val, add(bytecode, 0x20), mload(bytecode))
}

Expand All @@ -532,8 +527,7 @@ abstract contract StdCheatsSafe {

function deployCode(string memory what, uint256 val) internal virtual returns (address addr) {
bytes memory bytecode = vm.getCode(what);
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
addr := create(val, add(bytecode, 0x20), mload(bytecode))
}

Expand Down
2 changes: 1 addition & 1 deletion src/StdConstants.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

import {IMulticall3} from "./interfaces/IMulticall3.sol";
import {Vm} from "./Vm.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/StdError.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
// Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test
pragma solidity >=0.6.2 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

library stdError {
bytes public constant assertionError = abi.encodeWithSignature("Panic(uint256)", 0x01);
Expand Down
4 changes: 1 addition & 3 deletions src/StdInvariant.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;

pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

abstract contract StdInvariant {
struct FuzzSelector {
Expand Down
4 changes: 1 addition & 3 deletions src/StdJson.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.0 <0.9.0;

pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

import {VmSafe} from "./Vm.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/StdMath.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

library stdMath {
int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968;
Expand Down
8 changes: 3 additions & 5 deletions src/StdStorage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

import {Vm} from "./Vm.sol";

Expand Down Expand Up @@ -293,8 +293,7 @@ library stdStorageSafe {
bytes memory result = new bytes(b.length * 32);
for (uint256 i = 0; i < b.length; i++) {
bytes32 k = b[i];
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
mstore(add(result, add(32, mul(32, i))), k)
}
}
Expand Down Expand Up @@ -400,8 +399,7 @@ library stdStorage {

function checked_write(StdStorage storage self, bool write) internal {
bytes32 t;
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
t := write
}
checked_write(self, t);
Expand Down
2 changes: 1 addition & 1 deletion src/StdStyle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.4.22 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

import {VmSafe} from "./Vm.sol";

Expand Down
4 changes: 1 addition & 3 deletions src/StdToml.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.0 <0.9.0;

pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

import {VmSafe} from "./Vm.sol";

Expand Down
7 changes: 2 additions & 5 deletions src/StdUtils.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;

pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

import {IMulticall3} from "./interfaces/IMulticall3.sol";
import {VmSafe} from "./Vm.sol";
Expand Down Expand Up @@ -185,8 +183,7 @@ abstract contract StdUtils {
function _sendLogPayloadView(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE2_ADDRESS;
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
let payloadStart := add(payload, 32)
let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)
}
Expand Down
4 changes: 1 addition & 3 deletions src/Test.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;

pragma experimental ABIEncoderV2;
pragma solidity >=0.8.13 <0.9.0;

// 💬 ABOUT
// Forge Std's default Test.
Expand Down
3 changes: 1 addition & 2 deletions src/Vm.sol

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

5 changes: 2 additions & 3 deletions src/console.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.4.22 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

library console {
address constant CONSOLE_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67;

function _sendLogPayloadImplementation(bytes memory payload) internal view {
address consoleAddress = CONSOLE_ADDRESS;
/// @solidity memory-safe-assembly
assembly {
assembly ("memory-safe") {
pop(staticcall(gas(), consoleAddress, add(payload, 32), mload(payload), 0, 0))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/console2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.4.22 <0.9.0;
pragma solidity >=0.8.13 <0.9.0;

import {console as console2} from "./console.sol";
2 changes: 1 addition & 1 deletion src/interfaces/IERC1155.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2;
pragma solidity >=0.8.13 <0.9.0;

import {IERC165} from "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC165.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2;
pragma solidity >=0.8.13 <0.9.0;

interface IERC165 {
/// @notice Query if a contract implements an interface
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2;
pragma solidity >=0.8.13 <0.9.0;

/// @dev Interface of the ERC20 standard as defined in the EIP.
/// @dev This includes the optional name, symbol, and decimals metadata.
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC4626.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2;
pragma solidity >=0.8.13 <0.9.0;

import {IERC20} from "./IERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC6909.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2;
pragma solidity >=0.8.13 <0.9.0;

import {IERC165} from "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC721.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2;
pragma solidity >=0.8.13 <0.9.0;

import {IERC165} from "./IERC165.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IERC7540.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2;
pragma solidity >=0.8.13 <0.9.0;

import {IERC7575} from "./IERC7575.sol";

Expand Down
Loading