Latest 9 from a total of 9 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Add Supported To... | 24263647 | 53 days ago | IN | 0 ETH | 0.00022675 | ||||
| Add Supported To... | 22917202 | 241 days ago | IN | 0 ETH | 0.00056544 | ||||
| Add Supported To... | 22913718 | 242 days ago | IN | 0 ETH | 0.00007379 | ||||
| Add Supported To... | 22353635 | 320 days ago | IN | 0 ETH | 0.00010097 | ||||
| Add Stake | 22068048 | 360 days ago | IN | 0.1 ETH | 0.0000635 | ||||
| Add Stake | 20626868 | 561 days ago | IN | 0.00001 ETH | 0.00012192 | ||||
| Add Supported To... | 20626831 | 561 days ago | IN | 0 ETH | 0.00013834 | ||||
| Add Supported To... | 20626830 | 561 days ago | IN | 0 ETH | 0.00013948 | ||||
| Add Supported To... | 20626829 | 561 days ago | IN | 0 ETH | 0.00013728 |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CandidePaymaster07
Compiler Version
v0.8.23+commit.f704f362
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.20;
/// @author CandideWallet Team
import {BytesLib} from "./utils/BytesLib.sol";
import "@account-abstraction-07/contracts/core/BasePaymaster.sol";
import "@account-abstraction-07/contracts/core/Helpers.sol";
import "@account-abstraction-07/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 CandidePaymaster07 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 pure returns (bytes32) {
return keccak256(abi.encode(
userOp.sender,
userOp.nonce,
keccak256(userOp.initCode),
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.getSender();
uint256 maxUseropCost = maxCost + (COST_OF_POST * userOp.unpackMaxFeePerGas());
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: GPL-3.0
pragma solidity ^0.8.23;
/* solhint-disable reason-string */
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "../interfaces/IPaymaster.sol";
import "../interfaces/IEntryPoint.sol";
import "./UserOperationLib.sol";
/**
* Helper class for creating a paymaster.
* provides helper methods for staking.
* Validates that the postOp is called only by the entryPoint.
*/
abstract contract BasePaymaster is IPaymaster, Ownable {
IEntryPoint public immutable entryPoint;
uint256 internal constant PAYMASTER_VALIDATION_GAS_OFFSET = UserOperationLib.PAYMASTER_VALIDATION_GAS_OFFSET;
uint256 internal constant PAYMASTER_POSTOP_GAS_OFFSET = UserOperationLib.PAYMASTER_POSTOP_GAS_OFFSET;
uint256 internal constant PAYMASTER_DATA_OFFSET = UserOperationLib.PAYMASTER_DATA_OFFSET;
constructor(IEntryPoint _entryPoint) 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 gas used so far (without this postOp call).
* @param actualUserOpFeePerGas - the gas price this UserOp pays. This value is based on the UserOp's maxFeePerGas
* and maxPriorityFee (and basefee)
* It is not the same as tx.gasprice, which is what the bundler pays.
*/
function _postOp(
PostOpMode mode,
bytes calldata context,
uint256 actualGasCost,
uint256 actualUserOpFeePerGas
) internal virtual {
(mode, context, actualGasCost, actualUserOpFeePerGas); // unused params
// subclass must override this method if validatePaymasterUserOp returns a context
revert("must override");
}
/**
* Add a deposit for this paymaster, used for paying for transaction fees.
*/
function deposit() public payable {
entryPoint.depositTo{value: msg.value}(address(this));
}
/**
* Withdraw value from the deposit.
* @param withdrawAddress - Target to send to.
* @param amount - Amount to withdraw.
*/
function withdrawTo(
address payable withdrawAddress,
uint256 amount
) public onlyOwner {
entryPoint.withdrawTo(withdrawAddress, amount);
}
/**
* Add stake for this paymaster.
* This method can also carry eth value to add to the current stake.
* @param unstakeDelaySec - The unstake delay for this paymaster. Can only be increased.
*/
function addStake(uint32 unstakeDelaySec) external payable onlyOwner {
entryPoint.addStake{value: msg.value}(unstakeDelaySec);
}
/**
* Return current paymaster's deposit on the entryPoint.
*/
function getDeposit() public view returns (uint256) {
return entryPoint.balanceOf(address(this));
}
/**
* Unlock the stake, in order to withdraw it.
* The paymaster can't serve requests once unlocked, until it calls addStake again
*/
function unlockStake() external onlyOwner {
entryPoint.unlockStake();
}
/**
* Withdraw the entire paymaster's stake.
* stake must be unlocked first (and then wait for the unstakeDelay to be over)
* @param withdrawAddress - The address to send withdrawn value.
*/
function withdrawStake(address payable withdrawAddress) external onlyOwner {
entryPoint.withdrawStake(withdrawAddress);
}
/**
* Validate the call is made from a valid entrypoint
*/
function _requireFromEntryPoint() internal virtual {
require(msg.sender == address(entryPoint), "Sender not EntryPoint");
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.23;
/* solhint-disable no-inline-assembly */
/*
* For simulation purposes, validateUserOp (and validatePaymasterUserOp)
* must return this value in case of signature failure, instead of revert.
*/
uint256 constant SIG_VALIDATION_FAILED = 1;
/*
* For simulation purposes, validateUserOp (and validatePaymasterUserOp)
* return this value on success.
*/
uint256 constant SIG_VALIDATION_SUCCESS = 0;
/**
* Returned data from validateUserOp.
* validateUserOp returns a uint256, which is created by `_packedValidationData` and
* parsed by `_parseValidationData`.
* @param aggregator - address(0) - The account validated the signature by itself.
* address(1) - The account failed to validate the signature.
* otherwise - This is an address of a signature aggregator that must
* be used to validate the signature.
* @param validAfter - This UserOp is valid only after this timestamp.
* @param validaUntil - This UserOp is valid only up to this timestamp.
*/
struct ValidationData {
address aggregator;
uint48 validAfter;
uint48 validUntil;
}
/**
* Extract sigFailed, validAfter, validUntil.
* Also convert zero validUntil to type(uint48).max.
* @param validationData - The packed validation data.
*/
function _parseValidationData(
uint256 validationData
) pure returns (ValidationData memory data) {
address aggregator = address(uint160(validationData));
uint48 validUntil = uint48(validationData >> 160);
if (validUntil == 0) {
validUntil = type(uint48).max;
}
uint48 validAfter = uint48(validationData >> (48 + 160));
return ValidationData(aggregator, validAfter, validUntil);
}
/**
* Helper to pack the return value for validateUserOp.
* @param data - The ValidationData to pack.
*/
function _packValidationData(
ValidationData memory data
) pure returns (uint256) {
return
uint160(data.aggregator) |
(uint256(data.validUntil) << 160) |
(uint256(data.validAfter) << (160 + 48));
}
/**
* Helper to pack the return value for validateUserOp, when not using an aggregator.
* @param sigFailed - True for signature failure, false for success.
* @param validUntil - Last timestamp this UserOperation is valid (or zero for infinite).
* @param validAfter - First timestamp this UserOperation is valid.
*/
function _packValidationData(
bool sigFailed,
uint48 validUntil,
uint48 validAfter
) pure returns (uint256) {
return
(sigFailed ? 1 : 0) |
(uint256(validUntil) << 160) |
(uint256(validAfter) << (160 + 48));
}
/**
* keccak function over calldata.
* @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.
*/
function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {
assembly ("memory-safe") {
let mem := mload(0x40)
let len := data.length
calldatacopy(mem, data.offset, len)
ret := keccak256(mem, len)
}
}
/**
* The minimum of two numbers.
* @param a - First number.
* @param b - Second number.
*/
function min(uint256 a, uint256 b) pure returns (uint256) {
return a < b ? a : b;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.23;
/* solhint-disable no-inline-assembly */
import "../interfaces/PackedUserOperation.sol";
import {calldataKeccak, min} from "./Helpers.sol";
/**
* Utility functions helpful when working with UserOperation structs.
*/
library UserOperationLib {
uint256 public constant PAYMASTER_VALIDATION_GAS_OFFSET = 20;
uint256 public constant PAYMASTER_POSTOP_GAS_OFFSET = 36;
uint256 public constant PAYMASTER_DATA_OFFSET = 52;
/**
* Get sender from user operation data.
* @param userOp - The user operation data.
*/
function getSender(
PackedUserOperation calldata userOp
) internal pure returns (address) {
address data;
//read sender from userOp, which is first userOp member (saves 800 gas...)
assembly {
data := calldataload(userOp)
}
return address(uint160(data));
}
/**
* Relayer/block builder might submit the TX with higher priorityFee,
* but the user should not pay above what he signed for.
* @param userOp - The user operation data.
*/
function gasPrice(
PackedUserOperation calldata userOp
) internal view returns (uint256) {
unchecked {
(uint256 maxPriorityFeePerGas, uint256 maxFeePerGas) = unpackUints(userOp.gasFees);
if (maxFeePerGas == maxPriorityFeePerGas) {
//legacy mode (for networks that don't support basefee opcode)
return maxFeePerGas;
}
return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);
}
}
/**
* Pack the user operation data into bytes for hashing.
* @param userOp - The user operation data.
*/
function encode(
PackedUserOperation calldata userOp
) internal pure returns (bytes memory ret) {
address sender = getSender(userOp);
uint256 nonce = userOp.nonce;
bytes32 hashInitCode = calldataKeccak(userOp.initCode);
bytes32 hashCallData = calldataKeccak(userOp.callData);
bytes32 accountGasLimits = userOp.accountGasLimits;
uint256 preVerificationGas = userOp.preVerificationGas;
bytes32 gasFees = userOp.gasFees;
bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);
return abi.encode(
sender, nonce,
hashInitCode, hashCallData,
accountGasLimits, preVerificationGas, gasFees,
hashPaymasterAndData
);
}
function unpackUints(
bytes32 packed
) internal pure returns (uint256 high128, uint256 low128) {
return (uint128(bytes16(packed)), uint128(uint256(packed)));
}
//unpack just the high 128-bits from a packed value
function unpackHigh128(bytes32 packed) internal pure returns (uint256) {
return uint256(packed) >> 128;
}
// unpack just the low 128-bits from a packed value
function unpackLow128(bytes32 packed) internal pure returns (uint256) {
return uint128(uint256(packed));
}
function unpackMaxPriorityFeePerGas(PackedUserOperation calldata userOp)
internal pure returns (uint256) {
return unpackHigh128(userOp.gasFees);
}
function unpackMaxFeePerGas(PackedUserOperation calldata userOp)
internal pure returns (uint256) {
return unpackLow128(userOp.gasFees);
}
function unpackVerificationGasLimit(PackedUserOperation calldata userOp)
internal pure returns (uint256) {
return unpackHigh128(userOp.accountGasLimits);
}
function unpackCallGasLimit(PackedUserOperation calldata userOp)
internal pure returns (uint256) {
return unpackLow128(userOp.accountGasLimits);
}
function unpackPaymasterVerificationGasLimit(PackedUserOperation calldata userOp)
internal pure returns (uint256) {
return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET]));
}
function unpackPostOpGasLimit(PackedUserOperation calldata userOp)
internal pure returns (uint256) {
return uint128(bytes16(userOp.paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET]));
}
function unpackPaymasterStaticFields(
bytes calldata paymasterAndData
) internal pure returns (address paymaster, uint256 validationGasLimit, uint256 postOpGasLimit) {
return (
address(bytes20(paymasterAndData[: PAYMASTER_VALIDATION_GAS_OFFSET])),
uint128(bytes16(paymasterAndData[PAYMASTER_VALIDATION_GAS_OFFSET : PAYMASTER_POSTOP_GAS_OFFSET])),
uint128(bytes16(paymasterAndData[PAYMASTER_POSTOP_GAS_OFFSET : PAYMASTER_DATA_OFFSET]))
);
}
/**
* Hash the user operation data.
* @param userOp - The user operation data.
*/
function hash(
PackedUserOperation calldata userOp
) internal pure returns (bytes32) {
return keccak256(encode(userOp));
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.5;
import "./PackedUserOperation.sol";
/**
* Aggregated Signatures validator.
*/
interface IAggregator {
/**
* Validate aggregated signature.
* Revert if the aggregated signature does not match the given list of operations.
* @param userOps - Array of UserOperations to validate the signature for.
* @param signature - The aggregated signature.
*/
function validateSignatures(
PackedUserOperation[] calldata userOps,
bytes calldata signature
) external view;
/**
* Validate signature of a single userOp.
* This method should be called by bundler after EntryPointSimulation.simulateValidation() returns
* the aggregator this account uses.
* First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.
* @param userOp - The userOperation received from the user.
* @return sigForUserOp - The value to put into the signature field of the userOp when calling handleOps.
* (usually empty, unless account and aggregator support some kind of "multisig".
*/
function validateUserOpSignature(
PackedUserOperation calldata userOp
) external view returns (bytes memory sigForUserOp);
/**
* Aggregate multiple signatures into a single value.
* This method is called off-chain to calculate the signature to pass with handleOps()
* bundler MAY use optimized custom code perform this aggregation.
* @param userOps - Array of UserOperations to collect the signatures from.
* @return aggregatedSignature - The aggregated signature.
*/
function aggregateSignatures(
PackedUserOperation[] calldata userOps
) external view returns (bytes memory aggregatedSignature);
}/**
** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.
** Only one instance required on each chain.
**/
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.5;
/* solhint-disable avoid-low-level-calls */
/* solhint-disable no-inline-assembly */
/* solhint-disable reason-string */
import "./PackedUserOperation.sol";
import "./IStakeManager.sol";
import "./IAggregator.sol";
import "./INonceManager.sol";
interface IEntryPoint is IStakeManager, INonceManager {
/***
* An event emitted after each successful request.
* @param userOpHash - Unique identifier for the request (hash its entire content, except signature).
* @param sender - The account that generates this request.
* @param paymaster - If non-null, the paymaster that pays for this request.
* @param nonce - The nonce value from the request.
* @param success - True if the sender transaction succeeded, false if reverted.
* @param actualGasCost - Actual amount paid (by account or paymaster) for this UserOperation.
* @param actualGasUsed - Total gas used by this UserOperation (including preVerification, creation,
* validation and execution).
*/
event UserOperationEvent(
bytes32 indexed userOpHash,
address indexed sender,
address indexed paymaster,
uint256 nonce,
bool success,
uint256 actualGasCost,
uint256 actualGasUsed
);
/**
* Account "sender" was deployed.
* @param userOpHash - The userOp that deployed this account. UserOperationEvent will follow.
* @param sender - The account that is deployed
* @param factory - The factory used to deploy this account (in the initCode)
* @param paymaster - The paymaster used by this UserOp
*/
event AccountDeployed(
bytes32 indexed userOpHash,
address indexed sender,
address factory,
address paymaster
);
/**
* An event emitted if the UserOperation "callData" reverted with non-zero length.
* @param userOpHash - The request unique identifier.
* @param sender - The sender of this request.
* @param nonce - The nonce used in the request.
* @param revertReason - The return bytes from the (reverted) call to "callData".
*/
event UserOperationRevertReason(
bytes32 indexed userOpHash,
address indexed sender,
uint256 nonce,
bytes revertReason
);
/**
* An event emitted if the UserOperation Paymaster's "postOp" call reverted with non-zero length.
* @param userOpHash - The request unique identifier.
* @param sender - The sender of this request.
* @param nonce - The nonce used in the request.
* @param revertReason - The return bytes from the (reverted) call to "callData".
*/
event PostOpRevertReason(
bytes32 indexed userOpHash,
address indexed sender,
uint256 nonce,
bytes revertReason
);
/**
* UserOp consumed more than prefund. The UserOperation is reverted, and no refund is made.
* @param userOpHash - The request unique identifier.
* @param sender - The sender of this request.
* @param nonce - The nonce used in the request.
*/
event UserOperationPrefundTooLow(
bytes32 indexed userOpHash,
address indexed sender,
uint256 nonce
);
/**
* An event emitted by handleOps(), before starting the execution loop.
* Any event emitted before this event, is part of the validation.
*/
event BeforeExecution();
/**
* Signature aggregator used by the following UserOperationEvents within this bundle.
* @param aggregator - The aggregator used for the following UserOperationEvents.
*/
event SignatureAggregatorChanged(address indexed aggregator);
/**
* A custom revert error of handleOps, to identify the offending op.
* Should be caught in off-chain handleOps simulation and not happen on-chain.
* Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.
* NOTE: If simulateValidation passes successfully, there should be no reason for handleOps to fail on it.
* @param opIndex - Index into the array of ops to the failed one (in simulateValidation, this is always zero).
* @param reason - Revert reason. The string starts with a unique code "AAmn",
* where "m" is "1" for factory, "2" for account and "3" for paymaster issues,
* so a failure can be attributed to the correct entity.
*/
error FailedOp(uint256 opIndex, string reason);
/**
* A custom revert error of handleOps, to report a revert by account or paymaster.
* @param opIndex - Index into the array of ops to the failed one (in simulateValidation, this is always zero).
* @param reason - Revert reason. see FailedOp(uint256,string), above
* @param inner - data from inner cought revert reason
* @dev note that inner is truncated to 2048 bytes
*/
error FailedOpWithRevert(uint256 opIndex, string reason, bytes inner);
error PostOpReverted(bytes returnData);
/**
* Error case when a signature aggregator fails to verify the aggregated signature it had created.
* @param aggregator The aggregator that failed to verify the signature
*/
error SignatureValidationFailed(address aggregator);
// Return value of getSenderAddress.
error SenderAddressResult(address sender);
// UserOps handled, per aggregator.
struct UserOpsPerAggregator {
PackedUserOperation[] userOps;
// Aggregator address
IAggregator aggregator;
// Aggregated signature
bytes signature;
}
/**
* Execute a batch of UserOperations.
* No signature aggregator is used.
* If any account requires an aggregator (that is, it returned an aggregator when
* performing simulateValidation), then handleAggregatedOps() must be used instead.
* @param ops - The operations to execute.
* @param beneficiary - The address to receive the fees.
*/
function handleOps(
PackedUserOperation[] calldata ops,
address payable beneficiary
) external;
/**
* Execute a batch of UserOperation with Aggregators
* @param opsPerAggregator - The operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts).
* @param beneficiary - The address to receive the fees.
*/
function handleAggregatedOps(
UserOpsPerAggregator[] calldata opsPerAggregator,
address payable beneficiary
) external;
/**
* Generate a request Id - unique identifier for this request.
* The request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.
* @param userOp - The user operation to generate the request ID for.
* @return hash the hash of this UserOperation
*/
function getUserOpHash(
PackedUserOperation calldata userOp
) external view returns (bytes32);
/**
* Gas and return values during simulation.
* @param preOpGas - The gas used for validation (including preValidationGas)
* @param prefund - The required prefund for this operation
* @param accountValidationData - returned validationData from account.
* @param paymasterValidationData - return validationData from paymaster.
* @param paymasterContext - Returned by validatePaymasterUserOp (to be passed into postOp)
*/
struct ReturnInfo {
uint256 preOpGas;
uint256 prefund;
uint256 accountValidationData;
uint256 paymasterValidationData;
bytes paymasterContext;
}
/**
* Returned aggregated signature info:
* The aggregator returned by the account, and its current stake.
*/
struct AggregatorStakeInfo {
address aggregator;
StakeInfo stakeInfo;
}
/**
* Get counterfactual sender address.
* Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.
* This method always revert, and returns the address in SenderAddressResult error
* @param initCode - The constructor code to be passed into the UserOperation.
*/
function getSenderAddress(bytes memory initCode) external;
error DelegateAndRevert(bool success, bytes ret);
/**
* Helper method for dry-run testing.
* @dev calling this method, the EntryPoint will make a delegatecall to the given data, and report (via revert) the result.
* The method always revert, so is only useful off-chain for dry run calls, in cases where state-override to replace
* actual EntryPoint code is less convenient.
* @param target a target contract to make a delegatecall from entrypoint
* @param data data to pass to target in a delegatecall
*/
function delegateAndRevert(address target, bytes calldata data) external;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.5;
interface INonceManager {
/**
* Return the next nonce for this sender.
* Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)
* But UserOp with different keys can come with arbitrary order.
*
* @param sender the account address
* @param key the high 192 bit of the nonce
* @return nonce a full nonce to pass for next UserOp with this sender.
*/
function getNonce(address sender, uint192 key)
external view returns (uint256 nonce);
/**
* Manually increment the nonce of the sender.
* This method is exposed just for completeness..
* Account does NOT need to call it, neither during validation, nor elsewhere,
* as the EntryPoint will update the nonce regardless.
* Possible use-case is call it with various keys to "initialize" their nonces to one, so that future
* UserOperations will not pay extra for the first transaction with a given key.
*/
function incrementNonce(uint192 key) external;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.5;
import "./PackedUserOperation.sol";
/**
* The interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.
* A paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.
*/
interface IPaymaster {
enum PostOpMode {
// User op succeeded.
opSucceeded,
// User op reverted. Still has to pay for gas.
opReverted,
// Only used internally in the EntryPoint (cleanup after postOp reverts). Never calling paymaster with this value
postOpReverted
}
/**
* Payment validation: check if paymaster agrees to pay.
* Must verify sender is the entryPoint.
* Revert to reject this request.
* Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted).
* The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.
* @param userOp - The user operation.
* @param userOpHash - Hash of the user's request data.
* @param maxCost - The maximum cost of this transaction (based on maximum gas and gas price from userOp).
* @return context - Value to send to a postOp. Zero length to signify postOp is not required.
* @return validationData - Signature and time-range of this operation, encoded the same as the return
* value of validateUserOperation.
* <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,
* other values are invalid for paymaster.
* <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite"
* <6-byte> validAfter - first timestamp this operation is valid
* Note that the validation code cannot use block.timestamp (or block.number) directly.
*/
function validatePaymasterUserOp(
PackedUserOperation calldata userOp,
bytes32 userOpHash,
uint256 maxCost
) external returns (bytes memory context, uint256 validationData);
/**
* Post-operation handler.
* Must verify sender is the entryPoint.
* @param mode - Enum with the following options:
* opSucceeded - User operation succeeded.
* opReverted - User op reverted. The paymaster still has to pay for gas.
* postOpReverted - never passed in a call to postOp().
* @param context - The context value returned by validatePaymasterUserOp
* @param actualGasCost - Actual gas used so far (without this postOp call).
* @param actualUserOpFeePerGas - the gas price this UserOp pays. This value is based on the UserOp's maxFeePerGas
* and maxPriorityFee (and basefee)
* It is not the same as tx.gasprice, which is what the bundler pays.
*/
function postOp(
PostOpMode mode,
bytes calldata context,
uint256 actualGasCost,
uint256 actualUserOpFeePerGas
) external;
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.7.5;
/**
* Manage deposits and stakes.
* Deposit is just a balance used to pay for UserOperations (either by a paymaster or an account).
* Stake is value locked for at least "unstakeDelay" by the staked entity.
*/
interface IStakeManager {
event Deposited(address indexed account, uint256 totalDeposit);
event Withdrawn(
address indexed account,
address withdrawAddress,
uint256 amount
);
// Emitted when stake or unstake delay are modified.
event StakeLocked(
address indexed account,
uint256 totalStaked,
uint256 unstakeDelaySec
);
// Emitted once a stake is scheduled for withdrawal.
event StakeUnlocked(address indexed account, uint256 withdrawTime);
event StakeWithdrawn(
address indexed account,
address withdrawAddress,
uint256 amount
);
/**
* @param deposit - The entity's deposit.
* @param staked - True if this entity is staked.
* @param stake - Actual amount of ether staked for this entity.
* @param unstakeDelaySec - Minimum delay to withdraw the stake.
* @param withdrawTime - First block timestamp where 'withdrawStake' will be callable, or zero if already locked.
* @dev Sizes were chosen so that deposit fits into one cell (used during handleOp)
* and the rest fit into a 2nd cell (used during stake/unstake)
* - 112 bit allows for 10^15 eth
* - 48 bit for full timestamp
* - 32 bit allows 150 years for unstake delay
*/
struct DepositInfo {
uint256 deposit;
bool staked;
uint112 stake;
uint32 unstakeDelaySec;
uint48 withdrawTime;
}
// API struct used by getStakeInfo and simulateValidation.
struct StakeInfo {
uint256 stake;
uint256 unstakeDelaySec;
}
/**
* Get deposit info.
* @param account - The account to query.
* @return info - Full deposit information of given account.
*/
function getDepositInfo(
address account
) external view returns (DepositInfo memory info);
/**
* Get account balance.
* @param account - The account to query.
* @return - The deposit (for gas payment) of the account.
*/
function balanceOf(address account) external view returns (uint256);
/**
* Add to the deposit of the given account.
* @param account - The account to add to.
*/
function depositTo(address account) external payable;
/**
* Add to the account's stake - amount and delay
* any pending unstake is first cancelled.
* @param _unstakeDelaySec - The new lock duration before the deposit can be withdrawn.
*/
function addStake(uint32 _unstakeDelaySec) external payable;
/**
* Attempt to unlock the stake.
* The value can be withdrawn (using withdrawStake) after the unstake delay.
*/
function unlockStake() external;
/**
* Withdraw from the (unlocked) stake.
* Must first call unlockStake and wait for the unstakeDelay to pass.
* @param withdrawAddress - The address to send withdrawn value.
*/
function withdrawStake(address payable withdrawAddress) external;
/**
* Withdraw from the deposit.
* @param withdrawAddress - The address to send withdrawn value.
* @param withdrawAmount - The amount to withdraw.
*/
function withdrawTo(
address payable withdrawAddress,
uint256 withdrawAmount
) external;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.5;
/**
* 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) (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á <goncalo.sa@consensys.net>
*
* @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 Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
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":"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":[{"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 CandidePaymaster07.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 CandidePaymaster07.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 CandidePaymaster07.SponsoringMode","name":"mode","type":"uint8"},{"internalType":"enum CandidePaymaster07.PriceMarkupMode","name":"priceMarkupMode","type":"uint8"},{"components":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"internalType":"enum CandidePaymaster07.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 CandidePaymaster07.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 CandidePaymaster07.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 CandidePaymaster07.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 CandidePaymaster07.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 CandidePaymaster07.SponsoringMode","name":"mode","type":"uint8"},{"internalType":"enum CandidePaymaster07.PriceMarkupMode","name":"priceMarkupMode","type":"uint8"},{"components":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"internalType":"enum CandidePaymaster07.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 CandidePaymaster07.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 CandidePaymaster07.PaymasterData","name":"","type":"tuple"}],"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
60a060409080825234620001a4578181620037e38038038091620000248285620001a9565b833981010312620001a45780516001600160a01b0391828216808303620001a4576020809201519384168403620001a45733156200018c57816024916200006b33620001e3565b86516301ffc9a760e01b815263122a0e9b60e31b600482015292839182905afa90811562000181576000916200013d575b5015620000fa5750608052620000b290620001e3565b516135b890816200022b82396080518181816101c4015281816102c801528181610c3e01528181610fe6015281816110ac015281816111910152818161143a01526129660152f35b60649084519062461bcd60e51b82526004820152601e60248201527f49456e747279506f696e7420696e74657266616365206d69736d6174636800006044820152fd5b8281813d831162000179575b620001558183620001a9565b81010312620001755751908115158203620001725750386200009c565b80fd5b5080fd5b503d62000149565b85513d6000823e3d90fd5b8451631e4fbdf760e01b815260006004820152602490fd5b600080fd5b601f909101601f19168101906001600160401b03821190821017620001cd57604052565b634e487b7160e01b600052604160045260246000fd5b600080546001600160a01b039283166001600160a01b03198216811783559216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a356fe6080604052600436101561001257600080fd5b60003560e01c80630396cb6014610167578063205c2878146101625780632c7f92cc1461015d57806352b7512c146101585780635ab244d914610153578063715018a61461014e578063796d4371146101495780637c627b21146101445780637fa5c1901461013f5780638da5cb5b1461013a57806394d4ad60146101355780639a6e85f014610130578063b0d691fe1461012b578063b9221a4014610126578063bb9fe6bf14610121578063c23a5cea1461011c578063c399ec8814610117578063cc9c837c14610112578063d0e30db01461010d578063ed9f0ef1146101085763f2fde38b1461010357600080fd5b61150b565b6114a7565b6113f8565b6111fa565b611119565b61104e565b610f96565b610e83565b610bf3565b610ad8565b6109dd565b610981565b61088b565b610816565b610796565b6106f9565b610616565b610406565b61034c565b61026a565b600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445760043563ffffffff8116809103610240576101ac61246e565b8173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691823b15610240576024604051809481937f0396cb60000000000000000000000000000000000000000000000000000000008352600483015234905af1801561023b5761022f575080f35b61023890610c91565b80f35b6115f1565b5080fd5b80fd5b73ffffffffffffffffffffffffffffffffffffffff81160361026557565b600080fd5b3461026557600060407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610244576004356102a781610247565b6102af61246e565b8173ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001692833b1561033d576044908360405195869485937f205c287800000000000000000000000000000000000000000000000000000000855216600484015260243560248401525af1801561023b5761022f575080f35b8280fd5b60ff81160361026557565b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026557602061039160043561038c81610341565b6117c4565b604051908152f35b90816101209103126102655790565b919082519283825260005b8481106103f25750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016103b3565b346102655760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043567ffffffffffffffff81116102655761047061045b610484923690600401610399565b61046361294f565b6044359060243590612ade565b6040519283926040845260408401906103a8565b9060208301520390f35b9060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8301126102655760043567ffffffffffffffff9283821161026557806023830112156102655781600401359384116102655760248460051b83010111610265576024019190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002111561053257565b6104f9565b9073ffffffffffffffffffffffffffffffffffffffff825116815260208201516002811015610532576020820152608080610581604085015160a0604086015260a08501906103a8565b9360608101516060850152015191015290565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b8483106105ca5750505050505090565b9091929394958480610606837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a51610537565b98019301930191949392906105ba565b34610265576106243661048e565b9061062e82611935565b9161063c6040519384610cff565b8083527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061066982611935565b0160005b8181106106e257505060005b818110610692576040518061068e8682610594565b0390f35b806106c66106c16106ae6106a960019587896119a8565b6119bd565b60ff166000526001602052604060002090565b611650565b6106d082876119c7565b526106db81866119c7565b5001610679565b6020906106ed61194d565b8282880101520161066d565b34610265576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445761073161246e565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760206040516188b88152f35b6003111561026557565b35906107e6826107d1565b565b9181601f840112156102655782359167ffffffffffffffff8311610265576020838186019501011161026557565b346102655760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576108506004356107d1565b60243567ffffffffffffffff8111610265576108736108899136906004016107e8565b9061087c61294f565b6064359160443591612e55565b005b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576004356108c681610341565b73ffffffffffffffffffffffffffffffffffffffff6000541633036108fd5760ff1660005260016020526108896040600020611a4b565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f435030323a206f6e6c79206f776e65722063616e207265766f6b65207375707060448201527f6f7274656420746f6b656e7300000000000000000000000000000000000000006064820152fd5b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026557602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b6003111561053257565b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043567ffffffffffffffff811161026557610a38610a3261068e9236906004016107e8565b90611d68565b604051918291602083528051610a4d816109d3565b60208401526020810151610a60816109d3565b604084015260c0610a81604083015160e06060870152610100860190610537565b9160608101516080860152608081015160a086015265ffffffffffff60a0820151168286015201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160e08501526103a8565b34610265577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040813601126102655760043590610b1582610341565b6024359067ffffffffffffffff82116102655760a09082360301126102655773ffffffffffffffffffffffffffffffffffffffff600054163303610b6f5760ff61088992166000526001602052600401604060002061201c565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f435030313a206f6e6c79206f776e65722063616e2061646420737570706f727460448201527f656420746f6b656e7300000000000000000000000000000000000000000000006064820152fd5b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026557602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff8111610ca557604052565b610c62565b60a0810190811067ffffffffffffffff821117610ca557604052565b6080810190811067ffffffffffffffff821117610ca557604052565b610100810190811067ffffffffffffffff821117610ca557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610ca557604052565b6040519060e0820182811067ffffffffffffffff821117610ca557604052565b6002111561026557565b67ffffffffffffffff8111610ca557601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192610db082610d6a565b91610dbe6040519384610cff565b829481845281830111610265578281602093846000960137010152565b9080601f8301121561026557816020610df693359101610da4565b90565b91909160a0818403126102655760405190610e1382610caa565b81938135610e2081610247565b83526020820135610e3081610d60565b602084015260408201359167ffffffffffffffff831161026557610e5a6080939284938301610ddb565b6040850152606081013560608501520135910152565b359065ffffffffffff8216820361026557565b34610265577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040813601126102655767ffffffffffffffff9060043582811161026557610ed5903690600401610399565b602435918383116102655760e090833603011261026557610ef4610d40565b90610f01836004016107db565b8252610f0f602484016107db565b6020830152604483013584811161026557610f309060043691860101610df9565b60408301526064830135606083015260848301356080830152610f5560a48401610e70565b60a083015260c483013593841161026557610f7c610f8693600461068e9636920101610ddb565b60c083015261228a565b6040519081529081906020820190565b34610265576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024457610fce61246e565b8073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b1561104b5781906004604051809481937fbb9fe6bf0000000000000000000000000000000000000000000000000000000083525af1801561023b5761022f575080f35b50fd5b3461026557600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445760043561108b81610247565b61109361246e565b8173ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001692833b1561033d576024908360405195869485937fc23a5cea0000000000000000000000000000000000000000000000000000000085521660048401525af1801561023b5761022f575080f35b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa801561023b576020916000916111cd575b50604051908152f35b6111ed9150823d84116111f3575b6111e58183610cff565b81019061245f565b386111c4565b503d6111db565b346102655760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043561123581610247565b6024359061124282610247565b73ffffffffffffffffffffffffffffffffffffffff9060009282845416330361137557838091846112eb9416946040519060208201927fa9059cbb0000000000000000000000000000000000000000000000000000000084521660248201526044356044820152604481526112b681610cc6565b519082865af13d1561136d573d906112cd82610d6a565b916112db6040519384610cff565b82523d85602084013e5b836134e2565b805190811515918261134b575b5050611302575080f35b6040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152602490fd5b61136692509060208061136293830101910161331c565b1590565b38806112f8565b6060906112e5565b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f435030303a206f6e6c79206f776e65722063616e20776974686472617720746f60448201527f6b656e73000000000000000000000000000000000000000000000000000000006064820152fd5b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001681813b1561024457602491604051928380927fb760faf900000000000000000000000000000000000000000000000000000000825230600483015234905af1801561023b5761022f575080f35b34610265576114b53661048e565b60005b8181106114c157005b806114cf60019284866119a8565b356114d981610341565b6114e2816117c4565b90816114f1575b5050016114b8565b60ff166000528260205260026040600020015538806114e9565b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043561154681610247565b61154e61246e565b73ffffffffffffffffffffffffffffffffffffffff80911680156115c0576000918254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60246040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152fd5b6040513d6000823e3d90fd5b90600182811c92168015611646575b602083101461161757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f169161160c565b9060405161165d81610caa565b809260ff815473ffffffffffffffffffffffffffffffffffffffff8116845260a01c1660209060028110156105325781840152600180830191604051926000928154916116a9836115fd565b808752926001811690811561172657506001146116ed575b5050505091816116d76003936080950382610cff565b6040850152600281015460608501520154910152565b6000908152838120939450925b82841061171357505050820101816116d78160806116c1565b80548685018601529284019281016116fa565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685880152505050151560051b8301019050816116d78160806116c1565b90602082519201517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081811693601481106117a057505050565b60140360031b82901b16169150565b908160209103126102655751610df681610341565b6106c16117de9160ff166000526001602052604060002090565b73ffffffffffffffffffffffffffffffffffffffff61182d611814835173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b161561192f57600090602081015161184481610528565b61184d81610528565b61191e5760049150604081019060206118a861181461188d61188061187b61188661188061187b8a51612531565b611765565b60601c90565b975161259a565b935173ffffffffffffffffffffffffffffffffffffffff1690565b604051948580927f313ce5670000000000000000000000000000000000000000000000000000000082525afa91821561023b57610df6936000936118ed575b50612783565b61191091935060203d602011611917575b6119088183610cff565b8101906117af565b91386118e7565b503d6118fe565b604061192b910151612531565b5090565b50600090565b67ffffffffffffffff8111610ca55760051b60200190565b6040519061195a82610caa565b6000608083828152826020820152606060408201528260608201520152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b91908110156119b85760051b0190565b611979565b35610df681610341565b80518210156119b85760209160051b010190565b8181106119e6575050565b600081556001016119db565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b906188b89180830292830403611a3357565b6119f2565b81810292918115918404141715611a3357565b60036000918281558260018201611a6281546115fd565b80611a73575b505060028201550155565b82601f8211600114611a8b575050555b823880611a68565b9091808252611aa9601f60208420940160051c8401600185016119db565b5555611a83565b6040519060e0820182811067ffffffffffffffff821117610ca557604052606060c0836000815260006020820152611ae661194d565b604082015260008382015260006080820152600060a08201520152565b906001116102655790600190565b906002116102655760010190600190565b906008116102655760020190600690565b909291928360081161026557831161026557600801917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80190565b906003116102655760020190600190565b906009116102655760030190600690565b906029116102655760090190602090565b909291928360341161026557831161026557603401917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc0190565b909291928360091161026557831161026557600901917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70190565b909291928360291161026557831161026557602901917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd70190565b909291928360491161026557831161026557604901917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb70190565b7fff000000000000000000000000000000000000000000000000000000000000009035818116939260018110611cc257505050565b60010360031b82901b16169150565b60ff16610df6816109d3565b7fffffffffffff00000000000000000000000000000000000000000000000000009035818116939260068110611d1257505050565b60060360031b82901b16169150565b359060208110611d2f575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060200360031b1b1690565b611d65826109d3565b52565b611d70611ab0565b50611d95611d90611d8a611d848585611b03565b90611c8d565b60f81c90565b611cd1565b91611da9611d90611d8a611d848486611b11565b60008052600160205291611ddc7fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49611650565b60006a52b7d2dcc80cd2e400000081606093611df7896109d3565b88611eb557505050505090611e8f9282611e1a611d8a611d8485611ead97611b6e565b90611e70611e3a611e34611e2e8785611b7f565b90611cdd565b60d01c90565b94611e686106c1611e54611e4e8487611b90565b90611d21565b9560ff166000526001602052604060002090565b9283866130b5565b9690935b611e86611e7f610d40565b998a611d5c565b60208901611d5c565b60408701526060860152608085015265ffffffffffff1660a0840152565b60c082015290565b611ebe896109d3565b60018903611f2857505050505090611e8f9282611ee4611d8a611d8485611ead97611b6e565b92611f20611f126106c1611efe611e34611e2e8688611b7f565b9660ff166000526001602052604060002090565b916060830151938386612fba565b969093611e74565b919395611f3889969294966109d3565b60028914611f50575b5050611e8f611ead9596611e74565b611ead9650819550611f798180611f73611e34611e2e611f8096611e8f98611b22565b98611b33565b3691610da4565b95611f41565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610265570180359067ffffffffffffffff82116102655760200191813603831361026557565b9190601f8111611fe657505050565b6107e6926000526020600020906020601f840160051c83019310612012575b601f0160051c01906119db565b9091508190612005565b9061206c813561202b81610247565b839073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b60208082013561207b81610d60565b6002811015610532577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000085549260a01b1691161783556001808401916120da6040850185611f86565b9267ffffffffffffffff8411610ca5576120fe846120f887546115fd565b87611fd7565b600092601f851160011461217457505082600395936080959361215593600092612169575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b90555b606081013560028501550135910155565b013590503880612123565b92907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516906121a987600052602060002090565b9483915b83831061220e575050509260019285926003989660809896106121d8575b505050811b019055612158565b01357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83891b60f8161c191690553880806121cb565b8585013587559586019593810193918101916121ad565b94909897969373ffffffffffffffffffffffffffffffffffffffff65ffffffffffff9460e0989461010089019c89526020890152166040870152612268816109d3565b6060860152612276816109d3565b60808501521660a083015260c08201520152565b6122ad916122a461229e60e0840184611f86565b90613179565b949150926131aa565b81516122b8816109d3565b6122ee60208401958651956122cc876109d3565b60a086015165ffffffffffff166040519788956020870197309046908a612225565b03926123207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe094858101835282610cff565b5190209260028251612331816109d3565b61233a816109d3565b036123ec575b815161234b816109d3565b612354816109d3565b156123a8575b60029051612367816109d3565b612370816109d3565b1461237a57505090565b6080015160408051602081019485529081019190915260609182018152906123a29082610cff565b51902090565b926002906123d56123e1606085015160405192839160208301958660209093929193604081019481520152565b03868101835282610cff565b51902093905061235a565b9261244a612456612419611814604086015173ffffffffffffffffffffffffffffffffffffffff90511690565b604080516020810195865273ffffffffffffffffffffffffffffffffffffffff909216908201529182906060820190565b03858101835282610cff565b51902092612340565b90816020910312610265575190565b73ffffffffffffffffffffffffffffffffffffffff60005416330361248f57565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b91908201809211611a3357565b156124d357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b61253f6014825110156124cc565b6040519060148083019101602883015b80831061258757505060148252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b909182518152602080910192019061254f565b6125a8603c825110156124cc565b604051906008820190601c01603083015b8083106125f157505060288252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b90918251815260208091019201906125b9565b1561260b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964205f646563696d616c730000000000000000000000000000006044820152fd5b604d8111611a3357600a0a90565b519069ffffffffffffffffffff8216820361026557565b908160a0910312610265576126a281612677565b91602082015191604081015191610df6608060608401519301612677565b8181029291600082127f8000000000000000000000000000000000000000000000000000000000000000821416611a33578184051490151715611a3357565b8115612754577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f8000000000000000000000000000000000000000000000000000000000000000821416611a33570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b916127a260ff821680151580612944575b61279d90612604565b612669565b73ffffffffffffffffffffffffffffffffffffffff80941691604051907ffeaf968c000000000000000000000000000000000000000000000000000000009384835260a0968784600481855afa93841561023b57600094612920575b5060405193847f313ce567000000000000000000000000000000000000000000000000000000009384825281600460209889935afa801561023b5761284d928692600092612901575b50613257565b9616946040519081528781600481895afa97881561023b576000986128c9575b5050829060046040518097819382525afa801561023b57610df6966128a59561289f946000936128aa575b5050613257565b926126c0565b6126ff565b6128c1929350803d10611917576119088183610cff565b903880612898565b8492985090816128ed92903d106128fa575b6128e58183610cff565b81019061268e565b505050905096903861286d565b503d6128db565b612919919250883d8a11611917576119088183610cff565b9038612847565b612938919450883d8a116128fa576128e58183610cff565b505050905092386127fe565b506012811115612794565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016330361298e57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f53656e646572206e6f7420456e747279506f696e7400000000000000000000006044820152fd5b156129f357565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f435030313a20696e76616c6964207369676e6174757265206c656e677468206960448201527f6e207061796d6173746572416e644461746100000000000000000000000000006064820152fd5b604051906020820182811067ffffffffffffffff821117610ca55760405260008252565b9195949360809360a084019773ffffffffffffffffffffffffffffffffffffffff80941685526020850152612acf816109d3565b60408401521660608201520152565b909291612afb610a32612af460e0850185611f86565b8091611ba1565b9160c08301612b1881515160408114908115612e08575b506129ec565b73ffffffffffffffffffffffffffffffffffffffff612b5a8184351694612b546fffffffffffffffffffffffffffffffff60c087013516611a21565b906124bf565b9285606081019485519560028351612b71816109d3565b612b7a816109d3565b03612cd8575b5050612bc4612b9561181492612be59461228a565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b60005473ffffffffffffffffffffffffffffffffffffffff169451906132b0565b911603612c8f5782612c60612c6d93612c3460a094610df69751612c08816109d3565b60408601515173ffffffffffffffffffffffffffffffffffffffff16906040519b8c9560208701612a9b565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101885287610cff565b015165ffffffffffff1690565b60a01b79ffffffffffff00000000000000000000000000000000000000001690565b505060a00151909150612ccb9065ffffffffffff165b79ffffffffffff00000000000000000000000000000000000000009060a01b1660011790565b90612cd4612a77565b9190565b9091608001519081612dde575b5050604087015151612d0c9073ffffffffffffffffffffffffffffffffffffffff16611814565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816600482015290602090829060249082905afa91821561023b578691600093612db3575b50612d8891612d7a91611a38565b670de0b6b3a7640000900490565b11612d9557853880612b80565b5050505050612ccb91925060a0612ca591015165ffffffffffff1690565b612d7a91935091612dd5612d889360203d6020116111f3576111e58183610cff565b93915091612d6c565b612e0092965090612def9151611a38565b6a52b7d2dcc80cd2e4000000900490565b933880612ce5565b604191501438612b12565b908160a0910312610265578035612e2981610247565b916020820135916040810135612e3e816107d1565b9160806060830135612e4f81610247565b92013590565b612e6191810190612e13565b91949095600273ffffffffffffffffffffffffffffffffffffffff95949580951696612e8c816109d3565b14612f7e5791612ea5612d7a92612b54612eaa95611a21565b611a38565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff8516602482015230604482015260648082018390528152909490612f1b9061136290612f15608482610cff565b836132c6565b612f545760405194855216927fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf84719080602081015b0390a4565b1692507ffd192c7f8c08f26e917720fa6006252183cc42217b5f8269b8fafa9764f48cfe600080a4565b50505050600092507fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf847160405180612f4f81906000602083019252565b939291936a52b7d2dcc80cd2e4000000606091612fd6816109d3565b60018103612ff45750505081610df6926080611f7993015195611bdc565b90919250613004819694966109d3565b600281036130565750505061301c611e4e8483611b90565b928060291161026557610df69160297fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd73693019101610da4565b6130648196929493966109d3565b15613070575b50509190565b8091929450600911610265576130ad9160097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73693019101610da4565b91388061306a565b939291936a52b7d2dcc80cd2e40000006060916130d1816109d3565b600181036130ef5750505081610df6926080611f7993015195611c17565b909192506130fc816109d3565b60028103613122575050508060491161026557611f7981610df692602986013595611c52565b613131819693969492946109d3565b1561313c5750509190565b8091929450602911610265576130ad9160297fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd73693019101610da4565b908060141161026557806024116102655760341161026557803560601c916024601483013560801c92013560801c90565b8035906131b682610247565b60c06131c8611f796040840184611f86565b60208151910120916131e0611f796060830183611f86565b602081519101206040519373ffffffffffffffffffffffffffffffffffffffff60208601961686526020830135604086015260608501526080840152608081013560a084015260a081013582840152013560e082015260e081526123a281610ce2565b9060ff8091169116039060ff8211611a3357565b9060ff831660ff821681811060001461328a57505060ff61327e61328492610df695613243565b16612669565b906126c0565b9392931161329757505090565b60ff61327e610df694936132aa93613243565b906126ff565b610df6916132bd91613334565b9092919261337a565b906000602091828151910182855af1903d60005190836132e7575b50505090565b91925090613312575073ffffffffffffffffffffffffffffffffffffffff163b15155b3880806132e1565b600191501461330a565b90816020910312610265575180151581036102655790565b81519190604183036133655761335e92506020820151906060604084015193015160001a90613451565b9192909190565b505060009160029190565b6004111561053257565b61338381613370565b8061338c575050565b61339581613370565b600181036133c75760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b6133d081613370565b6002810361340a576040517ffce698f700000000000000000000000000000000000000000000000000000000815260048101839052602490fd5b80613416600392613370565b1461341e5750565b6040517fd78bce0c0000000000000000000000000000000000000000000000000000000081526004810191909152602490fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084116134d657926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561023b57805173ffffffffffffffffffffffffffffffffffffffff8116156134cd57918190565b50809160019190565b50505060009160039190565b9061352157508051156134f757805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b81511580613579575b613532575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561352a56fea2646970667358221220d6806df3ba725bfac626eb510ee5f35596a80f71ebb3b97d0580ef7fc282701164736f6c634300081700330000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0320000000000000000000000003cfdc212769c890907bce93d3d8c2c53de6a7a89
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80630396cb6014610167578063205c2878146101625780632c7f92cc1461015d57806352b7512c146101585780635ab244d914610153578063715018a61461014e578063796d4371146101495780637c627b21146101445780637fa5c1901461013f5780638da5cb5b1461013a57806394d4ad60146101355780639a6e85f014610130578063b0d691fe1461012b578063b9221a4014610126578063bb9fe6bf14610121578063c23a5cea1461011c578063c399ec8814610117578063cc9c837c14610112578063d0e30db01461010d578063ed9f0ef1146101085763f2fde38b1461010357600080fd5b61150b565b6114a7565b6113f8565b6111fa565b611119565b61104e565b610f96565b610e83565b610bf3565b610ad8565b6109dd565b610981565b61088b565b610816565b610796565b6106f9565b610616565b610406565b61034c565b61026a565b600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445760043563ffffffff8116809103610240576101ac61246e565b8173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321691823b15610240576024604051809481937f0396cb60000000000000000000000000000000000000000000000000000000008352600483015234905af1801561023b5761022f575080f35b61023890610c91565b80f35b6115f1565b5080fd5b80fd5b73ffffffffffffffffffffffffffffffffffffffff81160361026557565b600080fd5b3461026557600060407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610244576004356102a781610247565b6102af61246e565b8173ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321692833b1561033d576044908360405195869485937f205c287800000000000000000000000000000000000000000000000000000000855216600484015260243560248401525af1801561023b5761022f575080f35b8280fd5b60ff81160361026557565b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026557602061039160043561038c81610341565b6117c4565b604051908152f35b90816101209103126102655790565b919082519283825260005b8481106103f25750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016103b3565b346102655760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043567ffffffffffffffff81116102655761047061045b610484923690600401610399565b61046361294f565b6044359060243590612ade565b6040519283926040845260408401906103a8565b9060208301520390f35b9060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc8301126102655760043567ffffffffffffffff9283821161026557806023830112156102655781600401359384116102655760248460051b83010111610265576024019190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002111561053257565b6104f9565b9073ffffffffffffffffffffffffffffffffffffffff825116815260208201516002811015610532576020820152608080610581604085015160a0604086015260a08501906103a8565b9360608101516060850152015191015290565b6020808201906020835283518092526040830192602060408460051b8301019501936000915b8483106105ca5750505050505090565b9091929394958480610606837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a51610537565b98019301930191949392906105ba565b34610265576106243661048e565b9061062e82611935565b9161063c6040519384610cff565b8083527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061066982611935565b0160005b8181106106e257505060005b818110610692576040518061068e8682610594565b0390f35b806106c66106c16106ae6106a960019587896119a8565b6119bd565b60ff166000526001602052604060002090565b611650565b6106d082876119c7565b526106db81866119c7565b5001610679565b6020906106ed61194d565b8282880101520161066d565b34610265576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445761073161246e565b8073ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760206040516188b88152f35b6003111561026557565b35906107e6826107d1565b565b9181601f840112156102655782359167ffffffffffffffff8311610265576020838186019501011161026557565b346102655760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576108506004356107d1565b60243567ffffffffffffffff8111610265576108736108899136906004016107e8565b9061087c61294f565b6064359160443591612e55565b005b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576004356108c681610341565b73ffffffffffffffffffffffffffffffffffffffff6000541633036108fd5760ff1660005260016020526108896040600020611a4b565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f435030323a206f6e6c79206f776e65722063616e207265766f6b65207375707060448201527f6f7274656420746f6b656e7300000000000000000000000000000000000000006064820152fd5b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026557602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b6003111561053257565b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043567ffffffffffffffff811161026557610a38610a3261068e9236906004016107e8565b90611d68565b604051918291602083528051610a4d816109d3565b60208401526020810151610a60816109d3565b604084015260c0610a81604083015160e06060870152610100860190610537565b9160608101516080860152608081015160a086015265ffffffffffff60a0820151168286015201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08483030160e08501526103a8565b34610265577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040813601126102655760043590610b1582610341565b6024359067ffffffffffffffff82116102655760a09082360301126102655773ffffffffffffffffffffffffffffffffffffffff600054163303610b6f5760ff61088992166000526001602052600401604060002061201c565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f435030313a206f6e6c79206f776e65722063616e2061646420737570706f727460448201527f656420746f6b656e7300000000000000000000000000000000000000000000006064820152fd5b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261026557602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032168152f35b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b67ffffffffffffffff8111610ca557604052565b610c62565b60a0810190811067ffffffffffffffff821117610ca557604052565b6080810190811067ffffffffffffffff821117610ca557604052565b610100810190811067ffffffffffffffff821117610ca557604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610ca557604052565b6040519060e0820182811067ffffffffffffffff821117610ca557604052565b6002111561026557565b67ffffffffffffffff8111610ca557601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192610db082610d6a565b91610dbe6040519384610cff565b829481845281830111610265578281602093846000960137010152565b9080601f8301121561026557816020610df693359101610da4565b90565b91909160a0818403126102655760405190610e1382610caa565b81938135610e2081610247565b83526020820135610e3081610d60565b602084015260408201359167ffffffffffffffff831161026557610e5a6080939284938301610ddb565b6040850152606081013560608501520135910152565b359065ffffffffffff8216820361026557565b34610265577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040813601126102655767ffffffffffffffff9060043582811161026557610ed5903690600401610399565b602435918383116102655760e090833603011261026557610ef4610d40565b90610f01836004016107db565b8252610f0f602484016107db565b6020830152604483013584811161026557610f309060043691860101610df9565b60408301526064830135606083015260848301356080830152610f5560a48401610e70565b60a083015260c483013593841161026557610f7c610f8693600461068e9636920101610ddb565b60c083015261228a565b6040519081529081906020820190565b34610265576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261024457610fce61246e565b8073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da03216803b1561104b5781906004604051809481937fbb9fe6bf0000000000000000000000000000000000000000000000000000000083525af1801561023b5761022f575080f35b50fd5b3461026557600060207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445760043561108b81610247565b61109361246e565b8173ffffffffffffffffffffffffffffffffffffffff807f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321692833b1561033d576024908360405195869485937fc23a5cea0000000000000000000000000000000000000000000000000000000085521660048401525af1801561023b5761022f575080f35b346102655760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610265576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260208160248173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032165afa801561023b576020916000916111cd575b50604051908152f35b6111ed9150823d84116111f3575b6111e58183610cff565b81019061245f565b386111c4565b503d6111db565b346102655760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043561123581610247565b6024359061124282610247565b73ffffffffffffffffffffffffffffffffffffffff9060009282845416330361137557838091846112eb9416946040519060208201927fa9059cbb0000000000000000000000000000000000000000000000000000000084521660248201526044356044820152604481526112b681610cc6565b519082865af13d1561136d573d906112cd82610d6a565b916112db6040519384610cff565b82523d85602084013e5b836134e2565b805190811515918261134b575b5050611302575080f35b6040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff919091166004820152602490fd5b61136692509060208061136293830101910161331c565b1590565b38806112f8565b6060906112e5565b60846040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f435030303a206f6e6c79206f776e65722063616e20776974686472617720746f60448201527f6b656e73000000000000000000000000000000000000000000000000000000006064820152fd5b6000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102445773ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0321681813b1561024457602491604051928380927fb760faf900000000000000000000000000000000000000000000000000000000825230600483015234905af1801561023b5761022f575080f35b34610265576114b53661048e565b60005b8181106114c157005b806114cf60019284866119a8565b356114d981610341565b6114e2816117c4565b90816114f1575b5050016114b8565b60ff166000528260205260026040600020015538806114e9565b346102655760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102655760043561154681610247565b61154e61246e565b73ffffffffffffffffffffffffffffffffffffffff80911680156115c0576000918254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60246040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152fd5b6040513d6000823e3d90fd5b90600182811c92168015611646575b602083101461161757565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f169161160c565b9060405161165d81610caa565b809260ff815473ffffffffffffffffffffffffffffffffffffffff8116845260a01c1660209060028110156105325781840152600180830191604051926000928154916116a9836115fd565b808752926001811690811561172657506001146116ed575b5050505091816116d76003936080950382610cff565b6040850152600281015460608501520154910152565b6000908152838120939450925b82841061171357505050820101816116d78160806116c1565b80548685018601529284019281016116fa565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685880152505050151560051b8301019050816116d78160806116c1565b90602082519201517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081811693601481106117a057505050565b60140360031b82901b16169150565b908160209103126102655751610df681610341565b6106c16117de9160ff166000526001602052604060002090565b73ffffffffffffffffffffffffffffffffffffffff61182d611814835173ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b161561192f57600090602081015161184481610528565b61184d81610528565b61191e5760049150604081019060206118a861181461188d61188061187b61188661188061187b8a51612531565b611765565b60601c90565b975161259a565b935173ffffffffffffffffffffffffffffffffffffffff1690565b604051948580927f313ce5670000000000000000000000000000000000000000000000000000000082525afa91821561023b57610df6936000936118ed575b50612783565b61191091935060203d602011611917575b6119088183610cff565b8101906117af565b91386118e7565b503d6118fe565b604061192b910151612531565b5090565b50600090565b67ffffffffffffffff8111610ca55760051b60200190565b6040519061195a82610caa565b6000608083828152826020820152606060408201528260608201520152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b91908110156119b85760051b0190565b611979565b35610df681610341565b80518210156119b85760209160051b010190565b8181106119e6575050565b600081556001016119db565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b906188b89180830292830403611a3357565b6119f2565b81810292918115918404141715611a3357565b60036000918281558260018201611a6281546115fd565b80611a73575b505060028201550155565b82601f8211600114611a8b575050555b823880611a68565b9091808252611aa9601f60208420940160051c8401600185016119db565b5555611a83565b6040519060e0820182811067ffffffffffffffff821117610ca557604052606060c0836000815260006020820152611ae661194d565b604082015260008382015260006080820152600060a08201520152565b906001116102655790600190565b906002116102655760010190600190565b906008116102655760020190600690565b909291928360081161026557831161026557600801917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80190565b906003116102655760020190600190565b906009116102655760030190600690565b906029116102655760090190602090565b909291928360341161026557831161026557603401917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcc0190565b909291928360091161026557831161026557600901917ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70190565b909291928360291161026557831161026557602901917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd70190565b909291928360491161026557831161026557604901917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb70190565b7fff000000000000000000000000000000000000000000000000000000000000009035818116939260018110611cc257505050565b60010360031b82901b16169150565b60ff16610df6816109d3565b7fffffffffffff00000000000000000000000000000000000000000000000000009035818116939260068110611d1257505050565b60060360031b82901b16169150565b359060208110611d2f575090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9060200360031b1b1690565b611d65826109d3565b52565b611d70611ab0565b50611d95611d90611d8a611d848585611b03565b90611c8d565b60f81c90565b611cd1565b91611da9611d90611d8a611d848486611b11565b60008052600160205291611ddc7fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49611650565b60006a52b7d2dcc80cd2e400000081606093611df7896109d3565b88611eb557505050505090611e8f9282611e1a611d8a611d8485611ead97611b6e565b90611e70611e3a611e34611e2e8785611b7f565b90611cdd565b60d01c90565b94611e686106c1611e54611e4e8487611b90565b90611d21565b9560ff166000526001602052604060002090565b9283866130b5565b9690935b611e86611e7f610d40565b998a611d5c565b60208901611d5c565b60408701526060860152608085015265ffffffffffff1660a0840152565b60c082015290565b611ebe896109d3565b60018903611f2857505050505090611e8f9282611ee4611d8a611d8485611ead97611b6e565b92611f20611f126106c1611efe611e34611e2e8688611b7f565b9660ff166000526001602052604060002090565b916060830151938386612fba565b969093611e74565b919395611f3889969294966109d3565b60028914611f50575b5050611e8f611ead9596611e74565b611ead9650819550611f798180611f73611e34611e2e611f8096611e8f98611b22565b98611b33565b3691610da4565b95611f41565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610265570180359067ffffffffffffffff82116102655760200191813603831361026557565b9190601f8111611fe657505050565b6107e6926000526020600020906020601f840160051c83019310612012575b601f0160051c01906119db565b9091508190612005565b9061206c813561202b81610247565b839073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b60208082013561207b81610d60565b6002811015610532577fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff74ff000000000000000000000000000000000000000085549260a01b1691161783556001808401916120da6040850185611f86565b9267ffffffffffffffff8411610ca5576120fe846120f887546115fd565b87611fd7565b600092601f851160011461217457505082600395936080959361215593600092612169575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b90555b606081013560028501550135910155565b013590503880612123565b92907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516906121a987600052602060002090565b9483915b83831061220e575050509260019285926003989660809896106121d8575b505050811b019055612158565b01357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83891b60f8161c191690553880806121cb565b8585013587559586019593810193918101916121ad565b94909897969373ffffffffffffffffffffffffffffffffffffffff65ffffffffffff9460e0989461010089019c89526020890152166040870152612268816109d3565b6060860152612276816109d3565b60808501521660a083015260c08201520152565b6122ad916122a461229e60e0840184611f86565b90613179565b949150926131aa565b81516122b8816109d3565b6122ee60208401958651956122cc876109d3565b60a086015165ffffffffffff166040519788956020870197309046908a612225565b03926123207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe094858101835282610cff565b5190209260028251612331816109d3565b61233a816109d3565b036123ec575b815161234b816109d3565b612354816109d3565b156123a8575b60029051612367816109d3565b612370816109d3565b1461237a57505090565b6080015160408051602081019485529081019190915260609182018152906123a29082610cff565b51902090565b926002906123d56123e1606085015160405192839160208301958660209093929193604081019481520152565b03868101835282610cff565b51902093905061235a565b9261244a612456612419611814604086015173ffffffffffffffffffffffffffffffffffffffff90511690565b604080516020810195865273ffffffffffffffffffffffffffffffffffffffff909216908201529182906060820190565b03858101835282610cff565b51902092612340565b90816020910312610265575190565b73ffffffffffffffffffffffffffffffffffffffff60005416330361248f57565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b91908201809211611a3357565b156124d357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b61253f6014825110156124cc565b6040519060148083019101602883015b80831061258757505060148252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b909182518152602080910192019061254f565b6125a8603c825110156124cc565b604051906008820190601c01603083015b8083106125f157505060288252601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660405290565b90918251815260208091019201906125b9565b1561260b57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964205f646563696d616c730000000000000000000000000000006044820152fd5b604d8111611a3357600a0a90565b519069ffffffffffffffffffff8216820361026557565b908160a0910312610265576126a281612677565b91602082015191604081015191610df6608060608401519301612677565b8181029291600082127f8000000000000000000000000000000000000000000000000000000000000000821416611a33578184051490151715611a3357565b8115612754577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82147f8000000000000000000000000000000000000000000000000000000000000000821416611a33570590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b916127a260ff821680151580612944575b61279d90612604565b612669565b73ffffffffffffffffffffffffffffffffffffffff80941691604051907ffeaf968c000000000000000000000000000000000000000000000000000000009384835260a0968784600481855afa93841561023b57600094612920575b5060405193847f313ce567000000000000000000000000000000000000000000000000000000009384825281600460209889935afa801561023b5761284d928692600092612901575b50613257565b9616946040519081528781600481895afa97881561023b576000986128c9575b5050829060046040518097819382525afa801561023b57610df6966128a59561289f946000936128aa575b5050613257565b926126c0565b6126ff565b6128c1929350803d10611917576119088183610cff565b903880612898565b8492985090816128ed92903d106128fa575b6128e58183610cff565b81019061268e565b505050905096903861286d565b503d6128db565b612919919250883d8a11611917576119088183610cff565b9038612847565b612938919450883d8a116128fa576128e58183610cff565b505050905092386127fe565b506012811115612794565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da03216330361298e57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f53656e646572206e6f7420456e747279506f696e7400000000000000000000006044820152fd5b156129f357565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f435030313a20696e76616c6964207369676e6174757265206c656e677468206960448201527f6e207061796d6173746572416e644461746100000000000000000000000000006064820152fd5b604051906020820182811067ffffffffffffffff821117610ca55760405260008252565b9195949360809360a084019773ffffffffffffffffffffffffffffffffffffffff80941685526020850152612acf816109d3565b60408401521660608201520152565b909291612afb610a32612af460e0850185611f86565b8091611ba1565b9160c08301612b1881515160408114908115612e08575b506129ec565b73ffffffffffffffffffffffffffffffffffffffff612b5a8184351694612b546fffffffffffffffffffffffffffffffff60c087013516611a21565b906124bf565b9285606081019485519560028351612b71816109d3565b612b7a816109d3565b03612cd8575b5050612bc4612b9561181492612be59461228a565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600052601c52603c60002090565b60005473ffffffffffffffffffffffffffffffffffffffff169451906132b0565b911603612c8f5782612c60612c6d93612c3460a094610df69751612c08816109d3565b60408601515173ffffffffffffffffffffffffffffffffffffffff16906040519b8c9560208701612a9b565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101885287610cff565b015165ffffffffffff1690565b60a01b79ffffffffffff00000000000000000000000000000000000000001690565b505060a00151909150612ccb9065ffffffffffff165b79ffffffffffff00000000000000000000000000000000000000009060a01b1660011790565b90612cd4612a77565b9190565b9091608001519081612dde575b5050604087015151612d0c9073ffffffffffffffffffffffffffffffffffffffff16611814565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816600482015290602090829060249082905afa91821561023b578691600093612db3575b50612d8891612d7a91611a38565b670de0b6b3a7640000900490565b11612d9557853880612b80565b5050505050612ccb91925060a0612ca591015165ffffffffffff1690565b612d7a91935091612dd5612d889360203d6020116111f3576111e58183610cff565b93915091612d6c565b612e0092965090612def9151611a38565b6a52b7d2dcc80cd2e4000000900490565b933880612ce5565b604191501438612b12565b908160a0910312610265578035612e2981610247565b916020820135916040810135612e3e816107d1565b9160806060830135612e4f81610247565b92013590565b612e6191810190612e13565b91949095600273ffffffffffffffffffffffffffffffffffffffff95949580951696612e8c816109d3565b14612f7e5791612ea5612d7a92612b54612eaa95611a21565b611a38565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff8516602482015230604482015260648082018390528152909490612f1b9061136290612f15608482610cff565b836132c6565b612f545760405194855216927fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf84719080602081015b0390a4565b1692507ffd192c7f8c08f26e917720fa6006252183cc42217b5f8269b8fafa9764f48cfe600080a4565b50505050600092507fa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf847160405180612f4f81906000602083019252565b939291936a52b7d2dcc80cd2e4000000606091612fd6816109d3565b60018103612ff45750505081610df6926080611f7993015195611bdc565b90919250613004819694966109d3565b600281036130565750505061301c611e4e8483611b90565b928060291161026557610df69160297fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd73693019101610da4565b6130648196929493966109d3565b15613070575b50509190565b8091929450600911610265576130ad9160097ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73693019101610da4565b91388061306a565b939291936a52b7d2dcc80cd2e40000006060916130d1816109d3565b600181036130ef5750505081610df6926080611f7993015195611c17565b909192506130fc816109d3565b60028103613122575050508060491161026557611f7981610df692602986013595611c52565b613131819693969492946109d3565b1561313c5750509190565b8091929450602911610265576130ad9160297fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd73693019101610da4565b908060141161026557806024116102655760341161026557803560601c916024601483013560801c92013560801c90565b8035906131b682610247565b60c06131c8611f796040840184611f86565b60208151910120916131e0611f796060830183611f86565b602081519101206040519373ffffffffffffffffffffffffffffffffffffffff60208601961686526020830135604086015260608501526080840152608081013560a084015260a081013582840152013560e082015260e081526123a281610ce2565b9060ff8091169116039060ff8211611a3357565b9060ff831660ff821681811060001461328a57505060ff61327e61328492610df695613243565b16612669565b906126c0565b9392931161329757505090565b60ff61327e610df694936132aa93613243565b906126ff565b610df6916132bd91613334565b9092919261337a565b906000602091828151910182855af1903d60005190836132e7575b50505090565b91925090613312575073ffffffffffffffffffffffffffffffffffffffff163b15155b3880806132e1565b600191501461330a565b90816020910312610265575180151581036102655790565b81519190604183036133655761335e92506020820151906060604084015193015160001a90613451565b9192909190565b505060009160029190565b6004111561053257565b61338381613370565b8061338c575050565b61339581613370565b600181036133c75760046040517ff645eedf000000000000000000000000000000000000000000000000000000008152fd5b6133d081613370565b6002810361340a576040517ffce698f700000000000000000000000000000000000000000000000000000000815260048101839052602490fd5b80613416600392613370565b1461341e5750565b6040517fd78bce0c0000000000000000000000000000000000000000000000000000000081526004810191909152602490fd5b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084116134d657926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561023b57805173ffffffffffffffffffffffffffffffffffffffff8116156134cd57918190565b50809160019190565b50505060009160039190565b9061352157508051156134f757805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b81511580613579575b613532575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561352a56fea2646970667358221220d6806df3ba725bfac626eb510ee5f35596a80f71ebb3b97d0580ef7fc282701164736f6c63430008170033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da0320000000000000000000000003cfdc212769c890907bce93d3d8c2c53de6a7a89
-----Decoded View---------------
Arg [0] : _entryPoint (address): 0x0000000071727De22E5E9d8BAf0edAc6f37da032
Arg [1] : _owner (address): 0x3cfDc212769c890907bcE93D3d8C2c53dE6a7a89
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000071727de22e5e9d8baf0edac6f37da032
Arg [1] : 0000000000000000000000003cfdc212769c890907bce93d3d8c2c53de6a7a89
Loading...
Loading
Loading...
Loading
OVERVIEW
Candide provides the tools to build seamless onchain UX experiences with Account AbstractionNet Worth in USD
$798.47
Net Worth in ETH
0.380142
Token Allocations
USDT
50.92%
XAUT
38.67%
USD₮0
5.45%
Others
4.96%
Multichain Portfolio | 33 Chains
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.