Overview
BERA Balance
BERA Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
VerifyingSingletonPaymaster
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; /* solhint-disable reason-string */ /* solhint-disable no-inline-assembly */ import {ECDSA} from '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import {MessageHashUtils} from '@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol'; import {ReentrancyGuard} from '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import {UserOperation, UserOperationLib} from '@account-abstraction/contracts/interfaces/UserOperation.sol'; import {BasePaymaster} from '../base/BasePaymaster.sol'; import {IEntryPoint} from '@account-abstraction/contracts/interfaces/IEntryPoint.sol'; import {_packValidationData} from '@account-abstraction/contracts/core/Helpers.sol'; /** * @title A sample paymaster that uses external service to decide whether to pay for the UserOp. * @dev The paymaster trusts an external signer to sign the transaction. * The calling user must pass the UserOp to that external signer first, which performs whatever * off-chain verification before signing the UserOp. * @notice That this signature is NOT a replacement for wallet signature: * - The paymaster signs to agree to PAY for GAS. * - The wallet signs to prove identity and wallet ownership. */ contract VerifyingSingletonPaymaster is BasePaymaster, ReentrancyGuard { using ECDSA for bytes32; using MessageHashUtils for bytes32; using UserOperationLib for UserOperation; bytes32 public constant SIGNER = keccak256('SIGNER'); bytes32 public constant ADMIN = keccak256('ADMIN'); uint256 private constant PAYMASTER_ID_OFFSET = 20; uint256 private constant VALID_PND_OFFSET = 40; uint256 private constant SIGNATURE_OFFSET = 104; // Gas used in EntryPoint._handlePostOp() method (including this#postOp() call) uint256 private unaccountedEPGasOverhead; mapping(address => uint256) public paymasterIdBalances; event EPGasOverheadChanged(uint256 indexed _oldValue, uint256 indexed _newValue); event GasDeposited(address indexed _paymasterId, uint256 indexed _value); event GasWithdrawn(address indexed _paymasterId, address indexed _to, uint256 indexed _value); event GasBalanceDeducted(address indexed _paymasterId, uint256 indexed _charge); error EntryPointCannotBeZero(); error PaymasterIdCannotBeZero(); error DepositCanNotBeZero(); error CanNotWithdrawToZeroAddress(); error InsufficientBalance(uint256 amount, uint256 currentBalance); error InvalidPaymasterSignatureLength(uint256 sigLength); error UserDepositForInstead(); constructor(IEntryPoint _entryPoint, address _admin) payable BasePaymaster(_entryPoint) { if (address(_entryPoint) == address(0)) revert EntryPointCannotBeZero(); _grantRole(DEFAULT_ADMIN_ROLE, _admin); // 7936 unaccountedEPGasOverhead = 12000; } /** * @dev Add a deposit for this paymaster and given paymasterId (Dapp Depositor address), used for paying for transaction fees * @param paymasterId dapp identifier for which deposit is being made */ function depositFor(address paymasterId) external payable nonReentrant { if (paymasterId == address(0)) revert PaymasterIdCannotBeZero(); if (msg.value == 0) revert DepositCanNotBeZero(); paymasterIdBalances[paymasterId] = paymasterIdBalances[paymasterId] + msg.value; entryPoint.depositTo{value: msg.value}(address(this)); emit GasDeposited(paymasterId, msg.value); } /** * @dev get the current deposit for paymasterId (Dapp Depositor address) * @param paymasterId dapp identifier */ function getBalance(address paymasterId) external view returns (uint256 balance) { balance = paymasterIdBalances[paymasterId]; } /** @dev Override the default implementation. */ function deposit() public payable virtual override { revert UserDepositForInstead(); } /** * @dev Withdraws the specified amount of gas tokens from the paymaster's balance and transfers them to the specified address. * @param withdrawAddress The address to which the gas tokens should be transferred. * @param amount The amount of gas tokens to withdraw. */ function withdrawTo( address payable withdrawAddress, uint256 amount ) public override nonReentrant { if (withdrawAddress == address(0)) revert CanNotWithdrawToZeroAddress(); uint256 currentBalance = paymasterIdBalances[msg.sender]; if (amount > currentBalance) revert InsufficientBalance(amount, currentBalance); paymasterIdBalances[msg.sender] = paymasterIdBalances[msg.sender] - amount; entryPoint.withdrawTo(withdrawAddress, amount); emit GasWithdrawn(msg.sender, withdrawAddress, amount); } function setUnaccountedEPGasOverhead(uint256 value) external onlyRole(ADMIN) { uint256 oldValue = unaccountedEPGasOverhead; unaccountedEPGasOverhead = value; emit EPGasOverheadChanged(oldValue, value); } /** * @dev This method is called by the off-chain service, to sign the request. * It is called on-chain from the validatePaymasterUserOp, to validate the signature. * @notice That this signature covers all fields of the UserOperation, except the "paymasterAndData", * which will carry the signature itself. * @return hash we're going to sign off-chain (and validate on-chain) */ function getHash( UserOperation calldata userOp, address paymasterId, uint48 validUntil, uint48 validAfter ) public view returns (bytes32) { //can't use userOp.hash(), since it contains also the paymasterAndData itself. address sender = userOp.getSender(); return keccak256( bytes.concat( abi.encode( sender, userOp.nonce, keccak256(userOp.initCode), keccak256(userOp.callData), userOp.callGasLimit, userOp.verificationGasLimit, userOp.preVerificationGas, userOp.maxFeePerGas, userOp.maxPriorityFeePerGas, block.chainid, address(this) ), abi.encode(paymasterId, validUntil, validAfter) ) ); } /** * @dev Verify that an external signer signed the paymaster data of a user operation. * The paymaster data is expected to be the paymaster and a signature over the entire request parameters. * @param userOp The UserOperation struct that represents the current user operation. * userOpHash The hash of the UserOperation struct. * @param requiredPreFund The required amount of pre-funding for the paymaster. * @return context A context string returned by the entry point after successful validation. * @return validationData An integer returned by the entry point after successful validation. */ function _validatePaymasterUserOp( UserOperation calldata userOp, bytes32 /*userOpHash*/, uint256 requiredPreFund ) internal view override returns (bytes memory context, uint256 validationData) { ( address paymasterId, uint48 validUntil, uint48 validAfter, bytes calldata signature ) = parsePaymasterAndData(userOp.paymasterAndData); bytes32 hash = getHash(userOp, paymasterId, validUntil, validAfter); require(signature.length == 65, 'Paymaster: invalid signature length in paymasterAndData'); //don't revert on signature failure: return SIG_VALIDATION_FAILED if (!hasRole(SIGNER, hash.toEthSignedMessageHash().recover(signature))) { // empty context and sigFailed with time range provided return ('', _packValidationData(true, validUntil, validAfter)); } if (requiredPreFund > paymasterIdBalances[paymasterId]) revert InsufficientBalance(requiredPreFund, paymasterIdBalances[paymasterId]); return ( abi.encode(paymasterId, userOp.maxFeePerGas, userOp.maxPriorityFeePerGas), _packValidationData(false, validUntil, validAfter) ); } function parsePaymasterAndData( bytes calldata paymasterAndData ) public pure returns ( address paymasterId, uint48 validUntil, uint48 validAfter, bytes calldata signature ) { paymasterId = address(bytes20(paymasterAndData[PAYMASTER_ID_OFFSET:VALID_PND_OFFSET])); (validUntil, validAfter) = abi.decode( paymasterAndData[VALID_PND_OFFSET:SIGNATURE_OFFSET], (uint48, uint48) ); signature = paymasterAndData[SIGNATURE_OFFSET:]; } function getGasPrice( uint256 maxFeePerGas, uint256 maxPriorityFeePerGas ) internal view returns (uint256) { if (maxFeePerGas == maxPriorityFeePerGas) { //legacy mode (for networks that don't support basefee opcode) return maxFeePerGas; } return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee); } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Executes the paymaster's payment conditions * mode tells whether the op succeeded, reverted, or if the op succeeded but cause the postOp to revert * @param context payment conditions signed by the paymaster in `validatePaymasterUserOp` * @param actualGasCost amount to be paid to the entry point in wei */ function _postOp( PostOpMode /*mode*/, bytes calldata context, uint256 actualGasCost ) internal virtual override { (address paymasterId, uint256 maxFeePerGas, uint256 maxPriorityFeePerGas) = abi.decode( context, (address, uint256, uint256) ); uint256 effectiveGasPrice = getGasPrice(maxFeePerGas, maxPriorityFeePerGas); uint256 balToDeduct = actualGasCost + unaccountedEPGasOverhead * effectiveGasPrice; paymasterIdBalances[paymasterId] = paymasterIdBalances[paymasterId] - balToDeduct; emit GasBalanceDeducted(paymasterId, balToDeduct); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.12; /* solhint-disable no-inline-assembly */ /** * returned data from validateUserOp. * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData` * @param aggregator - address(0) - the account validated the signature by itself. * address(1) - the account failed to validate the signature. * otherwise - this is an address of a signature aggregator that must be used to validate the signature. * @param validAfter - this UserOp is valid only after this timestamp. * @param validaUntil - this UserOp is valid only up to this timestamp. */ struct ValidationData { address aggregator; uint48 validAfter; uint48 validUntil; } //extract sigFailed, validAfter, validUntil. // also convert zero validUntil to type(uint48).max function _parseValidationData(uint validationData) pure returns (ValidationData memory data) { address aggregator = address(uint160(validationData)); uint48 validUntil = uint48(validationData >> 160); if (validUntil == 0) { validUntil = type(uint48).max; } uint48 validAfter = uint48(validationData >> (48 + 160)); return ValidationData(aggregator, validAfter, validUntil); } // intersect account and paymaster ranges. function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) { ValidationData memory accountValidationData = _parseValidationData(validationData); ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData); address aggregator = accountValidationData.aggregator; if (aggregator == address(0)) { aggregator = pmValidationData.aggregator; } uint48 validAfter = accountValidationData.validAfter; uint48 validUntil = accountValidationData.validUntil; uint48 pmValidAfter = pmValidationData.validAfter; uint48 pmValidUntil = pmValidationData.validUntil; if (validAfter < pmValidAfter) validAfter = pmValidAfter; if (validUntil > pmValidUntil) validUntil = pmValidUntil; return ValidationData(aggregator, validAfter, validUntil); } /** * helper to pack the return value for validateUserOp * @param data - the ValidationData to pack */ function _packValidationData(ValidationData memory data) pure returns (uint256) { return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48)); } /** * helper to pack the return value for validateUserOp, when not using an aggregator * @param sigFailed - true for signature failure, false for success * @param validUntil last timestamp this UserOperation is valid (or zero for infinite) * @param validAfter first timestamp this UserOperation is valid */ function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) { return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48)); } /** * keccak function over calldata. * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it. */ function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) { assembly { let mem := mload(0x40) let len := data.length calldatacopy(mem, data.offset, len) ret := keccak256(mem, len) } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.12; import "./UserOperation.sol"; /** * Aggregated Signatures validator. */ interface IAggregator { /** * validate aggregated signature. * revert if the aggregated signature does not match the given list of operations. */ function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view; /** * validate signature of a single userOp * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps. * @param userOp the userOperation received from the user. * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps. * (usually empty, unless account and aggregator support some kind of "multisig" */ function validateUserOpSignature(UserOperation calldata userOp) external view returns (bytes memory sigForUserOp); /** * aggregate multiple signatures into a single value. * This method is called off-chain to calculate the signature to pass with handleOps() * bundler MAY use optimized custom code perform this aggregation * @param userOps array of UserOperations to collect the signatures from. * @return aggregatedSignature the aggregated signature */ function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature); }
/** ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation. ** Only one instance required on each chain. **/ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.12; /* solhint-disable avoid-low-level-calls */ /* solhint-disable no-inline-assembly */ /* solhint-disable reason-string */ import "./UserOperation.sol"; import "./IStakeManager.sol"; import "./IAggregator.sol"; import "./INonceManager.sol"; interface IEntryPoint is IStakeManager, INonceManager { /*** * An event emitted after each successful request * @param userOpHash - unique identifier for the request (hash its entire content, except signature). * @param sender - the account that generates this request. * @param paymaster - if non-null, the paymaster that pays for this request. * @param nonce - the nonce value from the request. * @param success - true if the sender transaction succeeded, false if reverted. * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation. * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution). */ event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed); /** * account "sender" was deployed. * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow. * @param sender the account that is deployed * @param factory the factory used to deploy this account (in the initCode) * @param paymaster the paymaster used by this UserOp */ event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster); /** * An event emitted if the UserOperation "callData" reverted with non-zero length * @param userOpHash the request unique identifier. * @param sender the sender of this request * @param nonce the nonce used in the request * @param revertReason - the return bytes from the (reverted) call to "callData". */ event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason); /** * an event emitted by handleOps(), before starting the execution loop. * any event emitted before this event, is part of the validation. */ event BeforeExecution(); /** * signature aggregator used by the following UserOperationEvents within this bundle. */ event SignatureAggregatorChanged(address indexed aggregator); /** * a custom revert error of handleOps, to identify the offending op. * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it. * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero) * @param reason - revert reason * The string starts with a unique code "AAmn", where "m" is "1" for factory, "2" for account and "3" for paymaster issues, * so a failure can be attributed to the correct entity. * Should be caught in off-chain handleOps simulation and not happen on-chain. * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts. */ error FailedOp(uint256 opIndex, string reason); /** * error case when a signature aggregator fails to verify the aggregated signature it had created. */ error SignatureValidationFailed(address aggregator); /** * Successful result from simulateValidation. * @param returnInfo gas and time-range returned values * @param senderInfo stake information about the sender * @param factoryInfo stake information about the factory (if any) * @param paymasterInfo stake information about the paymaster (if any) */ error ValidationResult(ReturnInfo returnInfo, StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo); /** * Successful result from simulateValidation, if the account returns a signature aggregator * @param returnInfo gas and time-range returned values * @param senderInfo stake information about the sender * @param factoryInfo stake information about the factory (if any) * @param paymasterInfo stake information about the paymaster (if any) * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator) * bundler MUST use it to verify the signature, or reject the UserOperation */ error ValidationResultWithAggregation(ReturnInfo returnInfo, StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo, AggregatorStakeInfo aggregatorInfo); /** * return value of getSenderAddress */ error SenderAddressResult(address sender); /** * return value of simulateHandleOp */ error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult); //UserOps handled, per aggregator struct UserOpsPerAggregator { UserOperation[] userOps; // aggregator address IAggregator aggregator; // aggregated signature bytes signature; } /** * Execute a batch of UserOperation. * no signature aggregator is used. * if any account requires an aggregator (that is, it returned an aggregator when * performing simulateValidation), then handleAggregatedOps() must be used instead. * @param ops the operations to execute * @param beneficiary the address to receive the fees */ function handleOps(UserOperation[] calldata ops, address payable beneficiary) external; /** * Execute a batch of UserOperation with Aggregators * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts) * @param beneficiary the address to receive the fees */ function handleAggregatedOps( UserOpsPerAggregator[] calldata opsPerAggregator, address payable beneficiary ) external; /** * generate a request Id - unique identifier for this request. * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid. */ function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32); /** * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp. * @dev this method always revert. Successful result is ValidationResult error. other errors are failures. * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data. * @param userOp the user operation to validate. */ function simulateValidation(UserOperation calldata userOp) external; /** * gas and return values during simulation * @param preOpGas the gas used for validation (including preValidationGas) * @param prefund the required prefund for this operation * @param sigFailed validateUserOp's (or paymaster's) signature check failed * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range) * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range) * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp) */ struct ReturnInfo { uint256 preOpGas; uint256 prefund; bool sigFailed; uint48 validAfter; uint48 validUntil; bytes paymasterContext; } /** * returned aggregated signature info. * the aggregator returned by the account, and its current stake. */ struct AggregatorStakeInfo { address aggregator; StakeInfo stakeInfo; } /** * Get counterfactual sender address. * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation. * this method always revert, and returns the address in SenderAddressResult error * @param initCode the constructor code to be passed into the UserOperation. */ function getSenderAddress(bytes memory initCode) external; /** * simulate full execution of a UserOperation (including both validation and target execution) * this method will always revert with "ExecutionResult". * it performs full validation of the UserOperation, but ignores signature error. * an optional target address is called after the userop succeeds, and its value is returned * (before the entire call is reverted) * Note that in order to collect the the success/failure of the target call, it must be executed * with trace enabled to track the emitted events. * @param op the UserOperation to simulate * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult * are set to the return from that call. * @param targetCallData callData to pass to target address */ function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.12; interface INonceManager { /** * Return the next nonce for this sender. * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop) * But UserOp with different keys can come with arbitrary order. * * @param sender the account address * @param key the high 192 bit of the nonce * @return nonce a full nonce to pass for next UserOp with this sender. */ function getNonce(address sender, uint192 key) external view returns (uint256 nonce); /** * Manually increment the nonce of the sender. * This method is exposed just for completeness.. * Account does NOT need to call it, neither during validation, nor elsewhere, * as the EntryPoint will update the nonce regardless. * Possible use-case is call it with various keys to "initialize" their nonces to one, so that future * UserOperations will not pay extra for the first transaction with a given key. */ function incrementNonce(uint192 key) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.12; import "./UserOperation.sol"; /** * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations. * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction. */ interface IPaymaster { enum PostOpMode { opSucceeded, // user op succeeded opReverted, // user op reverted. still has to pay for gas. postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted. } /** * payment validation: check if paymaster agrees to pay. * Must verify sender is the entryPoint. * Revert to reject this request. * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted) * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns. * @param userOp the user operation * @param userOpHash hash of the user's request data. * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp) * @return context value to send to a postOp * zero length to signify postOp is not required. * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure, * otherwise, an address of an "authorizer" contract. * <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite" * <6-byte> validAfter - first timestamp this operation is valid * Note that the validation code cannot use block.timestamp (or block.number) directly. */ function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost) external returns (bytes memory context, uint256 validationData); /** * post-operation handler. * Must verify sender is the entryPoint * @param mode enum with the following options: * opSucceeded - user operation succeeded. * opReverted - user op reverted. still has to pay for gas. * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert. * Now this is the 2nd call, after user's op was deliberately reverted. * @param context - the context value returned by validatePaymasterUserOp * @param actualGasCost - actual gas used so far (without this postOp call). */ function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.12; /** * manage deposits and stakes. * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account) * stake is value locked for at least "unstakeDelay" by the staked entity. */ interface IStakeManager { event Deposited( address indexed account, uint256 totalDeposit ); event Withdrawn( address indexed account, address withdrawAddress, uint256 amount ); /// Emitted when stake or unstake delay are modified event StakeLocked( address indexed account, uint256 totalStaked, uint256 unstakeDelaySec ); /// Emitted once a stake is scheduled for withdrawal event StakeUnlocked( address indexed account, uint256 withdrawTime ); event StakeWithdrawn( address indexed account, address withdrawAddress, uint256 amount ); /** * @param deposit the entity's deposit * @param staked true if this entity is staked. * @param stake actual amount of ether staked for this entity. * @param unstakeDelaySec minimum delay to withdraw the stake. * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps) * and the rest fit into a 2nd cell. * 112 bit allows for 10^15 eth * 48 bit for full timestamp * 32 bit allows 150 years for unstake delay */ struct DepositInfo { uint112 deposit; bool staked; uint112 stake; uint32 unstakeDelaySec; uint48 withdrawTime; } //API struct used by getStakeInfo and simulateValidation struct StakeInfo { uint256 stake; uint256 unstakeDelaySec; } /// @return info - full deposit information of given account function getDepositInfo(address account) external view returns (DepositInfo memory info); /// @return the deposit (for gas payment) of the account function balanceOf(address account) external view returns (uint256); /** * add to the deposit of the given account */ function depositTo(address account) external payable; /** * add to the account's stake - amount and delay * any pending unstake is first cancelled. * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn. */ function addStake(uint32 _unstakeDelaySec) external payable; /** * attempt to unlock the stake. * the value can be withdrawn (using withdrawStake) after the unstake delay. */ function unlockStake() external; /** * withdraw from the (unlocked) stake. * must first call unlockStake and wait for the unstakeDelay to pass * @param withdrawAddress the address to send withdrawn value. */ function withdrawStake(address payable withdrawAddress) external; /** * withdraw from the deposit. * @param withdrawAddress the address to send withdrawn value. * @param withdrawAmount the amount to withdraw. */ function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.12; /* solhint-disable no-inline-assembly */ import {calldataKeccak} from "../core/Helpers.sol"; /** * 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 callGasLimit the gas limit passed to the callData method call. * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp. * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead. * @param maxFeePerGas same as EIP-1559 gas parameter. * @param maxPriorityFeePerGas same as EIP-1559 gas parameter. * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific 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 UserOperation { address sender; uint256 nonce; bytes initCode; bytes callData; uint256 callGasLimit; uint256 verificationGasLimit; uint256 preVerificationGas; uint256 maxFeePerGas; uint256 maxPriorityFeePerGas; bytes paymasterAndData; bytes signature; } /** * Utility functions helpful when working with UserOperation structs. */ library UserOperationLib { function getSender(UserOperation calldata userOp) internal pure returns (address) { address data; //read sender from userOp, which is first userOp member (saves 800 gas...) assembly {data := calldataload(userOp)} return address(uint160(data)); } //relayer/block builder might submit the TX with higher priorityFee, but the user should not // pay above what he signed for. function gasPrice(UserOperation calldata userOp) internal view returns (uint256) { unchecked { uint256 maxFeePerGas = userOp.maxFeePerGas; uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas; if (maxFeePerGas == maxPriorityFeePerGas) { //legacy mode (for networks that don't support basefee opcode) return maxFeePerGas; } return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee); } } function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) { address sender = getSender(userOp); uint256 nonce = userOp.nonce; bytes32 hashInitCode = calldataKeccak(userOp.initCode); bytes32 hashCallData = calldataKeccak(userOp.callData); uint256 callGasLimit = userOp.callGasLimit; uint256 verificationGasLimit = userOp.verificationGasLimit; uint256 preVerificationGas = userOp.preVerificationGas; uint256 maxFeePerGas = userOp.maxFeePerGas; uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas; bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData); return abi.encode( sender, nonce, hashInitCode, hashCallData, callGasLimit, verificationGasLimit, preVerificationGas, maxFeePerGas, maxPriorityFeePerGas, hashPaymasterAndData ); } function hash(UserOperation calldata userOp) internal pure returns (bytes32) { return keccak256(pack(userOp)); } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.20; /* solhint-disable reason-string */ import {AccessControl} from '@openzeppelin/contracts/access/AccessControl.sol'; import {IPaymaster} from '@account-abstraction/contracts/interfaces/IPaymaster.sol'; import {IEntryPoint} from '@account-abstraction/contracts/interfaces/IEntryPoint.sol'; import {UserOperation} from '@account-abstraction/contracts/interfaces/UserOperation.sol'; /** * Helper class for creating a paymaster. * provides helper methods for staking. * validates that the postOp is called only by the entryPoint */ abstract contract BasePaymaster is IPaymaster, AccessControl { IEntryPoint public immutable entryPoint; bytes32 public constant CASHIER = keccak256('CASHIER'); constructor(IEntryPoint _entryPoint) { entryPoint = _entryPoint; } /// @inheritdoc IPaymaster function validatePaymasterUserOp( UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost ) external override returns (bytes memory context, uint256 validationData) { _requireFromEntryPoint(); return _validatePaymasterUserOp(userOp, userOpHash, maxCost); } function _validatePaymasterUserOp( UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost ) internal virtual returns (bytes memory context, uint256 validationData); /// @inheritdoc IPaymaster function postOp( PostOpMode mode, bytes calldata context, uint256 actualGasCost ) external override { _requireFromEntryPoint(); _postOp(mode, context, actualGasCost); } /** * post-operation handler. * (verified to be called only through the entryPoint) * @dev if subclass returns a non-empty context from validatePaymasterUserOp, it must also implement this method. * @param mode enum with the following options: * opSucceeded - user operation succeeded. * opReverted - user op reverted. still has to pay for gas. * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert. * Now this is the 2nd call, after user's op was deliberately reverted. * @param context - the context value returned by validatePaymasterUserOp * @param actualGasCost - actual gas used so far (without this postOp call). */ function _postOp( PostOpMode mode, bytes calldata context, uint256 actualGasCost ) internal virtual { (mode, context, actualGasCost); // unused params // subclass must override this method if validatePaymasterUserOp returns a context revert('must override'); } /** * add a deposit for this paymaster, used for paying for transaction fees */ function deposit() public payable virtual { entryPoint.depositTo{value: msg.value}(address(this)); } /** * withdraw value from the deposit * @param withdrawAddress target to send to * @param amount to withdraw */ function withdrawTo( address payable withdrawAddress, uint256 amount ) public virtual onlyRole(CASHIER) { entryPoint.withdrawTo(withdrawAddress, amount); } /** * add stake for this paymaster. * This method can also carry eth value to add to the current stake. * @param unstakeDelaySec - the unstake delay for this paymaster. Can only be increased. */ function addStake(uint32 unstakeDelaySec) external payable onlyRole(CASHIER) { entryPoint.addStake{value: msg.value}(unstakeDelaySec); } /** * return current paymaster's deposit on the entryPoint. */ function getDeposit() public view returns (uint256) { return entryPoint.balanceOf(address(this)); } /** * unlock the stake, in order to withdraw it. * The paymaster can't serve requests once unlocked, until it calls addStake again */ function unlockStake() external onlyRole(CASHIER) { entryPoint.unlockStake(); } /** * withdraw the entire paymaster's stake. * stake must be unlocked first (and then wait for the unstakeDelay to be over) * @param withdrawAddress the address to send withdrawn value. */ function withdrawStake(address payable withdrawAddress) external onlyRole(CASHIER) { entryPoint.withdrawStake(withdrawAddress); } /// validate the call is made from a valid entrypoint function _requireFromEntryPoint() internal virtual { require(msg.sender == address(entryPoint), 'Sender not EntryPoint'); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IEntryPoint","name":"_entryPoint","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"CanNotWithdrawToZeroAddress","type":"error"},{"inputs":[],"name":"DepositCanNotBeZero","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"EntryPointCannotBeZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"currentBalance","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"sigLength","type":"uint256"}],"name":"InvalidPaymasterSignatureLength","type":"error"},{"inputs":[],"name":"PaymasterIdCannotBeZero","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UserDepositForInstead","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_oldValue","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_newValue","type":"uint256"}],"name":"EPGasOverheadChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_paymasterId","type":"address"},{"indexed":true,"internalType":"uint256","name":"_charge","type":"uint256"}],"name":"GasBalanceDeducted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_paymasterId","type":"address"},{"indexed":true,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"GasDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_paymasterId","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"GasWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CASHIER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIGNER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"unstakeDelaySec","type":"uint32"}],"name":"addStake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"paymasterId","type":"address"}],"name":"depositFor","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"entryPoint","outputs":[{"internalType":"contract IEntryPoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"paymasterId","type":"address"}],"name":"getBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"uint256","name":"callGasLimit","type":"uint256"},{"internalType":"uint256","name":"verificationGasLimit","type":"uint256"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"uint256","name":"maxFeePerGas","type":"uint256"},{"internalType":"uint256","name":"maxPriorityFeePerGas","type":"uint256"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct UserOperation","name":"userOp","type":"tuple"},{"internalType":"address","name":"paymasterId","type":"address"},{"internalType":"uint48","name":"validUntil","type":"uint48"},{"internalType":"uint48","name":"validAfter","type":"uint48"}],"name":"getHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"paymasterAndData","type":"bytes"}],"name":"parsePaymasterAndData","outputs":[{"internalType":"address","name":"paymasterId","type":"address"},{"internalType":"uint48","name":"validUntil","type":"uint48"},{"internalType":"uint48","name":"validAfter","type":"uint48"},{"internalType":"bytes","name":"signature","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"paymasterIdBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IPaymaster.PostOpMode","name":"mode","type":"uint8"},{"internalType":"bytes","name":"context","type":"bytes"},{"internalType":"uint256","name":"actualGasCost","type":"uint256"}],"name":"postOp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setUnaccountedEPGasOverhead","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unlockStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"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":"uint256","name":"callGasLimit","type":"uint256"},{"internalType":"uint256","name":"verificationGasLimit","type":"uint256"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"uint256","name":"maxFeePerGas","type":"uint256"},{"internalType":"uint256","name":"maxPriorityFeePerGas","type":"uint256"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct UserOperation","name":"userOp","type":"tuple"},{"internalType":"bytes32","name":"userOpHash","type":"bytes32"},{"internalType":"uint256","name":"maxCost","type":"uint256"}],"name":"validatePaymasterUserOp","outputs":[{"internalType":"bytes","name":"context","type":"bytes"},{"internalType":"uint256","name":"validationData","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"withdrawAddress","type":"address"}],"name":"withdrawStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"withdrawAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawTo","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a060405260405162001b3838038062001b38833981016040819052620000269162000136565b6001600160a01b038216608081905260018055620000575760405163091748f960e21b815260040160405180910390fd5b620000635f8262000072565b5050612ee06002555062000173565b5f828152602081815260408083206001600160a01b038516845290915281205460ff1662000115575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000cc3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000118565b505f5b92915050565b6001600160a01b038116811462000133575f80fd5b50565b5f806040838503121562000148575f80fd5b825162000155816200011e565b602084015190925062000168816200011e565b809150509250929050565b60805161197b620001bd5f395f81816103bc0152818161054b01528181610671015281816109e901528181610a9f01528181610b4401528181610bb60152610e26015261197b5ff3fe608060405260043610610161575f3560e01c8063a217fddf116100cd578063c23a5cea11610087578063d547741f11610062578063d547741f14610445578063deeb387414610464578063f465c77e14610483578063f8b2cb4f146104b0575f80fd5b8063c23a5cea1461040a578063c399ec8814610429578063d0e30db01461043d575f80fd5b8063a217fddf1461033b578063a40a7ddc1461034e578063a9a2340914610379578063aa67c91914610398578063b0d691fe146103ab578063bb9fe6bf146103f6575f80fd5b806336568abe1161011e57806336568abe1461025b578063582abd121461027a5780635e1e7b54146102ad5780638016bbb6146102cc57806391d14854146102ec57806394d4ad601461030b575f80fd5b806301ffc9a7146101655780630396cb6014610199578063205c2878146101ae578063248a9ca3146101cd5780632a0acc6a146102095780632f2ff15d1461023c575b5f80fd5b348015610170575f80fd5b5061018461017f366004611406565b6104e4565b60405190151581526020015b60405180910390f35b6101ac6101a736600461142d565b61051a565b005b3480156101b9575f80fd5b506101ac6101c8366004611464565b6105b1565b3480156101d8575f80fd5b506101fb6101e736600461148e565b5f9081526020819052604090206001015490565b604051908152602001610190565b348015610214575f80fd5b506101fb7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b348015610247575f80fd5b506101ac6102563660046114a5565b61070d565b348015610266575f80fd5b506101ac6102753660046114a5565b610737565b348015610285575f80fd5b506101fb7f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4081565b3480156102b8575f80fd5b506101fb6102c7366004611504565b61076f565b3480156102d7575f80fd5b506101fb5f8051602061192683398151915281565b3480156102f7575f80fd5b506101846103063660046114a5565b6108ad565b348015610316575f80fd5b5061032a6103253660046115b6565b6108d5565b6040516101909594939291906115f5565b348015610346575f80fd5b506101fb5f81565b348015610359575f80fd5b506101fb61036836600461164e565b60036020525f908152604090205481565b348015610384575f80fd5b506101ac610393366004611669565b610931565b6101ac6103a636600461164e565b610945565b3480156103b6575f80fd5b506103de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610190565b348015610401575f80fd5b506101ac610a86565b348015610415575f80fd5b506101ac61042436600461164e565b610b0e565b348015610434575f80fd5b506101fb610b9f565b6101ac610c2c565b348015610450575f80fd5b506101ac61045f3660046114a5565b610c45565b34801561046f575f80fd5b506101ac61047e36600461148e565b610c69565b34801561048e575f80fd5b506104a261049d3660046116c4565b610ccc565b604051610190929190611730565b3480156104bb575f80fd5b506101fb6104ca36600461164e565b6001600160a01b03165f9081526003602052604090205490565b5f6001600160e01b03198216637965db0b60e01b148061051457506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f8051602061192683398151915261053181610cef565b604051621cb65b60e51b815263ffffffff831660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690630396cb609034906024015f604051808303818588803b158015610596575f80fd5b505af11580156105a8573d5f803e3d5ffd5b50505050505050565b6105b9610cf9565b6001600160a01b0382166105e0576040516392bc9df360e01b815260040160405180910390fd5b335f908152600360205260409020548082111561061f5760405163cf47918160e01b815260048101839052602481018290526044015b60405180910390fd5b335f9081526003602052604090205461063990839061177e565b335f9081526003602052604090819020919091555163040b850f60e31b81526001600160a01b038481166004830152602482018490527f0000000000000000000000000000000000000000000000000000000000000000169063205c2878906044015f604051808303815f87803b1580156106b2575f80fd5b505af11580156106c4573d5f803e3d5ffd5b50506040518492506001600160a01b038616915033907f926a144b6fffc1d73f115b81af7ec66a7c12aed0ff73197c39a683753fc1d925905f90a45061070960018055565b5050565b5f8281526020819052604090206001015461072781610cef565b6107318383610d23565b50505050565b6001600160a01b03811633146107605760405163334bd91960e11b815260040160405180910390fd5b61076a8282610db2565b505050565b5f84358060208701356107856040890189611791565b6040516107939291906117d4565b6040519081900390206107a960608a018a611791565b6040516107b79291906117d4565b604080519182900382206001600160a01b03909516602083015281019290925260608201526080808201929092529087013560a08083019190915287013560c08083019190915287013560e0808301919091528701356101008083019190915287013561012082015246610140820152306101608201526101800160408051601f198184030181528282526001600160a01b038816602084015265ffffffffffff8088169284019290925290851660608301529060800160408051601f198184030181529082905261088c92916020016117e3565b60405160208183030381529060405280519060200120915050949350505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f808036816108e860286014888a611811565b6108f191611838565b60601c945061090460686028888a611811565b810190610911919061186d565b9094509250610923866068818a611811565b915091509295509295909350565b610939610e1b565b61073184848484610e8d565b61094d610cf9565b6001600160a01b038116610974576040516355cd1c6560e11b815260040160405180910390fd5b345f03610994576040516333a6177160e11b815260040160405180910390fd5b6001600160a01b0381165f908152600360205260409020546109b790349061189e565b6001600160a01b038281165f908152600360205260409081902092909255905163b760faf960e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000009091169063b760faf99034906024015f604051808303818588803b158015610a2e575f80fd5b505af1158015610a40573d5f803e3d5ffd5b50506040513493506001600160a01b03851692507f1dbbf474736d6415d6a265fabee708fe6e988f6fd0c9d870ded36cab380898dd91505f90a3610a8360018055565b50565b5f80516020611926833981519152610a9d81610cef565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bb9fe6bf6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610af5575f80fd5b505af1158015610b07573d5f803e3d5ffd5b5050505050565b5f80516020611926833981519152610b2581610cef565b60405163611d2e7560e11b81526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063c23a5cea906024015f604051808303815f87803b158015610b85575f80fd5b505af1158015610b97573d5f803e3d5ffd5b505050505050565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610c03573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c2791906118b1565b905090565b60405163f0082dcf60e01b815260040160405180910390fd5b5f82815260208190526040902060010154610c5f81610cef565b6107318383610db2565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42610c9381610cef565b6002805490839055604051839082907f0b2f957fc0a9306310238ef9a212935360e98fe3f8bc525f4cb69d38b1efa859905f90a3505050565b60605f610cd7610e1b565b610ce2858585610f3c565b915091505b935093915050565b610a838133611136565b600260015403610d1c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b5f610d2e83836108ad565b610dab575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055610d633390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610514565b505f610514565b5f610dbd83836108ad565b15610dab575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610514565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610e8b5760405162461bcd60e51b815260206004820152601560248201527414d95b99195c881b9bdd08115b9d1c9e541bda5b9d605a1b6044820152606401610616565b565b5f8080610e9c858701876118c8565b9250925092505f610ead838361116f565b90505f81600254610ebe91906118fa565b610ec8908761189e565b6001600160a01b0386165f90815260036020526040902054909150610eee90829061177e565b6001600160a01b0386165f8181526003602052604080822093909355915183927f5dc1c754041954fe976773fa441397a7928c7127a1c83904214a7d256339900791a3505050505050505050565b60605f8080803681610f556103256101208c018c611791565b945094509450945094505f610f6c8b87878761076f565b905060418214610fe45760405162461bcd60e51b815260206004820152603760248201527f5061796d61737465723a20696e76616c6964207369676e6174757265206c656e60448201527f67746820696e207061796d6173746572416e64446174610000000000000000006064820152608401610616565b6110527f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4061030685858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061104c92508791506111989050565b906111ca565b61108157611062600186866111f2565b60405180602001604052805f8152509097509750505050505050610ce7565b6001600160a01b0386165f908152600360205260409020548911156110dd576001600160a01b0386165f908152600360205260409081902054905163cf47918160e01b8152610616918b91600401918252602082015260400190565b604080516001600160a01b038816602082015260e08d0135918101919091526101008c013560608201526080016040516020818303038152906040526111245f87876111f2565b97509750505050505050935093915050565b61114082826108ad565b6107095760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610616565b5f81830361117e575081610514565b6111918361118c488561189e565b611228565b9392505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c91909152603c902090565b5f805f806111d8868661123d565b9250925092506111e88282611286565b5090949350505050565b5f60d08265ffffffffffff16901b60a08465ffffffffffff16901b85611218575f61121b565b60015b60ff161717949350505050565b5f8183106112365781611191565b5090919050565b5f805f8351604103611274576020840151604085015160608601515f1a6112668882858561133e565b95509550955050505061127f565b505081515f91506002905b9250925092565b5f82600381111561129957611299611911565b036112a2575050565b60018260038111156112b6576112b6611911565b036112d45760405163f645eedf60e01b815260040160405180910390fd5b60028260038111156112e8576112e8611911565b036113095760405163fce698f760e01b815260048101829052602401610616565b600382600381111561131d5761131d611911565b03610709576040516335e2f38360e21b815260048101829052602401610616565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561137757505f915060039050826113fc565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156113c8573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b0381166113f357505f9250600191508290506113fc565b92505f91508190505b9450945094915050565b5f60208284031215611416575f80fd5b81356001600160e01b031981168114611191575f80fd5b5f6020828403121561143d575f80fd5b813563ffffffff81168114611191575f80fd5b6001600160a01b0381168114610a83575f80fd5b5f8060408385031215611475575f80fd5b823561148081611450565b946020939093013593505050565b5f6020828403121561149e575f80fd5b5035919050565b5f80604083850312156114b6575f80fd5b8235915060208301356114c881611450565b809150509250929050565b5f61016082840312156114e4575f80fd5b50919050565b803565ffffffffffff811681146114ff575f80fd5b919050565b5f805f8060808587031215611517575f80fd5b843567ffffffffffffffff81111561152d575f80fd5b611539878288016114d3565b945050602085013561154a81611450565b9250611558604086016114ea565b9150611566606086016114ea565b905092959194509250565b5f8083601f840112611581575f80fd5b50813567ffffffffffffffff811115611598575f80fd5b6020830191508360208285010111156115af575f80fd5b9250929050565b5f80602083850312156115c7575f80fd5b823567ffffffffffffffff8111156115dd575f80fd5b6115e985828601611571565b90969095509350505050565b6001600160a01b038616815265ffffffffffff85811660208301528416604082015260806060820181905281018290525f828460a08401375f60a0848401015260a0601f19601f85011683010190509695505050505050565b5f6020828403121561165e575f80fd5b813561119181611450565b5f805f806060858703121561167c575f80fd5b84356003811061168a575f80fd5b9350602085013567ffffffffffffffff8111156116a5575f80fd5b6116b187828801611571565b9598909750949560400135949350505050565b5f805f606084860312156116d6575f80fd5b833567ffffffffffffffff8111156116ec575f80fd5b6116f8868287016114d3565b9660208601359650604090950135949350505050565b5f5b83811015611728578181015183820152602001611710565b50505f910152565b604081525f835180604084015261174e81606085016020880161170e565b602083019390935250601f91909101601f191601606001919050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156105145761051461176a565b5f808335601e198436030181126117a6575f80fd5b83018035915067ffffffffffffffff8211156117c0575f80fd5b6020019150368190038213156115af575f80fd5b818382375f9101908152919050565b5f83516117f481846020880161170e565b83519083019061180881836020880161170e565b01949350505050565b5f808585111561181f575f80fd5b8386111561182b575f80fd5b5050820193919092039150565b6bffffffffffffffffffffffff1981358181169160148510156118655780818660140360031b1b83161692505b505092915050565b5f806040838503121561187e575f80fd5b611887836114ea565b9150611895602084016114ea565b90509250929050565b808201808211156105145761051461176a565b5f602082840312156118c1575f80fd5b5051919050565b5f805f606084860312156118da575f80fd5b83356118e581611450565b95602085013595506040909401359392505050565b80820281158282048414176105145761051461176a565b634e487b7160e01b5f52602160045260245ffdfeaf0d3ae5661af50c10d4a5f8117fa3fc098b633d350de8cd751d260a50e3eb29a26469706673582212204e2dca37ccf6a0195973038a21f920bb4ec420745c993a12a62ebe17c4e0cf1264736f6c634300081400330000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000a860b0c8187ae5eaf719a5d56334a53bcbade3d9
Deployed Bytecode
0x608060405260043610610161575f3560e01c8063a217fddf116100cd578063c23a5cea11610087578063d547741f11610062578063d547741f14610445578063deeb387414610464578063f465c77e14610483578063f8b2cb4f146104b0575f80fd5b8063c23a5cea1461040a578063c399ec8814610429578063d0e30db01461043d575f80fd5b8063a217fddf1461033b578063a40a7ddc1461034e578063a9a2340914610379578063aa67c91914610398578063b0d691fe146103ab578063bb9fe6bf146103f6575f80fd5b806336568abe1161011e57806336568abe1461025b578063582abd121461027a5780635e1e7b54146102ad5780638016bbb6146102cc57806391d14854146102ec57806394d4ad601461030b575f80fd5b806301ffc9a7146101655780630396cb6014610199578063205c2878146101ae578063248a9ca3146101cd5780632a0acc6a146102095780632f2ff15d1461023c575b5f80fd5b348015610170575f80fd5b5061018461017f366004611406565b6104e4565b60405190151581526020015b60405180910390f35b6101ac6101a736600461142d565b61051a565b005b3480156101b9575f80fd5b506101ac6101c8366004611464565b6105b1565b3480156101d8575f80fd5b506101fb6101e736600461148e565b5f9081526020819052604090206001015490565b604051908152602001610190565b348015610214575f80fd5b506101fb7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b348015610247575f80fd5b506101ac6102563660046114a5565b61070d565b348015610266575f80fd5b506101ac6102753660046114a5565b610737565b348015610285575f80fd5b506101fb7f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4081565b3480156102b8575f80fd5b506101fb6102c7366004611504565b61076f565b3480156102d7575f80fd5b506101fb5f8051602061192683398151915281565b3480156102f7575f80fd5b506101846103063660046114a5565b6108ad565b348015610316575f80fd5b5061032a6103253660046115b6565b6108d5565b6040516101909594939291906115f5565b348015610346575f80fd5b506101fb5f81565b348015610359575f80fd5b506101fb61036836600461164e565b60036020525f908152604090205481565b348015610384575f80fd5b506101ac610393366004611669565b610931565b6101ac6103a636600461164e565b610945565b3480156103b6575f80fd5b506103de7f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d278981565b6040516001600160a01b039091168152602001610190565b348015610401575f80fd5b506101ac610a86565b348015610415575f80fd5b506101ac61042436600461164e565b610b0e565b348015610434575f80fd5b506101fb610b9f565b6101ac610c2c565b348015610450575f80fd5b506101ac61045f3660046114a5565b610c45565b34801561046f575f80fd5b506101ac61047e36600461148e565b610c69565b34801561048e575f80fd5b506104a261049d3660046116c4565b610ccc565b604051610190929190611730565b3480156104bb575f80fd5b506101fb6104ca36600461164e565b6001600160a01b03165f9081526003602052604090205490565b5f6001600160e01b03198216637965db0b60e01b148061051457506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f8051602061192683398151915261053181610cef565b604051621cb65b60e51b815263ffffffff831660048201527f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d27896001600160a01b031690630396cb609034906024015f604051808303818588803b158015610596575f80fd5b505af11580156105a8573d5f803e3d5ffd5b50505050505050565b6105b9610cf9565b6001600160a01b0382166105e0576040516392bc9df360e01b815260040160405180910390fd5b335f908152600360205260409020548082111561061f5760405163cf47918160e01b815260048101839052602481018290526044015b60405180910390fd5b335f9081526003602052604090205461063990839061177e565b335f9081526003602052604090819020919091555163040b850f60e31b81526001600160a01b038481166004830152602482018490527f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789169063205c2878906044015f604051808303815f87803b1580156106b2575f80fd5b505af11580156106c4573d5f803e3d5ffd5b50506040518492506001600160a01b038616915033907f926a144b6fffc1d73f115b81af7ec66a7c12aed0ff73197c39a683753fc1d925905f90a45061070960018055565b5050565b5f8281526020819052604090206001015461072781610cef565b6107318383610d23565b50505050565b6001600160a01b03811633146107605760405163334bd91960e11b815260040160405180910390fd5b61076a8282610db2565b505050565b5f84358060208701356107856040890189611791565b6040516107939291906117d4565b6040519081900390206107a960608a018a611791565b6040516107b79291906117d4565b604080519182900382206001600160a01b03909516602083015281019290925260608201526080808201929092529087013560a08083019190915287013560c08083019190915287013560e0808301919091528701356101008083019190915287013561012082015246610140820152306101608201526101800160408051601f198184030181528282526001600160a01b038816602084015265ffffffffffff8088169284019290925290851660608301529060800160408051601f198184030181529082905261088c92916020016117e3565b60405160208183030381529060405280519060200120915050949350505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b5f808036816108e860286014888a611811565b6108f191611838565b60601c945061090460686028888a611811565b810190610911919061186d565b9094509250610923866068818a611811565b915091509295509295909350565b610939610e1b565b61073184848484610e8d565b61094d610cf9565b6001600160a01b038116610974576040516355cd1c6560e11b815260040160405180910390fd5b345f03610994576040516333a6177160e11b815260040160405180910390fd5b6001600160a01b0381165f908152600360205260409020546109b790349061189e565b6001600160a01b038281165f908152600360205260409081902092909255905163b760faf960e01b81523060048201527f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d27899091169063b760faf99034906024015f604051808303818588803b158015610a2e575f80fd5b505af1158015610a40573d5f803e3d5ffd5b50506040513493506001600160a01b03851692507f1dbbf474736d6415d6a265fabee708fe6e988f6fd0c9d870ded36cab380898dd91505f90a3610a8360018055565b50565b5f80516020611926833981519152610a9d81610cef565b7f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d27896001600160a01b031663bb9fe6bf6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610af5575f80fd5b505af1158015610b07573d5f803e3d5ffd5b5050505050565b5f80516020611926833981519152610b2581610cef565b60405163611d2e7560e11b81526001600160a01b0383811660048301527f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789169063c23a5cea906024015f604051808303815f87803b158015610b85575f80fd5b505af1158015610b97573d5f803e3d5ffd5b505050505050565b6040516370a0823160e01b81523060048201525f907f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d27896001600160a01b0316906370a0823190602401602060405180830381865afa158015610c03573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c2791906118b1565b905090565b60405163f0082dcf60e01b815260040160405180910390fd5b5f82815260208190526040902060010154610c5f81610cef565b6107318383610db2565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42610c9381610cef565b6002805490839055604051839082907f0b2f957fc0a9306310238ef9a212935360e98fe3f8bc525f4cb69d38b1efa859905f90a3505050565b60605f610cd7610e1b565b610ce2858585610f3c565b915091505b935093915050565b610a838133611136565b600260015403610d1c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b5f610d2e83836108ad565b610dab575f838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055610d633390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610514565b505f610514565b5f610dbd83836108ad565b15610dab575f838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610514565b336001600160a01b037f0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d27891614610e8b5760405162461bcd60e51b815260206004820152601560248201527414d95b99195c881b9bdd08115b9d1c9e541bda5b9d605a1b6044820152606401610616565b565b5f8080610e9c858701876118c8565b9250925092505f610ead838361116f565b90505f81600254610ebe91906118fa565b610ec8908761189e565b6001600160a01b0386165f90815260036020526040902054909150610eee90829061177e565b6001600160a01b0386165f8181526003602052604080822093909355915183927f5dc1c754041954fe976773fa441397a7928c7127a1c83904214a7d256339900791a3505050505050505050565b60605f8080803681610f556103256101208c018c611791565b945094509450945094505f610f6c8b87878761076f565b905060418214610fe45760405162461bcd60e51b815260206004820152603760248201527f5061796d61737465723a20696e76616c6964207369676e6174757265206c656e60448201527f67746820696e207061796d6173746572416e64446174610000000000000000006064820152608401610616565b6110527f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4061030685858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061104c92508791506111989050565b906111ca565b61108157611062600186866111f2565b60405180602001604052805f8152509097509750505050505050610ce7565b6001600160a01b0386165f908152600360205260409020548911156110dd576001600160a01b0386165f908152600360205260409081902054905163cf47918160e01b8152610616918b91600401918252602082015260400190565b604080516001600160a01b038816602082015260e08d0135918101919091526101008c013560608201526080016040516020818303038152906040526111245f87876111f2565b97509750505050505050935093915050565b61114082826108ad565b6107095760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610616565b5f81830361117e575081610514565b6111918361118c488561189e565b611228565b9392505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c91909152603c902090565b5f805f806111d8868661123d565b9250925092506111e88282611286565b5090949350505050565b5f60d08265ffffffffffff16901b60a08465ffffffffffff16901b85611218575f61121b565b60015b60ff161717949350505050565b5f8183106112365781611191565b5090919050565b5f805f8351604103611274576020840151604085015160608601515f1a6112668882858561133e565b95509550955050505061127f565b505081515f91506002905b9250925092565b5f82600381111561129957611299611911565b036112a2575050565b60018260038111156112b6576112b6611911565b036112d45760405163f645eedf60e01b815260040160405180910390fd5b60028260038111156112e8576112e8611911565b036113095760405163fce698f760e01b815260048101829052602401610616565b600382600381111561131d5761131d611911565b03610709576040516335e2f38360e21b815260048101829052602401610616565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561137757505f915060039050826113fc565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156113c8573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b0381166113f357505f9250600191508290506113fc565b92505f91508190505b9450945094915050565b5f60208284031215611416575f80fd5b81356001600160e01b031981168114611191575f80fd5b5f6020828403121561143d575f80fd5b813563ffffffff81168114611191575f80fd5b6001600160a01b0381168114610a83575f80fd5b5f8060408385031215611475575f80fd5b823561148081611450565b946020939093013593505050565b5f6020828403121561149e575f80fd5b5035919050565b5f80604083850312156114b6575f80fd5b8235915060208301356114c881611450565b809150509250929050565b5f61016082840312156114e4575f80fd5b50919050565b803565ffffffffffff811681146114ff575f80fd5b919050565b5f805f8060808587031215611517575f80fd5b843567ffffffffffffffff81111561152d575f80fd5b611539878288016114d3565b945050602085013561154a81611450565b9250611558604086016114ea565b9150611566606086016114ea565b905092959194509250565b5f8083601f840112611581575f80fd5b50813567ffffffffffffffff811115611598575f80fd5b6020830191508360208285010111156115af575f80fd5b9250929050565b5f80602083850312156115c7575f80fd5b823567ffffffffffffffff8111156115dd575f80fd5b6115e985828601611571565b90969095509350505050565b6001600160a01b038616815265ffffffffffff85811660208301528416604082015260806060820181905281018290525f828460a08401375f60a0848401015260a0601f19601f85011683010190509695505050505050565b5f6020828403121561165e575f80fd5b813561119181611450565b5f805f806060858703121561167c575f80fd5b84356003811061168a575f80fd5b9350602085013567ffffffffffffffff8111156116a5575f80fd5b6116b187828801611571565b9598909750949560400135949350505050565b5f805f606084860312156116d6575f80fd5b833567ffffffffffffffff8111156116ec575f80fd5b6116f8868287016114d3565b9660208601359650604090950135949350505050565b5f5b83811015611728578181015183820152602001611710565b50505f910152565b604081525f835180604084015261174e81606085016020880161170e565b602083019390935250601f91909101601f191601606001919050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156105145761051461176a565b5f808335601e198436030181126117a6575f80fd5b83018035915067ffffffffffffffff8211156117c0575f80fd5b6020019150368190038213156115af575f80fd5b818382375f9101908152919050565b5f83516117f481846020880161170e565b83519083019061180881836020880161170e565b01949350505050565b5f808585111561181f575f80fd5b8386111561182b575f80fd5b5050820193919092039150565b6bffffffffffffffffffffffff1981358181169160148510156118655780818660140360031b1b83161692505b505092915050565b5f806040838503121561187e575f80fd5b611887836114ea565b9150611895602084016114ea565b90509250929050565b808201808211156105145761051461176a565b5f602082840312156118c1575f80fd5b5051919050565b5f805f606084860312156118da575f80fd5b83356118e581611450565b95602085013595506040909401359392505050565b80820281158282048414176105145761051461176a565b634e487b7160e01b5f52602160045260245ffdfeaf0d3ae5661af50c10d4a5f8117fa3fc098b633d350de8cd751d260a50e3eb29a26469706673582212204e2dca37ccf6a0195973038a21f920bb4ec420745c993a12a62ebe17c4e0cf1264736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000a860b0c8187ae5eaf719a5d56334a53bcbade3d9
-----Decoded View---------------
Arg [0] : _entryPoint (address): 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
Arg [1] : _admin (address): 0xA860b0C8187aE5EAF719A5d56334a53BCBade3D9
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789
Arg [1] : 000000000000000000000000a860b0c8187ae5eaf719a5d56334a53bcbade3d9
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.