Skip to content

Commit

Permalink
Reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestognw committed Sep 19, 2024
1 parent aa4a7f7 commit 074423d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pragma solidity ^0.8.20;

import {IEntryPoint} from "../interfaces/IERC4337.sol";
import {Account} from "./Account.sol";
import {ECDSA} from "../utils/cryptography/ECDSA.sol";
import {Clones} from "../proxy/Clones.sol";
import {EIP712} from "../utils/cryptography/EIP712.sol";
import {IEntryPoint} from "../../interfaces/IERC4337.sol";
import {ECDSA} from "../../utils/cryptography/ECDSA.sol";
import {Clones} from "../../proxy/Clones.sol";
import {EIP712} from "../../utils/cryptography/EIP712.sol";
import {Account} from "./../Account.sol";

abstract contract AccountECDSA is Account {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
Expand All @@ -22,13 +22,7 @@ abstract contract AccountECDSA is Account {
}
}

contract AccountECDSAClonable is AccountECDSA {
constructor(
IEntryPoint entryPoint_,
string memory name,
string memory version
) Account(entryPoint_) EIP712(name, version) {}

abstract contract AccountECDSAClonable is AccountECDSA {
function signer() public view override returns (address) {
return abi.decode(Clones.fetchCloneArgs(address(this)), (address));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

pragma solidity ^0.8.20;

import {IEntryPoint} from "../interfaces/IERC4337.sol";
import {IEntryPoint} from "../../interfaces/IERC4337.sol";
import {AccountFactory} from "./../AccountFactory.sol";
import {AccountECDSAClonable} from "./AccountECDSA.sol";
import {AccountFactory} from "./AccountFactory.sol";

abstract contract AccountECDSAFactory is AccountFactory {
constructor(IEntryPoint entryPoint_, string memory name, string memory version) {
_accountImplementation = address(new AccountECDSAClonable(entryPoint_, name, version));
}

function clone(address signer, bytes32 salt) external returns (address) {
bytes memory encodedSigner = abi.encode(signer);
return _clone(encodedSigner, salt);
return _clone(abi.encode(signer), salt);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pragma solidity ^0.8.20;

import {IEntryPoint} from "../interfaces/IERC4337.sol";
import {Account} from "./Account.sol";
import {P256} from "../utils/cryptography/P256.sol";
import {Clones} from "../proxy/Clones.sol";
import {EIP712} from "../utils/cryptography/EIP712.sol";
import {IEntryPoint} from "../../interfaces/IERC4337.sol";
import {P256} from "../../utils/cryptography/P256.sol";
import {Clones} from "../../proxy/Clones.sol";
import {EIP712} from "../../utils/cryptography/EIP712.sol";
import {Account} from "./../Account.sol";

abstract contract AccountP256 is Account {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
Expand All @@ -31,13 +31,7 @@ abstract contract AccountP256 is Account {
}
}

contract AccountP256Clonable is AccountP256 {
constructor(
IEntryPoint entryPoint_,
string memory name,
string memory version
) Account(entryPoint_) EIP712(name, version) {}

abstract contract AccountP256Clonable is AccountP256 {
function signer() public view override returns (bytes32 qx, bytes32 qy) {
return abi.decode(Clones.fetchCloneArgs(address(this)), (bytes32, bytes32));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

pragma solidity ^0.8.20;

import {IEntryPoint} from "../interfaces/IERC4337.sol";
import {IEntryPoint} from "../../interfaces/IERC4337.sol";
import {AccountFactory} from "./../AccountFactory.sol";
import {AccountP256Clonable} from "./AccountP256.sol";
import {AccountFactory} from "./AccountFactory.sol";

abstract contract AccountP256Factory is AccountFactory {
constructor(IEntryPoint entryPoint_, string memory name, string memory version) {
_accountImplementation = address(new AccountP256Clonable(entryPoint_, name, version));
}

function clone(bytes32 qx, bytes32 qy, bytes32 salt) external returns (address) {
bytes memory encodedSigner = abi.encode(qx, qy);
return _clone(encodedSigner, salt);
return _clone(abi.encode(qx, qy), salt);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pragma solidity ^0.8.20;

import {IEntryPoint} from "../interfaces/IERC4337.sol";
import {Account} from "./Account.sol";
import {RSA} from "../utils/cryptography/RSA.sol";
import {Clones} from "../proxy/Clones.sol";
import {EIP712} from "../utils/cryptography/EIP712.sol";
import {IEntryPoint} from "../../interfaces/IERC4337.sol";
import {RSA} from "../../utils/cryptography/RSA.sol";
import {Clones} from "../../proxy/Clones.sol";
import {EIP712} from "../../utils/cryptography/EIP712.sol";
import {Account} from "./../Account.sol";

abstract contract AccountRSA is Account {
// NOTE: There is no way to store immutable byte arrays in a contract, so we use private instead
Expand All @@ -26,13 +26,7 @@ abstract contract AccountRSA is Account {
}
}

contract AccountRSAClonable is AccountRSA {
constructor(
IEntryPoint entryPoint_,
string memory name,
string memory version
) Account(entryPoint_) EIP712(name, version) {}

abstract contract AccountRSAClonable is AccountRSA {
function signer() public view override returns (bytes memory e, bytes memory m) {
return abi.decode(Clones.fetchCloneArgs(address(this)), (bytes, bytes));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

pragma solidity ^0.8.20;

import {IEntryPoint} from "../interfaces/IERC4337.sol";
import {IEntryPoint} from "../../interfaces/IERC4337.sol";
import {AccountFactory} from "./../AccountFactory.sol";
import {AccountRSAClonable} from "./AccountRSA.sol";
import {AccountFactory} from "./AccountFactory.sol";

abstract contract AccountRSAFactory is AccountFactory {
constructor(IEntryPoint entryPoint_, string memory name, string memory version) {
_accountImplementation = address(new AccountRSAClonable(entryPoint_, name, version));
}

function clone(bytes memory e, bytes memory m, bytes32 salt) external returns (address) {
bytes memory encodedSigner = abi.encode(e, m);
return _clone(encodedSigner, salt);
return _clone(abi.encode(e, m), salt);
}
}

0 comments on commit 074423d

Please sign in to comment.