From 5920fa25c7c24187ff1254fe2a8ef66c1f74ee2c Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Sat, 10 May 2025 11:02:22 +0200 Subject: [PATCH 1/2] Cleanup Imports, Update solidity version, etc... --- script/BatchCallAndSponsor.s.sol | 19 ++++++------------- script/DeployBatchCaller.s.sol | 10 +++++----- src/BatchCallAndSponsor.sol | 6 +++--- test/BatchCallAndSponsor.t.sol | 18 +++++------------- test/MockERC20.sol | 12 ++++++++++++ 5 files changed, 31 insertions(+), 34 deletions(-) create mode 100644 test/MockERC20.sol diff --git a/script/BatchCallAndSponsor.s.sol b/script/BatchCallAndSponsor.s.sol index a21492c..505e620 100644 --- a/script/BatchCallAndSponsor.s.sol +++ b/script/BatchCallAndSponsor.s.sol @@ -1,19 +1,12 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; +pragma solidity ^0.8.28; import "forge-std/Script.sol"; -import {Vm} from "forge-std/Vm.sol"; -import {BatchCallAndSponsor} from "../src/BatchCallAndSponsor.sol"; -import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; - -contract MockERC20 is ERC20 { - constructor() ERC20("Mock Token", "MOCK") {} - - function mint(address to, uint256 amount) external { - _mint(to, amount); - } -} +import "forge-std/Vm.sol"; +import "src/BatchCallAndSponsor.sol"; +import "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; +import "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol"; +import "test/MockERC20.sol"; contract BatchCallAndSponsorScript is Script { // Alice's address and private key (EOA with no initial contract code). diff --git a/script/DeployBatchCaller.s.sol b/script/DeployBatchCaller.s.sol index 9cdd965..26e1fa3 100644 --- a/script/DeployBatchCaller.s.sol +++ b/script/DeployBatchCaller.s.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; +pragma solidity ^0.8.28; import "forge-std/Script.sol"; -import {Vm} from "forge-std/Vm.sol"; -import {BatchCallAndSponsor} from "../src/BatchCallAndSponsor.sol"; -import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; +import "forge-std/Vm.sol"; +import "src/BatchCallAndSponsor.sol"; +import "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; +import "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol"; contract DeployBatchCaller is Script { BatchCallAndSponsor public batchCaller; diff --git a/src/BatchCallAndSponsor.sol b/src/BatchCallAndSponsor.sol index b3206b2..615191c 100644 --- a/src/BatchCallAndSponsor.sol +++ b/src/BatchCallAndSponsor.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; +pragma solidity ^0.8.28; -import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; -import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; +import "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; +import "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol"; /** * @title BatchCallAndSponsor diff --git a/test/BatchCallAndSponsor.t.sol b/test/BatchCallAndSponsor.t.sol index 2ca66d9..ab5e240 100644 --- a/test/BatchCallAndSponsor.t.sol +++ b/test/BatchCallAndSponsor.t.sol @@ -1,19 +1,11 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; +pragma solidity ^0.8.28; import {Test, console2} from "forge-std/Test.sol"; -import {Vm} from "forge-std/Vm.sol"; -import {BatchCallAndSponsor} from "../src/BatchCallAndSponsor.sol"; -import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; - -contract MockERC20 is ERC20 { - constructor() ERC20("Mock Token", "MOCK") {} - - function mint(address to, uint256 amount) external { - _mint(to, amount); - } -} +import "forge-std/Vm.sol"; +import "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol"; +import "src/BatchCallAndSponsor.sol"; +import "test/MockERC20.sol"; contract BatchCallAndSponsorTest is Test { // Alice's address and private key (EOA with no initial contract code). diff --git a/test/MockERC20.sol b/test/MockERC20.sol new file mode 100644 index 0000000..4a83f2e --- /dev/null +++ b/test/MockERC20.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +import "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; + +contract MockERC20 is ERC20 { + constructor() ERC20("Mock Token", "MOCK") {} + + function mint(address to, uint256 amount) external { + _mint(to, amount); + } +} From 569b08054d89cc0d2008726d30d2c672114f7c12 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Sat, 10 May 2025 11:03:10 +0200 Subject: [PATCH 2/2] Fix workflow dispatch --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34a4a52..0d756e5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,10 @@ -name: CI +name: Foundry CI on: push: + branches: [main] pull_request: - workflow_dispatch: + branches: [main] env: FOUNDRY_PROFILE: ci