Skip to content

Commit

Permalink
🔨 account: script to fetch ERC1271 signature
Browse files Browse the repository at this point in the history
  • Loading branch information
qd-qd committed Apr 2, 2024
1 parent ba5761d commit 8a7d165
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions script/Account/12_AccountIsValidSignature.s.sol
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

View workflow job for this annotation

GitHub Actions / lint

imported name EIP1271_VALIDATION_SUCCESS is not used

Check warning on line 5 in script/Account/12_AccountIsValidSignature.s.sol

View workflow job for this annotation

GitHub Actions / lint

imported name EIP1271_VALIDATION_SUCCESS is not used
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;
}
}

0 comments on commit 8a7d165

Please sign in to comment.