Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
| Parent Transaction Hash | Block | From | To | Amount | ||
|---|---|---|---|---|---|---|
| 10523129 | 733 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
SudoPolicy
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "kernel/sdk/moduleBase/PolicyBase.sol";
contract SudoPolicy is PolicyBase {
mapping(address => uint256) public usedIds;
function isInitialized(address wallet) external view override returns (bool) {
return usedIds[wallet] > 0;
}
function checkUserOpPolicy(bytes32 id, PackedUserOperation calldata userOp)
external
payable
override
returns (uint256)
{
return 0;
}
function checkSignaturePolicy(bytes32 id, address sender, bytes32 hash, bytes calldata sig)
external
view
override
returns (uint256)
{
return 0;
}
function _policyOninstall(bytes32 id, bytes calldata _data) internal override {
usedIds[msg.sender]++;
}
function _policyOnUninstall(bytes32 id, bytes calldata _data) internal override {
usedIds[msg.sender]--;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPolicy} from "../../interfaces/IERC7579Modules.sol";
import {PackedUserOperation} from "../../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 returns (bool) {
return id == 5;
}
function isInitialized(address) external view virtual returns (bool); // TODO : not sure if this is the right way to do it
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;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
import {PackedUserOperation} from "./PackedUserOperation.sol";
uint256 constant VALIDATION_SUCCESS = 0;
uint256 constant VALIDATION_FAILED = 1;
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_ACTION = 7;
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);
/**
* @dev Returns if the module was already initialized for a provided smartaccount
*/
function isInitialized(address smartAccount) 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 validaton phase
* Note: solely relying on bytes32 hash and signature is not suffcient 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, bytes calldata msgData) external payable returns (bytes memory hookData);
function postCheck(bytes calldata hookData) external payable returns (bool success);
}
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 IAction is IModule {}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.5;
/**
* 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 maxFeePerGas and maxPriorityFeePerGas - Same as EIP-1559 gas parameter.
* @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.
*/
struct PackedUserOperation {
address sender;
uint256 nonce;
bytes initCode;
bytes callData;
bytes32 accountGasLimits;
uint256 preVerificationGas;
bytes32 gasFees; //maxPriorityFee and maxFeePerGas;
bytes paymasterAndData;
bytes signature;
}{
"remappings": [
"ds-test/=lib/kernel_v3/lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"kernel/=lib/kernel_v3/src/",
"ExcessivelySafeCall/=lib/kernel_v3/lib/ExcessivelySafeCall/src/",
"kernel_v3/=lib/kernel_v3/src/",
"solady/=lib/kernel_v3/lib/solady/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "none",
"appendCBOR": false
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": true,
"libraries": {}
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"smartAccount","type":"address"}],"name":"AlreadyInitialized","type":"error"},{"inputs":[{"internalType":"address","name":"smartAccount","type":"address"}],"name":"NotInitialized","type":"error"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"sig","type":"bytes"}],"name":"checkSignaturePolicy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"initCode","type":"bytes"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes32","name":"accountGasLimits","type":"bytes32"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"bytes32","name":"gasFees","type":"bytes32"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct PackedUserOperation","name":"userOp","type":"tuple"}],"name":"checkUserOpPolicy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"isModuleType","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onInstall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onUninstall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"usedIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6080806040523461001657610292908161001c8239f35b600080fdfe60806040908082526004908136101561001757600080fd5b600090813560e01c908163244d6cb21461021657508063309bfb76146101c85780636d61fe70146101745780637129edce1461013e5780638a91b0e3146100d1578063d60b347f146100945763ecd059611461007257600080fd5b3461009157602036600319011261009157506005602092519135148152f35b80fd5b5082346100cd5760203660031901126100cd5760209181906001600160a01b036100bc610249565b168152808452205415159051908152f35b5080fd5b5091602036600319011261013657813567ffffffffffffffff811161013a576100fd9036908401610264565b905060201161013657338352826020528220908154908115610123575060001901905580f35b634e487b7160e01b845260119052602483fd5b8280fd5b8380fd5b50826003198181360112610136576024359067ffffffffffffffff821161013a5761012091360301126100cd5751908152602090f35b5091602036600319011261013657813567ffffffffffffffff811161013a576101a09036908401610264565b9050602011610136573383528260205282209081549060001982146101235750600101905580f35b5082346100cd5760803660031901126100cd576024356001600160a01b038116036100cd5760643567ffffffffffffffff81116101365760209361020e91369101610264565b505051908152f35b90508334610136576020366003190112610136576020926001600160a01b0361023d610249565b16815280845220548152f35b600435906001600160a01b038216820361025f57565b600080fd5b9181601f8401121561025f5782359167ffffffffffffffff831161025f576020838186019501011161025f5756
Deployed Bytecode
0x60806040908082526004908136101561001757600080fd5b600090813560e01c908163244d6cb21461021657508063309bfb76146101c85780636d61fe70146101745780637129edce1461013e5780638a91b0e3146100d1578063d60b347f146100945763ecd059611461007257600080fd5b3461009157602036600319011261009157506005602092519135148152f35b80fd5b5082346100cd5760203660031901126100cd5760209181906001600160a01b036100bc610249565b168152808452205415159051908152f35b5080fd5b5091602036600319011261013657813567ffffffffffffffff811161013a576100fd9036908401610264565b905060201161013657338352826020528220908154908115610123575060001901905580f35b634e487b7160e01b845260119052602483fd5b8280fd5b8380fd5b50826003198181360112610136576024359067ffffffffffffffff821161013a5761012091360301126100cd5751908152602090f35b5091602036600319011261013657813567ffffffffffffffff811161013a576101a09036908401610264565b9050602011610136573383528260205282209081549060001982146101235750600101905580f35b5082346100cd5760803660031901126100cd576024356001600160a01b038116036100cd5760643567ffffffffffffffff81116101365760209361020e91369101610264565b505051908152f35b90508334610136576020366003190112610136576020926001600160a01b0361023d610249565b16815280845220548152f35b600435906001600160a01b038216820361025f57565b600080fd5b9181601f8401121561025f5782359167ffffffffffffffff831161025f576020838186019501011161025f5756
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.