-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 account: script to fetch ERC1271 signature
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: APACHE-2.0 | ||
pragma solidity >=0.8.19 <0.9.0; | ||
|
||
import { SmartAccount } from "src/v1/Account/SmartAccount.sol"; | ||
import { EIP1271_VALIDATION_SUCCESS } from "src/v1/Account/SmartAccountEIP1271.sol"; | ||
Check warning on line 5 in script/Account/12_AccountIsValidSignature.s.sol GitHub Actions / lint
|
||
import { BaseScript } from "../Base.s.sol"; | ||
|
||
/// @title AccountIsValidSignature | ||
/// @notice Check if a EIP1271 signature is valid | ||
contract AccountIsValidSignature is BaseScript { | ||
function run() public broadcast returns (bool isValid) { | ||
// address of the account we wanna use | ||
address payable accountAddress = payable(vm.envAddress("ACCOUNT")); | ||
SmartAccount account = SmartAccount(accountAddress); | ||
|
||
// the message hash and the signature | ||
bytes32 hash = vm.envBytes32("HASH"); | ||
bytes memory signature = vm.envBytes("SIGNATURE"); | ||
|
||
// check the validity of the signature | ||
isValid = account.isValidSignature(hash, signature) == EIP1271_VALIDATION_SUCCESS; | ||
} | ||
} |