FRAX Price: $0.80 (-2.03%)

Contract

0x01fA3A1AbD225B252E4aBD179688d316aF47ed8E

Overview

FRAX Balance | FXTL Balance

0 FRAX | 1,163 FXTL

FRAX Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Swap Tokens66013602024-07-03 13:30:31573 days ago1720013431IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.00000310.00010025
Swap Tokens66013042024-07-03 13:28:39573 days ago1720013319IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.000002810.00010025
Withdraw Fees66012492024-07-03 13:26:49573 days ago1720013209IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.000002460.00010025
Withdraw Fees66012162024-07-03 13:25:43573 days ago1720013143IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.000002360.00010025
Swap Tokens66007592024-07-03 13:10:29573 days ago1720012229IN
0x01fA3A1A...6aF47ed8E
0.0001 FRAX0.00000370.00010025
Swap Tokens66007322024-07-03 13:09:35573 days ago1720012175IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.000003660.00010025
Cancel Swap Orde...66005472024-07-03 13:03:25573 days ago1720011805IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.000003330.00010025
Cancel Swap Orde...65985882024-07-03 11:58:07573 days ago1720007887IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.000000580.00010025
Swap Tokens65930442024-07-03 8:53:19573 days ago1719996799IN
0x01fA3A1A...6aF47ed8E
0.0001 FRAX0.000000480.00010025
Swap Tokens65929792024-07-03 8:51:09573 days ago1719996669IN
0x01fA3A1A...6aF47ed8E
0 FRAX0.000000430.00010025

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
66012492024-07-03 13:26:49573 days ago1720013209
0x01fA3A1A...6aF47ed8E
0.0002 FRAX

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Magenta

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;

import {Data} from "../libraries/Data.sol";
import {IMagenta} from "./interfaces/IMagenta.sol";
import {ITimely} from "../interfaces/ITimely.sol";
import {TimelyReceiver} from "../TimelyReceiver.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {IUniswapV2Router01} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol";
import {IUniswapV2Pair} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import {IUniswapV2Factory} from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";

