-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from bcnmy/fix/remap
Fix/remap
- Loading branch information
Showing
32 changed files
with
150 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/account-abstraction"] | ||
path = lib/account-abstraction | ||
url = https://github.com/eth-infinitism/account-abstraction | ||
[submodule "lib/nexus"] | ||
path = lib/nexus | ||
url = https://github.com/bcnmy/nexus | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts | ||
[submodule "lib/v3-core"] | ||
path = lib/v3-core | ||
url = https://github.com/Uniswap/v3-core | ||
[submodule "lib/v3-periphery"] | ||
path = lib/v3-periphery | ||
url = https://github.com/Uniswap/v3-periphery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.26; | ||
pragma solidity ^0.8.27; | ||
|
||
/* solhint-disable reason-string */ | ||
|
||
import "@account-abstraction/contracts/core/EntryPoint.sol"; | ||
import "@account-abstraction/contracts/core/EntryPointSimulations.sol"; | ||
import "account-abstraction/core/EntryPoint.sol"; | ||
import "account-abstraction/core/EntryPointSimulations.sol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pragma solidity ^0.8.26; | ||
pragma solidity ^0.8.27; | ||
|
||
import "@biconomy-devx/erc7579-msa/test/foundry/mocks/MockValidator.sol"; | ||
// import "nexus"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule account-abstraction
deleted from
7af70c
Submodule nexus
deleted from
b8085a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.27; | ||
|
||
import { IModule } from "../interfaces/modules/IModule.sol"; | ||
import { IValidator } from "../interfaces/modules/IValidator.sol"; | ||
import { IModuleManager } from "../interfaces/base/IModuleManager.sol"; | ||
import { VALIDATION_SUCCESS, VALIDATION_FAILED, MODULE_TYPE_VALIDATOR, ERC1271_MAGICVALUE, ERC1271_INVALID } from "../types/Constants.sol"; | ||
import { PackedUserOperation } from "account-abstraction/contracts/interfaces/PackedUserOperation.sol"; | ||
import { ECDSA } from "solady/utils/ECDSA.sol"; | ||
import { SignatureCheckerLib } from "solady/utils/SignatureCheckerLib.sol"; | ||
import { MessageHashUtils } from "@openzeppelin/contracts/contracts/utils/cryptography/MessageHashUtils.sol"; | ||
|
||
contract MockValidator is IValidator { | ||
mapping(address => address) public smartAccountOwners; | ||
|
||
function validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash) external view returns (uint256 validation) { | ||
return | ||
ECDSA.recover(MessageHashUtils.toEthSignedMessageHash(userOpHash), userOp.signature) == smartAccountOwners[msg.sender] | ||
? VALIDATION_SUCCESS | ||
: VALIDATION_FAILED; | ||
} | ||
|
||
function isValidSignatureWithSender(address, bytes32 hash, bytes calldata signature) external view returns (bytes4) { | ||
address owner = smartAccountOwners[msg.sender]; | ||
// MAYBE SHOULD PREPARE REPLAY RESISTANT HASH BY APPENDING MSG.SENDER | ||
// SEE: https://github.com/bcnmy/scw-contracts/blob/3362262dab34fa0f57e2fbe0e57a4bdbd5318165/contracts/smart-account/modules/EcdsaOwnershipRegistryModule.sol#L122-L132 | ||
// OR USE EIP-712 | ||
if (SignatureCheckerLib.isValidSignatureNowCalldata(owner, hash, signature)) { | ||
return ERC1271_MAGICVALUE; | ||
} | ||
if (SignatureCheckerLib.isValidSignatureNowCalldata(owner, MessageHashUtils.toEthSignedMessageHash(hash), signature)) { | ||
return ERC1271_MAGICVALUE; | ||
} | ||
return ERC1271_INVALID; | ||
} | ||
|
||
function onInstall(bytes calldata data) external { | ||
require(IModuleManager(msg.sender).isModuleInstalled(MODULE_TYPE_VALIDATOR, address(this), ""), "Validator is still installed"); | ||
smartAccountOwners[msg.sender] = address(bytes20(data)); | ||
} | ||
|
||
function onUninstall(bytes calldata data) external { | ||
data; | ||
require(!IModuleManager(msg.sender).isModuleInstalled(MODULE_TYPE_VALIDATOR, address(this), ""), "Validator is still installed"); | ||
delete smartAccountOwners[msg.sender]; | ||
} | ||
|
||
function isModuleType(uint256 moduleTypeId) external pure returns (bool) { | ||
return moduleTypeId == MODULE_TYPE_VALIDATOR; | ||
} | ||
|
||
function isOwner(address account, address owner) external view returns (bool) { | ||
return smartAccountOwners[account] == owner; | ||
} | ||
|
||
function isInitialized(address) external pure returns (bool) { | ||
return false; | ||
} | ||
|
||
function getOwner(address account) external view returns (address) { | ||
return smartAccountOwners[account]; | ||
} | ||
} |
Submodule openzeppelin-contracts
deleted from
b73bcb
Submodule v3-core
deleted from
6562c5
Submodule v3-periphery
deleted from
b325bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/ | ||
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/ | ||
@openzeppelin/contracts/contracts/=node_modules/@openzeppelin/contracts/ | ||
@prb/test/=node_modules/@prb/test/ | ||
@nexus/=lib/nexus/ | ||
@forge-std/=lib/forge-std/ | ||
@uniswap/v3-periphery/=lib/v3-periphery/ | ||
@uniswap/v3-core/=lib/v3-core/ | ||
@account-abstraction=lib/account-abstraction/ | ||
account-abstraction=lib/account-abstraction/ | ||
@nexus/=node_modules/nexus/ | ||
forge-std/=lib/forge-std/src/ | ||
account-abstraction/=node_modules/account-abstraction/contracts/ | ||
@modulekit/=node_modules/modulekit/src/ | ||
@sentinellist/=node_modules/sentinellist/ | ||
@solady/=node_modules/solady/ | ||
sentinellist/=node_modules/sentinellist/src/ | ||
solady/=node_modules/solady/src/ | ||
@uniswap/v3-periphery/=node_modules/@uniswap/v3-periphery/contracts | ||
@uniswap/v3-core/=node_modules/@uniswap/v3-core/contracts/ | ||
|
||
@uniswap/v3-periphery/contracts/=node_modules/@uniswap/v3-periphery/contracts | ||
@uniswap/v3-core/contracts/=node_modules/@uniswap/v3-core/contracts/ | ||
|
||
solady/src/=node_modules/solady/src/ | ||
excessively-safe-call/=node_modules/excessively-safe-call/src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.