Verified contractPartialMIT
DenySignaturePolicy
Address0xeea907fdfc9e7155117993f8ff6494dc4efb91e7
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.36
- Same code
Only this contract
Details
- Compiler
- solc 0.8.36+commit.8a079791
- Language
- solidity
- Optimization
- Yes, 1,000,000 runs
- EVM version
- osaka
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,399,182
- Creation transaction
- 0x7db2db5840…09aefc1622
src/policies/DenySignaturePolicy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {PackedUserOperation} from "account-abstraction/interfaces/PackedUserOperation.sol";
import {PolicyBase} from "../kernel-7579-plugins/src/base/PolicyBase.sol";
import {SIG_VALIDATION_FAILED_UINT, SIG_VALIDATION_SUCCESS_UINT} from "../kernel-7579-plugins/src/types/Constants.sol";
/// @notice Passes every user operation and refuses every ERC-1271 signature: a permission that
/// holds this policy runs its calls and signs no message for the account.
/// @dev kernel-7579-plugins PR #61's SudoPolicy with the signature answer inverted. It keeps no
/// state and takes no configuration, so its address among a permission's policies is the
/// whole of what it does.
contract DenySignaturePolicy is PolicyBase {
function checkUserOpPolicy(bytes32, PackedUserOperation calldata) external payable override returns (uint256) {
return SIG_VALIDATION_SUCCESS_UINT;
}
function checkSignaturePolicy(bytes32, address, bytes32, bytes calldata) external pure override returns (uint256) {
return SIG_VALIDATION_FAILED_UINT;
}
function _policyOninstall(bytes32, bytes calldata) internal override {}
function _policyOnUninstall(bytes32, bytes calldata) internal override {}
}
src/account-abstraction/interfaces/PackedUserOperation.sol
// Vendored from the eth-infinitism/account-abstraction dependency pinned by
// zerodevapp/kernel commit c960b42d2ed4adb0d5328f6e762962debdf8e57a:
// https://github.com/eth-infinitism/account-abstraction/blob/86fcd84cf7263fe384d61d078ee747b16e69a496/contracts/interfaces/PackedUserOperation.sol
// No source modifications below this header.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
/**
* User Operation struct
* @param sender - The sender account of this request.
* @param nonce - Unique value the sender uses to verify it is not a replay.
* @param initCode - If set, the account contract will be created by this constructor
* @param callData - The method call to execute on this account.
* @param accountGasLimits - Packed gas limits for validateUserOp and gas limit passed to the callData method call.
* @param preVerificationGas - Gas not calculated by the handleOps method, but added to the gas paid.
* Covers batch overhead.
* @param gasFees - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters.
* @param paymasterAndData - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data
* The paymaster will pay for the transaction instead of the sender.
* @param signature - Sender-verified signature over the entire request, the EntryPoint address and the chain ID.
*
*
* Field layout (enforced on-chain by EntryPoint):
* - sender: must already be deployed, or be the address that `initCode` will deploy; for EIP-7702 onboarding, `initCode = 0x7702 || optionalPayload`
* and `sender.code` must begin `0xef0100 || delegate`.
* - nonce = uint192(key) || uint64(sequence); EntryPoint tracks sequential values of `sequence` separately for each `key` value.
* - initCode:
* * non-7702: `initCode = factory(20) || factoryCalldata`; the factory must return `sender` and deploy code.
* * 7702: `0x7702` (magic prefix), optionally padded to 20 bytes and followed by `initizlizationCode`. This optional payload is executed on `sender` to finalise delegate setup.
* - callData: executed verbatim; if it starts with `IAccountExecute.executeUserOp.selector` (0x8dd7712f), EntryPoint wraps and forwards `(userOp, userOpHash)`.
* - accountGasLimits =`uint128(verificationGasLimit) || uint128(callGasLimit)`
* - gasFees = `uint128(maxPriorityFeePerGas) || uint128(maxFeePerGas)`
* - paymasterAndData (if non-empty) = `paymaster(20) || verificationGasLimit(16) || postOpGasLimit(16) || paymasterData`
* * an optional paymasterSignature may be added by appending:
* `paymasterSignature || uint16(paymasterSignature.length) || PAYMASTER_SIG_MAGIC (0x22e325a297439656)`
* - signature: Used by the account to validate the UserOperation against the `userOpHash`.
* The hash covers all UserOperation fields, except `signature` and `paymasterSignature`
*/
struct PackedUserOperation {
address sender;
uint256 nonce;
bytes initCode;
bytes callData;
bytes32 accountGasLimits;
uint256 preVerificationGas;
bytes32 gasFees;
bytes paymasterAndData;
bytes signature;
}
src/kernel-7579-plugins/src/base/PolicyBase.sol
// Vendored from zerodevapp/kernel-7579-plugins at commit
// a868ce8b83ec7022bed7e959453a17a12b2d4c4d (PR #61):
// https://github.com/zerodevapp/kernel-7579-plugins/blob/a868ce8b83ec7022bed7e959453a17a12b2d4c4d/src/base/PolicyBase.sol
// No source modifications below this header.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPolicy} from "src/interfaces/IERC7579Modules.sol";
import {PackedUserOperation} from "account-abstraction/interfaces/PackedUserOperation.sol";
abstract contract PolicyBase is IPolicy {
function onInstall(bytes calldata data) external payable {
bytes32 id = bytes32(data[0:32]);
bytes calldata _data = data[32:];
_policyOninstall(id, _data);
}
function onUninstall(bytes calldata data) external payable {
bytes32 id = bytes32(data[0:32]);
bytes calldata _data = data[32:];
_policyOnUninstall(id, _data);
}
function isModuleType(uint256 id) external pure virtual returns (bool) {
return id == 5;
}
function checkUserOpPolicy(bytes32 id, PackedUserOperation calldata userOp)
external
payable
virtual
returns (uint256);
function checkSignaturePolicy(bytes32 id, address sender, bytes32 hash, bytes calldata sig)
external
view
virtual
returns (uint256);
function _policyOninstall(bytes32 id, bytes calldata _data) internal virtual;
function _policyOnUninstall(bytes32 id, bytes calldata _data) internal virtual;
}
src/kernel-7579-plugins/src/interfaces/IERC7579Modules.sol
// Vendored from zerodevapp/kernel-7579-plugins at commit
// a868ce8b83ec7022bed7e959453a17a12b2d4c4d (PR #61):
// https://github.com/zerodevapp/kernel-7579-plugins/blob/a868ce8b83ec7022bed7e959453a17a12b2d4c4d/src/interfaces/IERC7579Modules.sol
// No source modifications below this header.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
import {PackedUserOperation} from "account-abstraction/interfaces/PackedUserOperation.sol";
interface IModule {
error AlreadyInitialized(address smartAccount);
error NotInitialized(address smartAccount);
/**
* @dev This function is called by the smart account during installation of the module
* @param data arbitrary data that may be required on the module during `onInstall`
* initialization
*
* MUST revert on error (i.e. if module is already enabled)
*/
function onInstall(bytes calldata data) external payable;
/**
* @dev This function is called by the smart account during uninstallation of the module
* @param data arbitrary data that may be required on the module during `onUninstall`
* de-initialization
*
* MUST revert on error
*/
function onUninstall(bytes calldata data) external payable;
/**
* @dev Returns boolean value if module is a certain type
* @param moduleTypeId the module type ID according the ERC-7579 spec
*
* MUST return true if the module is of the given type and false otherwise
*/
function isModuleType(uint256 moduleTypeId) external view returns (bool);
}
interface IValidator is IModule {
error InvalidTargetAddress(address target);
/**
* @dev Validates a transaction on behalf of the account.
* This function is intended to be called by the MSA during the ERC-4337 validation phase
* Note: solely relying on bytes32 hash and signature is not sufficient for some
* validation implementations (i.e. SessionKeys often need access to userOp.calldata)
* @param userOp The user operation to be validated. The userOp MUST NOT contain any metadata.
* The MSA MUST clean up the userOp before sending it to the validator.
* @param userOpHash The hash of the user operation to be validated
* @return return value according to ERC-4337
*/
function validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash) external payable returns (uint256);
/**
* Validator can be used for ERC-1271 validation
*/
function isValidSignatureWithSender(address sender, bytes32 hash, bytes calldata data)
external
view
returns (bytes4);
}
interface IExecutor is IModule {}
interface IHook is IModule {
function preCheck(address msgSender, uint256 msgValue, bytes calldata msgData)
external
payable
returns (bytes memory hookData);
function postCheck(bytes calldata hookData) external payable;
}
interface IFallback is IModule {}
interface IPolicy is IModule {
function checkUserOpPolicy(bytes32 id, PackedUserOperation calldata userOp) external payable returns (uint256);
function checkSignaturePolicy(bytes32 id, address sender, bytes32 hash, bytes calldata sig)
external
view
returns (uint256);
}
interface ISigner is IModule {
function checkUserOpSignature(bytes32 id, PackedUserOperation calldata userOp, bytes32 userOpHash)
external
payable
returns (uint256);
function checkSignature(bytes32 id, address sender, bytes32 hash, bytes calldata sig) external view returns (bytes4);
}
interface IStatelessValidator is IModule {
function validateSignatureWithData(bytes32 hash, bytes calldata signature, bytes calldata data)
external
view
returns (bool);
}
interface IStatelessValidatorWithSender is IModule {
function validateSignatureWithDataWithSender(
address sender,
bytes32 hash,
bytes calldata signature,
bytes calldata data
) external view returns (bool);
}
src/kernel-7579-plugins/src/types/Constants.sol
// Vendored from zerodevapp/kernel-7579-plugins at commit
// a868ce8b83ec7022bed7e959453a17a12b2d4c4d (PR #61):
// https://github.com/zerodevapp/kernel-7579-plugins/blob/a868ce8b83ec7022bed7e959453a17a12b2d4c4d/src/types/Constants.sol
// No source modifications below this header.
pragma solidity ^0.8.0;
uint256 constant MODULE_TYPE_VALIDATOR = 1;
uint256 constant MODULE_TYPE_EXECUTOR = 2;
uint256 constant MODULE_TYPE_FALLBACK = 3;
uint256 constant MODULE_TYPE_HOOK = 4;
uint256 constant MODULE_TYPE_POLICY = 5;
uint256 constant MODULE_TYPE_SIGNER = 6;
uint256 constant MODULE_TYPE_STATELESS_VALIDATOR = 7;
uint256 constant MODULE_TYPE_STATELESS_VALIDATOR_WITH_SENDER = 10;
bytes4 constant ERC1271_MAGICVALUE = 0x1626ba7e;
bytes4 constant ERC1271_INVALID = 0xffffffff;
uint256 constant SIG_VALIDATION_FAILED_UINT = 1;
uint256 constant SIG_VALIDATION_SUCCESS_UINT = 0;
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "none",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 1000000,
"enabled": true
},
"viaSSACFG": false,
"evmVersion": "osaka",
"remappings": [
"account-abstraction/=src/account-abstraction/",
"forge-std/=dependencies/forge-std-1.9.7/src/",
"solady/=dependencies/solady-0.1.26/src/",
"src/kernel-7579-plugins/:src/base/=src/kernel-7579-plugins/src/base/",
"src/kernel-7579-plugins/:src/interfaces/=src/kernel-7579-plugins/src/interfaces/",
"src/kernel-7579-plugins/:src/types/=src/kernel-7579-plugins/src/types/",
"src/kernel-7579-plugins/:src/utils/=src/kernel-7579-plugins/src/utils/",
"src/kernel-7579-plugins-v3/:kernel/=src/kernel-v3/src/",
"forge-std-1.9.7/=dependencies/forge-std-1.9.7/src/",
"solady-0.1.26/=dependencies/solady-0.1.26/src/"
],
"experimental": false
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.