contract Magenta is TimelyReceiver, AccessControl, Pausable, IMagenta {
    using SafeERC20 for IERC20;
    using Math for uint256;

    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");

    ITimely private _timely;
    IUniswapV2Router01 private _router;

    uint256 private _totalEarnedFees = 0;

    uint256 private _magentaFee;

    uint256 private _count;
    bytes32 private _identifier;

    // === Mappings ===
    mapping(bytes32 => SwapOrder) private _swapOrders;
    mapping(bytes32 => DCAOrder) private _dcaOrders;
    mapping(bytes32 => LimitOrder) private _limitOrders;
    mapping(bytes32 => TransferOrder) private _transferOrders;

    mapping(bytes32 => OrderType) private _orderTypes;

    constructor(
        address timely,
        address router,
        uint256 magentaFee
    ) TimelyReceiver(timely) {
        _timely = ITimely(getTimely());
        _router = IUniswapV2Router01(router);
        _magentaFee = magentaFee;

        _grantRole(ADMIN_ROLE, _msgSender());
        _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());

        IERC20(_timely.getTimelyToken()).approve(
            getTimely(),
            type(uint256).max
        );
    }

    // === Mutative Functions ===
    function swapTokens(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOutMin,
        uint64 startDelay,
        uint256 deadline
    ) external payable override whenNotPaused returns (bytes32) {
        IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);

        if (startDelay > 0) {
            require(msg.value >= _magentaFee, "Insufficient fee");
            _totalEarnedFees += _magentaFee;

            uint256 numberOfExecution = 1;
            uint256 timelyFee = _timely.estimateFee(numberOfExecution);

            IERC20(_timely.getTimelyToken()).safeTransferFrom(
                _msgSender(),
                address(this),
                timelyFee
            );

            _timely.deposit(timelyFee);

            // Create the time function param.
            Data.TimePayload memory timePayload = Data.TimePayload({
                delay: startDelay,
                iSchedule: Data.Schedule.ONCE,
                iMinutes: Data.Minutes.INGORE,
                iHours: Data.Hours.INGORE,
                middleware: Data.Middleware.INGORE
            });

            // Publish the time function to timely network.
            // And update the identifier.
            bytes32 identifier = _timely.publish(timePayload);

            _swapOrders[identifier] = SwapOrder({
                actor: _msgSender(),
                tokenIn: tokenIn,
                tokenOut: tokenOut,
                amountIn: amountIn,
                amountOutMin: amountOutMin,
                timestamp: block.timestamp,
                deadline: deadline,
                completed: false
            });
            _orderTypes[identifier] = OrderType.SwapOrder;

            emit SwapOrderCreated(
                identifier,
                tokenIn,
                tokenOut,
                amountIn,
                amountOutMin,
                startDelay,
                deadline
            );

            return identifier;
        }

        address[] memory path = new address[](2);
        path[0] = tokenIn;
        path[1] = tokenOut;

        IERC20(tokenIn).approve(address(_router), amountIn);

        _router.swapExactTokensForTokens(
            amountIn,
            amountOutMin,
            path,
            _msgSender(),
            deadline
        );

        emit SwapOrderCreated(
            bytes32(0),
            tokenIn,
            tokenOut,
            amountIn,
            amountOutMin,
            startDelay,
            deadline
        );

        return bytes32(0);
    }

    function cancelSwapOrder(bytes32 identifier) external whenNotPaused {
        SwapOrder storage order = _swapOrders[identifier];
        require(!order.completed, "Order was completed");
        require(order.actor == _msgSender());

        IERC20(order.tokenIn).transferFrom(
            address(this),
            order.actor,
            order.amountIn
        );

        // mark as completed
        order.completed = true;

        _timely.cancel(identifier);

        emit SwapOrderCancelled(identifier);
    }

    function createLimitOrder(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOutMin,
        uint64 startDelay,
        uint256 deadline
    ) external payable override whenNotPaused returns (bytes32) {
        IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);

        require(msg.value >= _magentaFee, "Insufficient fee");
        _totalEarnedFees += _magentaFee;

        uint256 numberOfExecution = 1;
        uint256 timelyFee = _timely.estimateFee(numberOfExecution);

        IERC20(_timely.getTimelyToken()).safeTransferFrom(
            _msgSender(),
            address(this),
            timelyFee
        );

        _timely.deposit(timelyFee);

        // Create the time function param.
        Data.TimePayload memory timePayload = Data.TimePayload({
            delay: startDelay,
            iSchedule: Data.Schedule.REPEAT,
            iMinutes: Data.Minutes.ONE_MINUTES,
            iHours: Data.Hours.INGORE,
            middleware: Data.Middleware.EXISTS
        });

        // Publish the time function to timely network.
        // And update the identifier.
        bytes32 identifier = _timely.publish(timePayload);

        _limitOrders[identifier] = LimitOrder({
            actor: _msgSender(),
            tokenIn: tokenIn,
            tokenOut: tokenOut,
            amountIn: amountIn,
            amountOutMin: amountOutMin,
            timestamp: block.timestamp,
            deadline: deadline,
            completed: false
        });
        _orderTypes[identifier] = OrderType.DCAOrder;

        emit LimitOrderCreated(
            identifier,
            tokenIn,
            tokenOut,
            amountIn,
            amountOutMin,
            startDelay,
            deadline
        );

        return identifier;
    }

    function cancelLimitOrder(
        bytes32 identifier
    ) external override whenNotPaused {
        LimitOrder storage order = _limitOrders[identifier];
        require(!order.completed, "Order was completed");
        require(order.actor == _msgSender());

        IERC20(order.tokenIn).transferFrom(
            address(this),
            order.actor,
            order.amountIn
        );

        // mark as completed
        order.completed = true;

        _timely.cancel(identifier);

        emit LimitOrdeCancelled(identifier);
    }

    function createDCAOrder(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint64 startDelay,
        uint256 numOfOrders,
        Data.Minutes iMinutes,
        Data.Hours iHours
    ) external payable override whenNotPaused returns (bytes32) {
        IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);

        require(msg.value >= _magentaFee, "Insufficient fee");
        _totalEarnedFees += _magentaFee;

        uint256 numberOfExecution = numOfOrders;
        uint256 timelyFee = _timely.estimateFee(numberOfExecution);

        IERC20(_timely.getTimelyToken()).safeTransferFrom(
            _msgSender(),
            address(this),
            timelyFee
        );

        _timely.deposit(timelyFee);

        // Create the time function param.
        Data.TimePayload memory timePayload = Data.TimePayload({
            delay: startDelay,
            iSchedule: Data.Schedule.REPEAT,
            iMinutes: iMinutes,
            iHours: iHours,
            middleware: Data.Middleware.INGORE
        });

        // Publish the time function to timely network.
        // And update the identifier.
        bytes32 identifier = _timely.publish(timePayload);

        _dcaOrders[identifier] = DCAOrder({
            actor: _msgSender(),
            tokenIn: tokenIn,
            tokenOut: tokenOut,
            amountIn: amountIn,
            numOfOrders: numOfOrders,
            iMinutes: iMinutes,
            iHours: iHours,
            amountInBalance: amountIn,
            timestamp: block.timestamp,
            completed: false
        });
        _orderTypes[identifier] = OrderType.DCAOrder;

        emit DCAOrderCreated(
            identifier,
            tokenIn,
            tokenOut,
            amountIn,
            startDelay,
            numOfOrders,
            iMinutes,
            iHours
        );

        return identifier;
    }

    function cancelDCAOrder(
        bytes32 identifier
    ) external override whenNotPaused {
        DCAOrder storage order = _dcaOrders[identifier];
        require(!order.completed, "Order was completed");
        require(order.actor == _msgSender());

        IERC20(order.tokenIn).safeTransferFrom(
            address(this),
            order.actor,
            order.amountInBalance
        );

        // mark as completed
        order.completed = true;

        _timely.cancel(identifier);

        emit DCAOrderCancelled(identifier);
    }

    function createTransferOrder(
        address receiver,
        address tokenIn,
        uint256 amountIn,
        uint64 startDelay,
        uint256 numOfOrders,
        Data.Minutes iMinutes,
        Data.Hours iHours
    ) external payable override whenNotPaused returns (bytes32) {
        require(_msgSender() != receiver, "Can't do self transfer");

        IERC20(tokenIn).safeTransferFrom(_msgSender(), address(this), amountIn);

        uint256 numberOfExecution = numOfOrders;

        require(msg.value >= _magentaFee, "Insufficient fee");
        _totalEarnedFees += _magentaFee;

        uint256 timelyFee = _timely.estimateFee(numberOfExecution);

        IERC20(_timely.getTimelyToken()).safeTransferFrom(
            _msgSender(),
            address(this),
            timelyFee
        );

        _timely.deposit(timelyFee);

        // Create the time function param.
        Data.TimePayload memory timePayload = Data.TimePayload({
            delay: startDelay,
            iSchedule: Data.Schedule.REPEAT,
            iMinutes: iMinutes,
            iHours: iHours,
            middleware: Data.Middleware.INGORE
        });

        // Publish the time function to timely network.
        // And update the identifier.
        bytes32 identifier = _timely.publish(timePayload);

        _transferOrders[identifier] = TransferOrder({
            actor: _msgSender(),
            receiver: receiver,
            tokenIn: tokenIn,
            amountIn: amountIn,
            numOfOrders: numOfOrders,
            iMinutes: iMinutes,
            iHours: iHours,
            amountInBalance: amountIn,
            timestamp: block.timestamp,
            completed: false
        });
        _orderTypes[identifier] = OrderType.TransferOrder;

        emit TransferOrderCreated(
            identifier,
            receiver,
            tokenIn,
            amountIn,
            startDelay,
            numOfOrders,
            iMinutes,
            iHours
        );

        return identifier;
    }

    function cancelTranferOrder(
        bytes32 identifier
    ) external override whenNotPaused {
        TransferOrder storage order = _transferOrders[identifier];
        require(!order.completed, "TransferOrder was completed");
        require(order.actor == _msgSender());

        IERC20(order.tokenIn).safeTransferFrom(
            address(this),
            order.actor,
            order.amountInBalance
        );

        // mark as completed
        order.completed = true;

        _timely.cancel(identifier);

        emit TransferOrderCancelled(identifier);
    }

    // === Internal Callback Functions ===
    function _timelyCallback(
        Data.TimePayloadIn calldata timePayload
    ) internal virtual override {
        bytes32 identifier = timePayload.identifier;
        OrderType orderType = _orderTypes[identifier];

        if (orderType == OrderType.SwapOrder) {
            _executeSwapOrderInternal(identifier);
        }

        if (orderType == OrderType.LimitOrder) {
            _executeLimitOrderInternal(identifier);
        }

        if (orderType == OrderType.DCAOrder) {
            _executeDCAOrderInternal(identifier);
        }

        if (orderType == OrderType.TransferOrder) {
            _executeTransferInternal(identifier);
        }

        // Check if deposited amount will be enough for next iteration.
        uint256 estimatedFee = _timely.estimateFee(1);

        if (_timely.balanceOf(address(this)) < estimatedFee) {
            // pay for next five iteration.
            _timely.deposit(estimatedFee * 5);
        }
    }

    function _timelyMiddleware(
        bytes32 identifier
    ) internal view virtual override returns (bool) {
        OrderType orderType = _orderTypes[identifier];

        if (orderType == OrderType.LimitOrder) {
            LimitOrder memory order = _limitOrders[identifier];

            uint256 amountOut = getAmountOut(
                order.tokenIn,
                order.tokenOut,
                order.amountIn,
                0
            );

            return amountOut >= order.amountOutMin;
        }

        return true;
    }

    // === Internal Functions ===
    function _executeSwapOrderInternal(bytes32 identifier) internal {
        SwapOrder storage order = _swapOrders[identifier];
        require(!order.completed, "Order has been completed");

        address[] memory path = new address[](2);
        path[0] = order.tokenIn;
        path[1] = order.tokenOut;

        IERC20(order.tokenIn).approve(address(_router), order.amountIn);

        _router.swapExactTokensForTokens(
            order.amountIn,
            order.amountOutMin,
            path,
            order.actor,
            order.deadline
        );

        // mark as completed
        order.completed = true;

        _timely.cancel(identifier);
    }

    function _executeLimitOrderInternal(bytes32 identifier) internal {
        LimitOrder storage order = _limitOrders[identifier];
        require(!order.completed, "Order has been completed");

        address[] memory path = new address[](2);
        path[0] = order.tokenIn;
        path[1] = order.tokenOut;

        IERC20(order.tokenIn).approve(address(_router), order.amountIn);

        _router.swapExactTokensForTokens(
            order.amountIn,
            order.amountOutMin,
            path,
            order.actor,
            order.deadline
        );

        // mark as completed
        order.completed = true;

        _timely.cancel(identifier);
    }

    function _executeDCAOrderInternal(bytes32 identifier) internal {
        DCAOrder storage order = _dcaOrders[identifier];
        require(!order.completed, "Order has been completed");

        uint256 amountPerSwap = order.amountIn / order.numOfOrders;

        address[] memory path = new address[](2);
        path[0] = order.tokenIn;
        path[1] = order.tokenOut;

        IERC20(order.tokenIn).approve(address(_router), amountPerSwap);

        _router.swapExactTokensForTokens(
            amountPerSwap,
            0, // amountOutMin
            path,
            order.actor,
            block.timestamp + 10 // deadline
        );

        order.amountInBalance -= amountPerSwap;

        // clean up before completing
        if (amountPerSwap < order.amountInBalance) {
            if (order.amountInBalance > 0) {
                IERC20(order.tokenIn).safeTransfer(
                    order.actor,
                    order.amountInBalance
                );

                order.amountInBalance = 0;
            }

            // mark as completed
            order.completed = true;

            _timely.cancel(identifier);
        }
    }

    function _executeTransferInternal(bytes32 identifier) internal {
        TransferOrder storage order = _transferOrders[identifier];
        require(!order.completed, "TransferOrder has been completed");

        uint256 amountPerTransfer = order.amountIn / order.numOfOrders;

        IERC20(order.tokenIn).safeTransfer(order.receiver, amountPerTransfer);

        order.amountInBalance -= amountPerTransfer;

        // clean up before completing
        if (amountPerTransfer < order.amountInBalance) {
            if (order.amountInBalance > 0) {
                IERC20(order.tokenIn).safeTransfer(
                    order.receiver,
                    order.amountInBalance
                );

                order.amountInBalance = 0;
            }

            // mark as completed
            order.completed = true;

            _timely.cancel(identifier);
        }
    }

    // === Public Functions ===
    function getAmountOut(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 fee
    ) public view override returns (uint256) {
        address pair = IUniswapV2Factory(_router.factory()).getPair(
            tokenIn,
            tokenOut
        );

        (uint112 reserve0, uint112 reserve1, ) = IUniswapV2Pair(pair)
            .getReserves();

        address token0 = IUniswapV2Pair(pair).token0();

        (uint112 reserveIn, uint112 reserveOut) = tokenIn == token0
            ? (reserve0, reserve1)
            : (reserve1, reserve0);

        uint256 amountOut = _getAmountOut(amountIn, reserveIn, reserveOut, fee);

        return amountOut;
    }

    // === Private Functions ===
    function _getAmountOut(
        uint256 amountIn,
        uint112 reserveIn,
        uint256 reserveOut,
        uint256 fee
    ) private pure returns (uint256) {
        uint256 usedFee = fee > 0 ? fee : 9_970;
        require(amountIn > 0 && reserveIn > 0 && reserveOut > 0); // INSUFFICIENT_INPUT_AMOUNT, INSUFFICIENT_LIQUIDITY
        uint256 amountInWithFee = amountIn * usedFee;
        uint256 numerator = amountInWithFee * reserveOut;
        uint256 denominator = (reserveIn * 10_000) + amountInWithFee;
        return numerator / denominator;
    }

    // === Admin Functions ===
    function depositFunds(uint256 amount) external onlyRole(ADMIN_ROLE) {
        _timely.deposit(amount);
    }

    function withdrawFees(
        address receiver,
        uint256 amount
    ) external onlyRole(ADMIN_ROLE) {
        require(amount <= _totalEarnedFees, "Insufficient amount");

        payable(receiver).transfer(amount);

        _totalEarnedFees -= amount;
    }

    function updateMagentaFee(uint256 newFee) external onlyRole(ADMIN_ROLE) {
        _magentaFee = newFee;
    }

    function pause() external onlyRole(ADMIN_ROLE) {
        _pause();
    }

    function unPause() external onlyRole(ADMIN_ROLE) {
        _unpause();
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

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

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

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

pragma solidity ^0.8.20;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;

import {Data} from "../../libraries/Data.sol";

interface IMagenta {
    // === Enums ===
    enum OrderType {
        SwapOrder,
        LimitOrder,
        DCAOrder,
        TransferOrder
    }

    // === Structs ===
    struct SwapOrder {
        address actor;
        address tokenIn;
        address tokenOut;
        uint256 amountIn;
        uint256 amountOutMin;
        uint256 timestamp;
        uint256 deadline;
        bool completed;
    }

    struct LimitOrder {
        address actor;
        address tokenIn;
        address tokenOut;
        uint256 amountIn;
        uint256 amountOutMin;
        uint256 timestamp;
        uint256 deadline;
        bool completed;
    }

    struct DCAOrder {
        address actor;
        address tokenIn;
        address tokenOut;
        uint256 amountIn;
        uint256 numOfOrders;
        Data.Minutes iMinutes;
        Data.Hours iHours;
        uint256 amountInBalance;
        uint256 timestamp;
        bool completed;
    }

    struct TransferOrder {
        address actor;
        address receiver;
        address tokenIn;
        uint256 amountIn;
        uint256 numOfOrders;
        Data.Minutes iMinutes;
        Data.Hours iHours;
        uint256 amountInBalance;
        uint256 timestamp;
        bool completed;
    }

    // === Events ===
    event SwapOrderCreated(
        bytes32 identifier,
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOutMin,
        uint64 startDelay,
        uint256 deadline
    );

    event SwapOrderCancelled(bytes32 identifier);

    event LimitOrderCreated(
        bytes32 identifier,
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOutMin,
        uint64 startDelay,
        uint256 deadline
    );

    event LimitOrdeCancelled(bytes32 identifier);

    event DCAOrderCreated(
        bytes32 identifier,
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint64 startDelay,
        uint256 numOfOrders,
        Data.Minutes iMinutes,
        Data.Hours iHours
    );

    event DCAOrderCancelled(bytes32 identifier);

    event TransferOrderCreated(
        bytes32 identifier,
        address receiver,
        address tokenIn,
        uint256 amountIn,
        uint64 startDelay,
        uint256 numOfOrders,
        Data.Minutes iMinutes,
        Data.Hours iHours
    );

    event TransferOrderCancelled(bytes32 identifier);

    // === Functions ===
    function swapTokens(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOutMin,
        uint64 startDelay,
        uint256 deadline
    ) external payable returns (bytes32);

    function cancelSwapOrder(bytes32 identifier) external;

    function createLimitOrder(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 amountOutMin,
        uint64 startDelay,
        uint256 deadline
    ) external payable returns (bytes32);

    function cancelLimitOrder(bytes32 identifier) external;

    function createDCAOrder(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint64 startDelay,
        uint256 numOfOrders,
        Data.Minutes iMinutes,
        Data.Hours iHours
    ) external payable returns (bytes32);

    function cancelDCAOrder(bytes32 identifier) external;

    function createTransferOrder(
        address receiver,
        address tokenIn,
        uint256 amountIn,
        uint64 startDelay,
        uint256 numOfOrders,
        Data.Minutes iMinutes,
        Data.Hours iHours
    ) external payable returns (bytes32);

    function cancelTranferOrder(bytes32 identifier) external;

    function getAmountOut(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 fee
    ) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;

import {Data} from "../libraries/Data.sol";

interface ITimely {
    error IndexAlreadyExecuted(bytes32 identifier, uint64 index);
    error InsufficientFee();
    error InsufficientAmount(uint256 amount);
    error UnAuthorize();
    error IdentifierAlreadyCancelled();

    event Published(
        uint64 nonce,
        bytes32 identifier,
        address sender,
        uint64 delay,
        Data.Schedule iSchedule,
        Data.Minutes iMinutes,
        Data.Hours iHours,
        Data.Middleware middleware
    );
    event Deposited(address sender, uint256 amount);
    event Withdrawn(address sender, uint256 amount);
    event Cancelled(bytes32 identifier);
    event ClaimedTokens(address tokenId, uint256 amount);

    function publish(
        Data.TimePayload calldata timePayload
    ) external returns (bytes32);

    function cancel(bytes32 identifier) external;

    function deposit(uint256 amount) external;

    function withdraw(uint256 amount) external;

    function balanceOf(address sender) external view returns (uint256);

    function getTimelyToken() external view returns (address);

    function claimTokens(address tokenId, uint256 amount) external;

    function estimateFee(uint256 count) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;

import {Data} from "../libraries/Data.sol";

interface ITimelyReceiver {
    function timelyCallback(Data.TimePayloadIn calldata timePayload) external;

    function timelyMiddleware(bytes32 identifier) external view returns (bool);

    function getTimely() external view returns (address);
}

File 19 of 20 : Data.sol
// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;

library Data {
    enum Minutes {
        ONE_MINUTES,
        TWO_MINUTES,
        FIVE_MINUTES,
        TEN_MINUTES,
        FIFTEEN_MINUTES,
        TWENTY_MINUTES,
        TWENTY_FIVE_MINUTES,
        THIRTY_MINUTES,
        THIRTY_FIVE_MINUTES,
        FORTY_MINUTES,
        FORTY_FIVE_MINUTES,
        FIFTY_MINUTES,
        FIFTY_FIVE_MINUTES,
        SIXTY_MINUTES,
        INGORE
    }

    enum Hours {
        ZERO_HOUR,
        ONE_HOUR,
        TWO_HOUR,
        THREE_HOUR,
        FOUR_HOUR,
        FIVE_HOUR,
        SIX_HOUR,
        SEVEN_HOUR,
        EIGHT_HOUR,
        NINE_HOUR,
        TEN_HOUR,
        ELEVEN_HOUR,
        TWELVE_HOUR,
        THIRTEEN_HOUR,
        FOURTEEN_HOUR,
        FIFTEEN_HOUR,
        SIXTEEN_HOUR,
        SEVENTEEN_HOUR,
        EIGHTEEN_HOUR,
        NINETEEN_HOUR,
        TWENTY_HOUR,
        TWENTY_ONE_HOUR,
        TWENTY_TWO_HOUR,
        TWENTY_THREE_HOUR,
        INGORE
    }

    enum Schedule {
        ONCE,
        REPEAT
    }

    enum Middleware {
        EXISTS,
        INGORE
    }

    struct TimePayload {
        uint64 delay;
        Schedule iSchedule;
        Minutes iMinutes;
        Hours iHours;
        Middleware middleware;
    }

    struct TimePayloadIn {
        bytes32 identifier;
        uint64 index;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity <=0.8.24;

import {Data} from "./libraries/Data.sol";

import {ITimelyReceiver} from "./interfaces/ITimelyReceiver.sol";

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

abstract contract TimelyReceiver is ITimelyReceiver, Context {
    address private immutable _timely;

    constructor(address timely_) {
        if (timely_ == address(0)) revert InvalidRouter(address(0));
        _timely = timely_;
    }

    function timelyCallback(
        Data.TimePayloadIn calldata timePayload
    ) external virtual override onlyTimely {
        _timelyCallback(timePayload);
    }

    function timelyMiddleware(
        bytes32 identifier
    ) external view virtual override returns (bool) {
        return _timelyMiddleware(identifier);
    }

    function _timelyCallback(
        Data.TimePayloadIn calldata timePayload
    ) internal virtual;

    function _timelyMiddleware(
        bytes32 identifier
    ) internal view virtual returns (bool);

    function getTimely() public view override returns (address) {
        return _timely;
    }

    error InvalidRouter(address router);

    modifier onlyTimely() {
        if (_timely != _msgSender()) revert InvalidRouter(_msgSender());
        _;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "viaIR": true,
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"timely","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"magentaFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"InvalidRouter","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"DCAOrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"indexed":false,"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"indexed":false,"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"DCAOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"LimitOrdeCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"LimitOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"SwapOrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"SwapOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"TransferOrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"identifier","type":"bytes32"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"startDelay","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"indexed":false,"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"indexed":false,"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"TransferOrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelDCAOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelLimitOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelSwapOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"cancelTranferOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"createDCAOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"createLimitOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"numOfOrders","type":"uint256"},{"internalType":"enum Data.Minutes","name":"iMinutes","type":"uint8"},{"internalType":"enum Data.Hours","name":"iHours","type":"uint8"}],"name":"createTransferOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimely","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint64","name":"startDelay","type":"uint64"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokens","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"identifier","type":"bytes32"},{"internalType":"uint64","name":"index","type":"uint64"}],"internalType":"struct Data.TimePayloadIn","name":"timePayload","type":"tuple"}],"name":"timelyCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"identifier","type":"bytes32"}],"name":"timelyMiddleware","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"updateMagentaFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060409080825234620001fa57606081620035ea8038038091620000258285620001ff565b833981010312620001fa576200003b8162000239565b906020836200004c82840162000239565b9201516001600160a01b039284841615620001e257608085905260018054600060038190556001600160a81b031990911660089790971b610100600160a81b0316969096179055600280546001600160a01b031916918516919091179055600455620000b8336200024e565b50620000c433620002f0565b506004818360015460081c168651928380926322f0122b60e21b82525afa908115620001d857908291859162000196575b5060448460805116868851968794859363095ea7b360e01b855260048501526000196024850152165af180156200018c576200014b575b835161325990816200037182396080518181816101e40152610f600152f35b81813d831162000184575b620001628183620001ff565b81010312620001805751801515036200017d5780806200012c565b80fd5b5080fd5b503d62000156565b84513d85823e3d90fd5b82819392503d8311620001d0575b620001b08183620001ff565b81010312620001cc57620001c5829162000239565b38620000f5565b8380fd5b503d620001a4565b85513d86823e3d90fd5b85516335fdcccd60e21b815260006004820152602490fd5b600080fd5b601f909101601f19168101906001600160401b038211908210176200022357604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620001fa57565b6001600160a01b031660008181527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260408120549091907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff16620002eb57808352826020526040832082845260205260408320600160ff19825416179055600080516020620035ca833981519152339380a4600190565b505090565b6001600160a01b031660008181527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604081205490919060ff166200036c57818052816020526040822081835260205260408220600160ff198254161790553391600080516020620035ca8339815191528180a4600190565b509056fe608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a714611f575750806313cb1f8314611cf85780631f691f3a14611a2e578063244719b514611940578063248a9ca3146119145780632f2ff15d146118d75780632f4be9d0146118b45780633076315a1461188b578063308d6c9614610f4357806336568abe14610ee35780633b76594d14610e725780634584eff614610d3057806346662d0f14610c0157806349488f0e14610bd75780635c975abb14610bb45780636e45bb57146108b357806375b238fc146108785780638456cb591461081e578063892037e8146106aa57806391d148541461065e578063a217fddf14610642578063ad3b1b4714610594578063b7649f4814610249578063d547741f14610208578063efc48f06146101c45763f7b188a51461013f57600080fd5b346101c157806003193601126101c157610157612b66565b60015460ff8116156101975760ff19166001557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60046040517f8dfc202b000000000000000000000000000000000000000000000000000000008152fd5b80fd5b50346101c157806003193601126101c15760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101c15760403660031901126101c15761024560043561022861200d565b90808452836020526102406001604086200154612bf9565b612f9d565b5080f35b5061025336612023565b92969593610262929192612adf565b6102778130336001600160a01b038916612b15565b610291600454610289813410156121d5565b600354612220565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa91821561055457899261055f575b506020600491604051928380926322f0122b60e21b82525afa9081156105545761030e9183918b91610525575b5030906001600160a01b03339116612b15565b6001600160a01b0360015460081c1690813b1561052157889160248392604051948593849263b6b55f2560e01b845260048401525af18015610516579088916104fe575b5060206103c360405161036481612107565b67ffffffffffffffff8c1681526001838201526103848760408301612263565b610391886060830161226f565b600160808201526001600160a01b0360015460081c16906040519b8c8094819362bf4e7760e21b835260048301612295565b03925af19788156104f15781986104a7575b509160209861049c949260407f4d45f0b25d6fd91cfc11a4a255a62eb0eac1aacffa489b7c07d1563142597cd99998979561047c825161041481612123565b3381526001600160a01b038b168f8201526001600160a01b038c168482015284606082015286608082015261044c8860a08301612263565b6104598960c0830161226f565b8460e082015242610100820152826101208201528d835260088f528383206122f5565b8b8152600b8d5220805460ff191660021790556040519788978b896123ca565b0390a1604051908152f35b9391969594929097506020843d6020116104e9575b816104c960209383612179565b810103126104e45792519694959394919390929160206103d5565b600080fd5b3d91506104bc565b50604051903d90823e3d90fd5b610507906120dd565b610512578638610352565b8680fd5b6040513d8a823e3d90fd5b8880fd5b610547915060203d60201161054d575b61053f8183612179565b81019061219b565b386102fb565b503d610535565b6040513d8b823e3d90fd5b9091506020813d60201161058c575b8161057b60209383612179565b810103126104e457519060206102ce565b3d915061056e565b50346101c15760403660031901126101c1576105ae611ff7565b602435906105ba612b66565b60035482116105fe57828080848194829082156105f4575b6001600160a01b031690f1156104f1576105ee90600354612a9f565b60035580f35b6108fc91506105d2565b606460405162461bcd60e51b815260206004820152601360248201527f496e73756666696369656e7420616d6f756e74000000000000000000000000006044820152fd5b50346101c157806003193601126101c157602090604051908152f35b50346101c15760403660031901126101c1576001600160a01b03604061068261200d565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b50346101c1576020806003193601126107de57600435906106c9612adf565b818352600781528260408120600781016106e760ff82541615612425565b6001600160a01b0391828154169033820361081a5760018101546003909101546040516323b872dd60e01b81523060048201526001600160a01b039390931660248401526044830152859082906064908290889088165af1801561080f576107e2575b50600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528960048401525af180156107d3576107bb575b50507fa5372cfc0abf52b270bfc1f8b9afac84cb49534155cb8d3a47decc2dc80e597a91604051908152a180f35b6107c4906120dd565b6107cf57823861078d565b8280fd5b6040513d84823e3d90fd5b5080fd5b61080190853d8711610808575b6107f98183612179565b810190612470565b503861074a565b503d6107ef565b6040513d86823e3d90fd5b8480fd5b50346101c157806003193601126101c157610837612b66565b61083f612adf565b600160ff19815416176001557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101c157806003193601126101c15760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b506108bd3661208b565b9094916108cc96949396612adf565b6001600160a01b03968784166108e482303384612b15565b6108f6600454610289813410156121d5565b6003558860015460081c16986040519963127e8e4d60e01b8b52600160048c015260209a8b81602481855afa908115610b7b578c908b92610b86575b5060049192604051928380926322f0122b60e21b82525afa908115610b7b5761096c9183918e8d92610b5e575b5050309085339116612b15565b8160015460081c1690813b15610b5a57899160248392604051948593849263b6b55f2560e01b845260048401525af18015610554579089939291610b3c575b508a610a066040516109bc81612107565b67ffffffffffffffff8d168152600183820152856040820152601860608201528560808201528360015460081c16906040519c8d8094819362bf4e7760e21b835260048301612295565b03925af1988915610b3157908b91849a610aef575b5092610a938a9b959360096040947fc9f2beb9b28e93b57de97fecdbdf5c882b04dadd57f9b5f72de7ba2a724118499d61049c9b9a988e885195610a5e87612140565b3387528487015216878501528760608501528860808501524260a08501528a60c08501528560e0850152855252838320612488565b600b8c5220600260ff198254161790556040519687968a889360c095919897969267ffffffffffffffff9460e087019a87526001600160a01b038092166020880152166040860152606085015260808401521660a08201520152565b80979694999b95939a508291923d8311610b2a575b610b0e8183612179565b810103126104e45789978b96519992949a969190939596610a1b565b503d610b04565b6040513d85823e3d90fd5b610b4990939192936120dd565b610b5657908791386109ab565b8780fd5b8980fd5b610b749250803d1061054d5761053f8183612179565b388e61095f565b6040513d8c823e3d90fd5b809250813d8311610bad575b610b9c8183612179565b810103126104e457518b6004610932565b503d610b92565b50346101c157806003193601126101c157602060ff600154166040519015158152f35b6020610bf9610be53661208b565b94610bf4949194939293612adf565b612641565b604051908152f35b50346101c15760203660031901126101c157600435610c1e612adf565b808252600a60205260408220600881019060ff825416610cec5783916001600160a01b0391828154169033820361081a57610c6791600685600284015416920154913090612b15565b600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528860048401525af180156107d357610cd8575b507f0c848505d086791e836af5bd9381a53f86e3621daa7c04dca2c00e4f9a4939e7602083604051908152a180f35b610ce1906120dd565b6107de578138610ca9565b606460405162461bcd60e51b815260206004820152601b60248201527f5472616e736665724f726465722077617320636f6d706c6574656400000000006044820152fd5b50346101c1576020806003193601126107de5760043590610d4f612adf565b81835260098152826040812060078101610d6d60ff82541615612425565b6001600160a01b0391828154169033820361081a5760018101546003909101546040516323b872dd60e01b81523060048201526001600160a01b039390931660248401526044830152859082906064908290889088165af1801561080f57610e55575b50600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528960048401525af180156107d357610e41575b50507fa90c1ea1f8bf26cf5f70d9b0fd7716e41f4c34e97aef5ab1aba7088fdbf766c791604051908152a180f35b610e4a906120dd565b6107cf578238610e13565b610e6b90853d8711610808576107f98183612179565b5038610dd0565b50346101c15760203660031901126101c157610e8c612b66565b806001600160a01b0360015460081c16803b15610ee05781809160246040518094819363b6b55f2560e01b835260043560048401525af180156107d357610ed05750f35b610ed9906120dd565b6101c15780f35b50fd5b50346101c15760403660031901126101c157610efd61200d565b336001600160a01b03821603610f195761024590600435612f9d565b60046040517f6697b232000000000000000000000000000000000000000000000000000000008152fd5b50346101c15760403660031901126101c157336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000160361185b576004358152600b60205260ff60408220541660048110156118475780156116a0575b600181146114f9575b60028114611287575b600314611129575b6001600160a01b0360015460081c16906040519163127e8e4d60e01b835260016004840152602083602481845afa9283156107d35782936110f5575b506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa908115610b315790849184916110c0575b501061104e575080f35b6005830292808404600514901517156110ac578192813b156110a857829160248392604051948593849263b6b55f2560e01b845260048401525af180156107d357611097575080f35b6110a0906120dd565b6101c1578080f35b5050fd5b602482634e487b7160e01b81526011600452fd5b9150506020813d6020116110ed575b816110dc60209383612179565b810103126104e45783905138611044565b3d91506110cf565b9092506020813d602011611121575b8161111160209383612179565b810103126104e457519138610ffd565b3d9150611104565b6004358152600a60205260408120600881019060ff825416611243578061115a600385930154600483015490612abf565b600282019060066001600160a01b03835416936111878360018301966001600160a01b038854169061313e565b0192611194828554612a9f565b8092818655106111aa575b505050505050610fc1565b81611220575b5050505050600160ff19825416179055806001600160a01b0360015460081c16803b15610ee05781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d35761120c575b808080849361119f565b611215906120dd565b6101c1578038611202565b6001600160a01b03806112389454169154169061313e565b5581388080806111b0565b606460405162461bcd60e51b815260206004820152602060248201527f5472616e736665724f7264657220686173206265656e20636f6d706c657465646044820152fd5b60043582526008602052604082206112a660ff600883015416156130f3565b6112b96003820154600483015490612abf565b6040516112c58161215d565b6002815260403660208301376113476020836001600160a01b03600187015416806112ef8661251d565b526001600160a01b0360028801541661130786612540565b526001600160a01b03600254168960405180968195829463095ea7b360e01b845260048401602090939291936001600160a01b0360408201951681520152565b03925af180156114ee576114cf575b506001600160a01b03600254166001600160a01b0384541691600a420142116114bb576113b3879493928592836040518096819582946338ed173960e01b84528a600485015284602485015260a0604485015260a48401906125cc565b906064830152600a4201608483015203925af18015610b3157611499575b5060068301906113e2818354612a9f565b8091818455106113f6575b50505050610fb9565b8061146d575b5050506008600160ff19828401541617910155816001600160a01b0360015460081c16803b156107de5781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d357611459575b8082916113ed565b611462906120dd565b6107de578138611451565b611490906001600160a01b036001860154166001600160a01b038654169061313e565b558238806113fc565b6114b4903d8085833e6114ac8183612179565b810190612550565b50386113d1565b602487634e487b7160e01b81526011600452fd5b6114e79060203d602011610808576107f98183612179565b5038611356565b6040513d88823e3d90fd5b6004358252600960205260408220600781019061151a60ff835416156130f3565b836040516115278161215d565b6002815260403660208301376001600160a01b036001840154168061154b8361251d565b526001600160a01b0360028501541661156383612540565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561080f57611681575b506001600160a01b03600254169054836004860154916115ef60066001600160a01b03895416980154604051988997889687956338ed173960e01b875260048701612609565b03925af1801561080f57611667575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107de5781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d357611653575b5050610fb0565b61165c906120dd565b6107de57813861164c565b61167a903d8086833e6114ac8183612179565b50386115fe565b6116999060203d602011610808576107f98183612179565b50386115a9565b600435825260076020526040822060078101906116c160ff835416156130f3565b836040516116ce8161215d565b6002815260403660208301376001600160a01b03600184015416806116f28361251d565b526001600160a01b0360028501541661170a83612540565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561080f57611828575b506001600160a01b036002541690548360048601549161179660066001600160a01b03895416980154604051988997889687956338ed173960e01b875260048701612609565b03925af1801561080f5761180e575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107de5781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d3576117fa575b5050610fa7565b611803906120dd565b6107de5781386117f3565b611821903d8086833e6114ac8183612179565b50386117a5565b6118409060203d602011610808576107f98183612179565b5038611750565b602482634e487b7160e01b81526021600452fd5b60246040517fd7f73334000000000000000000000000000000000000000000000000000000008152336004820152fd5b50346101c15760203660031901126101c15760206118aa600435612c9e565b6040519015158152f35b50346101c15760203660031901126101c1576118ce612b66565b60043560045580f35b50346101c15760403660031901126101c1576102456004356118f761200d565b908084528360205261190f6001604086200154612bf9565b612c1f565b50346101c15760203660031901126101c157600160406020926004358152808452200154604051908152f35b50346101c15760203660031901126101c15760043561195d612adf565b808252600860205281604081206008810161197c60ff82541615612425565b6001600160a01b0391828154169033820361081a576119a991600685600184015416920154913090612b15565b600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528860048401525af180156107d357611a1a575b507fbbde28112400eaee5df97f22c92d999734e40e3e72e4418c370f491611289471602083604051908152a180f35b611a23906120dd565b6107de5781386119eb565b50611a3836612023565b92969593611a47929192612adf565b6001600160a01b0385163314611cb457611a6c8130336001600160a01b038a16612b15565b611a7e600454610289813410156121d5565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa918215610554578992611c7f575b506020600491604051928380926322f0122b60e21b82525afa90811561055457611afa9183918b91610525575030906001600160a01b03339116612b15565b6001600160a01b0360015460081c1690813b1561052157889160248392604051948593849263b6b55f2560e01b845260048401525af1801561051657611c6c575b50866020611b4e60405161036481612107565b03925af19788156104f1578198611c27575b509160209861049c949260407f30fe67ac5c8ed2e7eaf999e0b5f432af3bb12a6748ae109b558ff4b6c48866de99989795611c078251611b9f81612123565b3381526001600160a01b038b168f8201526001600160a01b038c1684820152846060820152866080820152611bd78860a08301612263565b611be48960c0830161226f565b8460e082015242610100820152826101208201528d8352600a8f528383206122f5565b8b8152600b8d5220805460ff191660031790556040519788978b896123ca565b9391969594929097506020843d602011611c64575b81611c4960209383612179565b810103126104e4579251969495939491939092916020611b60565b3d9150611c3c565b611c78909791976120dd565b9538611b3b565b9091506020813d602011611cac575b81611c9b60209383612179565b810103126105215751906020611abb565b3d9150611c8e565b606460405162461bcd60e51b815260206004820152601660248201527f43616e277420646f2073656c66207472616e73666572000000000000000000006044820152fd5b50346101c15760803660031901126101c157611d12611ff7565b90611d1b61200d565b90604435606435916001600160a01b03806002541695604051809763c45a015560e01b825281600460209a8b935afa90811561080f5760448493848b9481948991611f3a575b50604051968795869463e6a4390560e01b8652169c8d6004860152166024840152165afa908115610b31579082918491611f1d575b50169460405191630240bc6b60e21b83526060836004818a5afa96871561080f57889085948699611ebb575b509060049160405192838092630dfe168160e01b82525afa908115611eb0578591611e93575b501603611e8d5793915b6dffffffffffffffffffffffffffff928316938015611e8357905b80151580611e78575b80611e6f575b156107cf57611e39611e32612710938693612aac565b9586612aac565b951602918216918203611e5b5750610bf99291611e5591612220565b90612abf565b80634e487b7160e01b602492526011600452fd5b50841515611e1c565b508386161515611e16565b506126f290611e0d565b91611df2565b611eaa9150893d8b1161054d5761053f8183612179565b38611de8565b6040513d87823e3d90fd5b94509750506060833d606011611f15575b81611ed960609383612179565b81010312611f1157611eea836121ba565b6040611ef78a86016121ba565b94015163ffffffff81160361081a57929688906004611dc2565b8380fd5b3d9150611ecc565b611f349150883d8a1161054d5761053f8183612179565b38611d96565b611f519150863d881161054d5761053f8183612179565b38611d61565b9050346107de5760203660031901126107de576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036107cf57602092507f7965db0b000000000000000000000000000000000000000000000000000000008114908115611fcd575b5015158152f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501438611fc6565b600435906001600160a01b03821682036104e457565b602435906001600160a01b03821682036104e457565b60e09060031901126104e4576001600160a01b039060043582811681036104e4579160243590811681036104e457906044359060643567ffffffffffffffff811681036104e457906084359060a435600f8110156104e4579060c43560198110156104e45790565b60c09060031901126104e4576001600160a01b039060043582811681036104e4579160243590811681036104e45790604435906064359060843567ffffffffffffffff811681036104e4579060a43590565b67ffffffffffffffff81116120f157604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176120f157604052565b610140810190811067ffffffffffffffff8211176120f157604052565b610100810190811067ffffffffffffffff8211176120f157604052565b6060810190811067ffffffffffffffff8211176120f157604052565b90601f8019910116810190811067ffffffffffffffff8211176120f157604052565b908160209103126104e457516001600160a01b03811681036104e45790565b51906dffffffffffffffffffffffffffff821682036104e457565b156121dc57565b606460405162461bcd60e51b815260206004820152601060248201527f496e73756666696369656e7420666565000000000000000000000000000000006044820152fd5b9190820180921161222d57565b634e487b7160e01b600052601160045260246000fd5b6002111561224d57565b634e487b7160e01b600052602160045260246000fd5b600f82101561224d5752565b601982101561224d5752565b90600f82101561224d5752565b90601982101561224d5752565b91909160808060a083019467ffffffffffffffff815116845260208101516122bc81612243565b60208501526122d36040820151604086019061227b565b6122e560608201516060860190612288565b0151916122f183612243565b0152565b6001600160a01b038083511673ffffffffffffffffffffffffffffffffffffffff1990818454161783556001830182602086015116828254161790556002830191604085015116908254161790556060820151600382015560808201516004820155600581019160a081015192600f84101561224d5780549160c081015191601983101561224d576123c89560089460ff61ff0061012096881b1692169061ffff19161717905560e0810151600685015561010081015160078501550151151591019060ff801983541691151516179055565b565b9360e09567ffffffffffffffff916123c8999461241e969c9b99949c61010089019d89526001600160a01b0380921660208a0152166040880152606087015216608085015260a084015260c083019061227b565b0190612288565b1561242c57565b606460405162461bcd60e51b815260206004820152601360248201527f4f726465722077617320636f6d706c65746564000000000000000000000000006044820152fd5b908160209103126104e4575180151581036104e45790565b600760e06123c8936001600160a01b038082511673ffffffffffffffffffffffffffffffffffffffff199081875416178655600186018260208501511682825416179055600286019160408401511690825416179055606081015160038501556080810151600485015560a0810151600585015560c081015160068501550151151591019060ff801983541691151516179055565b80511561252a5760200190565b634e487b7160e01b600052603260045260246000fd5b80516001101561252a5760400190565b9060209081838203126104e457825167ffffffffffffffff938482116104e4570181601f820112156104e45780519384116120f1578360051b906040519461259a85840187612179565b855283808601928201019283116104e4578301905b8282106125bd575050505090565b815181529083019083016125af565b90815180825260208080930193019160005b8281106125ec575050505090565b83516001600160a01b0316855293810193928101926001016125de565b91608093612636916001600160a01b0393989796988552602085015260a0604085015260a08401906125cc565b951660608201520152565b9391949290946000956001600160a01b03808716966126628430338b612b15565b67ffffffffffffffff861695866127c65750506040908151906126848261215d565b6002825282366020840137886126998361251d565b52806126a483612540565b941693849052600254835163095ea7b360e01b81529082166001600160a01b03166004820152602481018690526020816044818e8e5af180156127bc57928b9287928b9561279d575b50600254169083896127168851978896879586946338ed173960e01b8652339260048701612609565b03925af18015612793579160e0979593917f551435caca85330f5bd28ea80fd0e393e0a5b6ba4979d372371395883319539299979593612779575b508051966000885260208801528601526060850152608084015260a083015260c0820152a190565b61278c903d808d833e6114ac8183612179565b5038612751565b82513d8b823e3d90fd5b6127b59060203d602011610808576107f98183612179565b50386126ed565b84513d8d823e3d90fd5b939197600499986127e58b9997959998939854610289813410156121d5565b6003558060015460081c1692604093600185519d8e63127e8e4d60e01b8152015260209c8d81602481855afa908115612a67578e908e92612a71575b50600491928751928380926322f0122b60e21b82525afa908115612a675761285c918f918f92859392612a4a575b5050309086339116612b15565b8260015460081c1690813b15612a46578c91602483928851948593849263b6b55f2560e01b845260048401525af18015612a3c57908d9291612a1f575b50906128ec8c9493928651906128ae82612107565b81528583820152600e8782015260186060820152600160808201528360015460081c169087519e8f8094819362bf4e7760e21b835260048301612295565b03925af19a8b15612a1557839b6129d4575b5091600b8b9c61297a8695947f551435caca85330f5bd28ea80fd0e393e0a5b6ba4979d37237139588331953929e87968f6129ce9e9d9c9b9a519361294285612140565b3385528685015216878301528860608301528960808301524260a08301528b60c08301528560e0830152855260078352858520612488565b522060ff198154169055519687968a889360c095919897969267ffffffffffffffff9460e087019a87526001600160a01b038092166020880152166040860152606085015260808401521660a08201520152565b0390a190565b919a509695949392918b82813d8311612a0e575b6129f28183612179565b810103126104e457898392519b925097909293949596976128fe565b503d6129e8565b84513d85823e3d90fd5b9b612a316128ec9d95949392956120dd565b9b9390919293612899565b85513d8e823e3d90fd5b8c80fd5b612a609250803d1061054d5761053f8183612179565b8f8061284f565b86513d8f823e3d90fd5b809250813d8311612a98575b612a878183612179565b81010312612a4657518d6004612821565b503d612a7d565b9190820391821161222d57565b8181029291811591840414171561222d57565b8115612ac9570490565b634e487b7160e01b600052601260045260246000fd5b60ff60015416612aeb57565b60046040517fd93c0665000000000000000000000000000000000000000000000000000000008152fd5b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648201929092526123c891612b6182608481015b03601f198101845283612179565b613013565b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260409020547fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff1615612bc25750565b604490604051907fe2517d3f0000000000000000000000000000000000000000000000000000000082523360048301526024820152fd5b80600052600060205260406000203360005260205260ff6040600020541615612bc25750565b90600091808352826020526001600160a01b036040842092169182845260205260ff60408420541615600014612c9957808352826020526040832082845260205260408320600160ff198254161790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a4600190565b505090565b6000908082526020600b815260409160ff83852054169060049182811015612f8a57600114612cd1575050505050600190565b8452600982528284209384928451612ce881612140565b6001600160a01b0380865416825284816001880154169283858201528260028901541690818a82015260e060ff60078560038d01549c8d606087015201549d608085019e8f52600581015460a0860152600681015460c086015201541615159101528483600254168a519384809263c45a015560e01b82525afa918215612f805791859184938892612f5e575b506044908b51948593849263e6a4390560e01b8452898d8501526024840152165afa908115612f54579082918691612f37575b501696805193630240bc6b60e21b855260608588818c5afa988915612f2d578695879a612ed0575b5090808892845193848092630dfe168160e01b82525afa928315612ec757508692612eaa575b50501603612ea45793915b6dffffffffffffffffffffffffffff8093168415801580612e99575b80612e90575b15611f11576126f2808702968704141715612e7d5783612e466127109287612aac565b961602928316928303612e6a575050612e639291611e5591612220565b9051111590565b906011602492634e487b7160e01b835252fd5b602483601184634e487b7160e01b835252fd5b50811515612e23565b508487161515612e1d565b91612e01565b612ec09250803d1061054d5761053f8183612179565b3880612df6565b513d88823e3d90fd5b955098506060853d606011612f25575b81612eed60609383612179565b81010312612f2157612efe856121ba565b82612f0a8388016121ba565b96015163ffffffff81160361051257949881612dd0565b8580fd5b3d9150612ee0565b82513d88823e3d90fd5b612f4e9150853d871161054d5761053f8183612179565b38612da8565b88513d87823e3d90fd5b6044919250612f7990843d861161054d5761053f8183612179565b9190612d75565b89513d88823e3d90fd5b602486602185634e487b7160e01b835252fd5b90600091808352826020526001600160a01b036040842092169182845260205260ff604084205416600014612c995780835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b6001600160a01b031690600080826020829451910182865af13d156130e6573d67ffffffffffffffff81116130d25760405161307093929161305f601f8201601f191660200183612179565b8152809260203d92013e5b83613190565b80519081151591826130b7575b50506130865750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b6130ca9250602080918301019101612470565b15388061307d565b602483634e487b7160e01b81526041600452fd5b613070915060609061306a565b156130fa57565b606460405162461bcd60e51b815260206004820152601860248201527f4f7264657220686173206265656e20636f6d706c6574656400000000000000006044820152fd5b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b03909216602483015260448201929092526123c891612b618260648101612b53565b906131cf57508051156131a557805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b8151158061321a575b6131e0575090565b6024906001600160a01b03604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b156131d856fea264697066735822122065f8190e3f7a3692b393b03f410226d8b3c219015ed3955eb4df0b956d4a40c464736f6c634300081800332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d000000000000000000000000658f1b0fd932b2e3c38c3a1961bc3c734c9b6a7500000000000000000000000039cd4db6460d8b5961f73e997e86ddbb7ca4d5f600000000000000000000000000000000000000000000000000005af3107a4000

Deployed Bytecode

0x608080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a714611f575750806313cb1f8314611cf85780631f691f3a14611a2e578063244719b514611940578063248a9ca3146119145780632f2ff15d146118d75780632f4be9d0146118b45780633076315a1461188b578063308d6c9614610f4357806336568abe14610ee35780633b76594d14610e725780634584eff614610d3057806346662d0f14610c0157806349488f0e14610bd75780635c975abb14610bb45780636e45bb57146108b357806375b238fc146108785780638456cb591461081e578063892037e8146106aa57806391d148541461065e578063a217fddf14610642578063ad3b1b4714610594578063b7649f4814610249578063d547741f14610208578063efc48f06146101c45763f7b188a51461013f57600080fd5b346101c157806003193601126101c157610157612b66565b60015460ff8116156101975760ff19166001557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b60046040517f8dfc202b000000000000000000000000000000000000000000000000000000008152fd5b80fd5b50346101c157806003193601126101c15760206040516001600160a01b037f000000000000000000000000658f1b0fd932b2e3c38c3a1961bc3c734c9b6a75168152f35b50346101c15760403660031901126101c15761024560043561022861200d565b90808452836020526102406001604086200154612bf9565b612f9d565b5080f35b5061025336612023565b92969593610262929192612adf565b6102778130336001600160a01b038916612b15565b610291600454610289813410156121d5565b600354612220565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa91821561055457899261055f575b506020600491604051928380926322f0122b60e21b82525afa9081156105545761030e9183918b91610525575b5030906001600160a01b03339116612b15565b6001600160a01b0360015460081c1690813b1561052157889160248392604051948593849263b6b55f2560e01b845260048401525af18015610516579088916104fe575b5060206103c360405161036481612107565b67ffffffffffffffff8c1681526001838201526103848760408301612263565b610391886060830161226f565b600160808201526001600160a01b0360015460081c16906040519b8c8094819362bf4e7760e21b835260048301612295565b03925af19788156104f15781986104a7575b509160209861049c949260407f4d45f0b25d6fd91cfc11a4a255a62eb0eac1aacffa489b7c07d1563142597cd99998979561047c825161041481612123565b3381526001600160a01b038b168f8201526001600160a01b038c168482015284606082015286608082015261044c8860a08301612263565b6104598960c0830161226f565b8460e082015242610100820152826101208201528d835260088f528383206122f5565b8b8152600b8d5220805460ff191660021790556040519788978b896123ca565b0390a1604051908152f35b9391969594929097506020843d6020116104e9575b816104c960209383612179565b810103126104e45792519694959394919390929160206103d5565b600080fd5b3d91506104bc565b50604051903d90823e3d90fd5b610507906120dd565b610512578638610352565b8680fd5b6040513d8a823e3d90fd5b8880fd5b610547915060203d60201161054d575b61053f8183612179565b81019061219b565b386102fb565b503d610535565b6040513d8b823e3d90fd5b9091506020813d60201161058c575b8161057b60209383612179565b810103126104e457519060206102ce565b3d915061056e565b50346101c15760403660031901126101c1576105ae611ff7565b602435906105ba612b66565b60035482116105fe57828080848194829082156105f4575b6001600160a01b031690f1156104f1576105ee90600354612a9f565b60035580f35b6108fc91506105d2565b606460405162461bcd60e51b815260206004820152601360248201527f496e73756666696369656e7420616d6f756e74000000000000000000000000006044820152fd5b50346101c157806003193601126101c157602090604051908152f35b50346101c15760403660031901126101c1576001600160a01b03604061068261200d565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b50346101c1576020806003193601126107de57600435906106c9612adf565b818352600781528260408120600781016106e760ff82541615612425565b6001600160a01b0391828154169033820361081a5760018101546003909101546040516323b872dd60e01b81523060048201526001600160a01b039390931660248401526044830152859082906064908290889088165af1801561080f576107e2575b50600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528960048401525af180156107d3576107bb575b50507fa5372cfc0abf52b270bfc1f8b9afac84cb49534155cb8d3a47decc2dc80e597a91604051908152a180f35b6107c4906120dd565b6107cf57823861078d565b8280fd5b6040513d84823e3d90fd5b5080fd5b61080190853d8711610808575b6107f98183612179565b810190612470565b503861074a565b503d6107ef565b6040513d86823e3d90fd5b8480fd5b50346101c157806003193601126101c157610837612b66565b61083f612adf565b600160ff19815416176001557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b50346101c157806003193601126101c15760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b506108bd3661208b565b9094916108cc96949396612adf565b6001600160a01b03968784166108e482303384612b15565b6108f6600454610289813410156121d5565b6003558860015460081c16986040519963127e8e4d60e01b8b52600160048c015260209a8b81602481855afa908115610b7b578c908b92610b86575b5060049192604051928380926322f0122b60e21b82525afa908115610b7b5761096c9183918e8d92610b5e575b5050309085339116612b15565b8160015460081c1690813b15610b5a57899160248392604051948593849263b6b55f2560e01b845260048401525af18015610554579089939291610b3c575b508a610a066040516109bc81612107565b67ffffffffffffffff8d168152600183820152856040820152601860608201528560808201528360015460081c16906040519c8d8094819362bf4e7760e21b835260048301612295565b03925af1988915610b3157908b91849a610aef575b5092610a938a9b959360096040947fc9f2beb9b28e93b57de97fecdbdf5c882b04dadd57f9b5f72de7ba2a724118499d61049c9b9a988e885195610a5e87612140565b3387528487015216878501528760608501528860808501524260a08501528a60c08501528560e0850152855252838320612488565b600b8c5220600260ff198254161790556040519687968a889360c095919897969267ffffffffffffffff9460e087019a87526001600160a01b038092166020880152166040860152606085015260808401521660a08201520152565b80979694999b95939a508291923d8311610b2a575b610b0e8183612179565b810103126104e45789978b96519992949a969190939596610a1b565b503d610b04565b6040513d85823e3d90fd5b610b4990939192936120dd565b610b5657908791386109ab565b8780fd5b8980fd5b610b749250803d1061054d5761053f8183612179565b388e61095f565b6040513d8c823e3d90fd5b809250813d8311610bad575b610b9c8183612179565b810103126104e457518b6004610932565b503d610b92565b50346101c157806003193601126101c157602060ff600154166040519015158152f35b6020610bf9610be53661208b565b94610bf4949194939293612adf565b612641565b604051908152f35b50346101c15760203660031901126101c157600435610c1e612adf565b808252600a60205260408220600881019060ff825416610cec5783916001600160a01b0391828154169033820361081a57610c6791600685600284015416920154913090612b15565b600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528860048401525af180156107d357610cd8575b507f0c848505d086791e836af5bd9381a53f86e3621daa7c04dca2c00e4f9a4939e7602083604051908152a180f35b610ce1906120dd565b6107de578138610ca9565b606460405162461bcd60e51b815260206004820152601b60248201527f5472616e736665724f726465722077617320636f6d706c6574656400000000006044820152fd5b50346101c1576020806003193601126107de5760043590610d4f612adf565b81835260098152826040812060078101610d6d60ff82541615612425565b6001600160a01b0391828154169033820361081a5760018101546003909101546040516323b872dd60e01b81523060048201526001600160a01b039390931660248401526044830152859082906064908290889088165af1801561080f57610e55575b50600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528960048401525af180156107d357610e41575b50507fa90c1ea1f8bf26cf5f70d9b0fd7716e41f4c34e97aef5ab1aba7088fdbf766c791604051908152a180f35b610e4a906120dd565b6107cf578238610e13565b610e6b90853d8711610808576107f98183612179565b5038610dd0565b50346101c15760203660031901126101c157610e8c612b66565b806001600160a01b0360015460081c16803b15610ee05781809160246040518094819363b6b55f2560e01b835260043560048401525af180156107d357610ed05750f35b610ed9906120dd565b6101c15780f35b50fd5b50346101c15760403660031901126101c157610efd61200d565b336001600160a01b03821603610f195761024590600435612f9d565b60046040517f6697b232000000000000000000000000000000000000000000000000000000008152fd5b50346101c15760403660031901126101c157336001600160a01b037f000000000000000000000000658f1b0fd932b2e3c38c3a1961bc3c734c9b6a75160361185b576004358152600b60205260ff60408220541660048110156118475780156116a0575b600181146114f9575b60028114611287575b600314611129575b6001600160a01b0360015460081c16906040519163127e8e4d60e01b835260016004840152602083602481845afa9283156107d35782936110f5575b506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152602081602481855afa908115610b315790849184916110c0575b501061104e575080f35b6005830292808404600514901517156110ac578192813b156110a857829160248392604051948593849263b6b55f2560e01b845260048401525af180156107d357611097575080f35b6110a0906120dd565b6101c1578080f35b5050fd5b602482634e487b7160e01b81526011600452fd5b9150506020813d6020116110ed575b816110dc60209383612179565b810103126104e45783905138611044565b3d91506110cf565b9092506020813d602011611121575b8161111160209383612179565b810103126104e457519138610ffd565b3d9150611104565b6004358152600a60205260408120600881019060ff825416611243578061115a600385930154600483015490612abf565b600282019060066001600160a01b03835416936111878360018301966001600160a01b038854169061313e565b0192611194828554612a9f565b8092818655106111aa575b505050505050610fc1565b81611220575b5050505050600160ff19825416179055806001600160a01b0360015460081c16803b15610ee05781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d35761120c575b808080849361119f565b611215906120dd565b6101c1578038611202565b6001600160a01b03806112389454169154169061313e565b5581388080806111b0565b606460405162461bcd60e51b815260206004820152602060248201527f5472616e736665724f7264657220686173206265656e20636f6d706c657465646044820152fd5b60043582526008602052604082206112a660ff600883015416156130f3565b6112b96003820154600483015490612abf565b6040516112c58161215d565b6002815260403660208301376113476020836001600160a01b03600187015416806112ef8661251d565b526001600160a01b0360028801541661130786612540565b526001600160a01b03600254168960405180968195829463095ea7b360e01b845260048401602090939291936001600160a01b0360408201951681520152565b03925af180156114ee576114cf575b506001600160a01b03600254166001600160a01b0384541691600a420142116114bb576113b3879493928592836040518096819582946338ed173960e01b84528a600485015284602485015260a0604485015260a48401906125cc565b906064830152600a4201608483015203925af18015610b3157611499575b5060068301906113e2818354612a9f565b8091818455106113f6575b50505050610fb9565b8061146d575b5050506008600160ff19828401541617910155816001600160a01b0360015460081c16803b156107de5781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d357611459575b8082916113ed565b611462906120dd565b6107de578138611451565b611490906001600160a01b036001860154166001600160a01b038654169061313e565b558238806113fc565b6114b4903d8085833e6114ac8183612179565b810190612550565b50386113d1565b602487634e487b7160e01b81526011600452fd5b6114e79060203d602011610808576107f98183612179565b5038611356565b6040513d88823e3d90fd5b6004358252600960205260408220600781019061151a60ff835416156130f3565b836040516115278161215d565b6002815260403660208301376001600160a01b036001840154168061154b8361251d565b526001600160a01b0360028501541661156383612540565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561080f57611681575b506001600160a01b03600254169054836004860154916115ef60066001600160a01b03895416980154604051988997889687956338ed173960e01b875260048701612609565b03925af1801561080f57611667575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107de5781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d357611653575b5050610fb0565b61165c906120dd565b6107de57813861164c565b61167a903d8086833e6114ac8183612179565b50386115fe565b6116999060203d602011610808576107f98183612179565b50386115a9565b600435825260076020526040822060078101906116c160ff835416156130f3565b836040516116ce8161215d565b6002815260403660208301376001600160a01b03600184015416806116f28361251d565b526001600160a01b0360028501541661170a83612540565b5260025460038501805460405163095ea7b360e01b81526001600160a01b0390931660048401526024830152916020908290604490829088905af1801561080f57611828575b506001600160a01b036002541690548360048601549161179660066001600160a01b03895416980154604051988997889687956338ed173960e01b875260048701612609565b03925af1801561080f5761180e575b50600160ff19825416179055816001600160a01b0360015460081c16803b156107de5781809160246040518094819363c4d252f560e01b835260043560048401525af180156107d3576117fa575b5050610fa7565b611803906120dd565b6107de5781386117f3565b611821903d8086833e6114ac8183612179565b50386117a5565b6118409060203d602011610808576107f98183612179565b5038611750565b602482634e487b7160e01b81526021600452fd5b60246040517fd7f73334000000000000000000000000000000000000000000000000000000008152336004820152fd5b50346101c15760203660031901126101c15760206118aa600435612c9e565b6040519015158152f35b50346101c15760203660031901126101c1576118ce612b66565b60043560045580f35b50346101c15760403660031901126101c1576102456004356118f761200d565b908084528360205261190f6001604086200154612bf9565b612c1f565b50346101c15760203660031901126101c157600160406020926004358152808452200154604051908152f35b50346101c15760203660031901126101c15760043561195d612adf565b808252600860205281604081206008810161197c60ff82541615612425565b6001600160a01b0391828154169033820361081a576119a991600685600184015416920154913090612b15565b600160ff1982541617905560015460081c16803b156107de5781809160246040518094819363c4d252f560e01b83528860048401525af180156107d357611a1a575b507fbbde28112400eaee5df97f22c92d999734e40e3e72e4418c370f491611289471602083604051908152a180f35b611a23906120dd565b6107de5781386119eb565b50611a3836612023565b92969593611a47929192612adf565b6001600160a01b0385163314611cb457611a6c8130336001600160a01b038a16612b15565b611a7e600454610289813410156121d5565b6003556001600160a01b0360015460081c166040519063127e8e4d60e01b8252836004830152602082602481845afa918215610554578992611c7f575b506020600491604051928380926322f0122b60e21b82525afa90811561055457611afa9183918b91610525575030906001600160a01b03339116612b15565b6001600160a01b0360015460081c1690813b1561052157889160248392604051948593849263b6b55f2560e01b845260048401525af1801561051657611c6c575b50866020611b4e60405161036481612107565b03925af19788156104f1578198611c27575b509160209861049c949260407f30fe67ac5c8ed2e7eaf999e0b5f432af3bb12a6748ae109b558ff4b6c48866de99989795611c078251611b9f81612123565b3381526001600160a01b038b168f8201526001600160a01b038c1684820152846060820152866080820152611bd78860a08301612263565b611be48960c0830161226f565b8460e082015242610100820152826101208201528d8352600a8f528383206122f5565b8b8152600b8d5220805460ff191660031790556040519788978b896123ca565b9391969594929097506020843d602011611c64575b81611c4960209383612179565b810103126104e4579251969495939491939092916020611b60565b3d9150611c3c565b611c78909791976120dd565b9538611b3b565b9091506020813d602011611cac575b81611c9b60209383612179565b810103126105215751906020611abb565b3d9150611c8e565b606460405162461bcd60e51b815260206004820152601660248201527f43616e277420646f2073656c66207472616e73666572000000000000000000006044820152fd5b50346101c15760803660031901126101c157611d12611ff7565b90611d1b61200d565b90604435606435916001600160a01b03806002541695604051809763c45a015560e01b825281600460209a8b935afa90811561080f5760448493848b9481948991611f3a575b50604051968795869463e6a4390560e01b8652169c8d6004860152166024840152165afa908115610b31579082918491611f1d575b50169460405191630240bc6b60e21b83526060836004818a5afa96871561080f57889085948699611ebb575b509060049160405192838092630dfe168160e01b82525afa908115611eb0578591611e93575b501603611e8d5793915b6dffffffffffffffffffffffffffff928316938015611e8357905b80151580611e78575b80611e6f575b156107cf57611e39611e32612710938693612aac565b9586612aac565b951602918216918203611e5b5750610bf99291611e5591612220565b90612abf565b80634e487b7160e01b602492526011600452fd5b50841515611e1c565b508386161515611e16565b506126f290611e0d565b91611df2565b611eaa9150893d8b1161054d5761053f8183612179565b38611de8565b6040513d87823e3d90fd5b94509750506060833d606011611f15575b81611ed960609383612179565b81010312611f1157611eea836121ba565b6040611ef78a86016121ba565b94015163ffffffff81160361081a57929688906004611dc2565b8380fd5b3d9150611ecc565b611f349150883d8a1161054d5761053f8183612179565b38611d96565b611f519150863d881161054d5761053f8183612179565b38611d61565b9050346107de5760203660031901126107de576004357fffffffff0000000000000000000000000000000000000000000000000000000081168091036107cf57602092507f7965db0b000000000000000000000000000000000000000000000000000000008114908115611fcd575b5015158152f35b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501438611fc6565b600435906001600160a01b03821682036104e457565b602435906001600160a01b03821682036104e457565b60e09060031901126104e4576001600160a01b039060043582811681036104e4579160243590811681036104e457906044359060643567ffffffffffffffff811681036104e457906084359060a435600f8110156104e4579060c43560198110156104e45790565b60c09060031901126104e4576001600160a01b039060043582811681036104e4579160243590811681036104e45790604435906064359060843567ffffffffffffffff811681036104e4579060a43590565b67ffffffffffffffff81116120f157604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176120f157604052565b610140810190811067ffffffffffffffff8211176120f157604052565b610100810190811067ffffffffffffffff8211176120f157604052565b6060810190811067ffffffffffffffff8211176120f157604052565b90601f8019910116810190811067ffffffffffffffff8211176120f157604052565b908160209103126104e457516001600160a01b03811681036104e45790565b51906dffffffffffffffffffffffffffff821682036104e457565b156121dc57565b606460405162461bcd60e51b815260206004820152601060248201527f496e73756666696369656e7420666565000000000000000000000000000000006044820152fd5b9190820180921161222d57565b634e487b7160e01b600052601160045260246000fd5b6002111561224d57565b634e487b7160e01b600052602160045260246000fd5b600f82101561224d5752565b601982101561224d5752565b90600f82101561224d5752565b90601982101561224d5752565b91909160808060a083019467ffffffffffffffff815116845260208101516122bc81612243565b60208501526122d36040820151604086019061227b565b6122e560608201516060860190612288565b0151916122f183612243565b0152565b6001600160a01b038083511673ffffffffffffffffffffffffffffffffffffffff1990818454161783556001830182602086015116828254161790556002830191604085015116908254161790556060820151600382015560808201516004820155600581019160a081015192600f84101561224d5780549160c081015191601983101561224d576123c89560089460ff61ff0061012096881b1692169061ffff19161717905560e0810151600685015561010081015160078501550151151591019060ff801983541691151516179055565b565b9360e09567ffffffffffffffff916123c8999461241e969c9b99949c61010089019d89526001600160a01b0380921660208a0152166040880152606087015216608085015260a084015260c083019061227b565b0190612288565b1561242c57565b606460405162461bcd60e51b815260206004820152601360248201527f4f726465722077617320636f6d706c65746564000000000000000000000000006044820152fd5b908160209103126104e4575180151581036104e45790565b600760e06123c8936001600160a01b038082511673ffffffffffffffffffffffffffffffffffffffff199081875416178655600186018260208501511682825416179055600286019160408401511690825416179055606081015160038501556080810151600485015560a0810151600585015560c081015160068501550151151591019060ff801983541691151516179055565b80511561252a5760200190565b634e487b7160e01b600052603260045260246000fd5b80516001101561252a5760400190565b9060209081838203126104e457825167ffffffffffffffff938482116104e4570181601f820112156104e45780519384116120f1578360051b906040519461259a85840187612179565b855283808601928201019283116104e4578301905b8282106125bd575050505090565b815181529083019083016125af565b90815180825260208080930193019160005b8281106125ec575050505090565b83516001600160a01b0316855293810193928101926001016125de565b91608093612636916001600160a01b0393989796988552602085015260a0604085015260a08401906125cc565b951660608201520152565b9391949290946000956001600160a01b03808716966126628430338b612b15565b67ffffffffffffffff861695866127c65750506040908151906126848261215d565b6002825282366020840137886126998361251d565b52806126a483612540565b941693849052600254835163095ea7b360e01b81529082166001600160a01b03166004820152602481018690526020816044818e8e5af180156127bc57928b9287928b9561279d575b50600254169083896127168851978896879586946338ed173960e01b8652339260048701612609565b03925af18015612793579160e0979593917f551435caca85330f5bd28ea80fd0e393e0a5b6ba4979d372371395883319539299979593612779575b508051966000885260208801528601526060850152608084015260a083015260c0820152a190565b61278c903d808d833e6114ac8183612179565b5038612751565b82513d8b823e3d90fd5b6127b59060203d602011610808576107f98183612179565b50386126ed565b84513d8d823e3d90fd5b939197600499986127e58b9997959998939854610289813410156121d5565b6003558060015460081c1692604093600185519d8e63127e8e4d60e01b8152015260209c8d81602481855afa908115612a67578e908e92612a71575b50600491928751928380926322f0122b60e21b82525afa908115612a675761285c918f918f92859392612a4a575b5050309086339116612b15565b8260015460081c1690813b15612a46578c91602483928851948593849263b6b55f2560e01b845260048401525af18015612a3c57908d9291612a1f575b50906128ec8c9493928651906128ae82612107565b81528583820152600e8782015260186060820152600160808201528360015460081c169087519e8f8094819362bf4e7760e21b835260048301612295565b03925af19a8b15612a1557839b6129d4575b5091600b8b9c61297a8695947f551435caca85330f5bd28ea80fd0e393e0a5b6ba4979d37237139588331953929e87968f6129ce9e9d9c9b9a519361294285612140565b3385528685015216878301528860608301528960808301524260a08301528b60c08301528560e0830152855260078352858520612488565b522060ff198154169055519687968a889360c095919897969267ffffffffffffffff9460e087019a87526001600160a01b038092166020880152166040860152606085015260808401521660a08201520152565b0390a190565b919a509695949392918b82813d8311612a0e575b6129f28183612179565b810103126104e457898392519b925097909293949596976128fe565b503d6129e8565b84513d85823e3d90fd5b9b612a316128ec9d95949392956120dd565b9b9390919293612899565b85513d8e823e3d90fd5b8c80fd5b612a609250803d1061054d5761053f8183612179565b8f8061284f565b86513d8f823e3d90fd5b809250813d8311612a98575b612a878183612179565b81010312612a4657518d6004612821565b503d612a7d565b9190820391821161222d57565b8181029291811591840414171561222d57565b8115612ac9570490565b634e487b7160e01b600052601260045260246000fd5b60ff60015416612aeb57565b60046040517fd93c0665000000000000000000000000000000000000000000000000000000008152fd5b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648201929092526123c891612b6182608481015b03601f198101845283612179565b613013565b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec60205260409020547fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217759060ff1615612bc25750565b604490604051907fe2517d3f0000000000000000000000000000000000000000000000000000000082523360048301526024820152fd5b80600052600060205260406000203360005260205260ff6040600020541615612bc25750565b90600091808352826020526001600160a01b036040842092169182845260205260ff60408420541615600014612c9957808352826020526040832082845260205260408320600160ff198254161790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a4600190565b505090565b6000908082526020600b815260409160ff83852054169060049182811015612f8a57600114612cd1575050505050600190565b8452600982528284209384928451612ce881612140565b6001600160a01b0380865416825284816001880154169283858201528260028901541690818a82015260e060ff60078560038d01549c8d606087015201549d608085019e8f52600581015460a0860152600681015460c086015201541615159101528483600254168a519384809263c45a015560e01b82525afa918215612f805791859184938892612f5e575b506044908b51948593849263e6a4390560e01b8452898d8501526024840152165afa908115612f54579082918691612f37575b501696805193630240bc6b60e21b855260608588818c5afa988915612f2d578695879a612ed0575b5090808892845193848092630dfe168160e01b82525afa928315612ec757508692612eaa575b50501603612ea45793915b6dffffffffffffffffffffffffffff8093168415801580612e99575b80612e90575b15611f11576126f2808702968704141715612e7d5783612e466127109287612aac565b961602928316928303612e6a575050612e639291611e5591612220565b9051111590565b906011602492634e487b7160e01b835252fd5b602483601184634e487b7160e01b835252fd5b50811515612e23565b508487161515612e1d565b91612e01565b612ec09250803d1061054d5761053f8183612179565b3880612df6565b513d88823e3d90fd5b955098506060853d606011612f25575b81612eed60609383612179565b81010312612f2157612efe856121ba565b82612f0a8388016121ba565b96015163ffffffff81160361051257949881612dd0565b8580fd5b3d9150612ee0565b82513d88823e3d90fd5b612f4e9150853d871161054d5761053f8183612179565b38612da8565b88513d87823e3d90fd5b6044919250612f7990843d861161054d5761053f8183612179565b9190612d75565b89513d88823e3d90fd5b602486602185634e487b7160e01b835252fd5b90600091808352826020526001600160a01b036040842092169182845260205260ff604084205416600014612c995780835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b6001600160a01b031690600080826020829451910182865af13d156130e6573d67ffffffffffffffff81116130d25760405161307093929161305f601f8201601f191660200183612179565b8152809260203d92013e5b83613190565b80519081151591826130b7575b50506130865750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b6130ca9250602080918301019101612470565b15388061307d565b602483634e487b7160e01b81526041600452fd5b613070915060609061306a565b156130fa57565b606460405162461bcd60e51b815260206004820152601860248201527f4f7264657220686173206265656e20636f6d706c6574656400000000000000006044820152fd5b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b03909216602483015260448201929092526123c891612b618260648101612b53565b906131cf57508051156131a557805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b8151158061321a575b6131e0575090565b6024906001600160a01b03604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b156131d856fea264697066735822122065f8190e3f7a3692b393b03f410226d8b3c219015ed3955eb4df0b956d4a40c464736f6c63430008180033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000658f1b0fd932b2e3c38c3a1961bc3c734c9b6a7500000000000000000000000039cd4db6460d8b5961f73e997e86ddbb7ca4d5f600000000000000000000000000000000000000000000000000005af3107a4000

-----Decoded View---------------
Arg [0] : timely (address): 0x658f1b0fd932B2e3c38C3a1961BC3C734C9b6A75
Arg [1] : router (address): 0x39cd4db6460d8B5961F73E997E86DdbB7Ca4D5F6
Arg [2] : magentaFee (uint256): 100000000000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000658f1b0fd932b2e3c38c3a1961bc3c734c9b6a75
Arg [1] : 00000000000000000000000039cd4db6460d8b5961f73e997e86ddbb7ca4d5f6
Arg [2] : 00000000000000000000000000000000000000000000000000005af3107a4000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.