diff --git a/.gitmodules b/.gitmodules index fa2b614..b756d1f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "lib/nexus"] - path = lib/nexus - url = https://github.com/bcnmy/nexus +[submodule "lib/nexus.git"] + path = lib/nexus.git + url = https://github.com/bcnmy/nexus.git diff --git a/.solhint.json b/.solhint.json index a41dc0f..06fbb26 100644 --- a/.solhint.json +++ b/.solhint.json @@ -1,7 +1,7 @@ { "extends": "solhint:recommended", "rules": { - "compiler-version": ["error", "^0.8.24"], + "compiler-version": ["error", "^0.8.26"], "func-visibility": ["warn", { "ignoreConstructors": true }], "reentrancy": "error", "state-visibility": "error", diff --git a/contracts/base/BasePaymaster.sol b/contracts/base/BasePaymaster.sol index 25ca1a6..8b7e1e0 100644 --- a/contracts/base/BasePaymaster.sol +++ b/contracts/base/BasePaymaster.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; /* solhint-disable reason-string */ diff --git a/contracts/common/Errors.sol b/contracts/common/Errors.sol index 045a5f1..4e42283 100644 --- a/contracts/common/Errors.sol +++ b/contracts/common/Errors.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; contract BiconomySponsorshipPaymasterErrors { diff --git a/contracts/interfaces/IBiconomySponsorshipPaymaster.sol b/contracts/interfaces/IBiconomySponsorshipPaymaster.sol index f90955c..ed4da78 100644 --- a/contracts/interfaces/IBiconomySponsorshipPaymaster.sol +++ b/contracts/interfaces/IBiconomySponsorshipPaymaster.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; interface IBiconomySponsorshipPaymaster { event PostopCostChanged(uint256 indexed _oldValue, uint256 indexed _newValue); diff --git a/contracts/mocks/Imports.sol b/contracts/mocks/Imports.sol index 3eb785e..7b0976a 100644 --- a/contracts/mocks/Imports.sol +++ b/contracts/mocks/Imports.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; /* solhint-disable reason-string */ diff --git a/contracts/mocks/MockValidator.sol b/contracts/mocks/MockValidator.sol index 5f7bdd9..2c3d359 100644 --- a/contracts/mocks/MockValidator.sol +++ b/contracts/mocks/MockValidator.sol @@ -1,3 +1,3 @@ -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; import "@biconomy-devx/erc7579-msa/test/foundry/mocks/MockValidator.sol"; \ No newline at end of file diff --git a/contracts/references/SampleVerifyingPaymaster.sol b/contracts/references/SampleVerifyingPaymaster.sol index 3fdce99..46f12bf 100644 --- a/contracts/references/SampleVerifyingPaymaster.sol +++ b/contracts/references/SampleVerifyingPaymaster.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; /* solhint-disable reason-string */ /* solhint-disable no-inline-assembly */ diff --git a/contracts/sponsorship/SponsorshipPaymasterWithPremium.sol b/contracts/sponsorship/SponsorshipPaymasterWithPremium.sol index 4cdc960..91d9988 100644 --- a/contracts/sponsorship/SponsorshipPaymasterWithPremium.sol +++ b/contracts/sponsorship/SponsorshipPaymasterWithPremium.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; /* solhint-disable reason-string */ diff --git a/contracts/test/Foo.sol b/contracts/test/Foo.sol index f419123..8302d06 100644 --- a/contracts/test/Foo.sol +++ b/contracts/test/Foo.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.24; +pragma solidity >=0.8.26; /** * @title Foo diff --git a/contracts/test/Lock.sol b/contracts/test/Lock.sol index d11302f..522be01 100644 --- a/contracts/test/Lock.sol +++ b/contracts/test/Lock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; /** * @title Lock diff --git a/contracts/utils/SoladyOwnable.sol b/contracts/utils/SoladyOwnable.sol index 9589b3d..0cd57c4 100644 --- a/contracts/utils/SoladyOwnable.sol +++ b/contracts/utils/SoladyOwnable.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; import {Ownable} from "solady/src/auth/Ownable.sol"; diff --git a/foundry.toml b/foundry.toml index e3480d4..04c3656 100644 --- a/foundry.toml +++ b/foundry.toml @@ -11,7 +11,7 @@ optimizer_runs = 1_000_000 out = "out" script = "scripts" - solc = "0.8.24" + solc = "0.8.26" src = "contracts" test = "test" cache_path = "cache_forge" diff --git a/hardhat.config.ts b/hardhat.config.ts index 3e7fdf2..e139ab6 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -5,7 +5,7 @@ import "@bonadocs/docgen"; const config: HardhatUserConfig = { solidity: { - version: "0.8.24", + version: "0.8.26", settings: { optimizer: { enabled: true, diff --git a/lib/nexus b/lib/nexus deleted file mode 160000 index ab9616b..0000000 --- a/lib/nexus +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ab9616bd71fcd51048e834f87a7b60dccbfc0adb diff --git a/lib/nexus.git b/lib/nexus.git new file mode 160000 index 0000000..5d81e53 --- /dev/null +++ b/lib/nexus.git @@ -0,0 +1 @@ +Subproject commit 5d81e533941b49194fbc469b09b182c6c5d0e9d9 diff --git a/remappings.txt b/remappings.txt index 3272323..b197025 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,5 +1,6 @@ @openzeppelin/contracts/=node_modules/@openzeppelin/contracts/ @prb/test/=node_modules/@prb/test/ +@nexus/=lib/nexus.git/ forge-std/=node_modules/forge-std/ account-abstraction=node_modules/account-abstraction/ modulekit/=node_modules/modulekit/src/ diff --git a/test/foundry/Lock.t.sol b/test/foundry/Lock.t.sol index 5782e2d..a6f245b 100644 --- a/test/foundry/Lock.t.sol +++ b/test/foundry/Lock.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.24 <0.9.0; +pragma solidity >=0.8.26 <0.9.0; import { PRBTest } from "@prb/test/src/PRBTest.sol"; import { Lock } from "../../contracts/test/Lock.sol"; diff --git a/test/foundry/SponsorshipPaymasterWithPremium.t.sol b/test/foundry/SponsorshipPaymasterWithPremium.t.sol index 8c47d9d..d1191a6 100644 --- a/test/foundry/SponsorshipPaymasterWithPremium.t.sol +++ b/test/foundry/SponsorshipPaymasterWithPremium.t.sol @@ -1,9 +1,16 @@ // SPDX-License-Identifier: Unlicensed -pragma solidity ^0.8.24; -import { BiconomySponsorshipPaymaster } from "../../contracts/sponsorship/SponsorshipPaymasterWithPremium.sol"; +pragma solidity ^0.8.26; + import { Test } from "forge-std/src/Test.sol"; -import { StdCheats } from "forge-std/src/StdCheats.sol"; +import { Vm } from "forge-std/src/Vm.sol"; + +import { BiconomySponsorshipPaymaster } from "../../contracts/sponsorship/SponsorshipPaymasterWithPremium.sol"; +import { NexusTestBase } from "./base/NexusTestBase.sol"; + +contract SponsorshipPaymasterWithPremiumTest is NexusTestBase { + function setUp() public virtual override { + super.setUp(); -contract SponsorshipPaymasterWithPremiumTest is Test { - -} \ No newline at end of file + + } +} diff --git a/test/foundry/base/NexusTestBase.sol b/test/foundry/base/NexusTestBase.sol new file mode 100644 index 0000000..a287985 --- /dev/null +++ b/test/foundry/base/NexusTestBase.sol @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.26; + +import { Test } from "forge-std/src/Test.sol"; + +import { EntryPoint } from "account-abstraction/contracts/core/EntryPoint.sol"; +import { Nexus } from "@nexus/contracts/Nexus.sol"; +import { NexusAccountFactory } from "@nexus/contracts/factory/NexusAccountFactory.sol"; + +abstract contract NexusTestBase is Test { + // Test Environment Configuration + string constant mnemonic = "test test test test test test test test test test test junk"; + uint256 constant testAccountCount = 10; + uint256 constant initialMainAccountFunds = 100_000 ether; + uint256 constant defaultPreVerificationGas = 21_000; + + uint32 nextKeyIndex; + + // Test Accounts + struct TestAccount { + address payable addr; + uint256 privateKey; + } + + TestAccount[] testAccounts; + TestAccount alice; + TestAccount bob; + TestAccount charlie; + TestAccount dan; + TestAccount emma; + TestAccount frank; + TestAccount george; + TestAccount henry; + TestAccount ida; + + TestAccount owner; + + // ERC7579 Contracts + EntryPoint entryPoint; + Nexus saImplementation; + NexusAccountFactory factory; + + function getNextPrivateKey() internal returns (uint256) { + return vm.deriveKey(mnemonic, ++nextKeyIndex); + } + + function setUp() public virtual { + // Generate Test Addresses + for (uint256 i = 0; i < testAccountCount; i++) { + uint256 privateKey = getNextPrivateKey(); + testAccounts.push(TestAccount(payable(vm.addr(privateKey)), privateKey)); + + deal(testAccounts[i].addr, initialMainAccountFunds); + } + + // Name Test Addresses + alice = testAccounts[0]; + vm.label(alice.addr, string.concat("Alice", vm.toString(uint256(0)))); + + bob = testAccounts[1]; + vm.label(bob.addr, string.concat("Bob", vm.toString(uint256(1)))); + + charlie = testAccounts[2]; + vm.label(charlie.addr, string.concat("Charlie", vm.toString(uint256(2)))); + + dan = testAccounts[3]; + vm.label(dan.addr, string.concat("Dan", vm.toString(uint256(3)))); + + emma = testAccounts[4]; + vm.label(emma.addr, string.concat("Emma", vm.toString(uint256(4)))); + + frank = testAccounts[5]; + vm.label(frank.addr, string.concat("Frank", vm.toString(uint256(5)))); + + george = testAccounts[6]; + vm.label(george.addr, string.concat("George", vm.toString(uint256(6)))); + + henry = testAccounts[7]; + vm.label(henry.addr, string.concat("Henry", vm.toString(uint256(7)))); + + ida = testAccounts[7]; + vm.label(ida.addr, string.concat("Ida", vm.toString(uint256(8)))); + + // Name Owner + owner = testAccounts[8]; + vm.label(owner.addr, string.concat("Owner", vm.toString(uint256(9)))); + } +} diff --git a/test/foundry/mocks/Counter.sol b/test/foundry/mocks/Counter.sol index 5807161..c4ec3d6 100644 --- a/test/foundry/mocks/Counter.sol +++ b/test/foundry/mocks/Counter.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.24; +pragma solidity ^0.8.26; contract Counter { uint256 private _number;