ETH Price: $1,938.56 (-2.00%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Defii For238745762025-11-25 8:17:2397 days ago1764058643IN
0x4815e7f9...934Fc2129
0 ETH0.000157261.10644502
Create Defii For238745052025-11-25 8:02:3597 days ago1764057755IN
0x4815e7f9...934Fc2129
0 ETH0.000083520.58766463
Create Defii For238394262025-11-20 9:41:59102 days ago1763631719IN
0x4815e7f9...934Fc2129
0 ETH0.000020460.1439773
Create Defii For238336042025-11-19 14:05:11102 days ago1763561111IN
0x4815e7f9...934Fc2129
0 ETH0.0000440.30961528
Create Defii For237977502025-11-14 13:33:23107 days ago1763127203IN
0x4815e7f9...934Fc2129
0 ETH0.000414322.91510521
Create Defii For237917822025-11-13 17:30:47108 days ago1763055047IN
0x4815e7f9...934Fc2129
0 ETH0.000123650.86998322
Create Defii For237047682025-11-01 13:24:11120 days ago1762003451IN
0x4815e7f9...934Fc2129
0 ETH0.000266991.87849806
Create Defii For237047622025-11-01 13:22:59120 days ago1762003379IN
0x4815e7f9...934Fc2129
0 ETH0.000266921.87799953
Create Defii For237037232025-11-01 9:54:23121 days ago1761990863IN
0x4815e7f9...934Fc2129
0 ETH0.000096050.67583476
Create Defii For236969152025-10-31 11:03:23122 days ago1761908603IN
0x4815e7f9...934Fc2129
0 ETH0.000304472.14221894
Create Defii For236969102025-10-31 11:02:23122 days ago1761908543IN
0x4815e7f9...934Fc2129
0 ETH0.000305782.1514422
Create Defii For236969022025-10-31 11:00:47122 days ago1761908447IN
0x4815e7f9...934Fc2129
0 ETH0.000306322.15523376
Create Defii For236968952025-10-31 10:59:23122 days ago1761908363IN
0x4815e7f9...934Fc2129
0 ETH0.000306112.15378683
Create Defii For236967662025-10-31 10:33:35122 days ago1761906815IN
0x4815e7f9...934Fc2129
0 ETH0.000021420.15077491
Create Defii For236906212025-10-30 13:52:11122 days ago1761832331IN
0x4815e7f9...934Fc2129
0 ETH0.000207411.45932152
Create Defii For236902452025-10-30 12:36:59123 days ago1761827819IN
0x4815e7f9...934Fc2129
0 ETH0.000253291.78209881
Create Defii For236830332025-10-29 12:24:47124 days ago1761740687IN
0x4815e7f9...934Fc2129
0 ETH0.000319992.25142629
Create Defii For236830212025-10-29 12:22:23124 days ago1761740543IN
0x4815e7f9...934Fc2129
0 ETH0.00024581.72944956
Create Defii For236830142025-10-29 12:20:59124 days ago1761740459IN
0x4815e7f9...934Fc2129
0 ETH0.000314882.21547446
Create Defii For236830092025-10-29 12:19:59124 days ago1761740399IN
0x4815e7f9...934Fc2129
0 ETH0.000313222.20378531
Create Defii For236830042025-10-29 12:18:59124 days ago1761740339IN
0x4815e7f9...934Fc2129
0 ETH0.00024431.71886212
Create Defii For236829992025-10-29 12:17:59124 days ago1761740279IN
0x4815e7f9...934Fc2129
0 ETH0.000244581.72080736
Create Defii For236829952025-10-29 12:17:11124 days ago1761740231IN
0x4815e7f9...934Fc2129
0 ETH0.000245331.72609415
Create Defii For236829882025-10-29 12:15:47124 days ago1761740147IN
0x4815e7f9...934Fc2129
0 ETH0.000242781.70814385
Create Defii For236829832025-10-29 12:14:47124 days ago1761740087IN
0x4815e7f9...934Fc2129
0 ETH0.000244151.71781119
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
0x3d602d80238745762025-11-25 8:17:2397 days ago1764058643
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80238745052025-11-25 8:02:3597 days ago1764057755
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80238394262025-11-20 9:41:59102 days ago1763631719
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80238336042025-11-19 14:05:11102 days ago1763561111
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80237977502025-11-14 13:33:23107 days ago1763127203
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80237917822025-11-13 17:30:47108 days ago1763055047
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80237047682025-11-01 13:24:11120 days ago1762003451
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80237047622025-11-01 13:22:59120 days ago1762003379
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80237037232025-11-01 9:54:23121 days ago1761990863
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236969152025-10-31 11:03:23122 days ago1761908603
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236969102025-10-31 11:02:23122 days ago1761908543
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236969022025-10-31 11:00:47122 days ago1761908447
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236968952025-10-31 10:59:23122 days ago1761908363
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236967662025-10-31 10:33:35122 days ago1761906815
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236906212025-10-30 13:52:11122 days ago1761832331
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236902452025-10-30 12:36:59123 days ago1761827819
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236830332025-10-29 12:24:47124 days ago1761740687
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236830212025-10-29 12:22:23124 days ago1761740543
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236830142025-10-29 12:20:59124 days ago1761740459
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236830092025-10-29 12:19:59124 days ago1761740399
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236830042025-10-29 12:18:59124 days ago1761740339
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236829992025-10-29 12:17:59124 days ago1761740279
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236829952025-10-29 12:17:11124 days ago1761740231
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236829882025-10-29 12:15:47124 days ago1761740147
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
0x3d602d80236829832025-10-29 12:14:47124 days ago1761740087
0x4815e7f9...934Fc2129
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SelfManagedFactoryV4

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
No with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.24;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

import {ISelfManagedFactory} from "./interfaces/ISelfManagedFactory.sol";
import {SelfManagedDefiiV4} from "./SelfManagedDefiiV4.sol";

contract SelfManagedFactoryV4 is ISelfManagedFactory, Ownable {
    address public operator;
    SelfManagedDefiiV4 public DEFII_TEMPLATE;

    event DefiiCreated(
        address indexed owner,
        address indexed logic,
        address defii
    );

    constructor() Ownable(msg.sender) {
        DEFII_TEMPLATE = new SelfManagedDefiiV4(address(this));
    }

    function createDefiiFor(
        address owner,
        address logic,
        address incentiveVault
    ) external {
        address defii = Clones.cloneDeterministic(
            address(DEFII_TEMPLATE),
            keccak256(abi.encodePacked(owner, logic))
        );

        SelfManagedDefiiV4(payable(defii)).init(logic, owner, incentiveVault);
        emit DefiiCreated(owner, logic, defii);
    }

    function setOperator(address operator_) external onlyOwner {
        operator = operator_;
    }

    function getDefiiFor(
        address owner,
        address logic
    ) external view returns (address defiiAddress) {
        defiiAddress = Clones.predictDeterministicAddress(
            address(DEFII_TEMPLATE),
            keccak256(abi.encodePacked(owner, logic))
        );
        if (defiiAddress.code.length == 0) defiiAddress = address(0);
    }
}

// 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.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 4 of 22 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 5 of 22 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (proxy/Clones.sol)

pragma solidity ^0.8.20;

import {Create2} from "../utils/Create2.sol";
import {Errors} from "../utils/Errors.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[ERC-1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 */
library Clones {
    error CloneArgumentsTooLong();

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        return clone(implementation, 0);
    }

    /**
     * @dev Same as {xref-Clones-clone-address-}[clone], but with a `value` parameter to send native currency
     * to the new contract.
     *
     * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
     * to always have enough balance for new deployments. Consider exposing this function under a payable method.
     */
    function clone(address implementation, uint256 value) internal returns (address instance) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        assembly ("memory-safe") {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create(value, 0x09, 0x37)
        }
        if (instance == address(0)) {
            revert Errors.FailedDeployment();
        }
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple times will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        return cloneDeterministic(implementation, salt, 0);
    }

    /**
     * @dev Same as {xref-Clones-cloneDeterministic-address-bytes32-}[cloneDeterministic], but with
     * a `value` parameter to send native currency to the new contract.
     *
     * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
     * to always have enough balance for new deployments. Consider exposing this function under a payable method.
     */
    function cloneDeterministic(
        address implementation,
        bytes32 salt,
        uint256 value
    ) internal returns (address instance) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        assembly ("memory-safe") {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create2(value, 0x09, 0x37, salt)
        }
        if (instance == address(0)) {
            revert Errors.FailedDeployment();
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        assembly ("memory-safe") {
            let ptr := mload(0x40)
            mstore(add(ptr, 0x38), deployer)
            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
            mstore(add(ptr, 0x14), implementation)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
            mstore(add(ptr, 0x58), salt)
            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
            predicted := and(keccak256(add(ptr, 0x43), 0x55), 0xffffffffffffffffffffffffffffffffffffffff)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt
    ) internal view returns (address predicted) {
        return predictDeterministicAddress(implementation, salt, address(this));
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behavior of `implementation` with custom
     * immutable arguments. These are provided through `args` and cannot be changed after deployment. To
     * access the arguments within the implementation, use {fetchCloneArgs}.
     *
     * This function uses the create opcode, which should never revert.
     */
    function cloneWithImmutableArgs(address implementation, bytes memory args) internal returns (address instance) {
        return cloneWithImmutableArgs(implementation, args, 0);
    }

    /**
     * @dev Same as {xref-Clones-cloneWithImmutableArgs-address-bytes-}[cloneWithImmutableArgs], but with a `value`
     * parameter to send native currency to the new contract.
     *
     * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
     * to always have enough balance for new deployments. Consider exposing this function under a payable method.
     */
    function cloneWithImmutableArgs(
        address implementation,
        bytes memory args,
        uint256 value
    ) internal returns (address instance) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        bytes memory bytecode = _cloneCodeWithImmutableArgs(implementation, args);
        assembly ("memory-safe") {
            instance := create(value, add(bytecode, 0x20), mload(bytecode))
        }
        if (instance == address(0)) {
            revert Errors.FailedDeployment();
        }
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation` with custom
     * immutable arguments. These are provided through `args` and cannot be changed after deployment. To
     * access the arguments within the implementation, use {fetchCloneArgs}.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy the clone. Using the same
     * `implementation`, `args` and `salt` multiple times will revert, since the clones cannot be deployed twice
     * at the same address.
     */
    function cloneDeterministicWithImmutableArgs(
        address implementation,
        bytes memory args,
        bytes32 salt
    ) internal returns (address instance) {
        return cloneDeterministicWithImmutableArgs(implementation, args, salt, 0);
    }

    /**
     * @dev Same as {xref-Clones-cloneDeterministicWithImmutableArgs-address-bytes-bytes32-}[cloneDeterministicWithImmutableArgs],
     * but with a `value` parameter to send native currency to the new contract.
     *
     * NOTE: Using a non-zero value at creation will require the contract using this function (e.g. a factory)
     * to always have enough balance for new deployments. Consider exposing this function under a payable method.
     */
    function cloneDeterministicWithImmutableArgs(
        address implementation,
        bytes memory args,
        bytes32 salt,
        uint256 value
    ) internal returns (address instance) {
        bytes memory bytecode = _cloneCodeWithImmutableArgs(implementation, args);
        return Create2.deploy(value, salt, bytecode);
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministicWithImmutableArgs}.
     */
    function predictDeterministicAddressWithImmutableArgs(
        address implementation,
        bytes memory args,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        bytes memory bytecode = _cloneCodeWithImmutableArgs(implementation, args);
        return Create2.computeAddress(salt, keccak256(bytecode), deployer);
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministicWithImmutableArgs}.
     */
    function predictDeterministicAddressWithImmutableArgs(
        address implementation,
        bytes memory args,
        bytes32 salt
    ) internal view returns (address predicted) {
        return predictDeterministicAddressWithImmutableArgs(implementation, args, salt, address(this));
    }

    /**
     * @dev Get the immutable args attached to a clone.
     *
     * - If `instance` is a clone that was deployed using `clone` or `cloneDeterministic`, this
     *   function will return an empty array.
     * - If `instance` is a clone that was deployed using `cloneWithImmutableArgs` or
     *   `cloneDeterministicWithImmutableArgs`, this function will return the args array used at
     *   creation.
     * - If `instance` is NOT a clone deployed using this library, the behavior is undefined. This
     *   function should only be used to check addresses that are known to be clones.
     */
    function fetchCloneArgs(address instance) internal view returns (bytes memory) {
        bytes memory result = new bytes(instance.code.length - 45); // revert if length is too short
        assembly ("memory-safe") {
            extcodecopy(instance, add(result, 32), 45, mload(result))
        }
        return result;
    }

    /**
     * @dev Helper that prepares the initcode of the proxy with immutable args.
     *
     * An assembly variant of this function requires copying the `args` array, which can be efficiently done using
     * `mcopy`. Unfortunately, that opcode is not available before cancun. A pure solidity implementation using
     * abi.encodePacked is more expensive but also more portable and easier to review.
     *
     * NOTE: https://eips.ethereum.org/EIPS/eip-170[EIP-170] limits the length of the contract code to 24576 bytes.
     * With the proxy code taking 45 bytes, that limits the length of the immutable args to 24531 bytes.
     */
    function _cloneCodeWithImmutableArgs(
        address implementation,
        bytes memory args
    ) private pure returns (bytes memory) {
        if (args.length > 24531) revert CloneArgumentsTooLong();
        return
            abi.encodePacked(
                hex"61",
                uint16(args.length + 45),
                hex"3d81600a3d39f3363d3d373d3d3d363d73",
                implementation,
                hex"5af43d82803e903d91602b57fd5bf3",
                args
            );
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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 ERC-20 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.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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.2.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @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 Errors.InsufficientBalance(address(this).balance, amount);
        }

        (bool success, bytes memory returndata) = recipient.call{value: amount}("");
        if (!success) {
            _revert(returndata);
        }
    }

    /**
     * @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
     * {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value);
        }
        (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 {Errors.FailedCall}) 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 {Errors.FailedCall} 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 {Errors.FailedCall}.
     */
    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
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}

// 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.1.0) (utils/Create2.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */
library Create2 {
    /**
     * @dev There's no code to deploy.
     */
    error Create2EmptyBytecode();

    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}.
     *
     * The bytecode for a contract can be obtained from Solidity with
     * `type(contractName).creationCode`.
     *
     * Requirements:
     *
     * - `bytecode` must not be empty.
     * - `salt` must have not been used for `bytecode` already.
     * - the factory must have a balance of at least `amount`.
     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
     */
    function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {
        if (address(this).balance < amount) {
            revert Errors.InsufficientBalance(address(this).balance, amount);
        }
        if (bytecode.length == 0) {
            revert Create2EmptyBytecode();
        }
        assembly ("memory-safe") {
            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
            // if no address was created, and returndata is not empty, bubble revert
            if and(iszero(addr), not(iszero(returndatasize()))) {
                let p := mload(0x40)
                returndatacopy(p, 0, returndatasize())
                revert(p, returndatasize())
            }
        }
        if (addr == address(0)) {
            revert Errors.FailedDeployment();
        }
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
     * `bytecodeHash` or `salt` will result in a new destination address.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
        return computeAddress(salt, bytecodeHash, address(this));
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {
        assembly ("memory-safe") {
            let ptr := mload(0x40) // Get free memory pointer

            // |                   | ↓ ptr ...  ↓ ptr + 0x0B (start) ...  ↓ ptr + 0x20 ...  ↓ ptr + 0x40 ...   |
            // |-------------------|---------------------------------------------------------------------------|
            // | bytecodeHash      |                                                        CCCCCCCCCCCCC...CC |
            // | salt              |                                      BBBBBBBBBBBBB...BB                   |
            // | deployer          | 000000...0000AAAAAAAAAAAAAAAAAAA...AA                                     |
            // | 0xFF              |            FF                                                             |
            // |-------------------|---------------------------------------------------------------------------|
            // | memory            | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |
            // | keccak(start, 85) |            ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |

            mstore(add(ptr, 0x40), bytecodeHash)
            mstore(add(ptr, 0x20), salt)
            mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
            let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
            mstore8(start, 0xff)
            addr := and(keccak256(start, 85), 0xffffffffffffffffffffffffffffffffffffffff)
        }
    }
}

File 13 of 22 : Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedCall();

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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);
}

File 15 of 22 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }

    /**
     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
     */
    function toUint(bool b) internal pure returns (uint256 u) {
        assembly ("memory-safe") {
            u := iszero(iszero(b))
        }
    }
}

// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.20;

abstract contract Logic {
    error NotImplemented();

    function claimRewards(address recipient) external payable virtual {
        revert NotImplemented();
    }

    function emergencyExit() external payable virtual {
        revert NotImplemented();
    }

    function withdrawLiquidity(
        address recipient,
        uint256 amount
    ) external payable virtual {
        revert NotImplemented();
    }

    function enter() external payable virtual;

    function exit(uint256 liquidity) external payable virtual;

    function accountLiquidity(
        address account
    ) external view virtual returns (uint256);
}

File 17 of 22 : Errors.sol
// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.24;

error NotImplemented();
error EnterFailed();
error ExitFailed();

File 18 of 22 : ISelfManagedFactory.sol
// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.24;

interface ISelfManagedFactory {
    function operator() external view returns (address);
}

// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.24;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

import {ISelfManagedFactory} from "./interfaces/ISelfManagedFactory.sol";
import {SelfManagedLogic} from "./SelfManagedLogic.sol";
import {UniswapV3Callbacks} from "./UniswapV3Callbacks.sol";
import {ExitFailed, EnterFailed} from "./Errors.sol";

contract SelfManagedDefii is Ownable {
    using Address for address;
    using Address for address payable;
    using SafeERC20 for IERC20;
    using SafeCast for int256;

    struct MinTokensDelta {
        address[] tokens;
        uint256[] deltas;
    }

    ISelfManagedFactory public immutable FACTORY;
    address public LOGIC;
    address public incentiveVault;

    uint256 public constant PERCENTAGE_BPS = 100;
    uint256 public constant SLIPPAGE_BPS = 10000;

    mapping(address => bool) public lendings;

    modifier onlyOwnerOrOperator() {
        if (msg.sender != owner() && msg.sender != FACTORY.operator())
            revert Ownable.OwnableUnauthorizedAccount(msg.sender);
        _;
    }

    constructor(address factory) Ownable(factory) {
        FACTORY = ISelfManagedFactory(factory);
    }

    receive() external payable {}

    function init(
        address logic,
        address owner,
        address incentiveVault_
    ) external {
        require(LOGIC == address(0));
        LOGIC = logic;
        incentiveVault = incentiveVault_;
        _transferOwnership(owner);
    }

    function whitelistLending(address lending) external onlyOwner {
        require(!lendings[lending], "Allready whitelisted");
        lendings[lending] = true;
    }

    function deWhitelistLending(address lending) external onlyOwner {
        require(lendings[lending], "Lending is not whitelisted");
        lendings[lending] = false;
    }

    function exitWithRepay(address lending) external onlyOwnerOrOperator {
        require(lendings[lending], "Lending is not whitelisted");
        LOGIC.functionDelegateCall(
            abi.encodeWithSignature("exitWithRepay(address)", lending)
        );
    }

    function enter(uint256 minLiquidityDelta) external onlyOwner {
        uint256 liquidityBefore = allocatedLiquidity();
        LOGIC.functionDelegateCall(abi.encodeWithSignature("enter()"));
        uint256 liquidityAfter = allocatedLiquidity();
        if (
            liquidityBefore > liquidityAfter ||
            (liquidityAfter - liquidityBefore) < minLiquidityDelta
        ) {
            revert EnterFailed();
        }
    }

    function enterWithParameters(
        uint256 minLiquidityDelta,
        bytes memory params
    ) external onlyOwner {
        uint256 liquidityBefore = allocatedLiquidity();
        LOGIC.functionDelegateCall(
            abi.encodeWithSignature("enterWithParams(bytes)", params)
        );
        uint256 liquidityAfter = allocatedLiquidity();
        if (
            liquidityBefore > liquidityAfter ||
            (liquidityAfter - liquidityBefore) < minLiquidityDelta
        ) {
            revert EnterFailed();
        }
    }

    function exit(
        uint256 percentage,
        MinTokensDelta memory minTokensDelta
    ) external onlyOwner {
        if (percentage == 0) percentage = 100;
        uint256 liquidity = (percentage * allocatedLiquidity()) /
            PERCENTAGE_BPS;

        uint256 n = minTokensDelta.tokens.length;
        for (uint256 i = 0; i < n; i++) {
            minTokensDelta.deltas[i] += IERC20(minTokensDelta.tokens[i])
                .balanceOf(address(this));
        }
        LOGIC.functionDelegateCall(
            abi.encodeWithSignature("exit(uint256)", liquidity)
        );
        for (uint256 i = 0; i < n; i++) {
            if (
                IERC20(minTokensDelta.tokens[i]).balanceOf(address(this)) <
                minTokensDelta.deltas[i]
            ) {
                revert ExitFailed();
            }
        }
        for (uint256 i = 0; i < n; i++) {
            withdrawERC20(IERC20(minTokensDelta.tokens[i]));
        }
        claimRewards();
    }

    function claimRewards() public onlyOwnerOrOperator {
        LOGIC.functionDelegateCall(
            abi.encodeWithSignature("claimRewards(address)", incentiveVault)
        );
    }

    function emergencyExit() external onlyOwnerOrOperator {
        LOGIC.functionDelegateCall(abi.encodeWithSignature("emergencyExit()"));
    }

    function exitBuildingBlock(
        uint256 buildingBlockId
    ) external onlyOwnerOrOperator {
        LOGIC.functionDelegateCall(
            abi.encodeWithSignature(
                "exitBuildingBlock(uint256)",
                buildingBlockId
            )
        );
    }

    function withdrawERC20(IERC20 token) public onlyOwnerOrOperator {
        uint256 tokenAmount = token.balanceOf(address(this));
        if (tokenAmount > 0) {
            token.safeTransfer(owner(), tokenAmount);
        }
    }

    function withdrawETH() external onlyOwnerOrOperator {
        payable(owner()).sendValue(address(this).balance);
    }

    function changeIncentiveVault(address incentiveVault_) external onlyOwner {
        incentiveVault = incentiveVault_;
    }

    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external virtual {
        LOGIC.functionDelegateCall(
            abi.encodeCall(
                UniswapV3Callbacks.uniswapV3SwapCallback,
                (amount0Delta, amount1Delta, data)
            )
        );
    }
    function uniswapV3MintCallback(
        uint256 amount0Owed,
        uint256 amount1Owed,
        bytes calldata data
    ) external virtual {
        LOGIC.functionDelegateCall(
            abi.encodeCall(
                UniswapV3Callbacks.uniswapV3MintCallback,
                (amount0Owed, amount1Owed, data)
            )
        );
    }
    function uniswapV3FlashCallback(
        uint256 fee0,
        uint256 fee1,
        bytes calldata data
    ) external virtual {
        LOGIC.functionDelegateCall(
            abi.encodeCall(
                UniswapV3Callbacks.uniswapV3FlashCallback,
                (fee0, fee1, data)
            )
        );
    }

    function runMultipleTx(
        address[] calldata targets,
        uint256[] calldata values,
        bytes[] calldata datas
    ) external {
        // we don't need onlyOwner modifier, owner checks in runTx
        require(targets.length == datas.length);
        require(targets.length == values.length);

        for (uint256 i = 0; i < targets.length; i++) {
            runTx(targets[i], values[i], datas[i]);
        }
    }

    function runTx(
        address target,
        uint256 value,
        bytes memory data
    ) public onlyOwner {
        target.functionCallWithValue(data, value);
    }

    function simulateEnterWithParams(
        bytes memory params
    ) external returns (uint256 liquidityChanged) {
        try this.simulateEnterWithParamsAndRevert(params) {} catch (
            bytes memory result
        ) {
            liquidityChanged = abi.decode(result, (uint256));
        }
    }

    function simulateEnterWithParamsAndRevert(bytes memory params) external {
        uint256 liquidityBefore = allocatedLiquidity();
        LOGIC.functionDelegateCall(
            abi.encodeCall(SelfManagedLogic.enterWithParams, (params))
        );
        uint256 liquidityAfter = allocatedLiquidity();
        uint256 delta = liquidityAfter - liquidityBefore;
        bytes memory returnData = abi.encode(delta);
        uint256 returnDataLength = returnData.length;
        assembly {
            revert(add(returnData, 0x20), returnDataLength)
        }
    }

    function simulateEnter() external returns (uint256 liquidityChanged) {
        try this.simulateEnterAndRevert() {} catch (bytes memory result) {
            liquidityChanged = abi.decode(result, (uint256));
        }
    }

    function simulateEnterAndRevert() external {
        uint256 liquidityBefore = allocatedLiquidity();
        LOGIC.functionDelegateCall(abi.encodeWithSignature("enter()"));
        uint256 liquidityAfter = allocatedLiquidity();
        uint256 delta = liquidityAfter - liquidityBefore;
        bytes memory returnData = abi.encode(delta);
        uint256 returnDataLength = returnData.length;
        assembly {
            revert(add(returnData, 0x20), returnDataLength)
        }
    }

    function simulateExit(
        uint256 percentage,
        address[] calldata tokens
    ) external returns (int256[] memory balanceChanges) {
        require(percentage >= 0 && percentage <= 100, "Wrong percentage");
        try this.simulateExitAndRevert(percentage, tokens) {} catch (
            bytes memory result
        ) {
            balanceChanges = abi.decode(result, (int256[]));
        }
    }

    function simulateExitAndRevert(
        uint256 percentage,
        address[] calldata tokens
    ) external {
        int256[] memory balanceChanges = new int256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            balanceChanges[i] = int256(
                IERC20(tokens[i]).balanceOf(address(this))
            );
        }

        if (percentage == 0) percentage = 100;
        uint256 liquidity = (percentage * allocatedLiquidity()) /
            PERCENTAGE_BPS;

        LOGIC.functionDelegateCall(
            abi.encodeWithSignature("exit(uint256)", liquidity)
        );

        for (uint256 i = 0; i < tokens.length; i++) {
            balanceChanges[i] =
                int256(IERC20(tokens[i]).balanceOf(address(this))) -
                balanceChanges[i];
        }

        bytes memory returnData = abi.encode(balanceChanges);
        uint256 returnDataLength = returnData.length;

        assembly {
            revert(add(returnData, 0x20), returnDataLength)
        }
    }

    function simulateClaimRewards(
        address[] calldata rewardTokens
    ) external returns (int256[] memory balanceChanges) {
        try this.simulateClaimRewardsAndRevert(rewardTokens) {} catch (
            bytes memory result
        ) {
            balanceChanges = abi.decode(result, (int256[]));
        }
    }

    function simulateClaimRewardsAndRevert(
        address[] calldata rewardTokens
    ) external {
        int256[] memory balanceChanges = new int256[](rewardTokens.length);
        for (uint256 i = 0; i < rewardTokens.length; i++) {
            balanceChanges[i] = int256(
                IERC20(rewardTokens[i]).balanceOf(incentiveVault)
            );
        }

        LOGIC.functionDelegateCall(
            abi.encodeWithSignature("claimRewards(address)", incentiveVault)
        );

        for (uint256 i = 0; i < rewardTokens.length; i++) {
            balanceChanges[i] =
                int256(IERC20(rewardTokens[i]).balanceOf(incentiveVault)) -
                balanceChanges[i];
        }

        bytes memory returnData = abi.encode(balanceChanges);
        uint256 returnDataLength = returnData.length;
        assembly {
            revert(add(returnData, 0x20), returnDataLength)
        }
    }

    function getMinLiquidityDelta(uint256 slippage) external returns (uint256) {
        uint256 minLiquidityDelta = this.simulateEnter();
        return (minLiquidityDelta * slippage) / SLIPPAGE_BPS;
    }

    function getMinTokensDeltas(
        uint256 percentage,
        uint256 slippage,
        address[] memory tokens
    ) external returns (MinTokensDelta memory) {
        int256[] memory balanceChanged = this.simulateExit(percentage, tokens);
        MinTokensDelta memory instruction;
        instruction.tokens = new address[](tokens.length);
        instruction.deltas = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            instruction.tokens[i] = tokens[i];
            instruction.deltas[i] =
                (balanceChanged[i].toUint256() * slippage) /
                SLIPPAGE_BPS;
        }
        return instruction;
    }

    function allocatedLiquidity() public view returns (uint256) {
        return SelfManagedLogic(LOGIC).allocatedLiquidity(address(this));
    }

    function totalLiquidity() public view returns (uint256) {
        return SelfManagedLogic(LOGIC).accountLiquidity(address(this));
    }

    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public view returns (bytes4) {
        require(tx.origin == owner() || tx.origin == FACTORY.operator(), "Wrong tx origin");
        return this.onERC721Received.selector;
    }
}

// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.24;

import {Address} from "@openzeppelin/contracts/utils/Address.sol";

import {SelfManagedDefii} from "./SelfManagedDefii.sol";

contract SelfManagedDefiiV4 is SelfManagedDefii {
    using Address for address;

    constructor(address factory) SelfManagedDefii(factory) {}

    function rebalance(bytes calldata data) external onlyOwnerOrOperator {
        LOGIC.functionDelegateCall(abi.encodeWithSignature("rebalance(bytes)", data));
    }
}

// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.24;

import {Logic} from "@shift-defi/core/contracts/defii/execution/Logic.sol";
import {UniswapV3Callbacks} from "./UniswapV3Callbacks.sol";

abstract contract SelfManagedLogic is Logic, UniswapV3Callbacks {
    error WrongBuildingBlockId(uint256);

    function enterWithParams(bytes memory params) external payable virtual {
        revert NotImplemented();
    }

    function exitBuildingBlock(
        uint256 buildingBlockId
    ) external payable virtual;

    function allocatedLiquidity(
        address account
    ) external view virtual returns (uint256);

    function exitWithRepay(address lending) external virtual {
        revert NotImplemented();
    }
}

// SPDX-License-Identifier: SHIFT-1.0
pragma solidity ^0.8.24;

import {NotImplemented} from "./Errors.sol";

abstract contract UniswapV3Callbacks {
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external virtual {
        revert NotImplemented();
    }
    function uniswapV3MintCallback(
        uint256 amount0Owed,
        uint256 amount1Owed,
        bytes calldata data
    ) external virtual {
        revert NotImplemented();
    }
    function uniswapV3FlashCallback(
        uint256 fee0,
        uint256 fee1,
        bytes calldata data
    ) external virtual {
        revert NotImplemented();
    }
}

Settings
{
  "evmVersion": "paris",
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FailedDeployment","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"logic","type":"address"},{"indexed":false,"internalType":"address","name":"defii","type":"address"}],"name":"DefiiCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"DEFII_TEMPLATE","outputs":[{"internalType":"contract SelfManagedDefiiV4","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"logic","type":"address"},{"internalType":"address","name":"incentiveVault","type":"address"}],"name":"createDefiiFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"logic","type":"address"}],"name":"getDefiiFor","outputs":[{"internalType":"address","name":"defiiAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator_","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5033600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100845760006040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161007b9190610220565b60405180910390fd5b6100938161010d60201b60201c565b50306040516100a1906101d1565b6100ab9190610220565b604051809103906000f0801580156100c7573d6000803e3d6000fd5b50600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061023b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6159408062000ca883390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061020a826101df565b9050919050565b61021a816101ff565b82525050565b60006020820190506102356000830184610211565b92915050565b610a5d806200024b6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b14610101578063b3ab15fb1461011f578063b946636e1461013b578063f2fde38b1461015957610088565b8063570ca7351461008d578063574b05a8146100ab57806359a5572f146100c7578063715018a6146100f7575b600080fd5b610095610175565b6040516100a291906107b4565b60405180910390f35b6100c560048036038101906100c09190610800565b61019b565b005b6100e160048036038101906100dc9190610853565b6102cd565b6040516100ee91906107b4565b60405180910390f35b6100ff61034f565b005b610109610363565b60405161011691906107b4565b60405180910390f35b61013960048036038101906101349190610893565b61038c565b005b6101436103d8565b604051610150919061091f565b60405180910390f35b610173600480360381019061016e9190610893565b6103fe565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006101f1600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040516020016101d6929190610982565b60405160208183030381529060405280519060200120610484565b90508073ffffffffffffffffffffffffffffffffffffffff1663184b95598486856040518463ffffffff1660e01b8152600401610230939291906109ae565b600060405180830381600087803b15801561024a57600080fd5b505af115801561025e573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f5b46e214fecd114a3c080d3fe6c9382401c9e63aa1742d84c6f9ae567208e75e836040516102bf91906107b4565b60405180910390a350505050565b6000610323600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168484604051602001610308929190610982565b6040516020818303038152906040528051906020012061049a565b905060008173ffffffffffffffffffffffffffffffffffffffff163b0361034957600090505b92915050565b6103576104af565b6103616000610536565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103946104af565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104066104af565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036104785760006040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161046f91906107b4565b60405180910390fd5b61048181610536565b50565b6000610492838360006105fa565b905092915050565b60006104a78383306106f4565b905092915050565b6104b761076b565b73ffffffffffffffffffffffffffffffffffffffff166104d5610363565b73ffffffffffffffffffffffffffffffffffffffff1614610534576104f861076b565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161052b91906107b4565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000814710156106435747826040517fcf47918100000000000000000000000000000000000000000000000000000000815260040161063a9291906109fe565b60405180910390fd5b763d602d80600a3d3981f3363d3d373d3d3d363d730000008460601b60e81c176000526e5af43d82803e903d91602b57fd5bf38460781b17602052826037600984f59050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036106ed576040517fb06ebf3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9392505050565b60006040518260388201526f5af43d82803e903d91602b57fd5bf3ff6024820152846014820152733d602d80600a3d3981f3363d3d373d3d3d363d7381528360588201526037600c820120607882015273ffffffffffffffffffffffffffffffffffffffff60556043830120169150509392505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061079e82610773565b9050919050565b6107ae81610793565b82525050565b60006020820190506107c960008301846107a5565b92915050565b600080fd5b6107dd81610793565b81146107e857600080fd5b50565b6000813590506107fa816107d4565b92915050565b600080600060608486031215610819576108186107cf565b5b6000610827868287016107eb565b9350506020610838868287016107eb565b9250506040610849868287016107eb565b9150509250925092565b6000806040838503121561086a576108696107cf565b5b6000610878858286016107eb565b9250506020610889858286016107eb565b9150509250929050565b6000602082840312156108a9576108a86107cf565b5b60006108b7848285016107eb565b91505092915050565b6000819050919050565b60006108e56108e06108db84610773565b6108c0565b610773565b9050919050565b60006108f7826108ca565b9050919050565b6000610909826108ec565b9050919050565b610919816108fe565b82525050565b60006020820190506109346000830184610910565b92915050565b60008160601b9050919050565b60006109528261093a565b9050919050565b600061096482610947565b9050919050565b61097c61097782610793565b610959565b82525050565b600061098e828561096b565b60148201915061099e828461096b565b6014820191508190509392505050565b60006060820190506109c360008301866107a5565b6109d060208301856107a5565b6109dd60408301846107a5565b949350505050565b6000819050919050565b6109f8816109e5565b82525050565b6000604082019050610a1360008301856109ef565b610a2060208301846109ef565b939250505056fea264697066735822122064317a8da79ac375002eb346bac350dc8289c492cd32add41a63656f271a515b64736f6c6343000818003360a06040523480156200001157600080fd5b50604051620059403803806200594083398181016040528101906200003791906200022a565b8080600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603620000ae5760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401620000a591906200026d565b60405180910390fd5b620000bf81620000fc60201b60201c565b508073ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff168152505050506200028a565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001f282620001c5565b9050919050565b6200020481620001e5565b81146200021057600080fd5b50565b6000815190506200022481620001f9565b92915050565b600060208284031215620002435762000242620001c0565b5b6000620002538482850162000213565b91505092915050565b6200026781620001e5565b82525050565b60006020820190506200028460008301846200025c565b92915050565b608051615662620002de60003960008181610b4f01528181610d3f01528181611535015281816116ac01528181611c850152818161279201528181612eda015281816130fd01526134ab01526156626000f3fe60806040526004361061024a5760003560e01c80638241340111610139578063cfc2db2c116100b6578063ec34c7c01161007a578063ec34c7c014610821578063f0eef54a1461084a578063f1f684d714610873578063f2fde38b146108b0578063f4f3b200146108d9578063fa461e331461090257610251565b8063cfc2db2c14610764578063d34879971461078d578063e086e5ec146107b6578063e4d402ad146107cd578063e9cbafb0146107f857610251565b80639f61f4ff116100fd5780639f61f4ff14610693578063a59f3e0c146106be578063b269add3146106e7578063b3c49dd814610710578063c2ebcd561461073b57610251565b80638241340114610588578063829b4dc2146105c55780638ced74db146106025780638da5cb5b1461063f5780638fd09ae11461066a57610251565b806333a95606116101c75780636592bd7d1161018b5780636592bd7d146104c9578063715018a614610506578063771c20801461051d57806377f8bb6d146105465780637e18b7ef1461057157610251565b806333a956061461040a578063372500ab146104475780634b2170f21461045e5780635641ec0314610487578063568d25a51461049e57610251565b8063179558c31161020e578063179558c31461033b578063184b9559146103645780632155c2761461038d5780632348a379146103b65780632dd31000146103df57610251565b806301d4c47a1461025657806307a20b55146102815780630c47cda3146102aa578063150b7a02146102d357806315770f921461031057610251565b3661025157005b600080fd5b34801561026257600080fd5b5061026b61092b565b6040516102789190613cfc565b60405180910390f35b34801561028d57600080fd5b506102a860048036038101906102a39190613e71565b6109dc565b005b3480156102b657600080fd5b506102d160048036038101906102cc9190613f44565b610ad6565b005b3480156102df57600080fd5b506102fa60048036038101906102f59190613fb3565b610b0f565b6040516103079190614071565b60405180910390f35b34801561031c57600080fd5b50610325610c5c565b6040516103329190613cfc565b60405180910390f35b34801561034757600080fd5b50610362600480360381019061035d919061408c565b610cff565b005b34801561037057600080fd5b5061038b600480360381019061038691906140b9565b610fa6565b005b34801561039957600080fd5b506103b460048036038101906103af919061410c565b611091565b005b3480156103c257600080fd5b506103dd60048036038101906103d89190614385565b6111df565b005b3480156103eb57600080fd5b506103f4611533565b6040516104019190614440565b60405180910390f35b34801561041657600080fd5b50610431600480360381019061042c91906144b6565b611557565b60405161043e91906145de565b60405180910390f35b34801561045357600080fd5b5061045c61166c565b005b34801561046a57600080fd5b5061048560048036038101906104809190614600565b6118a8565b005b34801561049357600080fd5b5061049c611c45565b005b3480156104aa57600080fd5b506104b3611e54565b6040516104c09190613cfc565b60405180910390f35b3480156104d557600080fd5b506104f060048036038101906104eb919061408c565b611ef7565b6040516104fd9190614668565b60405180910390f35b34801561051257600080fd5b5061051b611f17565b005b34801561052957600080fd5b50610544600480360381019061053f919061408c565b611f2b565b005b34801561055257600080fd5b5061055b61201a565b6040516105689190613cfc565b60405180910390f35b34801561057d57600080fd5b50610586612020565b005b34801561059457600080fd5b506105af60048036038101906105aa9190614683565b612147565b6040516105bc9190613cfc565b60405180910390f35b3480156105d157600080fd5b506105ec60048036038101906105e79190613e71565b6121de565b6040516105f99190613cfc565b60405180910390f35b34801561060e57600080fd5b50610629600480360381019061062491906146b0565b61229c565b60405161063691906148df565b60405180910390f35b34801561064b57600080fd5b506106546124c7565b6040516106619190614910565b60405180910390f35b34801561067657600080fd5b50610691600480360381019061068c91906149d7565b6124f0565b005b34801561069f57600080fd5b506106a86125ea565b6040516106b59190614910565b60405180910390f35b3480156106ca57600080fd5b506106e560048036038101906106e09190614683565b612610565b005b3480156106f357600080fd5b5061070e60048036038101906107099190614ae1565b612752565b005b34801561071c57600080fd5b50610725612970565b6040516107329190614910565b60405180910390f35b34801561074757600080fd5b50610762600480360381019061075d91906144b6565b612996565b005b34801561077057600080fd5b5061078b6004803603810190610786919061408c565b612cfd565b005b34801561079957600080fd5b506107b460048036038101906107af9190614b2e565b612ded565b005b3480156107c257600080fd5b506107cb612e9a565b005b3480156107d957600080fd5b506107e261300b565b6040516107ef9190613cfc565b60405180910390f35b34801561080457600080fd5b5061081f600480360381019061081a9190614b2e565b613010565b005b34801561082d57600080fd5b5061084860048036038101906108439190614683565b6130bd565b005b34801561085657600080fd5b50610871600480360381019061086c919061408c565b6132d8565b005b34801561087f57600080fd5b5061089a60048036038101906108959190614600565b613324565b6040516108a791906145de565b60405180910390f35b3480156108bc57600080fd5b506108d760048036038101906108d2919061408c565b6133e5565b005b3480156108e557600080fd5b5061090060048036038101906108fb9190614be0565b61346b565b005b34801561090e57600080fd5b5061092960048036038101906109249190614c39565b613668565b005b60003073ffffffffffffffffffffffffffffffffffffffff16637e18b7ef6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561097557600080fd5b505af1925050508015610986575060015b6109d8573d80600081146109b6576040519150601f19603f3d011682016040523d82523d6000602084013e6109bb565b606091505b50808060200190518101906109d09190614cc2565b9150506109d9565b5b90565b60006109e6611e54565b9050610a88826040516024016109fc9190614d6e565b60405160208183030381529060405263b0e092d260e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b506000610a93611e54565b905060008282610aa39190614dbf565b9050600081604051602001610ab89190613cfc565b60405160208183030381529060405290506000815190508060208301fd5b610ade613799565b610b0981838573ffffffffffffffffffffffffffffffffffffffff166138209092919063ffffffff16565b50505050565b6000610b196124c7565b73ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff161480610c0b57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdc9190614e08565b73ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16145b610c4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4190614e92565b60405180910390fd5b63150b7a0260e01b9050949350505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635a0f03c6306040518263ffffffff1660e01b8152600401610cb99190614910565b602060405180830381865afa158015610cd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfa9190614cc2565b905090565b610d076124c7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015610dfc57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc9190614e08565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15610e3e57336040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610e359190614910565b60405180910390fd5b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610eca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec190614efe565b60405180910390fd5b610fa281604051602401610ede9190614910565b6040516020818303038152906040527f179558c3000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5050565b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100157600080fd5b82600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061108c826138ef565b505050565b611099613799565b60006110a3611e54565b905061117d826040516024016110b99190614d6e565b6040516020818303038152906040527fb0e092d2000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b506000611188611e54565b9050808211806111a257508382826111a09190614dbf565b105b156111d9576040517f92e7634c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b6111e7613799565b600082036111f457606491505b60006064611200611e54565b8461120b9190614f1e565b6112159190614f8f565b90506000826000015151905060005b81811015611303578360000151818151811061124357611242614fc0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016112839190614910565b602060405180830381865afa1580156112a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c49190614cc2565b846020015182815181106112db576112da614fc0565b5b602002602001018181516112ef9190614fef565b915081815250508080600101915050611224565b506113dc826040516024016113189190613cfc565b6040516020818303038152906040527f7f8661a1000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5060005b818110156114e457836020015181815181106113ff576113fe614fc0565b5b60200260200101518460000151828151811061141e5761141d614fc0565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161145e9190614910565b602060405180830381865afa15801561147b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149f9190614cc2565b10156114d7576040517f2f35934c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80806001019150506113e0565b5060005b81811015611524576115178460000151828151811061150a57611509614fc0565b5b602002602001015161346b565b80806001019150506114e8565b5061152d61166c565b50505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60606000841015801561156b575060648411155b6115aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a19061506f565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff1663c2ebcd568585856040518463ffffffff1660e01b81526004016115e79392919061512b565b600060405180830381600087803b15801561160157600080fd5b505af1925050508015611612575060015b611664573d8060008114611642576040519150601f19603f3d011682016040523d82523d6000602084013e611647565b606091505b508080602001905181019061165c9190615235565b915050611665565b5b9392505050565b6116746124c7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415801561176957507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa158015611715573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117399190614e08565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156117ab57336040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016117a29190614910565b60405180910390fd5b6118a5600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516024016117e19190614910565b6040516020818303038152906040527fef5cfb8c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b50565b60008282905067ffffffffffffffff8111156118c7576118c6613d46565b5b6040519080825280602002602001820160405280156118f55781602001602082028036833780820191505090505b50905060005b838390508110156119f55783838281811061191957611918614fc0565b5b905060200201602081019061192e919061408c565b73ffffffffffffffffffffffffffffffffffffffff166370a08231600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b81526004016119889190614910565b602060405180830381865afa1580156119a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c99190614cc2565b8282815181106119dc576119db614fc0565b5b60200260200101818152505080806001019150506118fb565b50611af0600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051602401611a2c9190614910565b6040516020818303038152906040527fef5cfb8c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5060005b83839050811015611c1357818181518110611b1257611b11614fc0565b5b6020026020010151848483818110611b2d57611b2c614fc0565b5b9050602002016020810190611b42919061408c565b73ffffffffffffffffffffffffffffffffffffffff166370a08231600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401611b9c9190614910565b602060405180830381865afa158015611bb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bdd9190614cc2565b611be7919061527e565b828281518110611bfa57611bf9614fc0565b5b6020026020010181815250508080600101915050611af4565b50600081604051602001611c2791906145de565b60405160208183030381529060405290506000815190508060208301fd5b611c4d6124c7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015611d4257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d129190614e08565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15611d8457336040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611d7b9190614910565b60405180910390fd5b611e516040516024016040516020818303038152906040527f5641ec03000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e9b6cf6e306040518263ffffffff1660e01b8152600401611eb19190614910565b602060405180830381865afa158015611ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef29190614cc2565b905090565b60036020528060005260406000206000915054906101000a900460ff1681565b611f1f613799565b611f2960006138ef565b565b611f33613799565b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611fbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fb690614efe565b60405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61271081565b600061202a611e54565b90506120f96040516024016040516020818303038152906040527fe97dcb62000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b506000612104611e54565b9050600082826121149190614dbf565b90506000816040516020016121299190613cfc565b60405160208183030381529060405290506000815190508060208301fd5b6000803073ffffffffffffffffffffffffffffffffffffffff166301d4c47a6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612197573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bb9190614cc2565b905061271083826121cc9190614f1e565b6121d69190614f8f565b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff166307a20b55836040518263ffffffff1660e01b81526004016122199190614d6e565b600060405180830381600087803b15801561223357600080fd5b505af1925050508015612244575060015b612296573d8060008114612274576040519150601f19603f3d011682016040523d82523d6000602084013e612279565b606091505b508080602001905181019061228e9190614cc2565b915050612297565b5b919050565b6122a4613cc9565b60003073ffffffffffffffffffffffffffffffffffffffff166333a9560686856040518363ffffffff1660e01b81526004016122e192919061531f565b6000604051808303816000875af1158015612300573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906123299190615235565b9050612333613cc9565b835167ffffffffffffffff81111561234e5761234d613d46565b5b60405190808252806020026020018201604052801561237c5781602001602082028036833780820191505090505b508160000181905250835167ffffffffffffffff8111156123a05761239f613d46565b5b6040519080825280602002602001820160405280156123ce5781602001602082028036833780820191505090505b50816020018190525060005b84518110156124ba578481815181106123f6576123f5614fc0565b5b60200260200101518260000151828151811061241557612414614fc0565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506127108661247685848151811061246957612468614fc0565b5b60200260200101516139b3565b6124809190614f1e565b61248a9190614f8f565b826020015182815181106124a1576124a0614fc0565b5b60200260200101818152505080806001019150506123da565b5080925050509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b81819050868690501461250257600080fd5b83839050868690501461251457600080fd5b60005b868690508110156125e1576125d487878381811061253857612537614fc0565b5b905060200201602081019061254d919061408c565b8686848181106125605761255f614fc0565b5b9050602002013585858581811061257a57612579614fc0565b5b905060200281019061258c919061535e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610ad6565b8080600101915050612517565b50505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b612618613799565b6000612622611e54565b90506126f16040516024016040516020818303038152906040527fe97dcb62000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5060006126fc611e54565b90508082118061271657508282826127149190614dbf565b105b1561274d576040517f92e7634c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b61275a6124c7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415801561284f57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061281f9190614e08565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561289157336040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016128889190614910565b60405180910390fd5b61296b82826040516024016128a79291906153ee565b6040516020818303038152906040527fb269add3000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008282905067ffffffffffffffff8111156129b5576129b4613d46565b5b6040519080825280602002602001820160405280156129e35781602001602082028036833780820191505090505b50905060005b83839050811015612ac157838382818110612a0757612a06614fc0565b5b9050602002016020810190612a1c919061408c565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612a549190614910565b602060405180830381865afa158015612a71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a959190614cc2565b828281518110612aa857612aa7614fc0565b5b60200260200101818152505080806001019150506129e9565b5060008403612acf57606493505b60006064612adb611e54565b86612ae69190614f1e565b612af09190614f8f565b9050612bca81604051602401612b069190613cfc565b6040516020818303038152906040527f7f8661a1000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5060005b84849050811015612ccb57828181518110612bec57612beb614fc0565b5b6020026020010151858583818110612c0757612c06614fc0565b5b9050602002016020810190612c1c919061408c565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612c549190614910565b602060405180830381865afa158015612c71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c959190614cc2565b612c9f919061527e565b838281518110612cb257612cb1614fc0565b5b6020026020010181815250508080600101915050612bce565b50600082604051602001612cdf91906145de565b60405160208183030381529060405290506000815190508060208301fd5b612d05613799565b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612d92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d899061545e565b60405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b612e9384848484604051602401612e07949392919061547e565b60405160208183030381529060405263d348799760e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5050505050565b612ea26124c7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015612f9757507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f679190614e08565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15612fd957336040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401612fd09190614910565b60405180910390fd5b61300947612fe56124c7565b73ffffffffffffffffffffffffffffffffffffffff16613a0290919063ffffffff16565b565b606481565b6130b68484848460405160240161302a949392919061547e565b60405160208183030381529060405263e9cbafb060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5050505050565b6130c56124c7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156131ba57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa158015613166573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061318a9190614e08565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156131fc57336040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016131f39190614910565b60405180910390fd5b6132d4816040516024016132109190613cfc565b6040516020818303038152906040527fec34c7c0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5050565b6132e0613799565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60603073ffffffffffffffffffffffffffffffffffffffff16634b2170f284846040518363ffffffff1660e01b81526004016133619291906154be565b600060405180830381600087803b15801561337b57600080fd5b505af192505050801561338c575060015b6133de573d80600081146133bc576040519150601f19603f3d011682016040523d82523d6000602084013e6133c1565b606091505b50808060200190518101906133d69190615235565b9150506133df565b5b92915050565b6133ed613799565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361345f5760006040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016134569190614910565b60405180910390fd5b613468816138ef565b50565b6134736124c7565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415801561356857507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663570ca7356040518163ffffffff1660e01b8152600401602060405180830381865afa158015613514573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135389190614e08565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156135aa57336040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016135a19190614910565b60405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016135e59190614910565b602060405180830381865afa158015613602573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136269190614cc2565b905060008111156136645761366361363c6124c7565b828473ffffffffffffffffffffffffffffffffffffffff16613acc9092919063ffffffff16565b5b5050565b61370e8484848460405160240161368294939291906154f1565b60405160208183030381529060405263fa461e3360e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661371590919063ffffffff16565b5050505050565b60606000808473ffffffffffffffffffffffffffffffffffffffff168460405161373f919061556d565b600060405180830381855af49150503d806000811461377a576040519150601f19603f3d011682016040523d82523d6000602084013e61377f565b606091505b509150915061378f858383613b4b565b9250505092915050565b6137a1613bda565b73ffffffffffffffffffffffffffffffffffffffff166137bf6124c7565b73ffffffffffffffffffffffffffffffffffffffff161461381e576137e2613bda565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016138159190614910565b60405180910390fd5b565b6060814710156138695747826040517fcf479181000000000000000000000000000000000000000000000000000000008152600401613860929190615584565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051613892919061556d565b60006040518083038185875af1925050503d80600081146138cf576040519150601f19603f3d011682016040523d82523d6000602084013e6138d4565b606091505b50915091506138e4868383613b4b565b925050509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000808212156139fa57816040517fa8ce44320000000000000000000000000000000000000000000000000000000081526004016139f191906155ad565b60405180910390fd5b819050919050565b80471015613a495747816040517fcf479181000000000000000000000000000000000000000000000000000000008152600401613a40929190615584565b60405180910390fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1683604051613a70906155ee565b60006040518083038185875af1925050503d8060008114613aad576040519150601f19603f3d011682016040523d82523d6000602084013e613ab2565b606091505b509150915081613ac657613ac581613be2565b5b50505050565b613b46838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401613aff929190615603565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613c27565b505050565b606082613b6057613b5b82613be2565b613bd2565b60008251148015613b88575060008473ffffffffffffffffffffffffffffffffffffffff163b145b15613bca57836040517f9996b315000000000000000000000000000000000000000000000000000000008152600401613bc19190614910565b60405180910390fd5b819050613bd3565b5b9392505050565b600033905090565b600081511115613bf55780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080602060008451602086016000885af180613c4a576040513d6000823e3d81fd5b3d925060005191505060008214613c65576001811415613c81565b60008473ffffffffffffffffffffffffffffffffffffffff163b145b15613cc357836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401613cba9190614910565b60405180910390fd5b50505050565b604051806040016040528060608152602001606081525090565b6000819050919050565b613cf681613ce3565b82525050565b6000602082019050613d116000830184613ced565b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613d7e82613d35565b810181811067ffffffffffffffff82111715613d9d57613d9c613d46565b5b80604052505050565b6000613db0613d17565b9050613dbc8282613d75565b919050565b600067ffffffffffffffff821115613ddc57613ddb613d46565b5b613de582613d35565b9050602081019050919050565b82818337600083830152505050565b6000613e14613e0f84613dc1565b613da6565b905082815260208101848484011115613e3057613e2f613d30565b5b613e3b848285613df2565b509392505050565b600082601f830112613e5857613e57613d2b565b5b8135613e68848260208601613e01565b91505092915050565b600060208284031215613e8757613e86613d21565b5b600082013567ffffffffffffffff811115613ea557613ea4613d26565b5b613eb184828501613e43565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613ee582613eba565b9050919050565b613ef581613eda565b8114613f0057600080fd5b50565b600081359050613f1281613eec565b92915050565b613f2181613ce3565b8114613f2c57600080fd5b50565b600081359050613f3e81613f18565b92915050565b600080600060608486031215613f5d57613f5c613d21565b5b6000613f6b86828701613f03565b9350506020613f7c86828701613f2f565b925050604084013567ffffffffffffffff811115613f9d57613f9c613d26565b5b613fa986828701613e43565b9150509250925092565b60008060008060808587031215613fcd57613fcc613d21565b5b6000613fdb87828801613f03565b9450506020613fec87828801613f03565b9350506040613ffd87828801613f2f565b925050606085013567ffffffffffffffff81111561401e5761401d613d26565b5b61402a87828801613e43565b91505092959194509250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61406b81614036565b82525050565b60006020820190506140866000830184614062565b92915050565b6000602082840312156140a2576140a1613d21565b5b60006140b084828501613f03565b91505092915050565b6000806000606084860312156140d2576140d1613d21565b5b60006140e086828701613f03565b93505060206140f186828701613f03565b925050604061410286828701613f03565b9150509250925092565b6000806040838503121561412357614122613d21565b5b600061413185828601613f2f565b925050602083013567ffffffffffffffff81111561415257614151613d26565b5b61415e85828601613e43565b9150509250929050565b600080fd5b600080fd5b600067ffffffffffffffff82111561418d5761418c613d46565b5b602082029050602081019050919050565b600080fd5b60006141b66141b184614172565b613da6565b905080838252602082019050602084028301858111156141d9576141d861419e565b5b835b8181101561420257806141ee8882613f03565b8452602084019350506020810190506141db565b5050509392505050565b600082601f83011261422157614220613d2b565b5b81356142318482602086016141a3565b91505092915050565b600067ffffffffffffffff82111561425557614254613d46565b5b602082029050602081019050919050565b60006142796142748461423a565b613da6565b9050808382526020820190506020840283018581111561429c5761429b61419e565b5b835b818110156142c557806142b18882613f2f565b84526020840193505060208101905061429e565b5050509392505050565b600082601f8301126142e4576142e3613d2b565b5b81356142f4848260208601614266565b91505092915050565b60006040828403121561431357614312614168565b5b61431d6040613da6565b9050600082013567ffffffffffffffff81111561433d5761433c61416d565b5b6143498482850161420c565b600083015250602082013567ffffffffffffffff81111561436d5761436c61416d565b5b614379848285016142cf565b60208301525092915050565b6000806040838503121561439c5761439b613d21565b5b60006143aa85828601613f2f565b925050602083013567ffffffffffffffff8111156143cb576143ca613d26565b5b6143d7858286016142fd565b9150509250929050565b6000819050919050565b60006144066144016143fc84613eba565b6143e1565b613eba565b9050919050565b6000614418826143eb565b9050919050565b600061442a8261440d565b9050919050565b61443a8161441f565b82525050565b60006020820190506144556000830184614431565b92915050565b600080fd5b60008083601f84011261447657614475613d2b565b5b8235905067ffffffffffffffff8111156144935761449261445b565b5b6020830191508360208202830111156144af576144ae61419e565b5b9250929050565b6000806000604084860312156144cf576144ce613d21565b5b60006144dd86828701613f2f565b935050602084013567ffffffffffffffff8111156144fe576144fd613d26565b5b61450a86828701614460565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000819050919050565b61455581614542565b82525050565b6000614567838361454c565b60208301905092915050565b6000602082019050919050565b600061458b82614516565b6145958185614521565b93506145a083614532565b8060005b838110156145d15781516145b8888261455b565b97506145c383614573565b9250506001810190506145a4565b5085935050505092915050565b600060208201905081810360008301526145f88184614580565b905092915050565b6000806020838503121561461757614616613d21565b5b600083013567ffffffffffffffff81111561463557614634613d26565b5b61464185828601614460565b92509250509250929050565b60008115159050919050565b6146628161464d565b82525050565b600060208201905061467d6000830184614659565b92915050565b60006020828403121561469957614698613d21565b5b60006146a784828501613f2f565b91505092915050565b6000806000606084860312156146c9576146c8613d21565b5b60006146d786828701613f2f565b93505060206146e886828701613f2f565b925050604084013567ffffffffffffffff81111561470957614708613d26565b5b6147158682870161420c565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61475481613eda565b82525050565b6000614766838361474b565b60208301905092915050565b6000602082019050919050565b600061478a8261471f565b614794818561472a565b935061479f8361473b565b8060005b838110156147d05781516147b7888261475a565b97506147c283614772565b9250506001810190506147a3565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61481281613ce3565b82525050565b60006148248383614809565b60208301905092915050565b6000602082019050919050565b6000614848826147dd565b61485281856147e8565b935061485d836147f9565b8060005b8381101561488e5781516148758882614818565b975061488083614830565b925050600181019050614861565b5085935050505092915050565b600060408301600083015184820360008601526148b8828261477f565b915050602083015184820360208601526148d2828261483d565b9150508091505092915050565b600060208201905081810360008301526148f9818461489b565b905092915050565b61490a81613eda565b82525050565b60006020820190506149256000830184614901565b92915050565b60008083601f84011261494157614940613d2b565b5b8235905067ffffffffffffffff81111561495e5761495d61445b565b5b60208301915083602082028301111561497a5761497961419e565b5b9250929050565b60008083601f84011261499757614996613d2b565b5b8235905067ffffffffffffffff8111156149b4576149b361445b565b5b6020830191508360208202830111156149d0576149cf61419e565b5b9250929050565b600080600080600080606087890312156149f4576149f3613d21565b5b600087013567ffffffffffffffff811115614a1257614a11613d26565b5b614a1e89828a01614460565b9650965050602087013567ffffffffffffffff811115614a4157614a40613d26565b5b614a4d89828a0161492b565b9450945050604087013567ffffffffffffffff811115614a7057614a6f613d26565b5b614a7c89828a01614981565b92509250509295509295509295565b60008083601f840112614aa157614aa0613d2b565b5b8235905067ffffffffffffffff811115614abe57614abd61445b565b5b602083019150836001820283011115614ada57614ad961419e565b5b9250929050565b60008060208385031215614af857614af7613d21565b5b600083013567ffffffffffffffff811115614b1657614b15613d26565b5b614b2285828601614a8b565b92509250509250929050565b60008060008060608587031215614b4857614b47613d21565b5b6000614b5687828801613f2f565b9450506020614b6787828801613f2f565b935050604085013567ffffffffffffffff811115614b8857614b87613d26565b5b614b9487828801614a8b565b925092505092959194509250565b6000614bad82613eda565b9050919050565b614bbd81614ba2565b8114614bc857600080fd5b50565b600081359050614bda81614bb4565b92915050565b600060208284031215614bf657614bf5613d21565b5b6000614c0484828501614bcb565b91505092915050565b614c1681614542565b8114614c2157600080fd5b50565b600081359050614c3381614c0d565b92915050565b60008060008060608587031215614c5357614c52613d21565b5b6000614c6187828801614c24565b9450506020614c7287828801614c24565b935050604085013567ffffffffffffffff811115614c9357614c92613d26565b5b614c9f87828801614a8b565b925092505092959194509250565b600081519050614cbc81613f18565b92915050565b600060208284031215614cd857614cd7613d21565b5b6000614ce684828501614cad565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015614d29578082015181840152602081019050614d0e565b60008484015250505050565b6000614d4082614cef565b614d4a8185614cfa565b9350614d5a818560208601614d0b565b614d6381613d35565b840191505092915050565b60006020820190508181036000830152614d888184614d35565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614dca82613ce3565b9150614dd583613ce3565b9250828203905081811115614ded57614dec614d90565b5b92915050565b600081519050614e0281613eec565b92915050565b600060208284031215614e1e57614e1d613d21565b5b6000614e2c84828501614df3565b91505092915050565b600082825260208201905092915050565b7f57726f6e67207478206f726967696e0000000000000000000000000000000000600082015250565b6000614e7c600f83614e35565b9150614e8782614e46565b602082019050919050565b60006020820190508181036000830152614eab81614e6f565b9050919050565b7f4c656e64696e67206973206e6f742077686974656c6973746564000000000000600082015250565b6000614ee8601a83614e35565b9150614ef382614eb2565b602082019050919050565b60006020820190508181036000830152614f1781614edb565b9050919050565b6000614f2982613ce3565b9150614f3483613ce3565b9250828202614f4281613ce3565b91508282048414831517614f5957614f58614d90565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614f9a82613ce3565b9150614fa583613ce3565b925082614fb557614fb4614f60565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000614ffa82613ce3565b915061500583613ce3565b925082820190508082111561501d5761501c614d90565b5b92915050565b7f57726f6e672070657263656e7461676500000000000000000000000000000000600082015250565b6000615059601083614e35565b915061506482615023565b602082019050919050565b600060208201905081810360008301526150888161504c565b9050919050565b600082825260208201905092915050565b6000819050919050565b60006150b96020840184613f03565b905092915050565b6000602082019050919050565b60006150da838561508f565b93506150e5826150a0565b8060005b8581101561511e576150fb82846150aa565b615105888261475a565b9750615110836150c1565b9250506001810190506150e9565b5085925050509392505050565b60006040820190506151406000830186613ced565b81810360208301526151538184866150ce565b9050949350505050565b600067ffffffffffffffff82111561517857615177613d46565b5b602082029050602081019050919050565b60008151905061519881614c0d565b92915050565b60006151b16151ac8461515d565b613da6565b905080838252602082019050602084028301858111156151d4576151d361419e565b5b835b818110156151fd57806151e98882615189565b8452602084019350506020810190506151d6565b5050509392505050565b600082601f83011261521c5761521b613d2b565b5b815161522c84826020860161519e565b91505092915050565b60006020828403121561524b5761524a613d21565b5b600082015167ffffffffffffffff81111561526957615268613d26565b5b61527584828501615207565b91505092915050565b600061528982614542565b915061529483614542565b92508282039050818112600084121682821360008512151617156152bb576152ba614d90565b5b92915050565b60006152cc8261471f565b6152d6818561508f565b93506152e18361473b565b8060005b838110156153125781516152f9888261475a565b975061530483614772565b9250506001810190506152e5565b5085935050505092915050565b60006040820190506153346000830185613ced565b818103602083015261534681846152c1565b90509392505050565b600080fd5b600080fd5b600080fd5b6000808335600160200384360303811261537b5761537a61534f565b5b80840192508235915067ffffffffffffffff82111561539d5761539c615354565b5b6020830192506001820236038313156153b9576153b8615359565b5b509250929050565b60006153cd8385614cfa565b93506153da838584613df2565b6153e383613d35565b840190509392505050565b600060208201905081810360008301526154098184866153c1565b90509392505050565b7f416c6c72656164792077686974656c6973746564000000000000000000000000600082015250565b6000615448601483614e35565b915061545382615412565b602082019050919050565b600060208201905081810360008301526154778161543b565b9050919050565b60006060820190506154936000830187613ced565b6154a06020830186613ced565b81810360408301526154b38184866153c1565b905095945050505050565b600060208201905081810360008301526154d98184866150ce565b90509392505050565b6154eb81614542565b82525050565b600060608201905061550660008301876154e2565b61551360208301866154e2565b81810360408301526155268184866153c1565b905095945050505050565b600081905092915050565b600061554782614cef565b6155518185615531565b9350615561818560208601614d0b565b80840191505092915050565b6000615579828461553c565b915081905092915050565b60006040820190506155996000830185613ced565b6155a66020830184613ced565b9392505050565b60006020820190506155c260008301846154e2565b92915050565b50565b60006155d8600083615531565b91506155e3826155c8565b600082019050919050565b60006155f9826155cb565b9150819050919050565b60006040820190506156186000830185614901565b6156256020830184613ced565b939250505056fea264697066735822122028beb2dd9cfeea82af9cb9a2b8c0b98ef07f6d34911489e3b70e8ccbacef26dd64736f6c63430008180033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b14610101578063b3ab15fb1461011f578063b946636e1461013b578063f2fde38b1461015957610088565b8063570ca7351461008d578063574b05a8146100ab57806359a5572f146100c7578063715018a6146100f7575b600080fd5b610095610175565b6040516100a291906107b4565b60405180910390f35b6100c560048036038101906100c09190610800565b61019b565b005b6100e160048036038101906100dc9190610853565b6102cd565b6040516100ee91906107b4565b60405180910390f35b6100ff61034f565b005b610109610363565b60405161011691906107b4565b60405180910390f35b61013960048036038101906101349190610893565b61038c565b005b6101436103d8565b604051610150919061091f565b60405180910390f35b610173600480360381019061016e9190610893565b6103fe565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006101f1600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685856040516020016101d6929190610982565b60405160208183030381529060405280519060200120610484565b90508073ffffffffffffffffffffffffffffffffffffffff1663184b95598486856040518463ffffffff1660e01b8152600401610230939291906109ae565b600060405180830381600087803b15801561024a57600080fd5b505af115801561025e573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f5b46e214fecd114a3c080d3fe6c9382401c9e63aa1742d84c6f9ae567208e75e836040516102bf91906107b4565b60405180910390a350505050565b6000610323600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168484604051602001610308929190610982565b6040516020818303038152906040528051906020012061049a565b905060008173ffffffffffffffffffffffffffffffffffffffff163b0361034957600090505b92915050565b6103576104af565b6103616000610536565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6103946104af565b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104066104af565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036104785760006040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161046f91906107b4565b60405180910390fd5b61048181610536565b50565b6000610492838360006105fa565b905092915050565b60006104a78383306106f4565b905092915050565b6104b761076b565b73ffffffffffffffffffffffffffffffffffffffff166104d5610363565b73ffffffffffffffffffffffffffffffffffffffff1614610534576104f861076b565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161052b91906107b4565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000814710156106435747826040517fcf47918100000000000000000000000000000000000000000000000000000000815260040161063a9291906109fe565b60405180910390fd5b763d602d80600a3d3981f3363d3d373d3d3d363d730000008460601b60e81c176000526e5af43d82803e903d91602b57fd5bf38460781b17602052826037600984f59050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036106ed576040517fb06ebf3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9392505050565b60006040518260388201526f5af43d82803e903d91602b57fd5bf3ff6024820152846014820152733d602d80600a3d3981f3363d3d373d3d3d363d7381528360588201526037600c820120607882015273ffffffffffffffffffffffffffffffffffffffff60556043830120169150509392505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061079e82610773565b9050919050565b6107ae81610793565b82525050565b60006020820190506107c960008301846107a5565b92915050565b600080fd5b6107dd81610793565b81146107e857600080fd5b50565b6000813590506107fa816107d4565b92915050565b600080600060608486031215610819576108186107cf565b5b6000610827868287016107eb565b9350506020610838868287016107eb565b9250506040610849868287016107eb565b9150509250925092565b6000806040838503121561086a576108696107cf565b5b6000610878858286016107eb565b9250506020610889858286016107eb565b9150509250929050565b6000602082840312156108a9576108a86107cf565b5b60006108b7848285016107eb565b91505092915050565b6000819050919050565b60006108e56108e06108db84610773565b6108c0565b610773565b9050919050565b60006108f7826108ca565b9050919050565b6000610909826108ec565b9050919050565b610919816108fe565b82525050565b60006020820190506109346000830184610910565b92915050565b60008160601b9050919050565b60006109528261093a565b9050919050565b600061096482610947565b9050919050565b61097c61097782610793565b610959565b82525050565b600061098e828561096b565b60148201915061099e828461096b565b6014820191508190509392505050565b60006060820190506109c360008301866107a5565b6109d060208301856107a5565b6109dd60408301846107a5565b949350505050565b6000819050919050565b6109f8816109e5565b82525050565b6000604082019050610a1360008301856109ef565b610a2060208301846109ef565b939250505056fea264697066735822122064317a8da79ac375002eb346bac350dc8289c492cd32add41a63656f271a515b64736f6c63430008180033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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.