Skip to content

Commit

Permalink
setup imports, accounts, and align versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivaanshK committed Jun 27, 2024
1 parent 55d967d commit 659b7e3
Show file tree
Hide file tree
Showing 21 changed files with 121 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/BasePaymaster.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.24;
pragma solidity ^0.8.26;

/* solhint-disable reason-string */

Expand Down
2 changes: 1 addition & 1 deletion contracts/common/Errors.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.24;
pragma solidity ^0.8.26;

contract BiconomySponsorshipPaymasterErrors {

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IBiconomySponsorshipPaymaster.sol
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/Imports.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.24;
pragma solidity ^0.8.26;

/* solhint-disable reason-string */

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/MockValidator.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pragma solidity ^0.8.24;
pragma solidity ^0.8.26;

import "@biconomy-devx/erc7579-msa/test/foundry/mocks/MockValidator.sol";
2 changes: 1 addition & 1 deletion contracts/references/SampleVerifyingPaymaster.sol
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion contracts/sponsorship/SponsorshipPaymasterWithPremium.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.24;
pragma solidity ^0.8.26;

/* solhint-disable reason-string */

Expand Down
2 changes: 1 addition & 1 deletion contracts/test/Foo.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.24;
pragma solidity >=0.8.26;

/**
* @title Foo
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/Lock.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
pragma solidity ^0.8.26;

/**
* @title Lock
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/SoladyOwnable.sol
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "@bonadocs/docgen";

const config: HardhatUserConfig = {
solidity: {
version: "0.8.24",
version: "0.8.26",
settings: {
optimizer: {
enabled: true,
Expand Down
1 change: 0 additions & 1 deletion lib/nexus
Submodule nexus deleted from ab9616
1 change: 1 addition & 0 deletions lib/nexus.git
Submodule nexus.git added at 5d81e5
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
2 changes: 1 addition & 1 deletion test/foundry/Lock.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
19 changes: 13 additions & 6 deletions test/foundry/SponsorshipPaymasterWithPremium.t.sol
Original file line number Diff line number Diff line change
@@ -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 {

}
}
}
88 changes: 88 additions & 0 deletions test/foundry/base/NexusTestBase.sol
Original file line number Diff line number Diff line change
@@ -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))));
}
}
2 changes: 1 addition & 1 deletion test/foundry/mocks/Counter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
pragma solidity ^0.8.26;

contract Counter {
uint256 private _number;
Expand Down

0 comments on commit 659b7e3

Please sign in to comment.