Source Code
Overview
ETH Balance
0 ETH
Token Holdings
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
CandidePaymaster08
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.28; /// @author Candide Labs import {BytesLib} from "./utils/BytesLib.sol"; import "@account-abstraction-08/contracts/core/BasePaymaster.sol"; import "@account-abstraction-08/contracts/core/Helpers.sol"; import "@account-abstraction-08/contracts/core/Eip7702Support.sol"; import "@account-abstraction-08/contracts/interfaces/IEntryPoint.sol"; import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; contract CandidePaymaster08 is BasePaymaster { using ECDSA for bytes32; using UserOperationLib for PackedUserOperation; using SafeERC20 for IERC20Metadata; enum SponsoringMode { TOKEN_WITH_EXCHANGE, // exchange rate is embedded in the paymasterAndData and not using the cachedExchangeRate on-chain TOKEN, FREE } enum PriceMarkupMode { NO_MARKUP, INCLUDE, INCLUDE_CUSTOM } enum OracleType { CHAINLINK, UNISWAP } struct PaymasterData { SponsoringMode mode; PriceMarkupMode priceMarkupMode; GasToken gasToken; uint256 exchangeRate; uint256 priceMarkup; uint48 validUntil; bytes signature; } struct GasToken { IERC20Metadata token; OracleType oracleType; bytes oracle; uint256 cachedExchangeRate; uint256 priceMarkup; } // uint256 private constant PRICE_DENOMINATOR = 100000000000000000000000000; uint256 constant public COST_OF_POST = 35000; // mapping (uint8 => GasToken) internal gasTokens; // event PostOpReverted(bytes32 indexed userOpHash, address indexed sender, address indexed token); event UserOperationSponsored(bytes32 indexed userOpHash, address indexed sender, address indexed token, uint256 cost); constructor(IEntryPoint _entryPoint, address _owner) BasePaymaster(_entryPoint) { _transferOwnership(_owner); } /** * withdraw tokens. * @param token the token deposit to withdraw * @param target address to send to * @param amount amount to withdraw */ function withdrawTokensTo(IERC20Metadata token, address target, uint256 amount) public { require(owner() == msg.sender, "CP00: only owner can withdraw tokens"); token.safeTransfer(target, amount); } function addSupportedToken(uint8 slot, GasToken calldata token) public { require(owner() == msg.sender, "CP01: only owner can add supported tokens"); gasTokens[slot] = token; } function revokeSupportedToken(uint8 slot) public { require(owner() == msg.sender, "CP02: only owner can revoke supported tokens"); delete gasTokens[slot]; } function _getChainlinkDerivedExchangeRate( address _base, address _quote, uint8 _decimals ) internal view returns (int256) { require( _decimals > uint8(0) && _decimals <= uint8(18), "Invalid _decimals" ); int256 decimals = int256(10 ** uint256(_decimals)); (, int256 basePrice, , , ) = AggregatorV3Interface(_base).latestRoundData(); uint8 baseDecimals = AggregatorV3Interface(_base).decimals(); basePrice = _scalePrice(basePrice, baseDecimals, _decimals); (, int256 quotePrice, , , ) = AggregatorV3Interface(_quote).latestRoundData(); uint8 quoteDecimals = AggregatorV3Interface(_quote).decimals(); quotePrice = _scalePrice(quotePrice, quoteDecimals, _decimals); return (basePrice * decimals) / quotePrice; } function _scalePrice( int256 _price, uint8 _priceDecimals, uint8 _decimals ) internal pure returns (int256) { if (_priceDecimals < _decimals) { return _price * int256(10 ** uint256(_decimals - _priceDecimals)); } else if (_priceDecimals > _decimals) { return _price / int256(10 ** uint256(_priceDecimals - _decimals)); } return _price; } function getTokenExchangeRate(uint8 slot) public view returns (uint256) { GasToken memory gasToken = gasTokens[slot]; if (address(gasToken.token) == address(0)){ return 0; } uint256 exchangeRate; if (gasToken.oracleType == OracleType.CHAINLINK){ address baseTokenOracle = address(bytes20(BytesLib.slice(gasToken.oracle, 0, 20))); address quoteTokenOracle = address(bytes20(BytesLib.slice(gasToken.oracle, 20, 40))); uint8 decimals = gasToken.token.decimals(); exchangeRate = uint256(_getChainlinkDerivedExchangeRate(baseTokenOracle, quoteTokenOracle, decimals)); }else{ address pool = address(bytes20(BytesLib.slice(gasToken.oracle, 0, 20))); // todo } return exchangeRate; } function getTokens(uint8[] calldata slots) public view returns (GasToken[] memory) { GasToken[] memory result = new GasToken[](slots.length); for (uint i=0; i<slots.length; i++){ uint8 slot = slots[i]; result[i] = gasTokens[slot]; } return result; } function updateTokensExchangeRates(uint8[] calldata slots) public { for (uint i=0; i<slots.length; i++){ uint8 slot = slots[i]; uint256 exchangeRate = getTokenExchangeRate(slot); if (exchangeRate > 0) { GasToken storage gasToken = gasTokens[slot]; gasToken.cachedExchangeRate = exchangeRate; } } } function pack(PackedUserOperation calldata userOp) internal view returns (bytes32) { bytes32 overrideInitCodeHash = Eip7702Support._getEip7702InitCodeHashOverride(userOp); bytes32 hashInitCode = overrideInitCodeHash != 0 ? overrideInitCodeHash : keccak256(userOp.initCode); return keccak256(abi.encode( userOp.sender, userOp.nonce, hashInitCode, keccak256(userOp.callData), userOp.accountGasLimits, userOp.preVerificationGas, userOp.gasFees )); } /** * return the hash we're going to sign off-chain (and validate on-chain) * this method is called by the off-chain service, to sign the request. * it is called on-chain from the validatePaymasterUserOp, to validate the signature. */ function getHash(PackedUserOperation calldata userOp, PaymasterData memory paymasterData) public view returns (bytes32) { (, uint256 pmValidationGasLimit, uint256 pmPostOpGasLimit) = UserOperationLib.unpackPaymasterStaticFields(userOp.paymasterAndData); bytes32 hash = keccak256(abi.encode( pack(userOp), block.chainid, address(this), paymasterData.mode, paymasterData.priceMarkupMode, paymasterData.validUntil, pmValidationGasLimit, pmPostOpGasLimit )); if (paymasterData.mode != SponsoringMode.FREE){ hash = keccak256(abi.encode(hash, address(paymasterData.gasToken.token))); } if (paymasterData.mode == SponsoringMode.TOKEN_WITH_EXCHANGE){ hash = keccak256(abi.encode(hash, paymasterData.exchangeRate)); } if (paymasterData.priceMarkupMode == PriceMarkupMode.INCLUDE_CUSTOM){ hash = keccak256(abi.encode(hash, paymasterData.priceMarkup)); } return hash; } function _getPriceMarkupAndSignature(PriceMarkupMode priceMarkupMode, GasToken memory gasToken, uint256 startLocation, bytes calldata paymasterAndData) internal pure returns (uint256, bytes memory){ uint256 priceMarkup = PRICE_DENOMINATOR; bytes memory signature; if (priceMarkupMode == PriceMarkupMode.INCLUDE){ priceMarkup = gasToken.priceMarkup; signature = bytes(paymasterAndData[startLocation:]); }else if (priceMarkupMode == PriceMarkupMode.INCLUDE_CUSTOM){ priceMarkup = uint256(bytes32(paymasterAndData[startLocation:startLocation+32])); signature = bytes(paymasterAndData[startLocation+32:]); }else if (priceMarkupMode == PriceMarkupMode.NO_MARKUP){ signature = bytes(paymasterAndData[startLocation:]); } return (priceMarkup, signature); } function parsePaymasterAndData(bytes calldata paymasterAndData) public view returns (PaymasterData memory) { SponsoringMode mode = SponsoringMode(uint8(bytes1(paymasterAndData[0:1]))); PriceMarkupMode priceMarkupMode = PriceMarkupMode(uint8(bytes1(paymasterAndData[1:2]))); GasToken memory token = gasTokens[0]; uint256 exchangeRate = 0; uint256 priceMarkup = PRICE_DENOMINATOR; uint48 validUntil; bytes memory signature; if (mode == SponsoringMode.TOKEN_WITH_EXCHANGE){ uint8 gasTokenSlot = uint8(bytes1(paymasterAndData[2:3])); validUntil = uint48(bytes6(paymasterAndData[3:9])); exchangeRate = uint256(bytes32(paymasterAndData[9:41])); token = gasTokens[gasTokenSlot]; (priceMarkup, signature) = _getPriceMarkupAndSignature(priceMarkupMode, token, 41, paymasterAndData); }else if (mode == SponsoringMode.TOKEN){ uint8 gasTokenSlot = uint8(bytes1(paymasterAndData[2:3])); validUntil = uint48(bytes6(paymasterAndData[3:9])); token = gasTokens[gasTokenSlot]; exchangeRate = token.cachedExchangeRate; (priceMarkup, signature) = _getPriceMarkupAndSignature(priceMarkupMode, token, 9, paymasterAndData); } else if (mode == SponsoringMode.FREE){ validUntil = uint48(bytes6(paymasterAndData[2:8])); signature = bytes(paymasterAndData[8:]); } return PaymasterData(mode, priceMarkupMode, token, exchangeRate, priceMarkup, validUntil, signature); } /** * Verify our external signer signed this request and decode paymasterData * paymasterData contains the following: * token address length 20 * signature length 64 or 65 or empty in case of SponsoringMode == GAS_BACK */ function _validatePaymasterUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost) internal virtual override returns (bytes memory context, uint256 validationData){ PaymasterData memory paymasterData = parsePaymasterAndData(userOp.paymasterAndData[UserOperationLib.PAYMASTER_DATA_OFFSET:]); require(paymasterData.signature.length == 64 || paymasterData.signature.length == 65, "CP01: invalid signature length in paymasterAndData"); address account = userOp.sender; uint256 maxFeePerGas = userOp.unpackMaxFeePerGas(); uint256 maxPriorityFeePerGas = userOp.unpackMaxPriorityFeePerGas(); uint256 userOpGasPrice = min(maxFeePerGas, maxPriorityFeePerGas + block.basefee); uint256 maxUseropCost = maxCost + (COST_OF_POST * userOpGasPrice); uint256 tokenExchangeRate = paymasterData.exchangeRate; if (paymasterData.mode != SponsoringMode.FREE){ if (paymasterData.priceMarkup > 0){ tokenExchangeRate = (paymasterData.exchangeRate * paymasterData.priceMarkup) / PRICE_DENOMINATOR ; } uint256 accountBalance = paymasterData.gasToken.token.balanceOf(account); uint256 maxTokenCost = (maxUseropCost * tokenExchangeRate) / 1e18; if (accountBalance < maxTokenCost){ return ("", _packValidationData(true, paymasterData.validUntil, 0)); } } bytes32 _hash = MessageHashUtils.toEthSignedMessageHash(getHash(userOp, paymasterData)); if (owner() != _hash.recover(paymasterData.signature)) { return ("", _packValidationData(true, paymasterData.validUntil, 0)); } bytes memory _context = abi.encode( account, userOpHash, paymasterData.mode, paymasterData.gasToken.token, tokenExchangeRate ); return (_context, _packValidationData(false, paymasterData.validUntil, 0)); } /** * Perform the post-operation to charge the sender for the gas. */ function _postOp(PostOpMode, bytes calldata context, uint256 actualGasCost, uint256 actualUserOpFeePerGas) internal virtual override { ( address account, bytes32 userOpHash, SponsoringMode sponsoringMode, IERC20Metadata token, uint256 exchangeRate ) = abi.decode(context, (address, bytes32, SponsoringMode, IERC20Metadata, uint256)); if (sponsoringMode == SponsoringMode.FREE){ emit UserOperationSponsored(userOpHash, account, address(0), 0); return; } // uint256 actualETHCost = actualGasCost + (COST_OF_POST * actualUserOpFeePerGas); uint256 actualTokenCost = (actualETHCost * exchangeRate) / 1e18; // bool success = _callAndReturn(token, abi.encodeCall(token.transferFrom, (account, address(this), actualTokenCost))); if (!success){ emit PostOpReverted(userOpHash, account, address(token)); return; } emit UserOperationSponsored(userOpHash, account, address(token), actualTokenCost); } /** * @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 _callAndReturn(IERC20Metadata token, bytes memory data) internal returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; /* solhint-disable reason-string */ import "@openzeppelin/contracts/access/Ownable2Step.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, Ownable2Step { 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) Ownable(msg.sender) { _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 cost of 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"); } }
pragma solidity ^0.8.28; // SPDX-License-Identifier: MIT // solhint-disable no-inline-assembly import "../interfaces/PackedUserOperation.sol"; import "../core/UserOperationLib.sol"; library Eip7702Support { // EIP-7702 code prefix before delegate address. bytes3 internal constant EIP7702_PREFIX = 0xef0100; // EIP-7702 initCode marker, to specify this account is EIP-7702. bytes2 internal constant INITCODE_EIP7702_MARKER = 0x7702; using UserOperationLib for PackedUserOperation; /** * Get the alternative 'InitCodeHash' value for the UserOp hash calculation when using EIP-7702. * * @param userOp - the UserOperation to for the 'InitCodeHash' calculation. * @return the 'InitCodeHash' value. */ function _getEip7702InitCodeHashOverride(PackedUserOperation calldata userOp) internal view returns (bytes32) { bytes calldata initCode = userOp.initCode; if (!_isEip7702InitCode(initCode)) { return 0; } address delegate = _getEip7702Delegate(userOp.sender); if (initCode.length <= 20) return keccak256(abi.encodePacked(delegate)); else return keccak256(abi.encodePacked(delegate, initCode[20 :])); } /** * Check if this 'initCode' is actually an EIP-7702 authorization. * This is indicated by 'initCode' that starts with INITCODE_EIP7702_MARKER. * * @param initCode - the 'initCode' to check. * @return true if the 'initCode' is EIP-7702 authorization, false otherwise. */ function _isEip7702InitCode(bytes calldata initCode) internal pure returns (bool) { if (initCode.length < 2) { return false; } bytes20 initCodeStart; // non-empty calldata bytes are always zero-padded to 32-bytes, so can be safely casted to "bytes20" assembly ("memory-safe") { initCodeStart := calldataload(initCode.offset) } // make sure first 20 bytes of initCode are "0x7702" (padded with zeros) return initCodeStart == bytes20(INITCODE_EIP7702_MARKER); } /** * Get the EIP-7702 delegate from contract code. * Must only be used if _isEip7702InitCode(initCode) is true. * * @param sender - the EIP-7702 'sender' account to get the delegated contract code address. * @return the address of the EIP-7702 authorized contract. */ function _getEip7702Delegate(address sender) internal view returns (address) { bytes32 senderCode; assembly ("memory-safe") { extcodecopy(sender, 0, 0, 23) senderCode := mload(0) } // To be a valid EIP-7702 delegate, the first 3 bytes are EIP7702_PREFIX // followed by the delegate address if (bytes3(senderCode) != EIP7702_PREFIX) { // instead of just "not an EIP-7702 delegate", if some info. require(sender.code.length > 0, "sender has no code"); revert("not an EIP-7702 delegate"); } return address(bytes20(senderCode << 24)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; /* 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 validUntil - Last timestamp this operation is valid at, or 0 for "indefinitely". */ struct ValidationData { address aggregator; uint48 validAfter; uint48 validUntil; } /** * Extract aggregator/sigFailed, validAfter, validUntil. * Also convert zero validUntil to type(uint48).max. * @param validationData - The packed validation data. * @return data - The unpacked in-memory 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. * @return the packed validation data. */ 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 operation is valid at, or 0 for "indefinitely". * @param validAfter - First timestamp this UserOperation is valid. * @return the packed validation data. */ function _packValidationData( bool sigFailed, uint48 validUntil, uint48 validAfter ) pure returns (uint256) { return (sigFailed ? SIG_VALIDATION_FAILED : SIG_VALIDATION_SUCCESS) | (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. * * @param data - the calldata bytes array to perform keccak on. * @return ret - the keccak hash of the 'data' array. */ 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. * @return - the minimum value. */ function min(uint256 a, uint256 b) pure returns (uint256) { return a < b ? a : b; } /** * standard solidity memory allocation finalization. * copied from solidity generated code * @param memPointer - The current memory pointer * @param allocationSize - Bytes allocated from memPointer. */ function finalizeAllocation(uint256 memPointer, uint256 allocationSize) pure { assembly ("memory-safe"){ finalize_allocation(memPointer, allocationSize) function finalize_allocation(memPtr, size) { let newFreePtr := add(memPtr, round_up_to_mul_of_32(size)) mstore(64, newFreePtr) } function round_up_to_mul_of_32(value) -> result { result := and(add(value, 31), not(31)) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; /* 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; /** * 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); return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee); } } bytes32 internal constant PACKED_USEROP_TYPEHASH = keccak256( "PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData)" ); /** * Pack the user operation data into bytes for hashing. * @param userOp - The user operation data. * @param overrideInitCodeHash - If set, encode this instead of the initCode field in the userOp. */ function encode( PackedUserOperation calldata userOp, bytes32 overrideInitCodeHash ) internal pure returns (bytes memory ret) { address sender = userOp.sender; uint256 nonce = userOp.nonce; bytes32 hashInitCode = overrideInitCodeHash != 0 ? overrideInitCodeHash : 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( UserOperationLib.PACKED_USEROP_TYPEHASH, sender, nonce, hashInitCode, hashCallData, accountGasLimits, preVerificationGas, gasFees, hashPaymasterAndData ); } function unpackUints( bytes32 packed ) internal pure returns (uint256 high128, uint256 low128) { return (unpackHigh128(packed), unpackLow128(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. * @param overrideInitCodeHash - If set, the initCode hash will be replaced with this value just for UserOp hashing. */ function hash( PackedUserOperation calldata userOp, bytes32 overrideInitCodeHash ) internal pure returns (bytes32) { return keccak256(encode(userOp, overrideInitCodeHash)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; import "./PackedUserOperation.sol"; /** * Aggregated Signatures validator. */ interface IAggregator { /** * Validate an aggregated signature. * Reverts if the aggregated signature does not match the given list of operations. * @param userOps - An array of UserOperations to validate the signature for. * @param signature - The aggregated signature. */ function validateSignatures( PackedUserOperation[] calldata userOps, bytes calldata signature ) external; /** * Validate the 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 to perform this aggregation. * @param userOps - An array of UserOperations to collect the signatures from. * @return aggregatedSignature - The aggregated signature. */ function aggregateSignatures( PackedUserOperation[] calldata userOps ) external view returns (bytes memory aggregatedSignature); }
/** ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation. ** Only one instance required on each chain. **/ // SPDX-License-Identifier: MIT pragma solidity ^0.8.28; /* 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"; import "./ISenderCreator.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 "callData" call. */ 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 "postOp". */ 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() and handleAggregatedOps(), 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 andhandleAggregatedOps, to identify the offending op. * Should be caught in off-chain handleOps/handleAggregatedOps 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 and handleAggregatedOps, 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), entrypoint address, chainId and (optionally) 7702 delegate address * @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; } /** * 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. * @notice this method cannot be used for EIP-7702 derived contracts. * * @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; /** * @notice Retrieves the immutable SenderCreator contract which is responsible for deployment of sender contracts. */ function senderCreator() external view returns (ISenderCreator); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; 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. * * @param key - the "nonce key" to increment the "nonce sequence" for. */ function incrementNonce(uint192 key) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; 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> aggregatorOrSigFail - 0 for valid signature, 1 to mark signature failure, * other values are invalid for paymaster. * <6-byte> validUntil - Last timestamp this operation is valid at, or 0 for "indefinitely" * <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 cost of 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; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; interface ISenderCreator { /** * @dev Creates a new sender contract. * @return sender Address of the newly created sender contract. */ function createSender(bytes calldata initCode) external returns (address sender); /** * Use initCallData to initialize an EIP-7702 account. * The caller is the EntryPoint contract and it is already verified to be an EIP-7702 account. * Note: Can be called multiple times as long as an appropriate initCode is supplied * * @param sender - the 'sender' EIP-7702 account to be initialized. * @param initCallData - the call data to be passed to the sender account call. */ function initEip7702Sender(address sender, bytes calldata initCallData) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; /** * 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: MIT pragma solidity ^0.8.28; /** * User Operation struct * @param sender - The sender account of this request. * @param nonce - Unique value the sender uses to verify it is not a replay. * @param initCode - If set, the account contract will be created by this constructor * @param callData - The method call to execute on this account. * @param accountGasLimits - Packed gas limits for validateUserOp and gas limit passed to the callData method call. * @param preVerificationGas - Gas not calculated by the handleOps method, but added to the gas paid. * Covers batch overhead. * @param gasFees - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters. * @param paymasterAndData - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data * The paymaster will pay for the transaction instead of the sender. * @param signature - Sender-verified signature over the entire request, the EntryPoint address and the chain ID. */ struct PackedUserOperation { address sender; uint256 nonce; bytes initCode; bytes callData; bytes32 accountGasLimits; uint256 preVerificationGas; bytes32 gasFees; bytes paymasterAndData; bytes signature; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
// 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) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {Ownable} from "./Ownable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is specified at deployment time in the constructor for `Ownable`. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// 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) (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/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.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/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: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equal_nonAligned(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let endMinusWord := add(_preBytes, length) let mc := add(_preBytes, 0x20) let cc := add(_postBytes, 0x20) for { // the next line is the loop condition: // while(uint256(mc < endWord) + cb == 2) } eq(add(lt(mc, endMinusWord), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } // Only if still successful // For <1 word tail bytes if gt(success, 0) { // Get the remainder of length/32 // length % 32 = AND(length, 32 - 1) let numTailBytes := and(length, 0x1f) let mcRem := mload(mc) let ccRem := mload(cc) for { let i := 0 // the next line is the loop condition: // while(uint256(i < numTailBytes) + cb == 2) } eq(add(lt(i, numTailBytes), cb), 2) { i := add(i, 1) } { if iszero(eq(byte(i, mcRem), byte(i, ccRem))) { // unsuccess: success := 0 cb := 0 } } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract ABI
API[{"inputs":[{"internalType":"contract IEntryPoint","name":"_entryPoint","type":"address"},{"internalType":"address","name":"_owner","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":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"userOpHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"PostOpReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"userOpHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"cost","type":"uint256"}],"name":"UserOperationSponsored","type":"event"},{"inputs":[],"name":"COST_OF_POST","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"unstakeDelaySec","type":"uint32"}],"name":"addStake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"slot","type":"uint8"},{"components":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"internalType":"enum CandidePaymaster08.OracleType","name":"oracleType","type":"uint8"},{"internalType":"bytes","name":"oracle","type":"bytes"},{"internalType":"uint256","name":"cachedExchangeRate","type":"uint256"},{"internalType":"uint256","name":"priceMarkup","type":"uint256"}],"internalType":"struct CandidePaymaster08.GasToken","name":"token","type":"tuple"}],"name":"addSupportedToken","outputs":[],"stateMutability":"nonpayable","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"},{"components":[{"internalType":"enum CandidePaymaster08.SponsoringMode","name":"mode","type":"uint8"},{"internalType":"enum CandidePaymaster08.PriceMarkupMode","name":"priceMarkupMode","type":"uint8"},{"components":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"internalType":"enum CandidePaymaster08.OracleType","name":"oracleType","type":"uint8"},{"internalType":"bytes","name":"oracle","type":"bytes"},{"internalType":"uint256","name":"cachedExchangeRate","type":"uint256"},{"internalType":"uint256","name":"priceMarkup","type":"uint256"}],"internalType":"struct CandidePaymaster08.GasToken","name":"gasToken","type":"tuple"},{"internalType":"uint256","name":"exchangeRate","type":"uint256"},{"internalType":"uint256","name":"priceMarkup","type":"uint256"},{"internalType":"uint48","name":"validUntil","type":"uint48"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct CandidePaymaster08.PaymasterData","name":"paymasterData","type":"tuple"}],"name":"getHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"slot","type":"uint8"}],"name":"getTokenExchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8[]","name":"slots","type":"uint8[]"}],"name":"getTokens","outputs":[{"components":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"internalType":"enum CandidePaymaster08.OracleType","name":"oracleType","type":"uint8"},{"internalType":"bytes","name":"oracle","type":"bytes"},{"internalType":"uint256","name":"cachedExchangeRate","type":"uint256"},{"internalType":"uint256","name":"priceMarkup","type":"uint256"}],"internalType":"struct CandidePaymaster08.GasToken[]","name":"","type":"tuple[]"}],"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":[{"components":[{"internalType":"enum CandidePaymaster08.SponsoringMode","name":"mode","type":"uint8"},{"internalType":"enum CandidePaymaster08.PriceMarkupMode","name":"priceMarkupMode","type":"uint8"},{"components":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"internalType":"enum CandidePaymaster08.OracleType","name":"oracleType","type":"uint8"},{"internalType":"bytes","name":"oracle","type":"bytes"},{"internalType":"uint256","name":"cachedExchangeRate","type":"uint256"},{"internalType":"uint256","name":"priceMarkup","type":"uint256"}],"internalType":"struct CandidePaymaster08.GasToken","name":"gasToken","type":"tuple"},{"internalType":"uint256","name":"exchangeRate","type":"uint256"},{"internalType":"uint256","name":"priceMarkup","type":"uint256"},{"internalType":"uint48","name":"validUntil","type":"uint48"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct CandidePaymaster08.PaymasterData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IPaymaster.PostOpMode","name":"mode","type":"uint8"},{"internalType":"bytes","name":"context","type":"bytes"},{"internalType":"uint256","name":"actualGasCost","type":"uint256"},{"internalType":"uint256","name":"actualUserOpFeePerGas","type":"uint256"}],"name":"postOp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"slot","type":"uint8"}],"name":"revokeSupportedToken","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":[{"internalType":"uint8[]","name":"slots","type":"uint8[]"}],"name":"updateTokensExchangeRates","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":"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"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawTokensTo","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0806040523461019b57604081613d44803803809161001f82856101a0565b83398101031261019b578051906001600160a01b0382169081830361019b5760200151906001600160a01b038216820361019b573315610185576020602491610067336101d9565b6040516301ffc9a760e01b8152631313998b60e31b600482015292839182905afa90811561017957600091610137575b50156100f2576100a9916080526101d9565b604051613b15908161022f82396080518181816101e4015281816102ec01528181610dc9015281816111470152818161120d01528181611308015281816115de0152612bf30152f35b60405162461bcd60e51b815260206004820152601e60248201527f49456e747279506f696e7420696e74657266616365206d69736d6174636800006044820152606490fd5b6020813d602011610171575b81610150602093836101a0565b8101031261016d575190811515820361016a575038610097565b80fd5b5080fd5b3d9150610143565b6040513d6000823e3d90fd5b631e4fbdf760e01b600052600060045260246000fd5b600080fd5b601f909101601f19168101906001600160401b038211908210176101c357604052565b634e487b7160e01b600052604160045260246000fd5b600180546001600160a01b0319908116909155600080546001600160a01b03938416928116831782559192909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6080604052600436101561001257600080fd5b60003560e01c80630396cb6014610187578063205c2878146101825780632c7f92cc1461017d57806352b7512c146101785780635ab244d914610173578063715018a61461016e578063796d43711461016957806379ba5097146101645780637c627b211461015f5780637fa5c1901461015a5780638da5cb5b1461015557806394d4ad60146101505780639a6e85f01461014b578063b0d691fe14610146578063b9221a4014610141578063bb9fe6bf1461013c578063c23a5cea14610137578063c399ec8814610132578063cc9c837c1461012d578063d0e30db014610128578063e30c397814610123578063ed9f0ef11461011e5763f2fde38b1461011957600080fd5b611703565b61169e565b61164c565b61159c565b61137c565b611290565b6111b0565b6110f7565b610fb0565b610d7e565b610c46565b610b4b565b610aef565b6109f9565b610985565b610832565b6107f7565b610733565b610650565b61043e565b610383565b61028b565b600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043563ffffffff8116809103610263576101cc61265b565b8173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691823b15610263576024604051809481937f0396cb60000000000000000000000000000000000000000000000000000000008352600483015234905af1801561025e5782906102505780f35b61025991610e3d565b388180f35b6117c6565b505b80fd5b73ffffffffffffffffffffffffffffffffffffffff81160361028657565b600080fd5b3461028657600060407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576004356102c881610268565b81602435916102d561265b565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b156103745773ffffffffffffffffffffffffffffffffffffffff918360449260405196879586947f205c287800000000000000000000000000000000000000000000000000000000865216600485015260248401525af1801561025e5782906102505780f35b8280fd5b60ff81160361028657565b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760206103c86004356103c381610378565b6119bc565b604051908152f35b90816101209103126102865790565b919082519283825260005b8481106104295750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b806020809284010151828286010152016103ea565b346102865760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760043567ffffffffffffffff8111610286576104a76104936104bb9236906004016103d0565b602435604435916104a2612bdc565b612d67565b6040519283926040845260408401906103df565b9060208301520390f35b9060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8301126102865760043567ffffffffffffffff811161028657826023820112156102865780600401359267ffffffffffffffff84116102865760248460051b83010111610286576024019190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002111561057057565b610537565b9073ffffffffffffffffffffffffffffffffffffffff8251168152602082015160028110156105705760208201526080806105bf604085015160a0604086015260a08501906103df565b9360608101516060850152015191015290565b602081016020825282518091526040820191602060408360051b8301019401926000915b83831061060557505050505090565b9091929394602080610641837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528951610575565b970193019301919392906105f6565b346102865761065e366104c5565b9061066882611b2d565b916106766040519384610e3d565b8083527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06106a382611b2d565b0160005b81811061071c57505060005b8181106106cc57604051806106c886826105d2565b0390f35b806107006106fb6106e86106e36001958789611ba0565b611bb5565b60ff166000526002602052604060002090565b611825565b61070a8287611bbf565b526107158186611bbf565b50016106b3565b602090610727611b45565b828288010152016106a7565b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865761076a61265b565b7fffffffffffffffffffffffff000000000000000000000000000000000000000060015416600155600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760206040516188b88152f35b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286573373ffffffffffffffffffffffffffffffffffffffff6001541603610912577fffffffffffffffffffffffff000000000000000000000000000000000000000060015416600155600054337fffffffffffffffffffffffff000000000000000000000000000000000000000082161760005573ffffffffffffffffffffffffffffffffffffffff3391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b7f118cdaa7000000000000000000000000000000000000000000000000000000006000523360045260246000fd5b6003111561028657565b359061095582610940565b565b9181601f840112156102865782359167ffffffffffffffff8311610286576020838186019501011161028657565b346102865760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286576109bf600435610940565b60243567ffffffffffffffff8111610286576109e26109f7913690600401610957565b60443590606435926109f2612bdc565b6130ff565b005b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657600435610a3481610378565b73ffffffffffffffffffffffffffffffffffffffff600054163303610a6b5760ff1660005260026020526109f76040600020611c44565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f435030323a206f6e6c79206f776e65722063616e207265766f6b65207375707060448201527f6f7274656420746f6b656e7300000000000000000000000000000000000000006064820152fd5b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b6003111561057057565b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760043567ffffffffffffffff811161028657610ba6610ba06106c8923690600401610957565b90611f7d565b604051918291602083528051610bbb81610b41565b60208401526020810151610bce81610b41565b604084015260c0610bef604083015160e06060870152610100860190610575565b9160608101516080860152608081015160a086015265ffffffffffff60a0820151168286015201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160e08501526103df565b346102865760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657600435610c8181610378565b60243567ffffffffffffffff81116102865760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc82360301126102865773ffffffffffffffffffffffffffffffffffffffff600054163303610cfa5760ff6109f7921660005260026020526004016040600020612231565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f435030313a206f6e6c79206f776e65722063616e2061646420737570706f727460448201527f656420746f6b656e7300000000000000000000000000000000000000000000006064820152fd5b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810190811067ffffffffffffffff821117610e3857604052565b610ded565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610e3857604052565b6040519061095560e083610e3d565b6002111561028657565b67ffffffffffffffff8111610e3857601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192610edd82610e97565b91610eeb6040519384610e3d565b829481845281830111610286578281602093846000960137010152565b9080601f8301121561028657816020610f2393359101610ed1565b90565b91909160a0818403126102865760405190610f4082610e1c565b81938135610f4d81610268565b83526020820135610f5d81610e8d565b602084015260408201359167ffffffffffffffff831161028657610f876080939284938301610f08565b6040850152606081013560608501520135910152565b359065ffffffffffff8216820361028657565b346102865760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760043567ffffffffffffffff811161028657610fff9036906004016103d0565b60243567ffffffffffffffff81116102865760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc823603011261028657611045610e7e565b6110518260040161094a565b815261105f6024830161094a565b6020820152604482013567ffffffffffffffff8111610286576110889060043691850101610f26565b604082015260648201356060820152608482013560808201526110ad60a48301610f9d565b60a082015260c48201359267ffffffffffffffff8411610286576110dd6110e79360046106c89636920101610f08565b60c0830152612496565b6040519081529081906020820190565b34610286576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655761112f61265b565b8073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b156111ad5781906004604051809481937fbb9fe6bf0000000000000000000000000000000000000000000000000000000083525af1801561025e5782906102505780f35b50fd5b3461028657600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576004356111ed81610268565b6111f561265b565b8173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691823b1561026357602473ffffffffffffffffffffffffffffffffffffffff918360405195869485937fc23a5cea0000000000000000000000000000000000000000000000000000000085521660048401525af1801561025e5782906102505780f35b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa801561025e576106c89160009161134d575b506040519081529081906020820190565b61136f915060203d602011611375575b6113678183610e3d565b81019061264c565b3861133c565b503d61135d565b346102865760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286576004356113b781610268565b602435906113c482610268565b6044359173ffffffffffffffffffffffffffffffffffffffff600054163303611519576000809173ffffffffffffffffffffffffffffffffffffffff6114979416946040519073ffffffffffffffffffffffffffffffffffffffff60208301937fa9059cbb000000000000000000000000000000000000000000000000000000008552166024830152604482015260448152611461606482610e3d565b519082865af13d15611511573d9061147882610e97565b916114866040519384610e3d565b82523d6000602084013e5b83613a42565b80519081151591826114ef575b50506114ac57005b7f5274afe70000000000000000000000000000000000000000000000000000000060005273ffffffffffffffffffffffffffffffffffffffff1660045260246000fd5b61150a9250906020806115069383010191016136e4565b1590565b38806114a4565b606090611491565b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f435030303a206f6e6c79206f776e65722063616e20776974686472617720746f60448201527f6b656e73000000000000000000000000000000000000000000000000000000006064820152fd5b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001681813b1561026557602491604051928380927fb760faf900000000000000000000000000000000000000000000000000000000825230600483015234905af1801561025e5782906102505780f35b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b34610286576116ac366104c5565b60005b8181106116b857005b806116c66001928486611ba0565b356116d081610378565b6116d9816119bc565b90816116e8575b5050016116af565b60ff16600052600260205260026040600020015538806116e0565b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865773ffffffffffffffffffffffffffffffffffffffff60043561175381610268565b61175b61265b565b16807fffffffffffffffffffffffff0000000000000000000000000000000000000000600154161760015573ffffffffffffffffffffffffffffffffffffffff600054167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b6040513d6000823e3d90fd5b90600182811c9216801561181b575b60208310146117ec57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f16916117e1565b9060405161183281610e1c565b809260ff815473ffffffffffffffffffffffffffffffffffffffff8116845260a01c166002811015610570576020830152604051600182018054600091611878826117d2565b80855291600181169081156118f857506001146118ba575b505091816118a46003936080950382610e3d565b6040850152600281015460608501520154910152565b6000908152602081209092505b8183106118de5750508101602001816118a4611890565b6001816020929493945483858801015201910191906118c7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208087019190915292151560051b850190920192508391506118a49050611890565b90602082519201517fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081169260148110611975575050565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000929350829060140360031b1b161690565b908160209103126102865751610f2381610378565b6106fb6119d69160ff166000526002602052604060002090565b73ffffffffffffffffffffffffffffffffffffffff611a25611a0c835173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b1615611b27576000906020810151611a3c81610566565b611a4581610566565b611b16576004915060408101906020611aa0611a0c611a85611a78611a73611a7e611a78611a738a51612761565b61193d565b60601c90565b97516127de565b935173ffffffffffffffffffffffffffffffffffffffff1690565b604051948580927f313ce5670000000000000000000000000000000000000000000000000000000082525afa91821561025e57610f2393600093611ae5575b506129d4565b611b0891935060203d602011611b0f575b611b008183610e3d565b8101906119a7565b9138611adf565b503d611af6565b6040611b23910151612761565b5090565b50600090565b67ffffffffffffffff8111610e385760051b60200190565b60405190611b5282610e1c565b6000608083828152826020820152606060408201528260608201520152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9190811015611bb05760051b0190565b611b71565b35610f2381610378565b8051821015611bb05760209160051b010190565b818110611bde575050565b60008155600101611bd3565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b90816188b802916188b8830403611c2c57565b611bea565b81810292918115918404141715611c2c57565b600360009182815560018101611c5a81546117d2565b9081611c6d575b50508260028201550155565b81601f869311600114611c845750555b3880611c61565b81835260208320611ca091601f0160051c810190600101611bd3565b808252602082209081548360011b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85881b1c191617905555611c7d565b6040519060e0820182811067ffffffffffffffff821117610e3857604052606060c0836000815260006020820152611d15611b45565b604082015260008382015260006080820152600060a08201520152565b906001116102865790600190565b906002116102865760010190600190565b906008116102865760020190600690565b909291928360081161028657831161028657600801917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80190565b906003116102865760020190600190565b906009116102865760030190600690565b906029116102865760090190602090565b909291928360341161028657831161028657603401917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc0190565b909291928360141161028657831161028657601401917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0190565b90939293848311610286578411610286578101920390565b919091357fff0000000000000000000000000000000000000000000000000000000000000081169260018110611e92575050565b7fff00000000000000000000000000000000000000000000000000000000000000929350829060010360031b1b161690565b60ff16610f2381610b41565b919091357fffffffffffff000000000000000000000000000000000000000000000000000081169260068110611f04575050565b7fffffffffffff0000000000000000000000000000000000000000000000000000929350829060060360031b1b161690565b359060208110611f44575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060200360031b1b1690565b611f7a82610b41565b52565b611f85611cdf565b50611faa611fa5611f9f611f998585611d32565b90611e5e565b60f81c90565b611ec4565b91611fbe611fa5611f9f611f998486611d40565b60008052600260205291611ff17fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b611825565b60006a52b7d2dcc80cd2e40000008160609361200c89610b41565b886120ca575050505050906120a4928261202f611f9f611f99856120c297611d9d565b9061208561204f6120496120438785611dae565b90611ed0565b60d01c90565b9461207d6106fb6120696120638487611dbf565b90611f36565b9560ff166000526002602052604060002090565b928386613358565b9690935b61209b612094610e7e565b998a611f71565b60208901611f71565b60408701526060860152608085015265ffffffffffff1660a0840152565b60c082015290565b6120d389610b41565b6001890361213d575050505050906120a492826120f9611f9f611f99856120c297611d9d565b926121356121276106fb6121136120496120438688611dae565b9660ff166000526002602052604060002090565b91606083015193838661328c565b969093612089565b91939561214d8996929496610b41565b60028914612165575b50506120a46120c29596612089565b6120c2965081955061218e8180612188612049612043612195966120a498611d51565b98611d62565b3691610ed1565b95612156565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610286570180359067ffffffffffffffff82116102865760200191813603831361028657565b9190601f81116121fb57505050565b610955926000526020600020906020601f840160051c83019310612227575b601f0160051c0190611bd3565b909150819061221a565b90612281813561224081610268565b839073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b602081013561228f81610e8d565b6002811015610570577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000084549260a01b169116178255600182016122ec604083018361219b565b9067ffffffffffffffff8211610e38576123108261230a85546117d2565b856121ec565b600090601f83116001146123845782600395936080959361236593600092612379575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b90555b606081013560028501550135910155565b013590503880612333565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08316916123b785600052602060002090565b92815b81811061241957509260019285926003989660809896106123e3575b505050811b019055612368565b01357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83891b60f8161c191690553880806123d6565b919360206001819287870135815501950192016123ba565b94909897969373ffffffffffffffffffffffffffffffffffffffff65ffffffffffff9460e0989461010089019c8952602089015216604087015261247481610b41565b606086015261248281610b41565b60808501521660a083015260c08201520152565b906124ba916124b16124ab60e083018361219b565b90613414565b9491509161345d565b9061252b83516124c981610b41565b6124ff60208601968751946124dd86610b41565b60a088015165ffffffffffff166040519687956020870199309046908c612431565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610e3d565b519020916002825161253c81610b41565b61254581610b41565b036125e5575b815161255681610b41565b61255f81610b41565b156125ad575b6002905161257281610b41565b61257b81610b41565b14612584575090565b608001516040805160208101938452908101919091526125a781606081016124ff565b51902090565b916002906124ff6125da606085015160405192839160208301958660209093929193604081019481520152565b519020929050612565565b916124ff612643612612611a0c604086015173ffffffffffffffffffffffffffffffffffffffff90511690565b604080516020810195865273ffffffffffffffffffffffffffffffffffffffff909216908201529182906060820190565b5190209161254b565b90816020910312610286575190565b73ffffffffffffffffffffffffffffffffffffffff60005416330361091257565b9060208201809211611c2c57565b91908201809211611c2c57565b1561269e57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b1561270357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b61276b6001612697565b612783815161277c6014600061268a565b11156126fc565b6040519060148083019101602883015b8083106127cb57505060148252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b9091602080918451815201920190612793565b6127e86001612697565b6127f9815161277c6028601461268a565b604051906008820190601c01603083015b80831061284257505060288252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b909160208091845181520192019061280a565b1561285c57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964205f646563696d616c730000000000000000000000000000006044820152fd5b604d8111611c2c57600a0a90565b519069ffffffffffffffffffff8216820361028657565b908160a0910312610286576128f3816128c8565b91602082015191604081015191610f236080606084015193016128c8565b8181029291600082127f8000000000000000000000000000000000000000000000000000000000000000821416611c2c578184051490151715611c2c57565b81156129a5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f8000000000000000000000000000000000000000000000000000000000000000821416611c2c570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff612a0760ff851680151580612bd1575b612a0290612855565b6128ba565b9116604051907ffeaf968c00000000000000000000000000000000000000000000000000000000825260a082600481845afa90811561025e57600492600092612ba8575b50602090604051938480927f313ce5670000000000000000000000000000000000000000000000000000000082525afa91821561025e5773ffffffffffffffffffffffffffffffffffffffff92612aac928792600092612b4b575b5061352c565b921690604051917ffeaf968c00000000000000000000000000000000000000000000000000000000835260a083600481845afa92831561025e57600093612b6c575b506020600491604051928380927f313ce5670000000000000000000000000000000000000000000000000000000082525afa94851561025e57610f2395612b4694612b4093600092612b4b575061352c565b92612911565b612950565b612b6591925060203d602011611b0f57611b008183610e3d565b9038612aa6565b6004919350612b9460209160a03d60a011612ba1575b612b8c8183610e3d565b8101906128df565b5050509050939150612aee565b503d612b82565b6020919250612bc59060a03d60a011612ba157612b8c8183610e3d565b50505090509190612a4b565b5060128111156129f9565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163303612c1b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f53656e646572206e6f7420456e747279506f696e7400000000000000000000006044820152fd5b15612c8057565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f435030313a20696e76616c6964207369676e6174757265206c656e677468206960448201527f6e207061796d6173746572416e644461746100000000000000000000000000006064820152fd5b35610f2381610268565b60405190612d1d602083610e3d565b60008252565b919360809373ffffffffffffffffffffffffffffffffffffffff929796958360a08601991685526020850152612d5881610b41565b60408401521660608201520152565b909291612d84610ba0612d7d60e085018561219b565b8091611dd0565b9160c08301612da1815151604081149081156130b2575b50612c79565b612df1612dad83612d04565b93612deb612de660c0860135612de0612dd96fffffffffffffffffffffffffffffffff83169260801c90565b489061268a565b90613585565b611c19565b9061268a565b9184606081019384519460028351612e0881610b41565b612e1181610b41565b03612f84575b5050611a0c612e70612e41612e919373ffffffffffffffffffffffffffffffffffffffff95612496565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b60005473ffffffffffffffffffffffffffffffffffffffff16945190613597565b911603612f3b5782612f0c612f1993612ee060a094610f239751612eb481610b41565b60408601515173ffffffffffffffffffffffffffffffffffffffff16906040519b8c9560208701612d23565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101885287610e3d565b015165ffffffffffff1690565b60a01b79ffffffffffff00000000000000000000000000000000000000001690565b505060a00151909150612f779065ffffffffffff165b79ffffffffffff00000000000000000000000000000000000000009060a01b1660011790565b90612f80612d0e565b9190565b9091608001519081613088575b5050604086015151612fb89073ffffffffffffffffffffffffffffffffffffffff16611a0c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8716600482015290602090829060249082905afa91821561025e57859160009361305d575b506130349161302691611c31565b670de0b6b3a7640000900490565b1161304157843880612e17565b5050505060a00151909150612f779065ffffffffffff16612f51565b6130269193509161307f6130349360203d602011611375576113678183610e3d565b93915091613018565b6130aa929550906130999151611c31565b6a52b7d2dcc80cd2e4000000900490565b923880612f91565b604191501438612d9b565b908160a09103126102865780356130d381610268565b9160208201359160408101356130e881610940565b91608060608301356130f981610268565b92013590565b9161312473ffffffffffffffffffffffffffffffffffffffff936002938101906130bd565b949397929591969097169561313881610b41565b14613253579161315161302692612deb61315695611c19565b611c31565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff84166024820152306044820152606481018290529093906131c690611506906131c081608481016124ff565b836135ad565b6132145760405193845273ffffffffffffffffffffffffffffffffffffffff16927fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf84719080602081015b0390a4565b73ffffffffffffffffffffffffffffffffffffffff1692507ffd192c7f8c08f26e917720fa6006252183cc42217b5f8269b8fafa9764f48cfe600080a4565b5050604051600080825294507fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf84719150806020810161320f565b939291936a52b7d2dcc80cd2e4000000906000916060916132ac81610b41565b600181036132cd5750505050816009610f2393608061218e94015196611e46565b90919293506132db81610b41565b6002810361331257505050610f239161218e9150613300612063602960098489611e46565b948161330c600961267c565b91611e46565b6133228197939795949295610b41565b1561332f575b5050509190565b92945090916009831061026557509060098061334f930191033691610ed1565b91388080613328565b939291936a52b7d2dcc80cd2e40000009060009160609161337881610b41565b600181036133995750505050816029610f2393608061218e94015196611e46565b90919293506133a781610b41565b600281036133d857505050610f239161218e91506133cc612063604960298489611e46565b948161330c602961267c565b6133e88197939795949295610b41565b156133f4575050509190565b92945090916029831061026557509060298061334f930191033691610ed1565b909182601411610286578260241161028657601482013560801c926000906034116102655750813560601c926fffffffffffffffffffffffffffffffff16916024013560801c90565b6134668161363e565b80156134fb575b6125a761347983612d04565b926124ff60208201359161349361218e606083018361219b565b6020815191012090608081013560c060a083013592013592604051978896602088019a8b93909796959260c0959273ffffffffffffffffffffffffffffffffffffffff60e087019a168652602086015260408501526060840152608083015260a08201520152565b5061350c61218e604083018361219b565b6020815191012061346d565b9060ff8091169116039060ff8211611c2c57565b9060ff831660ff821681811060001461355f57505060ff61355361355992610f2395613518565b166128ba565b90612911565b9392931161356c57505090565b60ff613553610f23949361357f93613518565b90612950565b9080821015613592575090565b905090565b610f23916135a4916136fc565b90929192613742565b906000602091828151910182855af1903d60005190836135ce575b50505090565b919250906135f9575073ffffffffffffffffffffffffffffffffffffffff163b15155b3880806135c8565b60019150146135f1565b909280927fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060149560601b1683528483013701016000815290565b61364b604082018261219b565b909161365a611506838561380f565b6136dc5761366a61366f91612d04565b61385f565b91601482116136b85750506040516125a7816124ff6020820194857fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060149260601b1681520190565b816125a7926136c692611e0b565b91906124ff604051938492602084019687613603565b505050600090565b90816020910312610286575180151581036102865790565b815191906041830361372d5761372692506020820151906060604084015193015160001a906139ac565b9192909190565b505060009160029190565b6004111561057057565b61374b81613738565b80613754575050565b61375d81613738565b6001810361378f577ff645eedf0000000000000000000000000000000000000000000000000000000060005260046000fd5b61379881613738565b600281036137ce57507ffce698f70000000000000000000000000000000000000000000000000000000060005260045260246000fd5b806137da600392613738565b146137e25750565b7fd78bce0c0000000000000000000000000000000000000000000000000000000060005260045260246000fd5b90600211611b2757357fffffffffffffffffffffffffffffffffffffffff000000000000000000000000167f77020000000000000000000000000000000000000000000000000000000000001490565b6017600080833c600051907fef010000000000000000000000000000000000000000000000000000000000007fffffff00000000000000000000000000000000000000000000000000000000008316036138e95750611a786138c4610f239260181b90565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001690565b3b1561394e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6e6f7420616e204549502d373730322064656c656761746500000000000000006044820152606490fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f73656e64657220686173206e6f20636f646500000000000000000000000000006044820152fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411613a36579160209360809260ff60009560405194855216868401526040830152606082015282805260015afa1561025e5760005173ffffffffffffffffffffffffffffffffffffffff811615613a2a5790600090600090565b50600090600190600090565b50505060009160039190565b90613a815750805115613a5757805190602001fd5b7f1425ea420000000000000000000000000000000000000000000000000000000060005260046000fd5b81511580613ad6575b613a92575090565b73ffffffffffffffffffffffffffffffffffffffff907f9996b315000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b50803b15613a8a56fea26469706673582212203c138c8a8cdaaaa47b7cd7101a8e487a33b24f33786af858c8e0aaf9004f7c6d64736f6c634300081c00330000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff1080000000000000000000000003cfdc212769c890907bce93d3d8c2c53de6a7a89
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80630396cb6014610187578063205c2878146101825780632c7f92cc1461017d57806352b7512c146101785780635ab244d914610173578063715018a61461016e578063796d43711461016957806379ba5097146101645780637c627b211461015f5780637fa5c1901461015a5780638da5cb5b1461015557806394d4ad60146101505780639a6e85f01461014b578063b0d691fe14610146578063b9221a4014610141578063bb9fe6bf1461013c578063c23a5cea14610137578063c399ec8814610132578063cc9c837c1461012d578063d0e30db014610128578063e30c397814610123578063ed9f0ef11461011e5763f2fde38b1461011957600080fd5b611703565b61169e565b61164c565b61159c565b61137c565b611290565b6111b0565b6110f7565b610fb0565b610d7e565b610c46565b610b4b565b610aef565b6109f9565b610985565b610832565b6107f7565b610733565b610650565b61043e565b610383565b61028b565b600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043563ffffffff8116809103610263576101cc61265b565b8173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff1081691823b15610263576024604051809481937f0396cb60000000000000000000000000000000000000000000000000000000008352600483015234905af1801561025e5782906102505780f35b61025991610e3d565b388180f35b6117c6565b505b80fd5b73ffffffffffffffffffffffffffffffffffffffff81160361028657565b600080fd5b3461028657600060407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576004356102c881610268565b81602435916102d561265b565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff10816803b156103745773ffffffffffffffffffffffffffffffffffffffff918360449260405196879586947f205c287800000000000000000000000000000000000000000000000000000000865216600485015260248401525af1801561025e5782906102505780f35b8280fd5b60ff81160361028657565b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760206103c86004356103c381610378565b6119bc565b604051908152f35b90816101209103126102865790565b919082519283825260005b8481106104295750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b806020809284010151828286010152016103ea565b346102865760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760043567ffffffffffffffff8111610286576104a76104936104bb9236906004016103d0565b602435604435916104a2612bdc565b612d67565b6040519283926040845260408401906103df565b9060208301520390f35b9060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8301126102865760043567ffffffffffffffff811161028657826023820112156102865780600401359267ffffffffffffffff84116102865760248460051b83010111610286576024019190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002111561057057565b610537565b9073ffffffffffffffffffffffffffffffffffffffff8251168152602082015160028110156105705760208201526080806105bf604085015160a0604086015260a08501906103df565b9360608101516060850152015191015290565b602081016020825282518091526040820191602060408360051b8301019401926000915b83831061060557505050505090565b9091929394602080610641837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528951610575565b970193019301919392906105f6565b346102865761065e366104c5565b9061066882611b2d565b916106766040519384610e3d565b8083527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06106a382611b2d565b0160005b81811061071c57505060005b8181106106cc57604051806106c886826105d2565b0390f35b806107006106fb6106e86106e36001958789611ba0565b611bb5565b60ff166000526002602052604060002090565b611825565b61070a8287611bbf565b526107158186611bbf565b50016106b3565b602090610727611b45565b828288010152016106a7565b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865761076a61265b565b7fffffffffffffffffffffffff000000000000000000000000000000000000000060015416600155600073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760206040516188b88152f35b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286573373ffffffffffffffffffffffffffffffffffffffff6001541603610912577fffffffffffffffffffffffff000000000000000000000000000000000000000060015416600155600054337fffffffffffffffffffffffff000000000000000000000000000000000000000082161760005573ffffffffffffffffffffffffffffffffffffffff3391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b7f118cdaa7000000000000000000000000000000000000000000000000000000006000523360045260246000fd5b6003111561028657565b359061095582610940565b565b9181601f840112156102865782359167ffffffffffffffff8311610286576020838186019501011161028657565b346102865760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286576109bf600435610940565b60243567ffffffffffffffff8111610286576109e26109f7913690600401610957565b60443590606435926109f2612bdc565b6130ff565b005b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657600435610a3481610378565b73ffffffffffffffffffffffffffffffffffffffff600054163303610a6b5760ff1660005260026020526109f76040600020611c44565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f435030323a206f6e6c79206f776e65722063616e207265766f6b65207375707060448201527f6f7274656420746f6b656e7300000000000000000000000000000000000000006064820152fd5b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b6003111561057057565b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760043567ffffffffffffffff811161028657610ba6610ba06106c8923690600401610957565b90611f7d565b604051918291602083528051610bbb81610b41565b60208401526020810151610bce81610b41565b604084015260c0610bef604083015160e06060870152610100860190610575565b9160608101516080860152608081015160a086015265ffffffffffff60a0820151168286015201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160e08501526103df565b346102865760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657600435610c8181610378565b60243567ffffffffffffffff81116102865760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc82360301126102865773ffffffffffffffffffffffffffffffffffffffff600054163303610cfa5760ff6109f7921660005260026020526004016040600020612231565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f435030313a206f6e6c79206f776e65722063616e2061646420737570706f727460448201527f656420746f6b656e7300000000000000000000000000000000000000000000006064820152fd5b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff108168152f35b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810190811067ffffffffffffffff821117610e3857604052565b610ded565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610e3857604052565b6040519061095560e083610e3d565b6002111561028657565b67ffffffffffffffff8111610e3857601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192610edd82610e97565b91610eeb6040519384610e3d565b829481845281830111610286578281602093846000960137010152565b9080601f8301121561028657816020610f2393359101610ed1565b90565b91909160a0818403126102865760405190610f4082610e1c565b81938135610f4d81610268565b83526020820135610f5d81610e8d565b602084015260408201359167ffffffffffffffff831161028657610f876080939284938301610f08565b6040850152606081013560608501520135910152565b359065ffffffffffff8216820361028657565b346102865760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865760043567ffffffffffffffff811161028657610fff9036906004016103d0565b60243567ffffffffffffffff81116102865760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc823603011261028657611045610e7e565b6110518260040161094a565b815261105f6024830161094a565b6020820152604482013567ffffffffffffffff8111610286576110889060043691850101610f26565b604082015260648201356060820152608482013560808201526110ad60a48301610f9d565b60a082015260c48201359267ffffffffffffffff8411610286576110dd6110e79360046106c89636920101610f08565b60c0830152612496565b6040519081529081906020820190565b34610286576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655761112f61265b565b8073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff10816803b156111ad5781906004604051809481937fbb9fe6bf0000000000000000000000000000000000000000000000000000000083525af1801561025e5782906102505780f35b50fd5b3461028657600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576004356111ed81610268565b6111f561265b565b8173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff1081691823b1561026357602473ffffffffffffffffffffffffffffffffffffffff918360405195869485937fc23a5cea0000000000000000000000000000000000000000000000000000000085521660048401525af1801561025e5782906102505780f35b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff108165afa801561025e576106c89160009161134d575b506040519081529081906020820190565b61136f915060203d602011611375575b6113678183610e3d565b81019061264c565b3861133c565b503d61135d565b346102865760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610286576004356113b781610268565b602435906113c482610268565b6044359173ffffffffffffffffffffffffffffffffffffffff600054163303611519576000809173ffffffffffffffffffffffffffffffffffffffff6114979416946040519073ffffffffffffffffffffffffffffffffffffffff60208301937fa9059cbb000000000000000000000000000000000000000000000000000000008552166024830152604482015260448152611461606482610e3d565b519082865af13d15611511573d9061147882610e97565b916114866040519384610e3d565b82523d6000602084013e5b83613a42565b80519081151591826114ef575b50506114ac57005b7f5274afe70000000000000000000000000000000000000000000000000000000060005273ffffffffffffffffffffffffffffffffffffffff1660045260246000fd5b61150a9250906020806115069383010191016136e4565b1590565b38806114a4565b606090611491565b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f435030303a206f6e6c79206f776e65722063616e20776974686472617720746f60448201527f6b656e73000000000000000000000000000000000000000000000000000000006064820152fd5b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff1081681813b1561026557602491604051928380927fb760faf900000000000000000000000000000000000000000000000000000000825230600483015234905af1801561025e5782906102505780f35b346102865760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261028657602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b34610286576116ac366104c5565b60005b8181106116b857005b806116c66001928486611ba0565b356116d081610378565b6116d9816119bc565b90816116e8575b5050016116af565b60ff16600052600260205260026040600020015538806116e0565b346102865760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102865773ffffffffffffffffffffffffffffffffffffffff60043561175381610268565b61175b61265b565b16807fffffffffffffffffffffffff0000000000000000000000000000000000000000600154161760015573ffffffffffffffffffffffffffffffffffffffff600054167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700600080a3005b6040513d6000823e3d90fd5b90600182811c9216801561181b575b60208310146117ec57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f16916117e1565b9060405161183281610e1c565b809260ff815473ffffffffffffffffffffffffffffffffffffffff8116845260a01c166002811015610570576020830152604051600182018054600091611878826117d2565b80855291600181169081156118f857506001146118ba575b505091816118a46003936080950382610e3d565b6040850152600281015460608501520154910152565b6000908152602081209092505b8183106118de5750508101602001816118a4611890565b6001816020929493945483858801015201910191906118c7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208087019190915292151560051b850190920192508391506118a49050611890565b90602082519201517fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081169260148110611975575050565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000929350829060140360031b1b161690565b908160209103126102865751610f2381610378565b6106fb6119d69160ff166000526002602052604060002090565b73ffffffffffffffffffffffffffffffffffffffff611a25611a0c835173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b1615611b27576000906020810151611a3c81610566565b611a4581610566565b611b16576004915060408101906020611aa0611a0c611a85611a78611a73611a7e611a78611a738a51612761565b61193d565b60601c90565b97516127de565b935173ffffffffffffffffffffffffffffffffffffffff1690565b604051948580927f313ce5670000000000000000000000000000000000000000000000000000000082525afa91821561025e57610f2393600093611ae5575b506129d4565b611b0891935060203d602011611b0f575b611b008183610e3d565b8101906119a7565b9138611adf565b503d611af6565b6040611b23910151612761565b5090565b50600090565b67ffffffffffffffff8111610e385760051b60200190565b60405190611b5282610e1c565b6000608083828152826020820152606060408201528260608201520152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9190811015611bb05760051b0190565b611b71565b35610f2381610378565b8051821015611bb05760209160051b010190565b818110611bde575050565b60008155600101611bd3565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b90816188b802916188b8830403611c2c57565b611bea565b81810292918115918404141715611c2c57565b600360009182815560018101611c5a81546117d2565b9081611c6d575b50508260028201550155565b81601f869311600114611c845750555b3880611c61565b81835260208320611ca091601f0160051c810190600101611bd3565b808252602082209081548360011b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85881b1c191617905555611c7d565b6040519060e0820182811067ffffffffffffffff821117610e3857604052606060c0836000815260006020820152611d15611b45565b604082015260008382015260006080820152600060a08201520152565b906001116102865790600190565b906002116102865760010190600190565b906008116102865760020190600690565b909291928360081161028657831161028657600801917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80190565b906003116102865760020190600190565b906009116102865760030190600690565b906029116102865760090190602090565b909291928360341161028657831161028657603401917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc0190565b909291928360141161028657831161028657601401917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0190565b90939293848311610286578411610286578101920390565b919091357fff0000000000000000000000000000000000000000000000000000000000000081169260018110611e92575050565b7fff00000000000000000000000000000000000000000000000000000000000000929350829060010360031b1b161690565b60ff16610f2381610b41565b919091357fffffffffffff000000000000000000000000000000000000000000000000000081169260068110611f04575050565b7fffffffffffff0000000000000000000000000000000000000000000000000000929350829060060360031b1b161690565b359060208110611f44575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060200360031b1b1690565b611f7a82610b41565b52565b611f85611cdf565b50611faa611fa5611f9f611f998585611d32565b90611e5e565b60f81c90565b611ec4565b91611fbe611fa5611f9f611f998486611d40565b60008052600260205291611ff17fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b611825565b60006a52b7d2dcc80cd2e40000008160609361200c89610b41565b886120ca575050505050906120a4928261202f611f9f611f99856120c297611d9d565b9061208561204f6120496120438785611dae565b90611ed0565b60d01c90565b9461207d6106fb6120696120638487611dbf565b90611f36565b9560ff166000526002602052604060002090565b928386613358565b9690935b61209b612094610e7e565b998a611f71565b60208901611f71565b60408701526060860152608085015265ffffffffffff1660a0840152565b60c082015290565b6120d389610b41565b6001890361213d575050505050906120a492826120f9611f9f611f99856120c297611d9d565b926121356121276106fb6121136120496120438688611dae565b9660ff166000526002602052604060002090565b91606083015193838661328c565b969093612089565b91939561214d8996929496610b41565b60028914612165575b50506120a46120c29596612089565b6120c2965081955061218e8180612188612049612043612195966120a498611d51565b98611d62565b3691610ed1565b95612156565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610286570180359067ffffffffffffffff82116102865760200191813603831361028657565b9190601f81116121fb57505050565b610955926000526020600020906020601f840160051c83019310612227575b601f0160051c0190611bd3565b909150819061221a565b90612281813561224081610268565b839073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b602081013561228f81610e8d565b6002811015610570577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000084549260a01b169116178255600182016122ec604083018361219b565b9067ffffffffffffffff8211610e38576123108261230a85546117d2565b856121ec565b600090601f83116001146123845782600395936080959361236593600092612379575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b90555b606081013560028501550135910155565b013590503880612333565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08316916123b785600052602060002090565b92815b81811061241957509260019285926003989660809896106123e3575b505050811b019055612368565b01357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83891b60f8161c191690553880806123d6565b919360206001819287870135815501950192016123ba565b94909897969373ffffffffffffffffffffffffffffffffffffffff65ffffffffffff9460e0989461010089019c8952602089015216604087015261247481610b41565b606086015261248281610b41565b60808501521660a083015260c08201520152565b906124ba916124b16124ab60e083018361219b565b90613414565b9491509161345d565b9061252b83516124c981610b41565b6124ff60208601968751946124dd86610b41565b60a088015165ffffffffffff166040519687956020870199309046908c612431565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610e3d565b519020916002825161253c81610b41565b61254581610b41565b036125e5575b815161255681610b41565b61255f81610b41565b156125ad575b6002905161257281610b41565b61257b81610b41565b14612584575090565b608001516040805160208101938452908101919091526125a781606081016124ff565b51902090565b916002906124ff6125da606085015160405192839160208301958660209093929193604081019481520152565b519020929050612565565b916124ff612643612612611a0c604086015173ffffffffffffffffffffffffffffffffffffffff90511690565b604080516020810195865273ffffffffffffffffffffffffffffffffffffffff909216908201529182906060820190565b5190209161254b565b90816020910312610286575190565b73ffffffffffffffffffffffffffffffffffffffff60005416330361091257565b9060208201809211611c2c57565b91908201809211611c2c57565b1561269e57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b1561270357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b61276b6001612697565b612783815161277c6014600061268a565b11156126fc565b6040519060148083019101602883015b8083106127cb57505060148252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b9091602080918451815201920190612793565b6127e86001612697565b6127f9815161277c6028601461268a565b604051906008820190601c01603083015b80831061284257505060288252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b909160208091845181520192019061280a565b1561285c57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964205f646563696d616c730000000000000000000000000000006044820152fd5b604d8111611c2c57600a0a90565b519069ffffffffffffffffffff8216820361028657565b908160a0910312610286576128f3816128c8565b91602082015191604081015191610f236080606084015193016128c8565b8181029291600082127f8000000000000000000000000000000000000000000000000000000000000000821416611c2c578184051490151715611c2c57565b81156129a5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f8000000000000000000000000000000000000000000000000000000000000000821416611c2c570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff612a0760ff851680151580612bd1575b612a0290612855565b6128ba565b9116604051907ffeaf968c00000000000000000000000000000000000000000000000000000000825260a082600481845afa90811561025e57600492600092612ba8575b50602090604051938480927f313ce5670000000000000000000000000000000000000000000000000000000082525afa91821561025e5773ffffffffffffffffffffffffffffffffffffffff92612aac928792600092612b4b575b5061352c565b921690604051917ffeaf968c00000000000000000000000000000000000000000000000000000000835260a083600481845afa92831561025e57600093612b6c575b506020600491604051928380927f313ce5670000000000000000000000000000000000000000000000000000000082525afa94851561025e57610f2395612b4694612b4093600092612b4b575061352c565b92612911565b612950565b612b6591925060203d602011611b0f57611b008183610e3d565b9038612aa6565b6004919350612b9460209160a03d60a011612ba1575b612b8c8183610e3d565b8101906128df565b5050509050939150612aee565b503d612b82565b6020919250612bc59060a03d60a011612ba157612b8c8183610e3d565b50505090509190612a4b565b5060128111156129f9565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff108163303612c1b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f53656e646572206e6f7420456e747279506f696e7400000000000000000000006044820152fd5b15612c8057565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f435030313a20696e76616c6964207369676e6174757265206c656e677468206960448201527f6e207061796d6173746572416e644461746100000000000000000000000000006064820152fd5b35610f2381610268565b60405190612d1d602083610e3d565b60008252565b919360809373ffffffffffffffffffffffffffffffffffffffff929796958360a08601991685526020850152612d5881610b41565b60408401521660608201520152565b909291612d84610ba0612d7d60e085018561219b565b8091611dd0565b9160c08301612da1815151604081149081156130b2575b50612c79565b612df1612dad83612d04565b93612deb612de660c0860135612de0612dd96fffffffffffffffffffffffffffffffff83169260801c90565b489061268a565b90613585565b611c19565b9061268a565b9184606081019384519460028351612e0881610b41565b612e1181610b41565b03612f84575b5050611a0c612e70612e41612e919373ffffffffffffffffffffffffffffffffffffffff95612496565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b60005473ffffffffffffffffffffffffffffffffffffffff16945190613597565b911603612f3b5782612f0c612f1993612ee060a094610f239751612eb481610b41565b60408601515173ffffffffffffffffffffffffffffffffffffffff16906040519b8c9560208701612d23565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101885287610e3d565b015165ffffffffffff1690565b60a01b79ffffffffffff00000000000000000000000000000000000000001690565b505060a00151909150612f779065ffffffffffff165b79ffffffffffff00000000000000000000000000000000000000009060a01b1660011790565b90612f80612d0e565b9190565b9091608001519081613088575b5050604086015151612fb89073ffffffffffffffffffffffffffffffffffffffff16611a0c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8716600482015290602090829060249082905afa91821561025e57859160009361305d575b506130349161302691611c31565b670de0b6b3a7640000900490565b1161304157843880612e17565b5050505060a00151909150612f779065ffffffffffff16612f51565b6130269193509161307f6130349360203d602011611375576113678183610e3d565b93915091613018565b6130aa929550906130999151611c31565b6a52b7d2dcc80cd2e4000000900490565b923880612f91565b604191501438612d9b565b908160a09103126102865780356130d381610268565b9160208201359160408101356130e881610940565b91608060608301356130f981610268565b92013590565b9161312473ffffffffffffffffffffffffffffffffffffffff936002938101906130bd565b949397929591969097169561313881610b41565b14613253579161315161302692612deb61315695611c19565b611c31565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff84166024820152306044820152606481018290529093906131c690611506906131c081608481016124ff565b836135ad565b6132145760405193845273ffffffffffffffffffffffffffffffffffffffff16927fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf84719080602081015b0390a4565b73ffffffffffffffffffffffffffffffffffffffff1692507ffd192c7f8c08f26e917720fa6006252183cc42217b5f8269b8fafa9764f48cfe600080a4565b5050604051600080825294507fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf84719150806020810161320f565b939291936a52b7d2dcc80cd2e4000000906000916060916132ac81610b41565b600181036132cd5750505050816009610f2393608061218e94015196611e46565b90919293506132db81610b41565b6002810361331257505050610f239161218e9150613300612063602960098489611e46565b948161330c600961267c565b91611e46565b6133228197939795949295610b41565b1561332f575b5050509190565b92945090916009831061026557509060098061334f930191033691610ed1565b91388080613328565b939291936a52b7d2dcc80cd2e40000009060009160609161337881610b41565b600181036133995750505050816029610f2393608061218e94015196611e46565b90919293506133a781610b41565b600281036133d857505050610f239161218e91506133cc612063604960298489611e46565b948161330c602961267c565b6133e88197939795949295610b41565b156133f4575050509190565b92945090916029831061026557509060298061334f930191033691610ed1565b909182601411610286578260241161028657601482013560801c926000906034116102655750813560601c926fffffffffffffffffffffffffffffffff16916024013560801c90565b6134668161363e565b80156134fb575b6125a761347983612d04565b926124ff60208201359161349361218e606083018361219b565b6020815191012090608081013560c060a083013592013592604051978896602088019a8b93909796959260c0959273ffffffffffffffffffffffffffffffffffffffff60e087019a168652602086015260408501526060840152608083015260a08201520152565b5061350c61218e604083018361219b565b6020815191012061346d565b9060ff8091169116039060ff8211611c2c57565b9060ff831660ff821681811060001461355f57505060ff61355361355992610f2395613518565b166128ba565b90612911565b9392931161356c57505090565b60ff613553610f23949361357f93613518565b90612950565b9080821015613592575090565b905090565b610f23916135a4916136fc565b90929192613742565b906000602091828151910182855af1903d60005190836135ce575b50505090565b919250906135f9575073ffffffffffffffffffffffffffffffffffffffff163b15155b3880806135c8565b60019150146135f1565b909280927fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060149560601b1683528483013701016000815290565b61364b604082018261219b565b909161365a611506838561380f565b6136dc5761366a61366f91612d04565b61385f565b91601482116136b85750506040516125a7816124ff6020820194857fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060149260601b1681520190565b816125a7926136c692611e0b565b91906124ff604051938492602084019687613603565b505050600090565b90816020910312610286575180151581036102865790565b815191906041830361372d5761372692506020820151906060604084015193015160001a906139ac565b9192909190565b505060009160029190565b6004111561057057565b61374b81613738565b80613754575050565b61375d81613738565b6001810361378f577ff645eedf0000000000000000000000000000000000000000000000000000000060005260046000fd5b61379881613738565b600281036137ce57507ffce698f70000000000000000000000000000000000000000000000000000000060005260045260246000fd5b806137da600392613738565b146137e25750565b7fd78bce0c0000000000000000000000000000000000000000000000000000000060005260045260246000fd5b90600211611b2757357fffffffffffffffffffffffffffffffffffffffff000000000000000000000000167f77020000000000000000000000000000000000000000000000000000000000001490565b6017600080833c600051907fef010000000000000000000000000000000000000000000000000000000000007fffffff00000000000000000000000000000000000000000000000000000000008316036138e95750611a786138c4610f239260181b90565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001690565b3b1561394e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6e6f7420616e204549502d373730322064656c656761746500000000000000006044820152606490fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f73656e64657220686173206e6f20636f646500000000000000000000000000006044820152fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411613a36579160209360809260ff60009560405194855216868401526040830152606082015282805260015afa1561025e5760005173ffffffffffffffffffffffffffffffffffffffff811615613a2a5790600090600090565b50600090600190600090565b50505060009160039190565b90613a815750805115613a5757805190602001fd5b7f1425ea420000000000000000000000000000000000000000000000000000000060005260046000fd5b81511580613ad6575b613a92575090565b73ffffffffffffffffffffffffffffffffffffffff907f9996b315000000000000000000000000000000000000000000000000000000006000521660045260246000fd5b50803b15613a8a56fea26469706673582212203c138c8a8cdaaaa47b7cd7101a8e487a33b24f33786af858c8e0aaf9004f7c6d64736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff1080000000000000000000000003cfdc212769c890907bce93d3d8c2c53de6a7a89
-----Decoded View---------------
Arg [0] : _entryPoint (address): 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108
Arg [1] : _owner (address): 0x3cfDc212769c890907bcE93D3d8C2c53dE6a7a89
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004337084d9e255ff0702461cf8895ce9e3b5ff108
Arg [1] : 0000000000000000000000003cfdc212769c890907bce93d3d8c2c53de6a7a89
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.