Source Code
Overview
ETH Balance
0 ETH
Token Holdings
More Info
ContractCreator
Multichain Info
N/A
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
15643353 | 183 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
CABPaymaster
Compiler Version
v0.8.25+commit.b61c2a91
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "account-abstraction/core/BasePaymaster.sol"; import "account-abstraction/core/UserOperationLib.sol"; import "account-abstraction/core/Helpers.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import {IInvoiceManager} from "../interfaces/IInvoiceManager.sol"; import {IVault} from "../interfaces/IVault.sol"; import {IPaymasterVerifier} from "../interfaces/IPaymasterVerifier.sol"; /** * @title CABPaymaster * @dev A paymaster used in chain abstracted balance to sponsor the gas fee and tokens cross-chain. */ contract CABPaymaster is IPaymasterVerifier, BasePaymaster { using SafeERC20 for IERC20; using UserOperationLib for PackedUserOperation; IInvoiceManager public immutable invoiceManager; address public immutable verifyingSigner; uint256 private constant VALID_TIMESTAMP_OFFSET = PAYMASTER_DATA_OFFSET; uint256 private constant SIGNATURE_OFFSET = VALID_TIMESTAMP_OFFSET + 64; constructor(IEntryPoint _entryPoint, IInvoiceManager _invoiceManager, address _verifyingSigner) BasePaymaster(_entryPoint, _verifyingSigner) { invoiceManager = _invoiceManager; verifyingSigner = _verifyingSigner; } /// @inheritdoc IPaymasterVerifier function verifyInvoice(bytes32 invoiceId, IInvoiceManager.InvoiceWithRepayTokens calldata invoice, bytes calldata proof) external virtual override returns (bool ret) { bytes32 hash = MessageHashUtils.toEthSignedMessageHash(getInvoiceHash(invoice)); if (verifyingSigner == ECDSA.recover(hash, proof)) { ret = true; } } function withdraw(address token, uint256 amount) external override { IERC20(token).safeTransfer(owner(), amount); } function getInvoiceHash(IInvoiceManager.InvoiceWithRepayTokens calldata invoice) public pure returns (bytes32) { return keccak256( abi.encode( invoice.account, invoice.nonce, invoice.paymaster, invoice.sponsorChainId, keccak256(abi.encode(invoice.repayTokenInfos)) ) ); } function getHash(PackedUserOperation calldata userOp, uint48 validUntil, uint48 validAfter) public view returns (bytes32) { // can't use userOp.hash(), since it contains also the paymasterAndData itself. address sender = userOp.getSender(); (,, bytes calldata signature) = parsePaymasterAndData(userOp.paymasterAndData); (bytes calldata tokenData,) = parsePaymasterSignature(signature); return keccak256( abi.encode( sender, userOp.nonce, keccak256(userOp.initCode), keccak256(userOp.callData), userOp.accountGasLimits, keccak256(tokenData), uint256(bytes32(userOp.paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET:PAYMASTER_DATA_OFFSET])), userOp.preVerificationGas, userOp.gasFees, block.chainid, address(this), validUntil, validAfter ) ); } function _validatePaymasterUserOp( PackedUserOperation calldata userOp, bytes32, /*userOpHash*/ uint256 requiredPreFund ) internal override returns (bytes memory context, uint256 validationData) { (requiredPreFund); (uint48 validUntil, uint48 validAfter, bytes calldata signature) = parsePaymasterAndData(userOp.paymasterAndData); (bytes calldata sponsorTokenData, bytes memory paymasterSignature) = parsePaymasterSignature(signature); (uint256 sponsorTokenLength, SponsorToken[] memory sponsorTokens) = parseSponsorTokenData(sponsorTokenData); // revoke the approval at the end of userOp for (uint256 i = 0; i < sponsorTokenLength; i++) { SponsorToken memory sponsorToken = sponsorTokens[i]; IERC20(sponsorToken.token).approve(sponsorToken.spender, sponsorToken.amount); } // check the invoice // bytes32 invoiceId = invoiceManager.getInvoiceId(userOp.sender, address(this), userOp.nonce, block.chainid, repayTokens); bytes32 hash = MessageHashUtils.toEthSignedMessageHash(getHash(userOp, validUntil, validAfter)); // don't revert on signature failure: return SIG_VALIDATION_FAILED if (verifyingSigner != ECDSA.recover(hash, paymasterSignature)) { return (sponsorTokenData[0:1 + sponsorTokenLength * 72], _packValidationData(true, validUntil, validAfter)); } return (sponsorTokenData[0:1 + sponsorTokenLength * 72], _packValidationData(false, validUntil, validAfter)); } function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost, uint256 actualUserOpFeePerGas) internal virtual override { (uint8 sponsorTokenLength, SponsorToken[] memory sponsorTokens) = parseSponsorTokenData(context); for (uint8 i = 0; i < sponsorTokenLength; i++) { SponsorToken memory sponsorToken = sponsorTokens[i]; IERC20(sponsorToken.token).approve(sponsorToken.spender, 0); } } function parsePaymasterAndData(bytes calldata paymasterAndData) public pure returns (uint48 validUntil, uint48 validAfter, bytes calldata signature) { (validUntil, validAfter) = abi.decode(paymasterAndData[VALID_TIMESTAMP_OFFSET:], (uint48, uint48)); signature = paymasterAndData[SIGNATURE_OFFSET:]; } function parsePaymasterSignature(bytes calldata signature) public pure returns (bytes calldata sponsorTokenData, bytes calldata paymasterSignature) { uint8 sponsorTokenLength = uint8(signature[0]); require(signature.length == sponsorTokenLength * 72 + 65 + 1, "CABPaymaster: invalid paymasterAndData"); sponsorTokenData = signature[0:1 + sponsorTokenLength * 72]; paymasterSignature = signature[sponsorTokenLength * 72 + 1:sponsorTokenLength * 72 + 66]; } function parseSponsorTokenData(bytes calldata sposnorTokenData) public pure returns (uint8 sponsorTokenLength, SponsorToken[] memory sponsorTokens) { sponsorTokenLength = uint8(bytes1(sposnorTokenData[0])); // 1 byte: length // length * 72 bytes: (20 bytes: token adddress + 20 bytes: spender address + 32 bytes: amount) require( sposnorTokenData.length == 1 + sponsorTokenLength * (72), "CABPaymaster: invalid sponsorTokenData length" ); sponsorTokens = new SponsorToken[](sponsorTokenLength); for (uint256 i = 0; i < uint256(sponsorTokenLength);) { uint256 offset = 1 + i * 72; address token = address(bytes20(sposnorTokenData[offset:offset + 20])); address spender = address(bytes20(sposnorTokenData[offset + 20:offset + 40])); uint256 amount = uint256(bytes32(sposnorTokenData[offset + 40:offset + 72])); sponsorTokens[i] = SponsorToken(token, spender, amount); unchecked { i++; } } } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.23; /* solhint-disable reason-string */ import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "../interfaces/IPaymaster.sol"; import "../interfaces/IEntryPoint.sol"; import "./UserOperationLib.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, Ownable { IEntryPoint public immutable entryPoint; uint256 internal constant PAYMASTER_VALIDATION_GAS_OFFSET = UserOperationLib.PAYMASTER_VALIDATION_GAS_OFFSET; uint256 internal constant PAYMASTER_POSTOP_GAS_OFFSET = UserOperationLib.PAYMASTER_POSTOP_GAS_OFFSET; uint256 internal constant PAYMASTER_DATA_OFFSET = UserOperationLib.PAYMASTER_DATA_OFFSET; constructor(IEntryPoint _entryPoint, address _verifyingSigner) Ownable(_verifyingSigner) { _validateEntryPointInterface(_entryPoint); entryPoint = _entryPoint; } //sanity check: make sure this EntryPoint was compiled against the same // IEntryPoint of this paymaster function _validateEntryPointInterface(IEntryPoint _entryPoint) internal virtual { require(IERC165(address(_entryPoint)).supportsInterface(type(IEntryPoint).interfaceId), "IEntryPoint interface mismatch"); } /// @inheritdoc IPaymaster function validatePaymasterUserOp( PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost ) external override returns (bytes memory context, uint256 validationData) { _requireFromEntryPoint(); return _validatePaymasterUserOp(userOp, userOpHash, maxCost); } /** * Validate a user operation. * @param userOp - The user operation. * @param userOpHash - The hash of the user operation. * @param maxCost - The maximum cost of the user operation. */ function _validatePaymasterUserOp( PackedUserOperation 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, uint256 actualUserOpFeePerGas ) external override { _requireFromEntryPoint(); _postOp(mode, context, actualGasCost, actualUserOpFeePerGas); } /** * 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. The paymaster still has to pay for gas. * postOpReverted - never passed in a call to postOp(). * @param context - The context value returned by validatePaymasterUserOp * @param actualGasCost - Actual gas used so far (without this postOp call). * @param actualUserOpFeePerGas - the gas price this UserOp pays. This value is based on the UserOp's maxFeePerGas * and maxPriorityFee (and basefee) * It is not the same as tx.gasprice, which is what the bundler pays. */ function _postOp( PostOpMode mode, bytes calldata context, uint256 actualGasCost, uint256 actualUserOpFeePerGas ) internal virtual { (mode, context, actualGasCost, actualUserOpFeePerGas); // 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 { entryPoint.depositTo{value: msg.value}(address(this)); } /** * Withdraw value from the deposit. * @param withdrawAddress - Target to send to. * @param amount - Amount to withdraw. */ function withdrawTo( address payable withdrawAddress, uint256 amount ) public onlyOwner { 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 onlyOwner { 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 onlyOwner { 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 onlyOwner { entryPoint.withdrawStake(withdrawAddress); } /** * Validate the call is made from a valid entrypoint */ function _requireFromEntryPoint() internal virtual { require(msg.sender == address(entryPoint), "Sender not EntryPoint"); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.23; /* solhint-disable no-inline-assembly */ import "../interfaces/PackedUserOperation.sol"; import {calldataKeccak, min} from "./Helpers.sol"; /** * Utility functions helpful when working with UserOperation structs. */ library UserOperationLib { uint256 public constant PAYMASTER_VALIDATION_GAS_OFFSET = 20; uint256 public constant PAYMASTER_POSTOP_GAS_OFFSET = 36; uint256 public constant PAYMASTER_DATA_OFFSET = 52; /** * Get sender from user operation data. * @param userOp - The user operation data. */ function getSender( PackedUserOperation 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. * @param userOp - The user operation data. */ function gasPrice( PackedUserOperation calldata userOp ) internal view returns (uint256) { unchecked { (uint256 maxPriorityFeePerGas, uint256 maxFeePerGas) = unpackUints(userOp.gasFees); if (maxFeePerGas == maxPriorityFeePerGas) { //legacy mode (for networks that don't support basefee opcode) return maxFeePerGas; } return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee); } } /** * Pack the user operation data into bytes for hashing. * @param userOp - The user operation data. */ function encode( PackedUserOperation 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); bytes32 accountGasLimits = userOp.accountGasLimits; uint256 preVerificationGas = userOp.preVerificationGas; bytes32 gasFees = userOp.gasFees; bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData); return abi.encode( sender, nonce, hashInitCode, hashCallData, accountGasLimits, preVerificationGas, gasFees, hashPaymasterAndData ); } function unpackUints( bytes32 packed ) internal pure returns (uint256 high128, uint256 low128) { return (uint128(bytes16(packed)), uint128(uint256(packed))); } //unpack just the high 128-bits from a packed value function unpackHigh128(bytes32 packed) internal pure returns (uint256) { return uint256(packed) >> 128; } // unpack just the low 128-bits from a packed value function unpackLow128(bytes32 packed) internal pure returns (uint256) { return uint128(uint256(packed)); } function unpackMaxPriorityFeePerGas(PackedUserOperation calldata userOp) internal pure returns (uint256) { return unpackHigh128(userOp.gasFees); } function unpackMaxFeePerGas(PackedUserOperation calldata userOp) internal pure returns (uint256) { return unpackLow128(userOp.gasFees); } function unpackVerificationGasLimit(PackedUserOperation calldata userOp) internal pure returns (uint256) { return unpackHigh128(userOp.accountGasLimits); } function unpackCallGasLimit(PackedUserOperation calldata userOp) internal pure returns (uint256) { return unpackLow128(userOp.accountGasLimits); } function unpackPaymasterVerificationGasLimit(PackedUserOperation calldata userOp) internal pure returns (uint256) { return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET])); } function unpackPostOpGasLimit(PackedUserOperation calldata userOp) internal pure returns (uint256) { return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET])); } function unpackPaymasterStaticFields( bytes calldata paymasterAndData ) internal pure returns (address paymaster, uint256 validationGasLimit, uint256 postOpGasLimit) { return ( address(bytes20(paymasterAndData[: PAYMASTER_VALIDATION_GAS_OFFSET])), uint128(bytes16(paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET])), uint128(bytes16(paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET])) ); } /** * Hash the user operation data. * @param userOp - The user operation data. */ function hash( PackedUserOperation calldata userOp ) internal pure returns (bytes32) { return keccak256(encode(userOp)); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.23; /* solhint-disable no-inline-assembly */ /* * For simulation purposes, validateUserOp (and validatePaymasterUserOp) * must return this value in case of signature failure, instead of revert. */ uint256 constant SIG_VALIDATION_FAILED = 1; /* * For simulation purposes, validateUserOp (and validatePaymasterUserOp) * return this value on success. */ uint256 constant SIG_VALIDATION_SUCCESS = 0; /** * Returned data from validateUserOp. * validateUserOp returns a uint256, which 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. * @param validationData - The packed validation data. */ function _parseValidationData( uint256 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); } /** * 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 ("memory-safe") { let mem := mload(0x40) let len := data.length calldatacopy(mem, data.offset, len) ret := keccak256(mem, len) } } /** * The minimum of two numbers. * @param a - First number. * @param b - Second number. */ function min(uint256 a, uint256 b) pure returns (uint256) { return a < b ? a : b; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 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 pragma solidity ^0.8.0; import {IVault} from "./IVault.sol"; import {IPaymasterVerifier} from "../interfaces/IPaymasterVerifier.sol"; /** * @title Interface for the InvoiceManager contract. */ interface IInvoiceManager { /** * @notice Emitted when a paymaster is registered. * @param account The account that registered the paymaster. * @param paymaster The address of the paymaster. * @param paymasterVerifier The address of the paymaster verifier. * @param expiry The expiry time of the paymaster. */ event PaymasterRegistered( address indexed account, address indexed paymaster, IPaymasterVerifier indexed paymasterVerifier, uint256 expiry ); /** * @notice Emitted when a paymaster is revoked. * @param account The account that revoked the paymaster. * @param paymaster The address of the paymaster. * @param paymasterVerifier The address of the paymaster verifier. */ event PaymasterRevoked( address indexed account, address indexed paymaster, IPaymasterVerifier indexed paymasterVerifier ); /** * @notice Emitted when an invoice is created. * @param invoiceId The ID of the invoice. * @param account The account that created the invoice. * @param paymaster The address of the paymaster. */ event InvoiceCreated(bytes32 indexed invoiceId, address indexed account, address indexed paymaster); /** * @notice Emitted when an invoice is repaid. * @param invoiceId The ID of the invoice. * @param account The account that repaid the invoice. * @param paymaster The address of the paymaster. */ event InvoiceRepaid(bytes32 indexed invoiceId, address indexed account, address indexed paymaster); /// @notice Struct to represent the CAB paymaster. struct CABPaymaster { address paymaster; IPaymasterVerifier paymasterVerifier; uint256 expiry; } struct RepayTokenInfo { IVault vault; uint256 amount; uint256 chainId; } /// @notice Struct to represent the invoice. struct Invoice { address account; uint256 nonce; address paymaster; uint256 sponsorChainId; } /// @notice Struct to represent the invoice. struct InvoiceWithRepayTokens { address account; uint256 nonce; address paymaster; uint256 sponsorChainId; RepayTokenInfo[] repayTokenInfos; } /** * @notice Register the CAB paymaster for the smart account. * @param paymaster The address of the paymaster. * @param paymasterVerifier The address of the paymaster verifier. * @param expiry The expiry time of the paymaster. */ function registerPaymaster(address paymaster, IPaymasterVerifier paymasterVerifier, uint256 expiry) external; /** * @notice Revoke the CAB paymaster. */ function revokePaymaster() external; /** * @notice Create a new invoice. * @dev The invoideId is generated using the sender, nonce, chainId and repayChainId. * @param nonce The nonce of the invoice. * @param paymaster The address of the paymaster. * @param invoiceId The ID of the invoice. */ function createInvoice(uint256 nonce, address paymaster, bytes32 invoiceId) external; /** * @notice Repay the invoice. * @param invoiceId The ID of the invoice. * @param invoice The invoice to repay. * @param proof The proof of the repayment. */ function repay(bytes32 invoiceId, InvoiceWithRepayTokens calldata invoice, bytes calldata proof) external; /** * @notice Withdraw the locked tokens to the account. * @param account The address of the account. * @param repayTokenVaults The vault of the tokens to repay. * @param repayAmounts The amounts to repay. */ function withdrawToAccount(address account, IVault[] calldata repayTokenVaults, uint256[] calldata repayAmounts) external; /** * @notice Get the CAB paymaster. * @param account The address of the account. * @return cabPaymaster The CAB paymaster. */ function getCABPaymaster(address account) external view returns (CABPaymaster memory); /** * @notice Get the invoice. * @param invoiceId The ID of the invoice. * @return invoice The invoice. */ function getInvoice(bytes32 invoiceId) external view returns (Invoice memory); /** * @notice Get the invoice ID. * @param account The address of the account. * @param paymaster The address of the paymaster. * @param nonce The nonce of the invoice. * @param repayTokenInfos The tokens to repay. * @return invoiceId The ID of the invoice. */ function getInvoiceId( address account, address paymaster, uint256 nonce, RepayTokenInfo[] calldata repayTokenInfos ) external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Interface for the Vault contract. */ interface IVault { /** * @notice Deposits the specified amount of tokens into the Vault. * @dev The function is only callable by vaultManager contract. * @param token The token to deposit. * @param amount The amount of tokens to deposit. * @param isYield A flag to indicate if the deposit is in yield mode. * @return newShares The amount of new shares issue at the current exchange rate. */ function deposit(IERC20 token, uint256 amount, bool isYield) external returns (uint256); /** * @notice Withdraws the specified amount of tokens from the Vault. * @dev The function is only callable by vaultManager contract. * @param token The token to withdraw. * @param amountShare The amount of shares to withdraw. * @param recipient The address to send the withdrawn tokens to. */ function withdraw(IERC20 token, uint256 amountShare, address recipient) external; /** * @notice Convert the specified amount of shares to the underlying token. * @param amountShares The amount of shares. * @return amountUnderlying The amount of token corresponding to the shares. */ function sharesToUnderlying(uint256 amountShares) external view returns (uint256); /** * @notice Convert the specified amount of underlying token to shares. * @param amountUnderlying The amount of underlying tokens. * @return amountShares The amount of shares corresponding to the underlying amount. */ function underlyingToShares(uint256 amountUnderlying) external view returns (uint256); /** * @notice Returns the total amount of shares for the account. * @param account The account to query. * @return shares The amount of shares for the account. */ function accountShares(address account) external view returns (uint256); /** * @notice Returns the total amount of underlying tokens for the account. * @param account The account to query. * @return underlying The amount of underlying tokens for the account. */ function accountUnderlying(address account) external view returns (uint256); /** * @notice Returns the underlying token of the Vault. * @return token The underlying token. */ function underlyingToken() external view returns (IERC20); /** * @notice Returns the total amount of shares in the Vault. * @return totalShares The total amount of shares in the Vault. */ function totalShares() external view returns (uint256); /** * @notice Returns the total amount of balance in the Vault. * @return totalAssets The total balance of the Vault. */ function totalAssets() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IVault} from "./IVault.sol"; import {IInvoiceManager} from "./IInvoiceManager.sol"; /** * @title Interface for the PaymasterVerifier contract. */ interface IPaymasterVerifier { /// @notice The struct of the sponsor token. struct SponsorToken { address token; address spender; uint256 amount; } /** * @notice Verify the invoice. * @param invoiceId The ID of the invoice. * @param invoice The invoice to verify. * @param proof The proof of the invoice. */ function verifyInvoice(bytes32 invoiceId, IInvoiceManager.InvoiceWithRepayTokens calldata invoice, bytes calldata proof) external returns (bool); /** * @notice Withdraw the token. */ function withdraw(address token, uint256 amount) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// 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: GPL-3.0 pragma solidity >=0.7.5; import "./PackedUserOperation.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 { // User op succeeded. opSucceeded, // User op reverted. Still has to pay for gas. opReverted, // Only used internally in the EntryPoint (cleanup after postOp reverts). Never calling paymaster with this value postOpReverted } /** * 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, * other values are invalid for paymaster. * <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( PackedUserOperation 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. The paymaster still has to pay for gas. * postOpReverted - never passed in a call to postOp(). * @param context - The context value returned by validatePaymasterUserOp * @param actualGasCost - Actual gas used so far (without this postOp call). * @param actualUserOpFeePerGas - the gas price this UserOp pays. This value is based on the UserOp's maxFeePerGas * and maxPriorityFee (and basefee) * It is not the same as tx.gasprice, which is what the bundler pays. */ function postOp( PostOpMode mode, bytes calldata context, uint256 actualGasCost, uint256 actualUserOpFeePerGas ) external; }
/** ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation. ** Only one instance required on each chain. **/ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.5; /* solhint-disable avoid-low-level-calls */ /* solhint-disable no-inline-assembly */ /* solhint-disable reason-string */ import "./PackedUserOperation.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 if the UserOperation Paymaster's "postOp" call 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 PostOpRevertReason( bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason ); /** * UserOp consumed more than prefund. The UserOperation is reverted, and no refund is made. * @param userOpHash - The request unique identifier. * @param sender - The sender of this request. * @param nonce - The nonce used in the request. */ event UserOperationPrefundTooLow( bytes32 indexed userOpHash, address indexed sender, uint256 nonce ); /** * 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. * @param aggregator - The aggregator used for the following UserOperationEvents. */ event SignatureAggregatorChanged(address indexed aggregator); /** * A custom revert error of handleOps, to identify the offending op. * 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. * 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. */ error FailedOp(uint256 opIndex, string reason); /** * A custom revert error of handleOps, to report a revert by account or paymaster. * @param opIndex - Index into the array of ops to the failed one (in simulateValidation, this is always zero). * @param reason - Revert reason. see FailedOp(uint256,string), above * @param inner - data from inner cought revert reason * @dev note that inner is truncated to 2048 bytes */ error FailedOpWithRevert(uint256 opIndex, string reason, bytes inner); error PostOpReverted(bytes returnData); /** * Error case when a signature aggregator fails to verify the aggregated signature it had created. * @param aggregator The aggregator that failed to verify the signature */ error SignatureValidationFailed(address aggregator); // Return value of getSenderAddress. error SenderAddressResult(address sender); // UserOps handled, per aggregator. struct UserOpsPerAggregator { PackedUserOperation[] userOps; // Aggregator address IAggregator aggregator; // Aggregated signature bytes signature; } /** * Execute a batch of UserOperations. * 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( PackedUserOperation[] 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. * @param userOp - The user operation to generate the request ID for. * @return hash the hash of this UserOperation */ function getUserOpHash( PackedUserOperation calldata userOp ) external view returns (bytes32); /** * Gas and return values during simulation. * @param preOpGas - The gas used for validation (including preValidationGas) * @param prefund - The required prefund for this operation * @param accountValidationData - returned validationData from account. * @param paymasterValidationData - return validationData from paymaster. * @param paymasterContext - Returned by validatePaymasterUserOp (to be passed into postOp) */ struct ReturnInfo { uint256 preOpGas; uint256 prefund; uint256 accountValidationData; uint256 paymasterValidationData; 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; error DelegateAndRevert(bool success, bytes ret); /** * Helper method for dry-run testing. * @dev calling this method, the EntryPoint will make a delegatecall to the given data, and report (via revert) the result. * The method always revert, so is only useful off-chain for dry run calls, in cases where state-override to replace * actual EntryPoint code is less convenient. * @param target a target contract to make a delegatecall from entrypoint * @param data data to pass to target in a delegatecall */ function delegateAndRevert(address target, bytes calldata data) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.5; /** * User Operation struct * @param sender - The sender account of this request. * @param nonce - Unique value the sender uses to verify it is not a replay. * @param initCode - If set, the account contract will be created by this constructor/ * @param callData - The method call to execute on this account. * @param accountGasLimits - Packed gas limits for validateUserOp and gas limit passed to the callData method call. * @param preVerificationGas - Gas not calculated by the handleOps method, but added to the gas paid. * Covers batch overhead. * @param gasFees - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters. * @param paymasterAndData - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data * The paymaster will pay for the transaction instead of the sender. * @param signature - Sender-verified signature over the entire request, the EntryPoint address and the chain ID. */ struct PackedUserOperation { address sender; uint256 nonce; bytes initCode; bytes callData; bytes32 accountGasLimits; uint256 preVerificationGas; bytes32 gasFees; bytes paymasterAndData; bytes signature; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// 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: 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: GPL-3.0-only pragma solidity >=0.7.5; /** * 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 fits into one cell (used during handleOp) * and the rest fit into a 2nd cell (used during stake/unstake) * - 112 bit allows for 10^15 eth * - 48 bit for full timestamp * - 32 bit allows 150 years for unstake delay */ struct DepositInfo { uint256 deposit; bool staked; uint112 stake; uint32 unstakeDelaySec; uint48 withdrawTime; } // API struct used by getStakeInfo and simulateValidation. struct StakeInfo { uint256 stake; uint256 unstakeDelaySec; } /** * Get deposit info. * @param account - The account to query. * @return info - Full deposit information of given account. */ function getDepositInfo( address account ) external view returns (DepositInfo memory info); /** * Get account balance. * @param account - The account to query. * @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. * @param account - The account to add to. */ 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.7.5; import "./PackedUserOperation.sol"; /** * Aggregated Signatures validator. */ interface IAggregator { /** * Validate aggregated signature. * Revert if the aggregated signature does not match the given list of operations. * @param userOps - Array of UserOperations to validate the signature for. * @param signature - The aggregated signature. */ function validateSignatures( PackedUserOperation[] calldata userOps, bytes calldata signature ) external view; /** * Validate signature of a single userOp. * This method should be called by bundler after EntryPointSimulation.simulateValidation() returns * the aggregator this account uses. * 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( PackedUserOperation 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( PackedUserOperation[] calldata userOps ) external view returns (bytes memory aggregatedSignature); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.5; 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: 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); } } }
{ "remappings": [ "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "aave-v3-core/=lib/aave-v3-core/", "account-abstraction/=lib/account-abstraction/contracts/", "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzepplin-4.9/contracts/", "openzepplin-4.9/=lib/openzepplin-4.9/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
[{"inputs":[{"internalType":"contract IEntryPoint","name":"_entryPoint","type":"address"},{"internalType":"contract IInvoiceManager","name":"_invoiceManager","type":"address"},{"internalType":"address","name":"_verifyingSigner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","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":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint32","name":"unstakeDelaySec","type":"uint32"}],"name":"addStake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"entryPoint","outputs":[{"internalType":"contract IEntryPoint","name":"","type":"address"}],"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":"bytes32","name":"accountGasLimits","type":"bytes32"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"bytes32","name":"gasFees","type":"bytes32"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct PackedUserOperation","name":"userOp","type":"tuple"},{"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":[{"components":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"paymaster","type":"address"},{"internalType":"uint256","name":"sponsorChainId","type":"uint256"},{"components":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"}],"internalType":"struct IInvoiceManager.RepayTokenInfo[]","name":"repayTokenInfos","type":"tuple[]"}],"internalType":"struct IInvoiceManager.InvoiceWithRepayTokens","name":"invoice","type":"tuple"}],"name":"getInvoiceHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"invoiceManager","outputs":[{"internalType":"contract IInvoiceManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"paymasterAndData","type":"bytes"}],"name":"parsePaymasterAndData","outputs":[{"internalType":"uint48","name":"validUntil","type":"uint48"},{"internalType":"uint48","name":"validAfter","type":"uint48"},{"internalType":"bytes","name":"signature","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"parsePaymasterSignature","outputs":[{"internalType":"bytes","name":"sponsorTokenData","type":"bytes"},{"internalType":"bytes","name":"paymasterSignature","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"sposnorTokenData","type":"bytes"}],"name":"parseSponsorTokenData","outputs":[{"internalType":"uint8","name":"sponsorTokenLength","type":"uint8"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IPaymasterVerifier.SponsorToken[]","name":"sponsorTokens","type":"tuple[]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum IPaymaster.PostOpMode","name":"mode","type":"uint8"},{"internalType":"bytes","name":"context","type":"bytes"},{"internalType":"uint256","name":"actualGasCost","type":"uint256"},{"internalType":"uint256","name":"actualUserOpFeePerGas","type":"uint256"}],"name":"postOp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","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":"bytes32","name":"accountGasLimits","type":"bytes32"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"bytes32","name":"gasFees","type":"bytes32"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct PackedUserOperation","name":"userOp","type":"tuple"},{"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":"bytes32","name":"invoiceId","type":"bytes32"},{"components":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"paymaster","type":"address"},{"internalType":"uint256","name":"sponsorChainId","type":"uint256"},{"components":[{"internalType":"contract IVault","name":"vault","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"}],"internalType":"struct IInvoiceManager.RepayTokenInfo[]","name":"repayTokenInfos","type":"tuple[]"}],"internalType":"struct IInvoiceManager.InvoiceWithRepayTokens","name":"invoice","type":"tuple"},{"internalType":"bytes","name":"proof","type":"bytes"}],"name":"verifyInvoice","outputs":[{"internalType":"bool","name":"ret","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verifyingSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"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
60e0604090808252346101f657606081611a1b803803809161002182856101fb565b8339810103126101f65780516001600160a01b038082169291908382036101f657602090818401519381851685036101f65786015194818616918287036101f65782156101de57600080546001600160a01b0319811685178255895194919386938693602493859392167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08880a36301ffc9a760e01b825263122a0e9b60e31b60048301525afa9182156101d2578192610191575b50501561014e575060805260a05260c052516117e690816102358239608051818181610303015281816103ae01528181610460015281816104d60152818161058c01528181610aea01528181610b6f0152611361015260a05181610960015260c051818181610a3601528181610a8e01526114840152f35b60649085519062461bcd60e51b82526004820152601e60248201527f49456e747279506f696e7420696e74657266616365206d69736d6174636800006044820152fd5b9091508281813d83116101cb575b6101a981836101fb565b810103126101c757519081151582036101c4575038806100d6565b80fd5b5080fd5b503d61019f565b508651903d90823e3d90fd5b8751631e4fbdf760e01b815260006004820152602490fd5b600080fd5b601f909101601f19168101906001600160401b0382119082101761021e57604052565b634e487b7160e01b600052604160045260246000fdfe60406080815260048036101561001457600080fd5b600091823560e01c80630396cb6014610b4757838163205c287814610abd5750806323d9ac9b14610a7957806331f2b5b11461098f5780633d8cad901461094b57806352b7512c146108ac5780635829c5f514610847578063715018a6146107ed5780637c627b21146106ed5780638da5cb5b146106c557806394d4ad601461065c578063aa2f6b44146105bb578063b0d691fe14610577578063b2eae5b11461052c57838163bb9fe6bf146104b9578163c23a5cea1461043257508063c399ec881461038157838163d0e30db0146102f357508063f2fde38b14610262578063f3105d58146101f85763f3fef3a31461010d57600080fd5b346101f457806003193601126101f457610125610bd5565b8354825163a9059cbb60e01b602082019081526001600160a01b039283166024808401919091523560448084019190915282529290911692916101a59186918291610171606482610c90565b519082875af13d156101ec573d9061018882610cb1565b9161019585519384610c90565b82523d87602084013e5b8461174d565b80519081151591826101d1575b50506101bc578380f35b51635274afe760e01b81529182015260249150fd5b6101e492506020809183010191016113ce565b1538806101b2565b60609061019f565b8280fd5b50823461025f57602036600319011261025f578235906001600160401b03821161025f575061023961023361024d9461025b93369101610beb565b90611259565b919590928551968688978852870191610c2b565b918483036020860152610c2b565b0390f35b80fd5b5090346101f45760203660031901126101f45761027d610bd5565b90610286611333565b6001600160a01b039182169283156102dd575050600054826bffffffffffffffffffffffff60a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8084848260031936011261037d577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691823b15610378578390602483518095819363b760faf960e01b8352309083015234905af190811561036f575061035f5750f35b61036890610c4c565b61025f5780f35b513d84823e3d90fd5b505050fd5b5050fd5b50346101f457826003193601126101f45780516370a0823160e01b815230928101929092526020826024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9182156104285783926103f0575b6020838351908152f35b9091506020813d602011610420575b8161040c60209383610c90565b810103126101f457602092505190386103e6565b3d91506103ff565b81513d85823e3d90fd5b8084843461037d57602036600319011261037d5761044e610bd5565b610456611333565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116803b156104b5578592836024928651978895869463611d2e7560e11b865216908401525af190811561036f575061035f5750f35b8580fd5b8084843461037d578260031936011261037d576104d4611333565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691823b1561037857815163bb9fe6bf60e01b81529284918491829084905af190811561036f575061035f5750f35b5090346101f4576003199260203685011261025f578135936001600160401b0385116105735760a090853603011261025f575060209261056c910161114b565b9051908152f35b5080fd5b838234610573578160031936011261057357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50823461025f57602092836003193601126105735780356001600160401b0381116101f4576105f86105f285938793369101610beb565b90610f75565b9183519360ff818601931685528082860152835180935260608260608701950196915b8483106106285786860387f35b875180516001600160a01b03908116885281860151168786015281015186820152968301969481019460019092019161061b565b50913461025f57602036600319011261025f578135906001600160401b03821161025f575061069c61069660609361025b93369101610beb565b90610e6d565b9194909295805196879665ffffffffffff80921688521660208701528501526060840191610c2b565b838234610573578160031936011261057357905490516001600160a01b039091168152602090f35b50346101f45760803660031901126101f4576003823510156101f4576024906024356001600160401b0381116107e95761072d61073b9136908601610beb565b9061073661135f565b610f75565b9490815b60ff8082169083168110156107e5576107589088610f4b565b518051602091820151865163095ea7b360e01b81526001600160a01b03918216818b0152888101879052918391839160449183918a91165af180156107db579160ff93916001936107ad575b5050011661073f565b816107cc92903d106107d4575b6107c48183610c90565b8101906113ce565b5038806107a4565b503d6107ba565b86513d87823e3d90fd5b8380f35b8480fd5b833461025f578060031936011261025f57610806611333565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5090346101f4576003199260603685011261025f578135936001600160401b0385116105735761012090853603011261025f575065ffffffffffff60243581811681036108a75760443591821682036108a75760209461056c9301610d4d565b600080fd5b50823461025f57606092600319906060823601126101f4578035916001600160401b038311610947576101209083360301126101f4576108f7849286926108f161135f565b016113e6565b8391935194859383855285518094860152815b848110610930575050606080955083850101526020830152601f80199101168101030190f35b60208782018101518983018401528896500161090a565b8380fd5b838234610573578160031936011261057357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101f45760031960603682011261094757602435906001600160401b03908183116104b55760a09083360301126107e9576044359081116107e9576109f6610a25610a3493603c6020986109eb610a2b9636908b01610beb565b959093829a0161114b565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008252601c5220923691610ccc565b906115fc565b90929192611638565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116911614610a70575b519015158152f35b60019150610a68565b838234610573578160031936011261057357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b8084843461037d578060031936011261037d57610ad8610bd5565b610ae0611333565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116803b156104b5578592836044928651978895869463040b850f60e31b8652169084015260243560248401525af190811561036f575061035f5750f35b5060203660031901126101f45782823563ffffffff811680910361057357610b6d611333565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031693843b156101f45760249084519586938492621cb65b60e51b845283015234905af190811561036f5750610bc9575080f35b610bd290610c4c565b80f35b600435906001600160a01b03821682036108a757565b9181601f840112156108a7578235916001600160401b0383116108a757602083818601950101116108a757565b359065ffffffffffff821682036108a757565b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160401b038111610c5f57604052565b634e487b7160e01b600052604160045260246000fd5b606081019081106001600160401b03821117610c5f57604052565b90601f801991011681019081106001600160401b03821117610c5f57604052565b6001600160401b038111610c5f57601f01601f191660200190565b929192610cd882610cb1565b91610ce66040519384610c90565b8294818452818301116108a7578281602093846000960137010152565b903590601e19813603018212156108a757018035906001600160401b0382116108a7576020019181360383136108a757565b909392938483116108a75784116108a7578101920390565b9160e0830191610d6c610d636106968587610d03565b92509050611259565b5050939094610dc3610db5610d8e610d876040850185610d03565b3691610ccc565b6020815191012097610da6610d876060860186610d03565b60208151910120973691610ccc565b602081519101209282610d03565b6034939193116108a75760c09260149160405197602089019960018060a01b038635168b52602086013560408b015260608a01526080890152608084013560a089015284880152013560e086015260a08101356101008601520135610120840152466101408401523061016084015265ffffffffffff8091166101808401526101a091168183015281526101c081018181106001600160401b03821117610c5f5760405251902090565b9190806034116108a7576040603319848381010301126108a757610e9360348401610c18565b91610ea060548501610c18565b9293826074116108a757607401916073190190565b60ff60489116029060ff8216918203610eca57565b634e487b7160e01b600052601160045260246000fd5b60ff166001019060ff8211610eca57565b60ff60019116019060ff8211610eca57565b6001600160401b038111610c5f5760051b60200190565b6bffffffffffffffffffffffff199035818116939260148110610f3c57505050565b60140360031b82901b16169150565b8051821015610f5f5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b918115610f5f57823560f81c9260ff610f95610f9086610eb5565b610ee0565b1683036110dc57610fa584610f03565b6040610fb46040519283610c90565b858252601f19610fc387610f03565b0160005b8181106110b2575050819460005b878110610fe3575050505050565b604890818102918183041481151715610eca5760019180830190818411610eca576015810190818311610eca5761102561101f8385898d610d35565b90610f1a565b916060936029830191828211610eca5761104761101f846049938f8d90610d35565b861c9301809111610eca5761105d91888c610d35565b90359260209182811061109e575b5088519461107886610c75565b1c84528301528582015261108c8287610f4b565b526110978186610f4b565b5001610fd5565b60001990830360031b1b909316923861106b565b60209083516110c081610c75565b6000815282600081830152600086830152828701015201610fc7565b60405162461bcd60e51b815260206004820152602d60248201527f4341425061796d61737465723a20696e76616c69642073706f6e736f72546f6b60448201526c0cadc88c2e8c240d8cadccee8d609b1b6064820152608490fd5b356001600160a01b03811681036108a75790565b61115481611137565b6020916040611164818301611137565b9260606080840135601e19853603018112156108a75784019384356001600160401b03958682116108a7578801838202360381136108a75790855190818a810193828983018d875252868201909260005b81811061121b5750506111d1925003601f198101835282610c90565b519020928451968888019860018060a01b038093168a528301358689015216828701520135608085015260a084015260a0835260c083019183831090831117610c5f575251902090565b9092509083356001600160a01b03811691908290036108a757908152838d01358d820152898401358a820152928701928492908801916001016111b5565b918115610f5f5760ff833560f81c60418261127383610eb5565b1601828111610eca576112868391610ef1565b1684036112df578161129a610f9083610eb5565b16948486116108a7578095946042846112c36112bd6112b887610eb5565b610ef1565b95610eb5565b160193808511610eca57806112db9516931691610d35565b9091565b60405162461bcd60e51b815260206004820152602660248201527f4341425061796d61737465723a20696e76616c6964207061796d6173746572416044820152656e644461746160d01b6064820152608490fd5b6000546001600160a01b0316330361134757565b60405163118cdaa760e01b8152336004820152602490fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316330361139157565b60405162461bcd60e51b815260206004820152601560248201527414d95b99195c881b9bdd08115b9d1c9e541bda5b9d605a1b6044820152606490fd5b908160209103126108a7575180151581036108a75790565b9060ff61140e9261141a61140061069660e0840184610d03565b978298849794969392611259565b97929691973691610ccc565b926114258787610f75565b95169460005b86811061155f575050610a2b92611477949261144692610d4d565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206115fc565b6001600160a01b039081167f00000000000000000000000000000000000000000000000000000000000000009091160361150157604881029080820460481490151715610eca576001019182600111610eca5782116108a7576114db913691610ccc565b9260a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b0319161790565b60488194939294029080820460481490151715610eca576001019081600111610eca5781116108a757600192611538913691610ccc565b9360a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b031916171790565b919350915061156e8183610f4b565b518051602080830151604093840151845163095ea7b360e01b81526001600160a01b039283166004820152602481019190915291939192849184916044918391600091165af19081156115f257509060019392916115d4575b5050019187918a9361142b565b816115ea92903d106107d4576107c48183610c90565b5038806115c7565b513d6000823e3d90fd5b815191906041830361162d5761162692506020820151906060604084015193015160001a906116bd565b9192909190565b505060009160029190565b60048110156116a7578061164a575050565b600181036116645760405163f645eedf60e01b8152600490fd5b600281036116855760405163fce698f760e01b815260048101839052602490fd5b60031461168f5750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161174157926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156117355780516001600160a01b0381161561172c57918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b90611774575080511561176257805190602001fd5b604051630a12f52160e11b8152600490fd5b815115806117a7575b611785575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561177d56fea2646970667358221220fd11e78c7fd8a8406d095291be4e8a0daacf8d62b29cbc755b5d327e5c7b6d7d64736f6c634300081900330000000000000000000000000000000071727de22e5e9d8baf0edac6f37da03200000000000000000000000080f3b8c46381d5cf4b737742d5fe323b7caa43b1000000000000000000000000999f8012b114600d2b2995e14ed975322c30391e
Deployed Bytecode
0x60406080815260048036101561001457600080fd5b600091823560e01c80630396cb6014610b4757838163205c287814610abd5750806323d9ac9b14610a7957806331f2b5b11461098f5780633d8cad901461094b57806352b7512c146108ac5780635829c5f514610847578063715018a6146107ed5780637c627b21146106ed5780638da5cb5b146106c557806394d4ad601461065c578063aa2f6b44146105bb578063b0d691fe14610577578063b2eae5b11461052c57838163bb9fe6bf146104b9578163c23a5cea1461043257508063c399ec881461038157838163d0e30db0146102f357508063f2fde38b14610262578063f3105d58146101f85763f3fef3a31461010d57600080fd5b346101f457806003193601126101f457610125610bd5565b8354825163a9059cbb60e01b602082019081526001600160a01b039283166024808401919091523560448084019190915282529290911692916101a59186918291610171606482610c90565b519082875af13d156101ec573d9061018882610cb1565b9161019585519384610c90565b82523d87602084013e5b8461174d565b80519081151591826101d1575b50506101bc578380f35b51635274afe760e01b81529182015260249150fd5b6101e492506020809183010191016113ce565b1538806101b2565b60609061019f565b8280fd5b50823461025f57602036600319011261025f578235906001600160401b03821161025f575061023961023361024d9461025b93369101610beb565b90611259565b919590928551968688978852870191610c2b565b918483036020860152610c2b565b0390f35b80fd5b5090346101f45760203660031901126101f45761027d610bd5565b90610286611333565b6001600160a01b039182169283156102dd575050600054826bffffffffffffffffffffffff60a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8084848260031936011261037d577f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b031691823b15610378578390602483518095819363b760faf960e01b8352309083015234905af190811561036f575061035f5750f35b61036890610c4c565b61025f5780f35b513d84823e3d90fd5b505050fd5b5050fd5b50346101f457826003193601126101f45780516370a0823160e01b815230928101929092526020826024817f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b03165afa9182156104285783926103f0575b6020838351908152f35b9091506020813d602011610420575b8161040c60209383610c90565b810103126101f457602092505190386103e6565b3d91506103ff565b81513d85823e3d90fd5b8084843461037d57602036600319011261037d5761044e610bd5565b610456611333565b6001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0328116803b156104b5578592836024928651978895869463611d2e7560e11b865216908401525af190811561036f575061035f5750f35b8580fd5b8084843461037d578260031936011261037d576104d4611333565b7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b031691823b1561037857815163bb9fe6bf60e01b81529284918491829084905af190811561036f575061035f5750f35b5090346101f4576003199260203685011261025f578135936001600160401b0385116105735760a090853603011261025f575060209261056c910161114b565b9051908152f35b5080fd5b838234610573578160031936011261057357517f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b03168152602090f35b50823461025f57602092836003193601126105735780356001600160401b0381116101f4576105f86105f285938793369101610beb565b90610f75565b9183519360ff818601931685528082860152835180935260608260608701950196915b8483106106285786860387f35b875180516001600160a01b03908116885281860151168786015281015186820152968301969481019460019092019161061b565b50913461025f57602036600319011261025f578135906001600160401b03821161025f575061069c61069660609361025b93369101610beb565b90610e6d565b9194909295805196879665ffffffffffff80921688521660208701528501526060840191610c2b565b838234610573578160031936011261057357905490516001600160a01b039091168152602090f35b50346101f45760803660031901126101f4576003823510156101f4576024906024356001600160401b0381116107e95761072d61073b9136908601610beb565b9061073661135f565b610f75565b9490815b60ff8082169083168110156107e5576107589088610f4b565b518051602091820151865163095ea7b360e01b81526001600160a01b03918216818b0152888101879052918391839160449183918a91165af180156107db579160ff93916001936107ad575b5050011661073f565b816107cc92903d106107d4575b6107c48183610c90565b8101906113ce565b5038806107a4565b503d6107ba565b86513d87823e3d90fd5b8380f35b8480fd5b833461025f578060031936011261025f57610806611333565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5090346101f4576003199260603685011261025f578135936001600160401b0385116105735761012090853603011261025f575065ffffffffffff60243581811681036108a75760443591821682036108a75760209461056c9301610d4d565b600080fd5b50823461025f57606092600319906060823601126101f4578035916001600160401b038311610947576101209083360301126101f4576108f7849286926108f161135f565b016113e6565b8391935194859383855285518094860152815b848110610930575050606080955083850101526020830152601f80199101168101030190f35b60208782018101518983018401528896500161090a565b8380fd5b838234610573578160031936011261057357517f00000000000000000000000080f3b8c46381d5cf4b737742d5fe323b7caa43b16001600160a01b03168152602090f35b50346101f45760031960603682011261094757602435906001600160401b03908183116104b55760a09083360301126107e9576044359081116107e9576109f6610a25610a3493603c6020986109eb610a2b9636908b01610beb565b959093829a0161114b565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008252601c5220923691610ccc565b906115fc565b90929192611638565b7f000000000000000000000000999f8012b114600d2b2995e14ed975322c30391e6001600160a01b03908116911614610a70575b519015158152f35b60019150610a68565b838234610573578160031936011261057357517f000000000000000000000000999f8012b114600d2b2995e14ed975322c30391e6001600160a01b03168152602090f35b8084843461037d578060031936011261037d57610ad8610bd5565b610ae0611333565b6001600160a01b037f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0328116803b156104b5578592836044928651978895869463040b850f60e31b8652169084015260243560248401525af190811561036f575061035f5750f35b5060203660031901126101f45782823563ffffffff811680910361057357610b6d611333565b7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b031693843b156101f45760249084519586938492621cb65b60e51b845283015234905af190811561036f5750610bc9575080f35b610bd290610c4c565b80f35b600435906001600160a01b03821682036108a757565b9181601f840112156108a7578235916001600160401b0383116108a757602083818601950101116108a757565b359065ffffffffffff821682036108a757565b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160401b038111610c5f57604052565b634e487b7160e01b600052604160045260246000fd5b606081019081106001600160401b03821117610c5f57604052565b90601f801991011681019081106001600160401b03821117610c5f57604052565b6001600160401b038111610c5f57601f01601f191660200190565b929192610cd882610cb1565b91610ce66040519384610c90565b8294818452818301116108a7578281602093846000960137010152565b903590601e19813603018212156108a757018035906001600160401b0382116108a7576020019181360383136108a757565b909392938483116108a75784116108a7578101920390565b9160e0830191610d6c610d636106968587610d03565b92509050611259565b5050939094610dc3610db5610d8e610d876040850185610d03565b3691610ccc565b6020815191012097610da6610d876060860186610d03565b60208151910120973691610ccc565b602081519101209282610d03565b6034939193116108a75760c09260149160405197602089019960018060a01b038635168b52602086013560408b015260608a01526080890152608084013560a089015284880152013560e086015260a08101356101008601520135610120840152466101408401523061016084015265ffffffffffff8091166101808401526101a091168183015281526101c081018181106001600160401b03821117610c5f5760405251902090565b9190806034116108a7576040603319848381010301126108a757610e9360348401610c18565b91610ea060548501610c18565b9293826074116108a757607401916073190190565b60ff60489116029060ff8216918203610eca57565b634e487b7160e01b600052601160045260246000fd5b60ff166001019060ff8211610eca57565b60ff60019116019060ff8211610eca57565b6001600160401b038111610c5f5760051b60200190565b6bffffffffffffffffffffffff199035818116939260148110610f3c57505050565b60140360031b82901b16169150565b8051821015610f5f5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b918115610f5f57823560f81c9260ff610f95610f9086610eb5565b610ee0565b1683036110dc57610fa584610f03565b6040610fb46040519283610c90565b858252601f19610fc387610f03565b0160005b8181106110b2575050819460005b878110610fe3575050505050565b604890818102918183041481151715610eca5760019180830190818411610eca576015810190818311610eca5761102561101f8385898d610d35565b90610f1a565b916060936029830191828211610eca5761104761101f846049938f8d90610d35565b861c9301809111610eca5761105d91888c610d35565b90359260209182811061109e575b5088519461107886610c75565b1c84528301528582015261108c8287610f4b565b526110978186610f4b565b5001610fd5565b60001990830360031b1b909316923861106b565b60209083516110c081610c75565b6000815282600081830152600086830152828701015201610fc7565b60405162461bcd60e51b815260206004820152602d60248201527f4341425061796d61737465723a20696e76616c69642073706f6e736f72546f6b60448201526c0cadc88c2e8c240d8cadccee8d609b1b6064820152608490fd5b356001600160a01b03811681036108a75790565b61115481611137565b6020916040611164818301611137565b9260606080840135601e19853603018112156108a75784019384356001600160401b03958682116108a7578801838202360381136108a75790855190818a810193828983018d875252868201909260005b81811061121b5750506111d1925003601f198101835282610c90565b519020928451968888019860018060a01b038093168a528301358689015216828701520135608085015260a084015260a0835260c083019183831090831117610c5f575251902090565b9092509083356001600160a01b03811691908290036108a757908152838d01358d820152898401358a820152928701928492908801916001016111b5565b918115610f5f5760ff833560f81c60418261127383610eb5565b1601828111610eca576112868391610ef1565b1684036112df578161129a610f9083610eb5565b16948486116108a7578095946042846112c36112bd6112b887610eb5565b610ef1565b95610eb5565b160193808511610eca57806112db9516931691610d35565b9091565b60405162461bcd60e51b815260206004820152602660248201527f4341425061796d61737465723a20696e76616c6964207061796d6173746572416044820152656e644461746160d01b6064820152608490fd5b6000546001600160a01b0316330361134757565b60405163118cdaa760e01b8152336004820152602490fd5b7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0326001600160a01b0316330361139157565b60405162461bcd60e51b815260206004820152601560248201527414d95b99195c881b9bdd08115b9d1c9e541bda5b9d605a1b6044820152606490fd5b908160209103126108a7575180151581036108a75790565b9060ff61140e9261141a61140061069660e0840184610d03565b978298849794969392611259565b97929691973691610ccc565b926114258787610f75565b95169460005b86811061155f575050610a2b92611477949261144692610d4d565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c6000206115fc565b6001600160a01b039081167f000000000000000000000000999f8012b114600d2b2995e14ed975322c30391e9091160361150157604881029080820460481490151715610eca576001019182600111610eca5782116108a7576114db913691610ccc565b9260a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b0319161790565b60488194939294029080820460481490151715610eca576001019081600111610eca5781116108a757600192611538913691610ccc565b9360a09190911b65ffffffffffff60a01b1660d09190911b6001600160d01b031916171790565b919350915061156e8183610f4b565b518051602080830151604093840151845163095ea7b360e01b81526001600160a01b039283166004820152602481019190915291939192849184916044918391600091165af19081156115f257509060019392916115d4575b5050019187918a9361142b565b816115ea92903d106107d4576107c48183610c90565b5038806115c7565b513d6000823e3d90fd5b815191906041830361162d5761162692506020820151906060604084015193015160001a906116bd565b9192909190565b505060009160029190565b60048110156116a7578061164a575050565b600181036116645760405163f645eedf60e01b8152600490fd5b600281036116855760405163fce698f760e01b815260048101839052602490fd5b60031461168f5750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161174157926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156117355780516001600160a01b0381161561172c57918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b90611774575080511561176257805190602001fd5b604051630a12f52160e11b8152600490fd5b815115806117a7575b611785575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561177d56fea2646970667358221220fd11e78c7fd8a8406d095291be4e8a0daacf8d62b29cbc755b5d327e5c7b6d7d64736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da03200000000000000000000000080f3b8c46381d5cf4b737742d5fe323b7caa43b1000000000000000000000000999f8012b114600d2b2995e14ed975322c30391e
-----Decoded View---------------
Arg [0] : _entryPoint (address): 0x0000000071727De22E5E9d8BAf0edAc6f37da032
Arg [1] : _invoiceManager (address): 0x80F3b8c46381d5cF4B737742D5FE323b7CaA43b1
Arg [2] : _verifyingSigner (address): 0x999f8012B114600D2B2995e14ED975322c30391E
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032
Arg [1] : 00000000000000000000000080f3b8c46381d5cf4b737742d5fe323b7caa43b1
Arg [2] : 000000000000000000000000999f8012b114600d2b2995e14ed975322c30391e
Deployed Bytecode Sourcemap
866:6740:24:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4975:35:0;;866:6740:24;4975:35:0;;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;-1:-1:-1;;;866:6740:24;1412:43:12;;;;;-1:-1:-1;;;;;866:6740:24;;;;1412:43:12;;;866:6740:24;;;;;;;;;;;;;1412:43:12;;866:6740:24;;;;;;3510:55:13;;866:6740:24;;;;1412:43:12;866:6740:24;;1412:43:12;:::i;:::-;3462:31:13;;;;;;866:6740:24;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;3510:55:13;;:::i;:::-;866:6740:24;;4551:22:12;;;;:57;;;;866:6740:24;4547:135:12;;;;866:6740:24;;;4547:135:12;866:6740:24;-1:-1:-1;;;4631:40:12;;;;;866:6740:24;;;-1:-1:-1;4631:40:12;4551:57;4578:30;;;866:6740:24;4578:30:12;;;;;;;;:::i;:::-;4577:31;4551:57;;;;866:6740:24;;;;;;;;;;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;:::i;:::-;1500:62:9;;;:::i;:::-;-1:-1:-1;;;;;866:6740:24;;;;2627:22:9;;2623:91;;866:6740:24;;;;;;;;;;;;;;3052:40:9;866:6740:24;3052:40:9;;866:6740:24;;2623:91:9;866:6740:24;-1:-1:-1;;;2672:31:9;;;;;866:6740:24;;;;;2672:31:9;866:6740:24;;;;;;;;;;;;4062:10:0;-1:-1:-1;;;;;866:6740:24;;4062:53:0;;;;;866:6740:24;;;;;;;;;;;;4062:53:0;;4109:4;4062:53;;;866:6740:24;4090:9:0;4062:53;;;;;;;;;;;866:6740:24;;4062:53:0;;;;:::i;:::-;866:6740:24;;4062:53:0;866:6740:24;4062:53:0;866:6740:24;;;;;;;;4062:53:0;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;4975:35:0;;5004:4;4975:35;;;866:6740:24;;;;4975:35:0;866:6740:24;;;4975:10:0;-1:-1:-1;;;;;866:6740:24;4975:35:0;;;;;;;;;;;866:6740:24;4975:35:0;866:6740:24;;;;;;;4975:35:0;;;;;;;;;;;;;;;;;;:::i;:::-;;;866:6740:24;;;;4975:35:0;866:6740:24;;;4975:35:0;;;;;;;-1:-1:-1;4975:35:0;;;866:6740:24;;;;;;;;;;;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;:::i;:::-;1500:62:9;;:::i;:::-;-1:-1:-1;;;;;5565:10:0;866:6740:24;;5565:41:0;;;;;866:6740:24;;;;;;;;;;;;;;;5565:41:0;;866:6740:24;5565:41:0;;;866:6740:24;5565:41:0;;;;;;;;;;866:6740:24;;5565:41:0;866:6740:24;;;;;;;;;;;;;;;;;;1500:62:9;;:::i;:::-;5228:10:0;-1:-1:-1;;;;;866:6740:24;;5228:24:0;;;;;866:6740:24;;-1:-1:-1;;;5228:24:0;;866:6740:24;;;;;;;;;5228:24:0;;;;;;;;;;866:6740:24;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;544:39:0;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;:::i;:::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;5375:30;866:6740;;;;;;:::i;:::-;2257:278:0;;;:::i;:::-;5375:30:24;:::i;:::-;5420:11;;;5457:3;866:6740;;;;;;;5433:22;;;;;5511:16;;;;:::i;:::-;;866:6740;;;5576:20;;;866:6740;;;-1:-1:-1;;;5541:59:24;;-1:-1:-1;;;;;866:6740:24;;;5541:59;;;866:6740;;;;;;;;;;;;;;;;;;;5541:59;;;;;;;866:6740;5541:59;;866:6740;5541:59;;;5457:3;;;866:6740;;5420:11;;5541:59;;;;;;-1:-1:-1;5541:59:24;;;;;;;:::i;:::-;;;;;:::i;:::-;;;;;;;;;;;;866:6740;;;;;;;;;5433:22;;866:6740;;;;;;;;;;;;;;;;;;;1500:62:9;;:::i;:::-;866:6740:24;;;-1:-1:-1;;;;;;866:6740:24;;;;-1:-1:-1;;;;;866:6740:24;3052:40:9;866:6740:24;;3052:40:9;866:6740:24;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;-1:-1:-1;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;3558:1569;1646:22:0;;;;;;:::i;:::-;866:6740:24;3558:1569;:::i;:::-;866:6740;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;866:6740:24;;;;;;;;;;;;;;;;;;;;;;1016:47;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;-1:-1:-1;;866:6740:24;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;1831:23;866:6740;3915:8:16;866:6740:24;1367:309:17;866:6740:24;;;3859:27:16;866:6740:24;;;;;;:::i;:::-;1564:393;;;1752:8;866:6740;;1831:23;:::i;:::-;1367:309:17;;;;;;866:6740:24;;;;:::i;:::-;3859:27:16;;:::i;:::-;3915:8;;;;;:::i;:::-;1869:15:24;-1:-1:-1;;;;;866:6740:24;;;;;1869:45;1865:86;;866:6740;;;;;;;;1865:86;866:6740;;-1:-1:-1;1865:86:24;;866:6740;;;;;;;;;;;;;;;1070:40;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1500:62:9;;:::i;:::-;-1:-1:-1;;;;;4405:10:0;866:6740:24;;4405:46:0;;;;;866:6740:24;;;;;;;;;;;;;;;4405:46:0;;866:6740:24;4405:46:0;;;866:6740:24;;;;;;;4405:46:0;;;;;;;;;;866:6740:24;;;-1:-1:-1;866:6740:24;;-1:-1:-1;;866:6740:24;;;;;;;;;;;;;;;1500:62:9;;:::i;:::-;4762:10:0;-1:-1:-1;;;;;866:6740:24;;4762:54:0;;;;;866:6740:24;;;;;;;;;;;;4762:54:0;;;;866:6740:24;4789:9:0;4762:54;;;;;;;;;;;866:6740:24;;;4762:54:0;;;;:::i;:::-;866:6740:24;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;866:6740:24;;;;;;;;-1:-1:-1;;866:6740:24;;;;:::o;:::-;-1:-1:-1;;;;;866:6740:24;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;:::o;:::-;-1:-1:-1;;;;;866:6740:24;;;;;;-1:-1:-1;;866:6740:24;;;;:::o;:::-;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;-1:-1:-1;866:6740:24;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;:::o;860:38:0:-;;;;;;;;;;;;;;;;;;;:::o;2497:1055:24:-;;2844:23;;;;2908:34;2822:46;2844:23;;;;:::i;2822:46::-;2908:34;;;;;:::i;:::-;3075:15;;;;;3248:23;866:6740;;3075:15;;;;;;:::i;:::-;866:6740;;;:::i;:::-;3035:12;866:6740;;;;3065:26;3119:15;866:6740;3119:15;;;;;;:::i;866:6740::-;3035:12;866:6740;;;;3109:26;866:6740;;;;:::i;:::-;3035:12;866:6740;;;;3194:20;3248:23;;;:::i;:::-;490:2:2;860:38:0;;;;;;3389:14:24;866:6740;372:2:2;866:6740:24;3075:15;866:6740;2983:552;3035:12;2983:552;;866:6740;;;;;;823:61:2;;866:6740:24;;;3035:12;;;866:6740;3075:15;860:38:0;;866:6740:24;3119:15;860:38:0;;866:6740:24;3153:23;860:38:0;;866:6740:24;3153:23;;;866:6740;3346:25;860:38:0;;866:6740:24;860:38:0;;;866:6740:24;860:38:0;;2844:23:24;860:38:0;;866:6740:24;3346:25;;;866:6740;860:38:0;;;866:6740:24;3389:14;866:6740;860:38:0;;;866:6740:24;3421:13;860:38:0;;;866:6740:24;3460:4;860:38:0;;;866:6740:24;;;;;860:38:0;;;866:6740:24;860:38:0;866:6740:24;;860:38:0;;;866:6740:24;2983:552;;860:38:0;866:6740:24;;;;;-1:-1:-1;;;;;866:6740:24;;;;;3075:15;866:6740;;2960:585;;2497:1055;:::o;5623:349::-;;;860:38:0;490:2:2;860:38:0;;;1167:21:24;860:38:0;;5837:71:24;;;;1167:21;;;;;866:6740;490:2:2;860:38:0;;866:6740:24;:::i;:::-;1167:21;866:6740;1167:21;;;866:6740;:::i;:::-;5810:98;860:38:0;;1167:21:24;860:38:0;;;1167:21:24;860:38:0;;-1:-1:-1;;860:38:0;;5623:349:24:o;866:6740::-;;;;;;;;;;;;;;;:::o;:::-;;;;1167:21;;;;;;;;866:6740;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;:::o;:::-;-1:-1:-1;;;;;866:6740:24;;;;;;;;;:::o;:::-;-1:-1:-1;;866:6740:24;;;;;;;;;;;;;;;:::o;:::-;;;;;860:38:0;;;866:6740:24;;;-1:-1:-1;866:6740:24:o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;6504:1100;;866:6740;;;;6724:19;;866:6740;;6938:25;866:6740;6934:29;6938:25;;;:::i;:::-;6934:29;:::i;:::-;866:6740;6907:56;;866:6740;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;-1:-1:-1;;866:6740:24;;;:::i;:::-;;6741:1;866:6740;;;;;;7033:54;;;7102:13;6741:1;7117:31;;;;;;6504:1100;;;;;:::o;7102:13::-;6960:2;866:6740;;;;;;;;;;;;;;;6934:1;1167:21;;;;;;;;;;;;;;;;;;;7230:45;7238:36;;;;;;:::i;:::-;7230:45;;:::i;:::-;866:6740;;1167:21;;;;;;;;;;7316:50;7324:41;;1167:21;7324:41;;;;;:::i;7316:50::-;866:6740;;1167:21;;;;;;;7414:41;;;;;:::i;:::-;7406:50;860:38:0;866:6740:24;;860:38:0;;;;;;7102:13:24;866:6740;;;;;;;:::i;:::-;;;;7491:36;;866:6740;7491:36;;;866:6740;7472:55;;;;:::i;:::-;;;;;;:::i;:::-;;866:6740;7102:13;;860:38:0;-1:-1:-1;;860:38:0;;;;;;;;;;;;;866:6740:24;;;;;;;;:::i;:::-;6741:1;866:6740;;;6741:1;866:6740;;;;6741:1;866:6740;;;;;;;;;;;;;;;-1:-1:-1;;;866:6740:24;;;;;;;;;;;;;;;;;-1:-1:-1;;;866:6740:24;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;:::o;2096:395::-;2275:15;;;:::i;:::-;2308:13;2339:17;;;;;;;:::i;:::-;2374:22;;2435:23;;;866:6740;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;;;;;;2424:35;;;;;866:6740;;;;;;;;;;;;;;-1:-1:-1;866:6740:24;;;;;;2424:35;;;;;;866:6740;;2424:35;;;;;;:::i;:::-;866:6740;2414:46;;866:6740;;;2247:227;;;;866:6740;;;;;;;;;;;2308:13;;866:6740;;;;;;;;;;2374:22;866:6740;2435:23;866:6740;;;;;;;;2247:227;;866:6740;;;;;;;;;;;;;;;2224:260;;2096:395;:::o;866:6740::-;;;-1:-1:-1;866:6740:24;;;-1:-1:-1;;;;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5978:520;;866:6740;;;;;6197:12;;866:6740;;;;6248:23;866:6740;6248:23;:::i;:::-;866:6740;;;;;;;6248:32;;;;:::i;:::-;866:6740;6228:52;;866:6740;;6369:23;6365:27;6369:23;;;:::i;6365:27::-;866:6740;860:38:0;;;;;;6334:59:24;;6434:23;866:6740;6434:23;6462;6434:27;:23;;;:::i;:::-;:27;:::i;:::-;6462:23;;:::i;:::-;866:6740;;;;;;;;;6424:67;866:6740;;;;6424:67;;:::i;:::-;6403:88;;5978:520::o;866:6740::-;;;-1:-1:-1;;;866:6740:24;;;;;;;;;;;;;;;;;-1:-1:-1;;;866:6740:24;;;;;;;1796:162:9;1710:6;866:6740:24;-1:-1:-1;;;;;866:6740:24;735:10:14;1855:23:9;1851:101;;1796:162::o;1851:101::-;866:6740:24;;-1:-1:-1;;;1901:40:9;;735:10:14;1901:40:9;;;866:6740:24;;;1901:40:9;5692:135:0;5783:10;-1:-1:-1;;;;;866:6740:24;5761:10:0;:33;866:6740:24;;5692:135:0:o;866:6740:24:-;;;-1:-1:-1;;;866:6740:24;;;;;;;;;;;;-1:-1:-1;;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3558:1569::-;;866:6740;4024:34;3558:1569;866:6740;3898:46;3920:23;;;;;;:::i;3898:46::-;4024:34;;;;;;;;;;:::i;:::-;866:6740;;;;;;;;:::i;:::-;4136:39;;;;;:::i;:::-;866:6740;;4243:13;4255:1;4258:22;;;;;;4680:39;;3859:27:16;4680:39:24;3915:8:16;4680:39:24;;;;;:::i;:::-;1367:309:17;4255:1:24;1367:309:17;;;;4255:1:24;1367:309:17;3859:27:16;:::i;3915:8::-;-1:-1:-1;;;;;866:6740:24;;;4810:15;866:6740;;;4810:58;4806:196;;5064:2;866:6740;;;;;;5064:2;866:6740;;;;;;;;1167:21;;;866:6740;1167:21;;;860:38:0;;;;866:6740:24;;;;;:::i;:::-;860:38:0;;;;;;-1:-1:-1;;;860:38:0;;;;;;-1:-1:-1;;;;;;860:38:0;2589:104:1;;3558:1569:24:o;4806:196::-;4936:2;866:6740;;;;;;;;;;4936:2;866:6740;;;;;;;;1167:21;;;866:6740;1167:21;;;860:38:0;;;;866:6740:24;;;;;;;:::i;:::-;860:38:0;;;;;;-1:-1:-1;;;860:38:0;;;;;;-1:-1:-1;;;;;;860:38:0;2589:104:1;;;4884:107:24:o;4282:3::-;4336:16;;-1:-1:-1;4336:16:24;-1:-1:-1;4336:16:24;;;;:::i;:::-;;866:6740;;4401:20;;;;866:6740;4423:19;;;;866:6740;;;-1:-1:-1;;;4366:77:24;;-1:-1:-1;;;;;866:6740:24;;;4366:77;;;866:6740;;;;;;;;4401:20;;866:6740;;4401:20;;866:6740;;;;;;-1:-1:-1;;866:6740:24;4366:77;;;;;;;;;866:6740;4366:77;;;;;4282:3;;;866:6740;4243:13;;;;;;;4366:77;;;;;;-1:-1:-1;4366:77:24;;;;;;:::i;:::-;;;;;;;866:6740;;4255:1;866:6740;;;;;2129:766:16;866:6740:24;;;2129:766:16;2276:2;2256:22;;2276:2;;2739:25;2539:180;;;;;;;;;;;;;;;-1:-1:-1;2539:180:16;2739:25;;:::i;:::-;2732:32;;;;;:::o;2252:637::-;2795:83;;2811:1;2795:83;2815:35;2795:83;;:::o;7196:532::-;866:6740:24;;;;;;7282:29:16;;;7327:7;;:::o;7278:444::-;866:6740:24;7378:38:16;;866:6740:24;;;;-1:-1:-1;;;7439:23:16;;866:6740:24;;7439:23:16;7374:348;7492:35;7483:44;;7492:35;;866:6740:24;;-1:-1:-1;;;7550:46:16;;866:6740:24;7550:46:16;;866:6740:24;;;;;7550:46:16;7479:243;7626:30;7617:39;7613:109;;7479:243;7196:532::o;7613:109::-;866:6740:24;;;;7679:32:16;;;;;;866:6740:24;7679:32:16;;866:6740:24;7679:32:16;866:6740:24;;;;7291:20:16;866:6740:24;;;;;7291:20:16;866:6740:24;5140:1530:16;;;6199:66;6186:79;;6182:164;;866:6740:24;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6457:24:16;;;;;;;;;;;;;;-1:-1:-1;;;;;866:6740:24;;6495:20:16;6491:113;;6614:49;;5140:1530;:::o;6491:113::-;6531:62;;;6457:24;6531:62;;:::o;6457:24::-;866:6740:24;;;;;;;;;;6182:164:16;6281:54;;;6297:1;6281:54;6301:30;6281:54;;:::o;4625:582:13:-;;4797:8;;-1:-1:-1;866:6740:24;;5874:21:13;:17;;6046:142;;;;;;5870:383;866:6740:24;;-1:-1:-1;;;6225:17:13;;;;;4793:408;866:6740:24;;5045:22:13;:49;;;4793:408;5041:119;;5173:17;;:::o;5041:119::-;866:6740:24;;-1:-1:-1;;;5121:24:13;;-1:-1:-1;;;;;866:6740:24;;;5121:24:13;;;866:6740:24;;;5121:24:13;5045:49;5071:18;;;:23;5045:49;
Swarm Source
ipfs://fd11e78c7fd8a8406d095291be4e8a0daacf8d62b29cbc755b5d327e5c7b6d7d
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.