S Price: $0.067615 (+2.68%)
Gas: 55 Gwei

Contract

0x4450d6B6258c0B07EA54609ED833bD367aB5743D

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0.897233192030905724 S

S Value

$0.06 (@ $0.07/S)

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Stop Order495256702025-10-06 13:44:39112 days ago1759758279IN
0x4450d6B6...67aB5743D
0 S0.0048318655
Create Order495209562025-10-06 12:49:41112 days ago1759754981IN
0x4450d6B6...67aB5743D
0 S0.0866513366
Create Order493184292025-10-04 14:15:59114 days ago1759587359IN
0x4450d6B6...67aB5743D
0 S0.0766250155
Create Order492397002025-10-03 18:34:14115 days ago1759516454IN
0x4450d6B6...67aB5743D
0 S0.070204855
Create Order492239012025-10-03 16:03:45115 days ago1759507425IN
0x4450d6B6...67aB5743D
0 S0.0804531660
Create Order492157342025-10-03 14:41:29115 days ago1759502489IN
0x4450d6B6...67aB5743D
0 S0.0783086755
Create Order489774482025-10-01 13:10:02117 days ago1759324202IN
0x4450d6B6...67aB5743D
0 S0.1252844455
Create Order489753092025-10-01 12:47:30117 days ago1759322850IN
0x4450d6B6...67aB5743D
0 S0.0785253755
Create Order489712002025-10-01 12:06:35117 days ago1759320395IN
0x4450d6B6...67aB5743D
0 S0.0601207755

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
495769622025-10-07 0:26:04111 days ago1759796764
0x4450d6B6...67aB5743D
0.06093225 S
495769622025-10-07 0:26:04111 days ago1759796764
0x4450d6B6...67aB5743D
0.15086971 S
495762772025-10-07 0:16:04111 days ago1759796164
0x4450d6B6...67aB5743D
0.15745237 S
495762772025-10-07 0:16:04111 days ago1759796164
0x4450d6B6...67aB5743D
0.15100617 S
495753382025-10-07 0:06:05111 days ago1759795565
0x4450d6B6...67aB5743D
0.3072498 S
495753382025-10-07 0:06:05111 days ago1759795565
0x4450d6B6...67aB5743D
0.1503159 S
495746252025-10-06 23:56:04111 days ago1759794964
0x4450d6B6...67aB5743D
0.06092882 S
495746252025-10-06 23:56:04111 days ago1759794964
0x4450d6B6...67aB5743D
0.15047498 S
495209562025-10-06 12:49:41112 days ago1759754981
0x4450d6B6...67aB5743D
0.05513541 S
495209562025-10-06 12:49:41112 days ago1759754981
0x4450d6B6...67aB5743D
0.05513541 S
495209562025-10-06 12:49:41112 days ago1759754981
0x4450d6B6...67aB5743D
 Contract Creation0 S
493184292025-10-04 14:15:59114 days ago1759587359
0x4450d6B6...67aB5743D
 Contract Creation0 S
492397002025-10-03 18:34:14115 days ago1759516454
0x4450d6B6...67aB5743D
3.48469758 S
492397002025-10-03 18:34:14115 days ago1759516454
0x4450d6B6...67aB5743D
3.48469758 S
492397002025-10-03 18:34:14115 days ago1759516454
0x4450d6B6...67aB5743D
 Contract Creation0 S
492260732025-10-03 16:23:49115 days ago1759508629
0x4450d6B6...67aB5743D
0.06237976 S
492260732025-10-03 16:23:49115 days ago1759508629
0x4450d6B6...67aB5743D
1.51478674 S
492260732025-10-03 16:23:49115 days ago1759508629
0x4450d6B6...67aB5743D
1.51478674 S
492260732025-10-03 16:23:49115 days ago1759508629
0x4450d6B6...67aB5743D
0.14998521 S
492250062025-10-03 16:13:52115 days ago1759508032
0x4450d6B6...67aB5743D
0.06238108 S
492250062025-10-03 16:13:52115 days ago1759508032
0x4450d6B6...67aB5743D
1.51479593 S
492250062025-10-03 16:13:52115 days ago1759508032
0x4450d6B6...67aB5743D
1.51479593 S
492250062025-10-03 16:13:52115 days ago1759508032
0x4450d6B6...67aB5743D
0.14998521 S
492247352025-10-03 16:11:33115 days ago1759507893
0x4450d6B6...67aB5743D
0.05993776 S
492247352025-10-03 16:11:33115 days ago1759507893
0x4450d6B6...67aB5743D
0.96037394 S
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SilverSwapDCA

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

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

// ============ Imports ============
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import 'contracts/Libraries/TransferHelper.sol';

import 'contracts/DcaApprover.sol';

import 'contracts/Integrations/Gelato/AutomateTaskCreator.sol';
import 'contracts/Interfaces/IWrappedNative.sol';

// ============ Interfaces ============
interface IMagpieRouter {
	function swapWithMagpieSignature(bytes calldata) external payable returns (uint256);
}

/**
 * @title SilverSwap DCA
 * @author github.com/SifexPro
 * @notice This contract allows users to create DCA orders on the SilverSwap platform
 */
contract SilverSwapDCA is AutomateTaskCreator, Ownable2Step, ReentrancyGuard {
	// ============ Utils Variables ============
	IMagpieRouter public swapRouter;
	address public treasury;
	IWrappedNative public wrappedNative;
	uint256 public feesPercentage = 100; // 100 = 1%
	
	// ============ Order Variables ============
	uint256 public ordersCount;
	mapping(uint256 => Order) public ordersById;
	mapping(address => uint256[]) public idByAddress;

	// ============ Script CID for Gelato ============
	string private scriptCID;

	// ============ Events ============
	event OrderCreated(address indexed user, uint256 indexed id, address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOutMin, uint256 period);
	event OrderEdited(address indexed user, uint256 indexed id, address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOutMin, uint256 period);
	event OrderStopped(address indexed user, uint256 indexed id);
	event OrderRestarted(address indexed user, uint256 indexed id);
	event OrderExecuted(address indexed user, uint256 indexed id, address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOut, uint256 amountOutMin, uint256 period);

	// ============ Events for Misc ============
	event WithdrawnNative(address indexed to, uint256 amount);
	event WithdrawnToken(address indexed token, address to, uint256 amount);
	event EditedTreasury(address indexed treasury);
	event EditedScriptCID(string cid);
	event EditedSwapRouter(address swapRouter);

	// ============ Gelato events ============
	event GelatoTaskCreated(bytes32 id);
	event GelatoTaskCanceled(bytes32 id);
	event GelatoFeesCheck(uint256 fees, address token);

	// ============ Error events ============
	error ErrorOrderDoesNotExist(uint256 id, uint256 ordersCount);
	error ErrorNotAuthorized(uint id, address user, address msgSender);
	error ErrorInvalidTokens(address tokenIn, address tokenOut);
	error ErrorOrderStopped(uint256 id);
	error ErrorAmountOutBelowMin(uint256 amountOut, uint256 amountOutMin);

	// ============ Constructor ============
	
	constructor(address _swapRouter, address _automate, address _treasury, address _wrappedToken, string memory _scriptCID) AutomateTaskCreator(_automate) Ownable(msg.sender) {
		swapRouter = IMagpieRouter(payable(_swapRouter));
		treasury = _treasury;
		wrappedNative = IWrappedNative(_wrappedToken);
		scriptCID = _scriptCID;
	}

	// ============ Execution functions ============

	/**
	 * @dev Execute the order (internal function)
	 * @param id the order id
	 * @param gelatoFeesInTokenIn the amount of tokenIn to swap for gelato fees
	 * @param dcaArgs the calldata for magpie swap
	 */
	function _executeOrder(uint id, uint256 gelatoFeesInTokenIn, bytes calldata dcaArgs) private {
		Order storage order = ordersById[id];
		
		address user = order.user;
		IERC20 tokenIn = IERC20(order.tokenIn);
		IERC20 tokenOut = IERC20(order.tokenOut);

		uint256 amountIn = order.amountIn - gelatoFeesInTokenIn;

		uint256	fees = amountIn * feesPercentage / 10000;
		uint256 amountToSwap = amountIn - fees;
		uint256 amountOutMin = order.amountOutMin;

		// Validate function selector to prevent arbitrary calls
		_validateSwapSelector(dcaArgs);

		// External calls first to follow CEI pattern
        SilverDcaApprover(order.approver).executeOrder(amountIn);
		
		// State updates after external calls
		order.totalExecutions++;
		order.totalAmountIn += order.amountIn;
		order.lastExecution = block.timestamp;
		order.nextExecution = block.timestamp + order.period;
		
		// Verify fee transfer to prevent malicious tokens from evading fees
		uint256 balanceBefore = tokenIn.balanceOf(treasury);
		SafeERC20.safeTransfer(tokenIn, treasury, fees);
		uint256 balanceAfter = tokenIn.balanceOf(treasury);
		require(balanceAfter >= balanceBefore + fees, "Fee transfer verification failed");

		TransferHelper.safeApprove(address(tokenIn), address(swapRouter), amountToSwap);
		(bool success, bytes memory returnData) = address(swapRouter).call(dcaArgs);
		require(success, "Swap failed");
		uint256 amountOut = abi.decode(returnData, (uint256));

		if (amountOut < amountOutMin)
			revert ErrorAmountOutBelowMin(amountOut, amountOutMin);

		// Handle native ETH output
		if (order.isNativeOut) {
			wrappedNative.withdraw(amountOut);
			TransferHelper.safeTransferNative(user, amountOut);
		} else {
			SafeERC20.safeTransfer(tokenOut, user, amountOut);
		}

		order.totalAmountOut += amountOut;

		uint256 period = order.period;
		address emitTokenOut = order.isNativeOut ? ETH : address(tokenOut);
		emit OrderExecuted(user, id, address(tokenIn), emitTokenOut, order.amountIn, amountOut, amountOutMin, period);
	}

	/**
	 * @dev Execute the order (public function)
	 * @param id the order id
	 * @param amountGelatoFeesInTokenIn the amount of tokenIn to swap for gelato fees
	 * @param dcaArgs the calldata for magpie swap (order execution)
	 * @param gelatoFeesArgs the calldata for gelato fees (gelato fees execution)
	 */
	function executeOrder(uint256 id, uint256 amountGelatoFeesInTokenIn, bytes calldata dcaArgs, bytes calldata gelatoFeesArgs) public gelatoTaskOnly nonReentrant {
		if (id >= getOrdersCountTotal())
			revert ErrorOrderDoesNotExist(id, getOrdersCountTotal());

		Order storage order = ordersById[id];

		if (order.stopped)
			revert ErrorOrderStopped(id);
		require(block.timestamp + 5 minutes >= order.nextExecution, 'Period not elapsed'); // 5 minutes for slippage execution
		require(ERC20(order.tokenIn).balanceOf(order.user) >= order.amountIn, 'Not enough balance');
			
		require(amountGelatoFeesInTokenIn < order.amountIn, 'amountGelatoFeesInTokenIn too high');

		SilverDcaApprover(order.approver).transferGelatoFees(amountGelatoFeesInTokenIn);
		
		uint256 wrappedNativeAmount;
		if (order.tokenIn != address(wrappedNative))
		{
			// Validate Gelato fees function selector to prevent arbitrary calls
			_validateSwapSelector(gelatoFeesArgs);
			
			TransferHelper.safeApprove(order.tokenIn, address(swapRouter), amountGelatoFeesInTokenIn);
			
			(bool success, bytes memory returnData) = address(swapRouter).call(gelatoFeesArgs);
			require(success, "Gelato fees swap failed");
			wrappedNativeAmount = abi.decode(returnData, (uint256));
		}
		else
			wrappedNativeAmount = amountGelatoFeesInTokenIn;
		
		// Basic sanity check - ensure we got some native tokens back
		require(wrappedNativeAmount > 0, "Gelato fees swap returned zero");

		wrappedNative.withdraw(wrappedNativeAmount);

		_executeOrder(id, amountGelatoFeesInTokenIn, dcaArgs);
	}
	
	// ============ Order functions ============

	/**
	 * @dev Create an order
	 * @param tokenIn the token to swap
	 * @param tokenOut the token to receive
	 * @param amountIn the amount of tokenIn to swap
	 * @param amountOutMin the minimum amount of tokenOut to receive
	 * @param period the period between each swap
	 * @param dcaArgs the calldata for magpie swap
	 */
	function createOrder(
		address tokenIn, 
		address tokenOut, 
		uint256 amountIn, 
		uint256 amountOutMin, 
		uint256 period, 
		bytes calldata dcaArgs,
		bytes calldata data
	) public onlyValidEntries(period, amountIn, amountOutMin) onlyValidTokens(tokenIn, tokenOut) nonReentrant {
		require(ERC20(tokenIn).balanceOf(msg.sender) >= amountIn, 'Not enough balance');

		// Check if tokenOut is native ETH and store wrapped native instead
		bool isNativeOut = tokenOut == ETH;
		address actualTokenOut = isNativeOut ? address(wrappedNative) : tokenOut;

        address approver = address(new SilverDcaApprover{salt: bytes32(ordersCount)}(ordersCount, msg.sender, tokenIn));
		Order memory order = Order(msg.sender, tokenIn, actualTokenOut, amountIn, amountOutMin, period, 0, 0, 0, 0, 0, block.timestamp, isNativeOut, data, false, approver, bytes32(""));
		ordersById[ordersCount] = order;
		idByAddress[msg.sender].push(ordersCount);
		ordersCount++;

		_executeOrder(ordersCount - 1, 0, dcaArgs);
		createTaskOrder(ordersCount - 1);

		emit OrderCreated(msg.sender, getOrdersCountTotal() - 1, tokenIn, tokenOut, amountIn, amountOutMin, period);
	}

	/**
	 * @dev Edit an order
	 * @param id the order id
	 * @param amountIn the amount of tokenIn to swap
	 * @param amountOutMin the minimum amount of tokenOut to receive
	 * @param period the period between each swap
	 * @param dcaArgs the calldata for magpie swap
	 */
	function editOrder(uint256 id, uint256 amountIn, uint256 amountOutMin, uint256 period, bytes calldata dcaArgs, bytes calldata data) public onlyUser(id) onlyValidEntries(period, amountIn, amountOutMin) nonReentrant {
		Order storage order = ordersById[id];
		
		order.amountIn = amountIn;
		order.amountOutMin = amountOutMin;
		order.period = period;

		if (data.length > 0)
			order.data = data;

		if (!order.stopped)
		{
			cancelTaskOrder(id);
			if (block.timestamp + 5 minutes >= order.nextExecution)
				_executeOrder(id, 0, dcaArgs);
			createTaskOrder(id);
		}

		address tokenIn = order.tokenIn;
		address tokenOut = order.tokenOut;
		emit OrderEdited(msg.sender, id, tokenIn, tokenOut, amountIn, amountOutMin, period);
	}

	/**
	 * @dev Stop an order
	 * @param id the order id
	 */
	function stopOrder(uint256 id) public onlyUser(id) {
		require (!ordersById[id].stopped, 'Order already stopped');

		ordersById[id].stopped = true;
		cancelTaskOrder(id);

		emit OrderStopped(msg.sender, id);
	}
	
	/**
	 * @dev Restart an order
	 * @param id the order id
	 * @param dcaArgs the dcaArgs struct for Algebra swap (in case the order should be directly executed)
	 */
	function restartOrder(uint256 id, bytes calldata dcaArgs) public onlyUser(id) nonReentrant {
		require (ordersById[id].stopped, 'Order not stopped');

		ordersById[id].stopped = false;
		if (block.timestamp + 5 minutes >= ordersById[id].nextExecution)
			_executeOrder(id, 0, dcaArgs);
		createTaskOrder(id);

		emit OrderRestarted(msg.sender, id);
	}


	// ============ Gelato functions ============

	/**
	 * @dev Create a task with Gelato
	 * Cancel the previous task if it exists
	 * @param id the order id
	 */
	function createTaskOrder(uint256 id) private {
		Order storage order = ordersById[id];
		
		if (order.taskId != bytes32(""))
			cancelTaskOrder(id);

		bytes memory execData = abi.encode(
			Strings.toHexString(uint256(uint160(address(this))), 20),						// dca
			id,																				// id
			Strings.toHexString((uint256(uint160(order.user))), 20),						// userAddress
			Strings.toHexString((uint256(uint160(order.tokenIn))), 20),						// srcToken
			Strings.toHexString((uint256(uint160(order.tokenOut))), 20),					// destToken
			Strings.toString(ERC20(order.tokenIn).decimals()),								// srcDecimals
			Strings.toString(ERC20(order.tokenOut).decimals()),								// destDecimals
			Strings.toString(order.amountIn),												// amount
			order.data,																		// data
			Strings.toString(block.chainid)													// network
		);

		ModuleData memory moduleData = ModuleData({
			modules: new Module[](3),
			args: new bytes[](3)
		});

		moduleData.modules[0] = Module.PROXY;
		moduleData.modules[1] = Module.WEB3_FUNCTION;
		moduleData.modules[2] = Module.TRIGGER;
	
		moduleData.args[0] = _proxyModuleArg();
		moduleData.args[1] = _web3FunctionModuleArg(
			scriptCID,
			execData
		);
		moduleData.args[2] = _timeTriggerModuleArg(
			uint128(order.nextExecution) * 1000, 
			uint128(order.period) * 1000
		);

		bytes32 taskId = _createTask(address(this), execData, moduleData, ETH);
	
		order.taskId = taskId;
		
		emit GelatoTaskCreated(taskId);
	}

	/**
	 * @dev Cancel the gelato task for the order
	 * @param id the order id
	 */
	function cancelTaskOrder(uint256 id) private {
		if (ordersById[id].taskId != bytes32(""))
		{
			bytes32 taskId = ordersById[id].taskId;
			ordersById[id].taskId = bytes32("");

			_cancelTask(taskId);

			emit GelatoTaskCanceled(taskId);
		}
    }

	function _handleGelatoFees() private {
		(uint256 fee, address feeToken) = _getFeeDetails();
		_transfer(fee, feeToken);
		emit GelatoFeesCheck(fee, feeToken);
	}


	// ============ Utils functions ============

	/**
	 * @dev Validate that calldata contains only swapWithMagpieSignature function calls
	 * @param callData The calldata to validate
	 */
	function _validateSwapSelector(bytes calldata callData) private pure {
		require(callData.length >= 4, "Invalid calldata length");
		bytes4 selector = bytes4(callData[:4]);
		bytes4 expectedSelector = bytes4(keccak256("swapWithMagpieSignature(bytes)"));
		require(selector == expectedSelector, "Invalid function selector");
	}

	function getOrdersCountTotal() public view returns (uint256) {
		return ordersCount;
	}

    function getOrdersCountByAddress(address user) public view returns (uint256) {
        return idByAddress[user].length;
    }

	function getOrdersByIndex(address user, uint256 index) public view returns (Order memory, uint256 id) {
        require(index < idByAddress[user].length, "Index out of bounds");
        return (ordersById[idByAddress[user][index]], idByAddress[user][index]);
    }

    function getApproveBytecode(uint256 _id, address _user, address _tokenIn) public pure returns (bytes memory) {
        bytes memory bytecode = type(SilverDcaApprover).creationCode;

        return abi.encodePacked(bytecode, abi.encode(_id, _user, _tokenIn));
    }

    function getApproveAddress(address _user, address _tokenIn) public view returns (address) {
        uint256 _id = ordersCount;
        bytes memory bytecode = getApproveBytecode(_id, _user, _tokenIn);

        bytes32 hash = keccak256(
            abi.encodePacked(bytes1(0xff), address(this), _id, keccak256(bytecode))
        );

        // NOTE: cast last 20 bytes of hash to address
        return address(uint160(uint(hash)));
    }

	function checkAllowanceBalance(uint256 id) public view returns (bool) {
		IERC20 token = IERC20(ordersById[id].tokenIn);
		
		if (token.allowance(ordersById[id].user, ordersById[id].approver) < ordersById[id].amountIn)
			return (false);
		else if (token.balanceOf(ordersById[id].user) < ordersById[id].amountIn)
			return (false);

		return (true);
	}
	

	// ============ Internal functions ============

	/**
	 * @dev Edit the treasury address
	 */
	function editTreasury(address _treasury) public onlyOwner {
		require(_treasury != address(0), "Treasury cannot be zero address");
		treasury = _treasury;

		emit EditedTreasury(_treasury);
	}

	/**
	 * @dev Edit the fees percentage
	 * @param _feesPercentage the new fees percentage
	 */
	function editFeesPercentage(uint256 _feesPercentage) public onlyOwner {
		require(_feesPercentage <= 10000, "Fees percentage must be <= 10000");
		feesPercentage = _feesPercentage;
	}

	/**
	 * @dev Edit the script CID
	 */
	function editScriptCID(string memory _cid) public onlyOwner {
		scriptCID = _cid;

		emit EditedScriptCID(_cid);
	}

	/**
	 * @dev Edit the swap router address
	 */
	function editSwapRouter(address _swapRouter) public onlyOwner {
		swapRouter = IMagpieRouter(payable(_swapRouter));

		emit EditedSwapRouter(_swapRouter);
	}

	function withdrawNative(address _to) public onlyOwner {
		uint256 balance = address(this).balance;
        require(balance > 0, "No Native to withdraw");

		address payable _treasury = payable(_to);
		(bool success, ) = _treasury.call{value:balance}("");
		require(success, "Transaction failed");

		emit WithdrawnNative(_treasury, balance);
	}

	function withdrawToken(address _token, address _to) public onlyOwner {
		IERC20 token = IERC20(_token);
		uint256 balance = token.balanceOf(address(this));

		SafeERC20.safeTransfer(token, _to, balance);

		emit WithdrawnToken(_token, _to, balance);
	}


	// ============ Modifiers ============

	modifier onlyUser(uint256 id) {
		if (id >= getOrdersCountTotal())
			revert ErrorOrderDoesNotExist(id, getOrdersCountTotal());
		if (ordersById[id].user != msg.sender)
			revert ErrorNotAuthorized(id, ordersById[id].user, msg.sender);
		_;
	}

	modifier onlyValidEntries(uint256 period, uint256 amountIn, uint256 amountOutMin) {
		require(period >= 5 minutes, 'Period must be >= 5 min');
		require(amountIn >= 100, 'AmountIn must be > 99');
		_;
	}

	modifier onlyValidTokens(address tokenIn, address tokenOut) {
		if (tokenIn == address(0) || (tokenOut == address(0) && tokenOut != ETH) || tokenIn == tokenOut || tokenIn == ETH)
			revert ErrorInvalidTokens(tokenIn, tokenOut);
		_;
	}

	modifier gelatoTaskOnly() {
		require(msg.sender == dedicatedMsgSender, "Not authorized");
		_;
		_handleGelatoFees();
	}


	// ============ FeeM functions ============

	/**
	 * @dev Register the contract on FeeM
	 */
	function registerMe() external {
		(bool _success,) = address(0xDC2B0D2Dd2b7759D97D50db4eabDC36973110830).call(
			abi.encodeWithSignature("selfRegister(uint256)", 9)
		);
		require(_success, "FeeM registration failed");
	}


	// ============ Receive function (to receive FTM) ============

	receive() external payable {}
}

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

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

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

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

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

pragma solidity ^0.8.20;

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

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

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

pragma solidity ^0.8.20;

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        _status = ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

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

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
     * representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.20 <=0.8.25;

import {IERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

// ============ Order struct ============
struct Order {
    address user;
    address tokenIn;
    address tokenOut;
    uint256 amountIn;
    uint256 amountOutMin;
    uint256 period;
	uint256 nextExecution;
    uint256 lastExecution;
    uint256 totalExecutions;
    uint256 totalAmountIn;
    uint256 totalAmountOut;
    uint256 createdAt;
	bool isNativeOut;
	bytes data;
    bool stopped;
    address approver;
	bytes32	taskId;
}

// ============ SilverDCA interface ============
interface ISilverDCA {
    function ordersById(uint256) external returns (Order memory);
}

/**
 * @title Silver DCA Approver
 * @author github.com/SifexPro
 * @notice This contract is used manage the approval of a DCA order
 */
contract SilverDcaApprover is Ownable {
	// ============ DCA contract ============
    address public silverDca;

	// ============ Order data ==============
	uint256 public id;
    address public user;
    address public tokenIn;

	// ============ Error events ============
	error ErrorOrderStopped(uint256 id);
	error ErrorPeriodNotElapsed(uint256 id, uint256 lastExecution, uint256 blockTimestamp, uint256 nextExecution);

    // ============ Constructor ============
	constructor(uint256 _id, address _user, address _tokenIn) Ownable(msg.sender) {
		id = _id;
        silverDca = msg.sender;
        user = _user;
        tokenIn = _tokenIn;
	}

	// ============ Utils functions ============

	/**
	 * @dev Transfer the tokenIn to the DCA contract (for the order execution)
	 */
    function executeOrder(uint256 amount) public onlyDCA {
		IERC20(tokenIn).transferFrom(user, silverDca, amount);
    }

	/**
	 * @dev Transfer the tokenIn to the DCA contract (for gelato's fees)
	 * @param feesAmount The amount of fees to transfer (in tokenIn)
	 */
	function transferGelatoFees(uint256 feesAmount) public onlyDCA {
		IERC20(tokenIn).transferFrom(user, silverDca, feesAmount);
    }


	// ============ Modifiers ============

	/**
	 * @dev Modifier to check if the caller is the DCA contract
	 */
	modifier onlyDCA() {
		require(msg.sender == silverDca, 'Not authorized');
		_;
	}
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.14;

import "./Types.sol";

abstract contract AutomateModuleHelper {
    function _resolverModuleArg(
        address _resolverAddress,
        bytes memory _resolverData
    ) internal pure returns (bytes memory) {
        return abi.encode(_resolverAddress, _resolverData);
    }

    function _proxyModuleArg() internal pure returns (bytes memory) {
        return bytes("");
    }

    function _singleExecModuleArg() internal pure returns (bytes memory) {
        return bytes("");
    }

    function _web3FunctionModuleArg(
        string memory _web3FunctionHash,
        bytes memory _web3FunctionArgsHex
    ) internal pure returns (bytes memory) {
        return abi.encode(_web3FunctionHash, _web3FunctionArgsHex);
    }

    function _timeTriggerModuleArg(uint128 _start, uint128 _interval)
        internal
        pure
        returns (bytes memory)
    {
        bytes memory triggerConfig = abi.encode(_start, _interval);

        return abi.encode(TriggerType.TIME, triggerConfig);
    }

    function _cronTriggerModuleArg(string memory _expression)
        internal
        pure
        returns (bytes memory)
    {
        bytes memory triggerConfig = abi.encode(_expression);

        return abi.encode(TriggerType.CRON, triggerConfig);
    }

    function _eventTriggerModuleArg(
        address _address,
        bytes32[][] memory _topics,
        uint256 _blockConfirmations
    ) internal pure returns (bytes memory) {
        bytes memory triggerConfig = abi.encode(
            _address,
            _topics,
            _blockConfirmations
        );

        return abi.encode(TriggerType.EVENT, triggerConfig);
    }

    function _blockTriggerModuleArg() internal pure returns (bytes memory) {
        bytes memory triggerConfig = abi.encode(bytes(""));

        return abi.encode(TriggerType.BLOCK, triggerConfig);
    }
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.14;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./Types.sol";

/**
 * @dev Inherit this contract to allow your smart contract to
 * - Make synchronous fee payments.
 * - Have call restrictions for functions to be automated.
 */
// solhint-disable private-vars-leading-underscore
abstract contract AutomateReady {
    IAutomate public immutable automate;
    address public immutable dedicatedMsgSender;
    address private immutable feeCollector;
    address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    /**
     * @dev
     * Only tasks created by _taskCreator defined in constructor can call
     * the functions with this modifier.
     */
    modifier onlyDedicatedMsgSender() {
        require(msg.sender == dedicatedMsgSender, "Only dedicated msg.sender");
        _;
    }

    /**
     * @dev
     * _taskCreator is the address which will create tasks for this contract.
     */
    constructor(address _automate, address _taskCreator) {
        automate = IAutomate(_automate);
        IGelato gelato = IGelato(IAutomate(_automate).gelato());

        feeCollector = gelato.feeCollector();

        address proxyModuleAddress = IAutomate(_automate).taskModuleAddresses(
            Module.PROXY
        );

        address opsProxyFactoryAddress = IProxyModule(proxyModuleAddress)
            .opsProxyFactory();

        (dedicatedMsgSender, ) = IOpsProxyFactory(opsProxyFactoryAddress)
            .getProxyOf(_taskCreator);
    }

    /**
     * @dev
     * Transfers fee to gelato for synchronous fee payments.
     *
     * _fee & _feeToken should be queried from IAutomate.getFeeDetails()
     */
    function _transfer(uint256 _fee, address _feeToken) internal {
        if (_feeToken == ETH) {
            (bool success, ) = feeCollector.call{value: _fee}("");
            require(success, "_transfer: ETH transfer failed");
        } else {
            SafeERC20.safeTransfer(IERC20(_feeToken), feeCollector, _fee);
        }
    }

    function _getFeeDetails()
        internal
        view
        returns (uint256 fee, address feeToken)
    {
        (fee, feeToken) = automate.getFeeDetails();
    }
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.14;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./AutomateReady.sol";
import {AutomateModuleHelper} from "./AutomateModuleHelper.sol";

/**
 * @dev Inherit this contract to allow your smart contract
 * to be a task creator and create tasks.
 */
//solhint-disable const-name-snakecase
//solhint-disable no-empty-blocks
abstract contract AutomateTaskCreator is AutomateModuleHelper, AutomateReady {
    using SafeERC20 for IERC20;

    IGelato1Balance public constant gelato1Balance =
        IGelato1Balance(0x7506C12a824d73D9b08564d5Afc22c949434755e);

    constructor(address _automate) AutomateReady(_automate, address(this)) {}

    function _depositFunds1Balance(
        uint256 _amount,
        address _token,
        address _sponsor
    ) internal {
        if (_token == ETH) {
            ///@dev Only deposit ETH on goerli for now.
            require(block.chainid == 5, "Only deposit ETH on goerli");
            gelato1Balance.depositNative{value: _amount}(_sponsor);
        } else {
            ///@dev Only deposit USDC on polygon for now.
            require(
                block.chainid == 137 &&
                    _token ==
                    address(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174),
                "Only deposit USDC on polygon"
            );
            IERC20(_token).approve(address(gelato1Balance), _amount);
            gelato1Balance.depositToken(_sponsor, _token, _amount);
        }
    }

    function _createTask(
        address _execAddress,
        bytes memory _execDataOrSelector,
        ModuleData memory _moduleData,
        address _feeToken
    ) internal returns (bytes32) {
        return
            automate.createTask(
                _execAddress,
                _execDataOrSelector,
                _moduleData,
                _feeToken
            );
    }

    function _cancelTask(bytes32 _taskId) internal {
        automate.cancelTask(_taskId);
    }
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.12;

enum Module {
    RESOLVER,
    DEPRECATED_TIME,
    PROXY,
    SINGLE_EXEC,
    WEB3_FUNCTION,
    TRIGGER
}

enum TriggerType {
    TIME,
    CRON,
    EVENT,
    BLOCK
}

struct ModuleData {
    Module[] modules;
    bytes[] args;
}

interface IAutomate {
    function createTask(
        address execAddress,
        bytes calldata execDataOrSelector,
        ModuleData calldata moduleData,
        address feeToken
    ) external returns (bytes32 taskId);

    function cancelTask(bytes32 taskId) external;

    function getFeeDetails() external view returns (uint256, address);

    function gelato() external view returns (address payable);

    function taskModuleAddresses(Module) external view returns (address);
}

interface IProxyModule {
    function opsProxyFactory() external view returns (address);
}

interface IOpsProxyFactory {
    function getProxyOf(address account) external view returns (address, bool);
}

interface IGelato1Balance {
    function depositNative(address _sponsor) external payable;

    function depositToken(
        address _sponsor,
        address _token,
        uint256 _amount
    ) external;
}

interface IGelato {
    function feeCollector() external view returns (address);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface IWrappedNative {
    function deposit() external payable;
    function withdraw(uint256 amount) external;
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-periphery
library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers NativeToken to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferNative(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_swapRouter","type":"address"},{"internalType":"address","name":"_automate","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_wrappedToken","type":"address"},{"internalType":"string","name":"_scriptCID","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"}],"name":"ErrorAmountOutBelowMin","type":"error"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"}],"name":"ErrorInvalidTokens","type":"error"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"msgSender","type":"address"}],"name":"ErrorNotAuthorized","type":"error"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"ordersCount","type":"uint256"}],"name":"ErrorOrderDoesNotExist","type":"error"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ErrorOrderStopped","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"StringsInsufficientHexLength","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"cid","type":"string"}],"name":"EditedScriptCID","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"swapRouter","type":"address"}],"name":"EditedSwapRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"treasury","type":"address"}],"name":"EditedTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"GelatoFeesCheck","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"GelatoTaskCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"GelatoTaskCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"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":"uint256","name":"period","type":"uint256"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"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":"uint256","name":"period","type":"uint256"}],"name":"OrderEdited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"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":"amountOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"}],"name":"OrderExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"OrderRestarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"OrderStopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawnNative","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawnToken","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"automate","outputs":[{"internalType":"contract IAutomate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkAllowanceBalance","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":"uint256","name":"period","type":"uint256"},{"internalType":"bytes","name":"dcaArgs","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"createOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dedicatedMsgSender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feesPercentage","type":"uint256"}],"name":"editFeesPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"bytes","name":"dcaArgs","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"editOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_cid","type":"string"}],"name":"editScriptCID","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_swapRouter","type":"address"}],"name":"editSwapRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"editTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amountGelatoFeesInTokenIn","type":"uint256"},{"internalType":"bytes","name":"dcaArgs","type":"bytes"},{"internalType":"bytes","name":"gelatoFeesArgs","type":"bytes"}],"name":"executeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feesPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gelato1Balance","outputs":[{"internalType":"contract IGelato1Balance","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_tokenIn","type":"address"}],"name":"getApproveAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_tokenIn","type":"address"}],"name":"getApproveBytecode","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getOrdersByIndex","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"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":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"nextExecution","type":"uint256"},{"internalType":"uint256","name":"lastExecution","type":"uint256"},{"internalType":"uint256","name":"totalExecutions","type":"uint256"},{"internalType":"uint256","name":"totalAmountIn","type":"uint256"},{"internalType":"uint256","name":"totalAmountOut","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"bool","name":"isNativeOut","type":"bool"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"stopped","type":"bool"},{"internalType":"address","name":"approver","type":"address"},{"internalType":"bytes32","name":"taskId","type":"bytes32"}],"internalType":"struct Order","name":"","type":"tuple"},{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getOrdersCountByAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOrdersCountTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"idByAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ordersById","outputs":[{"internalType":"address","name":"user","type":"address"},{"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":"uint256","name":"period","type":"uint256"},{"internalType":"uint256","name":"nextExecution","type":"uint256"},{"internalType":"uint256","name":"lastExecution","type":"uint256"},{"internalType":"uint256","name":"totalExecutions","type":"uint256"},{"internalType":"uint256","name":"totalAmountIn","type":"uint256"},{"internalType":"uint256","name":"totalAmountOut","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"bool","name":"isNativeOut","type":"bool"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"stopped","type":"bool"},{"internalType":"address","name":"approver","type":"address"},{"internalType":"bytes32","name":"taskId","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ordersCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registerMe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"dcaArgs","type":"bytes"}],"name":"restartOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"stopOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapRouter","outputs":[{"internalType":"contract IMagpieRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedNative","outputs":[{"internalType":"contract IWrappedNative","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e0604090808252346200058a5762004db68038038091620000228285620005a5565b833981019060a0818303126200058a576200003d81620005c9565b60206200004c818401620005c9565b906200005a868501620005c9565b906200006960608601620005c9565b60808601516001600160401b03968782116200058a570192601f948886860112156200058a5784518881116200058f578a5195601f199a620000b2878d8b8601160189620005a5565b8288528683830101116200058a57859060005b83811062000575575050600091870101526001600160a01b0390811660808190528a5163573ea57560e01b815260049491908c9087818881865afa9081156200052257859189916000916200052d575b50888451809481936331056e5760e21b8352165afa801562000522578891600091620004de575b5060c052815163cd3d4fb960e01b815260028882015292839060249082905afa9182156200049157849288916000916200049c575b5087835180958193632e8743fd60e21b8352165afa8015620004915784926000916200044f575b5060248251809481936337b6269f60e21b8352308b840152165afa9081156200044457600091620003f7575b5060a0523315620003e0578160018060a01b0319938160019a868c54168c556000543388821617600055823391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a38b6002556064600655168560035416176003551683855416178455169060055416176005558251958611620003cb57600a54908582811c92168015620003c0575b83831014620003ab57508381116200035f575b5080928511600114620002f4575083945090839291600094620002e8575b50501b916000199060031b1c191617600a555b516147d79081620005df8239608051818181610f110152818161297701528181613a3d0152613f76015260a0518181816109d801526126cd015260c051818181610f7a01526110500152f35b01519250388062000289565b929484908116600a60005284600020946000905b888383106200034457505050106200032a575b505050811b01600a556200029c565b015160001960f88460031b161c191690553880806200031b565b85870151885590960195948501948793509081019062000308565b600a600052816000208480880160051c820192848910620003a1575b0160051c019085905b828110620003945750506200026b565b6000815501859062000384565b925081926200037b565b602290634e487b7160e01b6000525260246000fd5b91607f169162000258565b604190634e487b7160e01b6000525260246000fd5b8a51631e4fbdf760e01b8152600081860152602490fd5b908c82813d83116200043c575b620004108183620005a5565b810103126200043957866200042583620005c9565b9201518015150362000439575038620001c4565b80fd5b503d62000404565b8c513d6000823e3d90fd5b925090508682813d811162000489575b6200046b8183620005a5565b810103126200043957508b620004828492620005c9565b3862000198565b503d6200045f565b50513d6000823e3d90fd5b9350915082813d8311620004d6575b620004b78183620005a5565b810103126200043957508b86620004cf8593620005c9565b3862000171565b503d620004ab565b92509082813d81116200051a575b620004f88183620005a5565b8101031262000439575086602492620005128f93620005c9565b90936200013c565b503d620004ec565b82513d6000823e3d90fd5b9250925081813d83116200056d575b620005488183620005a5565b8101031262000569575190848216820362000439575083878e923862000115565b5080fd5b503d6200053c565b818101830151898201840152879201620000c5565b600080fd5b634e487b7160e01b600052604160045260246000fd5b601f909101601f19168101906001600160401b038211908210176200058f57604052565b51906001600160a01b03821682036200058a5756fe60a08060405260043610156200001f575b5036156200001d57600080fd5b005b600090813560e01c908163049aacfe14620029615750806304d02dc8146200275957806312af8423146200271c578063213ecbba14620026fc57806328f150eb14620026b55780632a5fbb85146200262e5780632c4cb11a14620024d85780632d52e697146200233f5780632dbc99f01462001c5e5780632f622e6b1462001b65578063327f52481462001af157806335daa73114620019865780633aeac4e114620019d35780634949b42914620019a65780634b76d19e146200198657806357fb1d67146200195557806361d027b3146200192a578063715018a614620018c157806373d2e10c146200158a57806379ba50971462001509578063813a2b2a14620014ac578063861b319e1462000981578063867b6efa14620008cb5780638da5cb5b14620008a25780639a198d6114620007f25780639e6dab8214620004b4578063b3a815a11462000450578063c31c9c071462000425578063e30c397814620003fa578063e554404a14620002c9578063e858b9f61462000254578063eb6d3a1114620002295763f2fde38b03620000105734620002265760203660031901126200022657620001d162002abb565b620001db62002c83565b600180546001600160a01b0319166001600160a01b0392831690811790915582549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b503462000226578060031936011262000226576005546040516001600160a01b039091168152602090f35b50346200022657602036600319011262000226576004356200027562002c83565b6127108111620002855760065580f35b606460405162461bcd60e51b815260206004820152602060248201527f466565732070657263656e74616765206d757374206265203c3d2031303030306044820152fd5b503462000226576020366003190112620002265760043560075480821015620003dc5750808252600860205260408220546001600160a01b0316338103620003ae5750808252600860205260ff600e604084200154166200037157808252600860205260408220600e01805460ff19166001179055620003498162003f51565b337f0c786fc02b756ed090bb466b9a1e5ac65b7f488613aa201a8058aa32e407f8ee8380a380f35b60405162461bcd60e51b815260206004820152601560248201527413dc99195c88185b1c9958591e481cdd1bdc1c1959605a1b6044820152606490fd5b60405163cc73533d60e01b815260048101929092526001600160a01b03166024820152336044820152606490fd5b6044925060405191633d1e220b60e11b835260048301526024820152fd5b503462000226578060031936011262000226576001546040516001600160a01b039091168152602090f35b503462000226578060031936011262000226576003546040516001600160a01b039091168152602090f35b50346200022657606036600319011262000226576200046e62002ad2565b604435906001600160a01b0382168203620004af57620004ab916200049691600435620040d9565b60405191829160208352602083019062002bfd565b0390f35b600080fd5b5034620002265760403660031901126200022657620004d262002abb565b9080610200604051620004e581620029a6565b8281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e0820152826101008201528261012082015282610140820152826101608201528261018082015260606101a0820152826101c0820152826101e0820152015260018060a01b0382168152600960205260408120546024351015620007b7576001600160a01b0382168152600960205260408120620005c5919062000596906024359062002c54565b90549060031b1c81526008602052604081209260018060a01b0316815260096020526040602435912062002c54565b90549060031b1c600f60405192620005dd84620029a6565b80546001600160a01b03908116855260018201548116602086015260028201541660408501526003810154606085015260048101546080850152600581015460a0850152600681015460c0850152600781015460e085015260088101546101008501526009810154610120850152600a810154610140850152600b810154610160850152600c81015460ff1615156101808501526200067f600d820162002b26565b6101a0850152600e81015460ff811615156101c086015260018060a01b039060081c166101e085015201546102008301526040519182916040835260018060a01b03825116604084015260018060a01b03602083015116606084015260018060a01b036040830151166080840152606082015160a0840152608082015160c084015260a082015160e084015260c082015161010084015260e08201516101208401526101008201516101408401526101208201516101608401526101408201516101808401526101608201516101a084015261018082015115156101c08401526102006101a0830151926200078461022094856101e088015261026087019062002bfd565b6101c08201511515868401526101e08201516001600160a01b031694860194909452015161024084015260208301520390f35b60405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606490fd5b50346200022657806003193601126200022657808060405160208101906307983f4560e21b825260096024820152602481526200082f8162002a25565b51908273dc2b0d2dd2b7759d97d50db4eabdc369731108305af16200085362002cfe565b50156200085d5780f35b60405162461bcd60e51b815260206004820152601860248201527f4665654d20726567697374726174696f6e206661696c656400000000000000006044820152606490fd5b50346200022657806003193601126200022657546040516001600160a01b039091168152602090f35b5034620002265760203660031901126200022657620008e962002abb565b620008f362002c83565b6001600160a01b031680156200093c57600480546001600160a01b031916821790557f205f3a999aef8fdf4bd49352a2d316a93408f48b6ef910bd3c456e3b0bbe95368280a280f35b60405162461bcd60e51b815260206004820152601f60248201527f54726561737572792063616e6e6f74206265207a65726f2061646472657373006044820152606490fd5b50346200022657608036600319011262000226576001600160401b03604435818111620010ca57620009b890369060040162002c24565b6064928335908111620014a857620009d590369060040162002c24565b907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303620014735762000a1162002d33565b6007548060043510156200145357506004358652600860205260408620600e81015460ff81166200143a5761012c42018042116200142657600683015411620013ed5760018201805483546040516370a0823160e01b81526001600160a01b03918216600482015292949160209184916024918391165afa918215620013e2578a92620013a3575b50600362000aad9101548092101562002cbc565b602435101562001354578790600881901c6001600160a01b03163b15620011365760405163700d60ed60e11b81526024803560048301529092918391908290849060081c6001600160a01b03165af180156200127e576200133a575b505460055487936001600160a01b03928316939290911683146200132d5762000b52849362000b39838562004021565b600354602435916001600160a01b039091169062002d6f565b8260018060a01b036003541692826040519384928337810182815203925af162000b7b62002cfe565b9015620012e957602081805181010312620004af57602001515b8015620012a55760055485916001600160a01b0390911690813b15620010ca578291602483926040519485938492632e1a7d4d60e01b845260048401525af180156200112b576200128d575b505060043560009081526008602052604081208054600182015460028301546003840180546001600160a01b03938416989484169795969491939092169162000c2e906024359062002e36565b9461271062000c406006548862002e44565b0462000c4d818862002e36565b9060048901549762000c60848662004021565b600e8a015460081c6001600160a01b031690813b156200128957889160248392604051948593849263253d844d60e21b845260048401525af180156200127e5762001267575b5060249060088a0162000cba815462002e58565b9055865462000ccf60098c0191825462002c98565b90554260078b015562000ce760058b01544262002c98565b60068b015560018060a01b036004541660208d604051948580926370a0823160e01b82528560048301525afa9283156200121d57908d92918a9462001228575b508162000d35918462003324565b602060018060a01b03600454166024604051809581936370a0823160e01b835260048301525afa9182156200121d578992620011e0575b5062000d79919262002c98565b116200119d579185929162000d9b849360018060a01b03600354168d62002d6f565b8260018060a01b036003541692826040519384928337810182815203925af162000dc462002cfe565b90156200116b57602081805181010312620004af5760200151928484106200114d57600c86015460ff16156200113a576005546001600160a01b0316803b156200113657818091602460405180948193632e1a7d4d60e01b83528a60048401525af180156200112b5790829162001113575b508080602060405162000e498162002a09565b82815201878b5af162000e5b62002cfe565b5015620010e9575b600a860162000e7485825462002c98565b905560ff600c6005880154970154169050600014620010e2575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee905b549060405196875260018060a01b0316602087015260408601526060850152608084015260a08301527fb892e213448633d7b81e7583f8cf2bd294ad1d3d6bd75aae7a7393083f3c793a60c060043593a3600160025560408051635c08631b60e11b81529190826004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa8015620010d757839284916200107c575b506001600160a01b03169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8203620010235783808080867f00000000000000000000000000000000000000000000000000000000000000005af162000fa562002cfe565b501562000fe157507f24e583ad06c0a341b20a393419bb6b35dd48f347397d061a8531a73804420263916040915b82519182526020820152a180f35b60405162461bcd60e51b815260206004820152601e60248201527f5f7472616e736665723a20455448207472616e73666572206661696c656400006044820152fd5b5081604091620010767f24e583ad06c0a341b20a393419bb6b35dd48f347397d061a8531a73804420263947f00000000000000000000000000000000000000000000000000000000000000008362003324565b62000fd3565b9250506040823d604011620010ce575b816200109b6040938362002a41565b81010312620010ca578151602090920151916001600160a01b0383168303620010c657913862000f4c565b8380fd5b8280fd5b3d91506200108c565b6040513d85823e3d90fd5b9062000ea5565b60405162461bcd60e51b815260206004820152600360248201526253544560e81b60448201528990fd5b6200111e90620029d9565b6200022657803862000e36565b6040513d84823e3d90fd5b5080fd5b6200114784888462003324565b62000e63565b6044848660405191636ce3426d60e11b835260048301526024820152fd5b60405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b60448201528990fd5b8a60405162461bcd60e51b815260206004820152602060248201527f466565207472616e7366657220766572696669636174696f6e206661696c65646044820152fd5b91506020823d60201162001214575b81620011fe6020938362002a41565b81010312620004af5762000d7991519162000d6c565b3d9150620011ef565b6040513d8b823e3d90fd5b925092506020823d6020116200125e575b81620012486020938362002a41565b81010312620004af579051918c91908162000d27565b3d915062001239565b966200127660249298620029d9565b969062000ca6565b6040513d8a823e3d90fd5b8880fd5b6200129890620029d9565b620010c657833862000be1565b60405162461bcd60e51b815260206004820152601e60248201527f47656c61746f206665657320737761702072657475726e6564207a65726f000060448201528490fd5b60405162461bcd60e51b815260206004820152601760248201527f47656c61746f20666565732073776170206661696c656400000000000000000060448201528490fd5b5050505060243562000b95565b6200134a909791939297620029d9565b9590913862000b09565b60405162461bcd60e51b815260206004820152602260248201527f616d6f756e7447656c61746f46656573496e546f6b656e496e20746f6f2068696044820152610ced60f31b81890152608490fd5b9091506020813d602011620013d9575b81620013c26020938362002a41565b81010312620013d5575190600362000a99565b8980fd5b3d9150620013b3565b6040513d8c823e3d90fd5b60405162461bcd60e51b815260206004820152601260248201527114195c9a5bd9081b9bdd08195b185c1cd95960721b60448201528790fd5b634e487b7160e01b89526011600452602489fd5b6024604051630a3e4aef60e31b81526004356004820152fd5b60449060405190633d1e220b60e11b825260043560048301526024820152fd5b60405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201528590fd5b8480fd5b5034620002265760403660031901126200022657620014ca62002abb565b6001600160a01b031681526009602052604081208054602435929083101562000226576020620014fb848462002c54565b90546040519160031b1c8152f35b503462000226578060031936011262000226576001546001600160a01b03338183160362001572576001600160a01b031991821660015582543392811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405163118cdaa760e01b8152336004820152602490fd5b5034620002265760c036600319011262000226576004356001600160401b03608435818111620010c657620015c490369060040162002c24565b60a492919235828111620018bd57620015e290369060040162002c24565b929091600754808710156200189f57508587526020946008865260018060a01b03918260408a2054163381036200186f57506064359361012c906200162a8287101562003442565b602435976200163d60648a10156200348f565b6200164762002d33565b8a8c5260088a5260408c20998960038c0155604435988960048d01558860058d01558262001784575b5050505060ff600e8901541615620016f6575b5050506001850154600290950154604080519683166001600160a01b0390811688529290911690911660208601528401929092526060830152608082015233907fabe0aa400a1908e4f4d414cd3d006e426751a5efb172442bb70065d5ce67436b908060a081015b0390a3600160025580f35b620017018962003f51565b4201804211620017705791620016eb93917fabe0aa400a1908e4f4d414cd3d006e426751a5efb172442bb70065d5ce67436b9796959360068a015411156200175c575b5050620017518862003593565b918193949562001683565b62001768918a62002e68565b388062001744565b634e487b7160e01b8a52601160045260248afd5b600d8c019383116200185b579082918e620017ac84620017a5885462002ae9565b88620034ed565b8092601f8511600114620017ed575092620017e1575b50508160011b916000199060031b1c19161790555b3880808062001670565b013590503880620017c2565b8682528082209450919291601f19861691905b8282106200184257505090846001959493921062001827575b505050811b019055620017d7565b0135600019600384901b60f8161c1916905538808062001819565b8060018597829496880135815501960193019062001800565b634e487b7160e01b8e52604160045260248efd5b60405163cc73533d60e01b8152600481018a90526001600160a01b03919091166024820152336044820152606490fd5b8660449160405191633d1e220b60e11b835260048301526024820152fd5b8580fd5b50346200022657806003193601126200022657620018de62002c83565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503462000226578060031936011262000226576004546040516001600160a01b039091168152602090f35b503462000226578060031936011262000226576020604051737506c12a824d73d9b08564d5afc22c949434755e8152f35b503462000226578060031936011262000226576020600754604051908152f35b50346200022657602036600319011262000226576020620019c960043562004179565b6040519015158152f35b5034620002265760403660031901126200022657620019f162002abb565b620019fb62002ad2565b9062001a0662002c83565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa90811562001ae657849162001a8d575b7f11dd463c4f2edd676b85f050130c7ab2f5832f52becb5444b09a92404aa1498a925062001a6f82828662003324565b604080516001600160a01b039290921682526020820192909252a280f35b90506020823d821162001add575b8162001aaa6020938362002a41565b81010312620010c6577f11dd463c4f2edd676b85f050130c7ab2f5832f52becb5444b09a92404aa1498a91519062001a3f565b3d915062001a9b565b6040513d86823e3d90fd5b50346200022657602036600319011262000226577f85f6cf3df932625818a348efd5ea3d16324e8f7160a6a2dbf264faf0d354b751602062001b3262002abb565b62001b3c62002c83565b600380546001600160a01b0319166001600160a01b03929092169182179055604051908152a180f35b503462000226576020366003190112620002265762001b8362002abb565b62001b8d62002c83565b4790811562001c21576001600160a01b0316908280808084865af162001bb262002cfe565b501562001be75760207fc4825c2033e49b7d8db9d453f0a5953dc550c9452166b576df9f456893f1695f91604051908152a280f35b60405162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b6044820152606490fd5b60405162461bcd60e51b81526020600482015260156024820152744e6f204e617469766520746f20776974686472617760581b6044820152606490fd5b5034620002265760e0366003190112620002265762001c7c62002abb565b62001c8662002ad2565b60a4356001600160401b038111620010c65762001ca890369060040162002c24565b60c4939193356001600160401b038111620018bd5762001ccd90369060040162002c24565b9062001ce061012c608435101562003442565b62001cf1606460443510156200348f565b6001600160a01b03841615801562002303575b8015620022ed575b8015620022c6575b620022985762001d2362002d33565b6040516370a0823160e01b81523360048201526020816024816001600160a01b0389165afa80156200127e57889062002259575b62001d689150604435111562002cbc565b6001600160a01b03851673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0362002251576005546001600160a01b0316915b600754604051806104d88101106001600160401b036104d8830111176200223d576104d8620042ca82396104d881018281523360208201526001600160a01b0388166040820152819060600103908af59182156200127e5762001e8d916040519462001e0786620029a6565b3386526001600160a01b03888116602088015290811660408701526044356060870152606435608087015260843560a087015260c086018b905260e086018b905261010086018b905261012086018b905261014086018b905242610160870152881673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610180860152369162002a7f565b6101a0830152866101c083015260018060a01b03166101e08201528561020082015260075486526008602052604086209060018060a01b038151166001600160601b0360a01b8354161782556001820160018060a01b036020830151166001600160601b0360a01b8254161790556002820160018060a01b036040830151166001600160601b0360a01b825416179055606081015160038301556080810151600483015560a0810151600583015560c0810151600683015560e0810151600783015561010081015160088301556101208101516009830155610140810151600a830155610160810151600b83015562001f9c6101808201511515600c84019060ff801983541691151516179055565b6101a08101518051906001600160401b038211620022295762001fd28262001fc8600d87015462002ae9565b600d8701620034ed565b602090601f8311600114620021b1579180600f9492610200948c92620021a5575b50508160011b916000199060031b1c191617600d8501555b600e84016200202d6101c08301511515829060ff801983541691151516179055565b6101e08201518154610100600160a81b03191660089190911b610100600160a81b03161790550151910155338552600960205260408520600754815490959168010000000000000000821015620021915790620020909160018201815562002c54565b81549060031b906000198098831b921b1916179055620020b260075462002e58565b806007558581019081116200217d5790620020ce929162002e68565b6007548381019081116200216957620020e79062003593565b6007549283019283116200215557604080516001600160a01b039283168152929091166020830152604435908201526064356060820152608435608082015233907faf8bd3c5abe498e30aea149b38afa6e7d9bbe58c9129b38eff2912440734c6e2908060a08101620016eb565b634e487b7160e01b84526011600452602484fd5b634e487b7160e01b85526011600452602485fd5b634e487b7160e01b87526011600452602487fd5b634e487b7160e01b88526041600452602488fd5b01519050388062001ff3565b90600d85018a5260208a20918a5b601f198516811062002210575092600f94926001926102009583601f19811610620021f6575b505050811b01600d8501556200200b565b015160001960f88460031b161c19169055388080620021e5565b91926020600181928685015181550194019201620021bf565b634e487b7160e01b89526041600452602489fd5b634e487b7160e01b8a52604160045260248afd5b849162001d9b565b506020813d6020116200228f575b81620022766020938362002a41565b810103126200228b5762001d68905162001d57565b8780fd5b3d915062002267565b50506040516309f5fa3960e31b81526001600160a01b03928316600482015292909116602483015250604490fd5b506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1462001d14565b506001600160a01b038481169086161462001d0c565b506001600160a01b038516801590816200231f575b5062001d04565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee915014153862002318565b50346200022657604036600319011262000226576004356024356001600160401b038111620010ca576200237890369060040162002c24565b60075480841015620024ba5750828452600860205260408420546001600160a01b03163381036200248a5750620023ae62002d33565b828452600860205260ff600e604086200154161562002451578284526008602052600e604085200160ff19815416905561012c420180421162002169578385526008602052600660408620015411156200243d575b5050620024108162003593565b337f909f03131276f153fa00cded0c338279aadb07b73123f6eac1f11ff6b476e3698380a3600160025580f35b62002449918362002e68565b388062002403565b60405162461bcd60e51b815260206004820152601160248201527013dc99195c881b9bdd081cdd1bdc1c1959607a1b6044820152606490fd5b60405163cc73533d60e01b8152600481018590526001600160a01b03919091166024820152336044820152606490fd5b8360449160405191633d1e220b60e11b835260048301526024820152fd5b50346200022657602036600319011262000226576004358152600860205260409020600160a01b6001900381541681600160a01b60019003600182015416600160a01b600190036002830154166003830154600484015460058501546006860154600787015490600888015492600989015494600a8a015496600b8b015498600c8c015460ff169a600d8d016200256f9062002b26565b9c600e01549e600f01549d60405180608052526080516020015260805160400152608051606001526080516080015260805160a0015260805160c0015260805160e00152608051610100015260805161012001526080516101400152608051610160015215156080516101800152610220806080516101a0015260805101620025f89162002bfd565b9160ff811615156080516101c00152600160a01b600190039060081c166080516101e00152608051610200015260805180910390f35b503462000226576040366003190112620002265760206200264e62002abb565b620026676200265c62002ad2565b6007549283620040d9565b82815191012090604051918383019160ff60f81b83523060601b602185015260358401526055830152605582526200269f82620029ed565b905190206040516001600160a01b039091168152f35b503462000226578060031936011262000226576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503462000226578060031936011262000226576020600654604051908152f35b50346200022657602036600319011262000226576020906040906001600160a01b036200274862002abb565b168152600983522054604051908152f35b503462000226576020908160031936011262000226576001600160401b03600435818111620010ca5736602382011215620010ca57620027a490369060248160040135910162002a7f565b90620027af62002c83565b81519081116200294d57620027c6600a5462002ae9565b601f8111620028f0575b5083601f8211600114620028495790808495927ff3ff20d88bc3f65f380b8e3b4ed399c7d20e2fd4282dc004a8d106445e0ee35895916200283d575b508160011b916000199060031b1c191617600a555b6200283760405192828493845283019062002bfd565b0390a180f35b9050830151386200280c565b600a84527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890601f198316855b818110620028d857509183917ff3ff20d88bc3f65f380b8e3b4ed399c7d20e2fd4282dc004a8d106445e0ee35896979460019410620028be575b5050811b01600a5562002821565b85015160001960f88460031b161c191690553880620028b0565b91928760018192868901518155019401920162002876565b6200293b90600a85527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8601f840160051c81019187851062002942575b601f0160051c0190620034d4565b38620027d0565b90915081906200292d565b634e487b7160e01b83526041600452602483fd5b90503462001136578160031936011262001136577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b61022081019081106001600160401b03821117620029c357604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111620029c357604052565b608081019081106001600160401b03821117620029c357604052565b602081019081106001600160401b03821117620029c357604052565b606081019081106001600160401b03821117620029c357604052565b90601f801991011681019081106001600160401b03821117620029c357604052565b6001600160401b038111620029c357601f01601f191660200190565b92919262002a8d8262002a63565b9162002a9d604051938462002a41565b829481845281830111620004af578281602093846000960137010152565b600435906001600160a01b0382168203620004af57565b602435906001600160a01b0382168203620004af57565b90600182811c9216801562002b1b575b602083101462002b0557565b634e487b7160e01b600052602260045260246000fd5b91607f169162002af9565b906040519182600082549262002b3c8462002ae9565b90818452600194858116908160001462002bb3575060011462002b6c575b505062002b6a9250038362002a41565b565b9093915060005260209081600020936000915b81831062002b9a57505062002b6a9350820101388062002b5a565b8554888401850152948501948794509183019162002b7f565b91505062002b6a94506020925060ff191682840152151560051b820101388062002b5a565b60005b83811062002bec5750506000910152565b818101518382015260200162002bdb565b9060209162002c188151809281855285808601910162002bd8565b601f01601f1916010190565b9181601f84011215620004af578235916001600160401b038311620004af5760208381860195010111620004af57565b805482101562002c6d5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b6000546001600160a01b031633036200157257565b9190820180921162002ca657565b634e487b7160e01b600052601160045260246000fd5b1562002cc457565b60405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b6044820152606490fd5b3d1562002d2e573d9062002d128262002a63565b9162002d22604051938462002a41565b82523d6000602084013e565b606090565b600280541462002d435760028055565b604051633ee5aeb560e01b8152600490fd5b90816020910312620004af57518015158103620004af5790565b60405163095ea7b360e01b602082019081526001600160a01b0390931660248201526044810193909352600092839290839062002dba81606481015b03601f19810183528262002a41565b51925af162002dc862002cfe565b8162002e02575b501562002dd857565b60405162461bcd60e51b8152602060048201526002602482015261534160f01b6044820152606490fd5b805180159250821562002e19575b50503862002dcf565b62002e2e925060208091830101910162002d55565b388062002e10565b9190820391821162002ca657565b8181029291811591840414171562002ca657565b600019811462002ca65760010190565b91906000918383526008602052604083209160018060a01b038354169360018060a01b036001850154169160018060a01b036002860154169360038601549161271062002eb86006548562002e44565b049062002ec6828562002e36565b9160048901549462002ed9858462004021565b600e8a015460081c6001600160a01b031690813b156200228b57879160248392604051948593849263253d844d60e21b845260048401525af18015620033195762003303575b506008890162002f30815462002e58565b9055600389015462002f4860098b0191825462002c98565b90554260078a015562002f6060058a01544262002c98565b60068a0155600480546040516370a0823160e01b81526001600160a01b0390911691810182905291906020836024818c5afa9283156200127e578893620032c9575b508162002fb0918a62003324565b60018060a01b036004541690604051916370a0823160e01b835260048301526020826024818c5afa9182156200127e5788926200328c575b5062002ff5919262002c98565b116200324857849262003015849360018060a01b03600354168962002d6f565b8260018060a01b036003541692826040519384928337810182815203925af16200303e62002cfe565b90156200321557602081805181010312620004af5760200151818110620031f857600c86015460ff1615620031c0576005546001600160a01b0316803b15620010c657838091602460405180948193632e1a7d4d60e01b83528760048401525af1801562001ae657908491620031a8575b5080806020604051620030c28162002a09565b82815201848b5af1620030d462002cfe565b50156200317d577fb892e213448633d7b81e7583f8cf2bd294ad1d3d6bd75aae7a7393083f3c793a9560c0955b600a82016200311284825462002c98565b90556005820154600c83015490955060ff1615620031735750600373eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee915b0154604080519687526001600160a01b039092166020870152908501526060840152608083015260a0820152a3565b6003909162003144565b60405162461bcd60e51b815260206004820152600360248201526253544560e81b6044820152606490fd5b620031b390620029d9565b620010ca578238620030af565b7fb892e213448633d7b81e7583f8cf2bd294ad1d3d6bd75aae7a7393083f3c793a9585620031f2838a60c09962003324565b62003101565b60449160405191636ce3426d60e11b835260048301526024820152fd5b60405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b6044820152606490fd5b606460405162461bcd60e51b815260206004820152602060248201527f466565207472616e7366657220766572696669636174696f6e206661696c65646044820152fd5b91506020823d602011620032c0575b81620032aa6020938362002a41565b81010312620004af5762002ff591519162002fe8565b3d91506200329b565b9092506020813d602011620032fa575b81620032e86020938362002a41565b81010312620004af5751918162002fa2565b3d9150620032d9565b6200331190969196620029d9565b943862002f1f565b6040513d89823e3d90fd5b60405163a9059cbb60e01b602082019081526001600160a01b039390931660248201526044808201949094529283526200338c916000918291906200336b60648762002a41565b60018060a01b031694519082865af16200338462002cfe565b9083620033da565b8051908115159182620033bc575b5050620033a45750565b60249060405190635274afe760e01b82526004820152fd5b620033d1925060208091830101910162002d55565b1538806200339a565b90620034035750805115620033f157805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158062003438575b62003416575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156200340d565b156200344a57565b60405162461bcd60e51b815260206004820152601760248201527f506572696f64206d757374206265203e3d2035206d696e0000000000000000006044820152606490fd5b156200349757565b60405162461bcd60e51b8152602060048201526015602482015274416d6f756e74496e206d757374206265203e20393960581b6044820152606490fd5b818110620034e0575050565b60008155600101620034d4565b9190601f8111620034fd57505050565b62002b6a926000526020600020906020601f840160051c830193106200294257601f0160051c0190620034d4565b90816020910312620004af575160ff81168103620004af5790565b80511562002c6d5760200190565b80516001101562002c6d5760400190565b80516002101562002c6d5760600190565b906103e86001600160801b038093160291821691820362002ca657565b8060005260086020526040600020600f81015462003cd1575b620035b73062003e62565b8154620035cd906001600160a01b031662003e62565b60018301549091906001600160a01b0316620035e98162003e62565b9060018060a01b0360028601541690620036038262003e62565b9160405160208160048163313ce56760e01b968782525afa801562003ae75760ff6200363d9160209360009162003caf575b501662003ce2565b9260046040518094819382525afa801562003ae75760ff9160009162003c79575b50166200366b9062003ce2565b9160038701546200367c9062003ce2565b93620036884662003ce2565b96604051998a976020890161014090526101608901620036a89162002bfd565b906040890152601f19888203016060890152620036c59162002bfd565b868103601f19016080880152620036dc9162002bfd565b858103601f190160a0870152620036f39162002bfd565b848103601f190160c08601526200370a9162002bfd565b838103601f190160e0850152620037219162002bfd565b828103601f1901610100840152620037399162002bfd565b818103601f1901610120830152600d840154600091620037598262002ae9565b808252916001811690811562003c51575060011462003c03575b50506200379290620037a193601f198483030161014085015262002bfd565b03601f19810184528362002a41565b604051620037af81620029ed565b600381526060366020830137604051620037c981620029ed565b6003815260005b6060811062003bf157506040519160408301908382106001600160401b03831117620029c3576002926200380f92604052818552602085015262003546565b5260046200381e825162003554565b5260056200382d825162003565565b526200385c604051620038408162002a09565b60008152602083015190620038558262003546565b5262003546565b506040516000600a54620038708162002ae9565b808452906001811690811562003bcb575060011462003b6c575b50620038c8620038db83620038ac620039aa989695620038f395038262002a41565b62002dab60405193849260406020850152606084019062002bfd565b828103601f190160408401528762002bfd565b602083015190620038ec8262003554565b5262003554565b506200398162002dab620039696001600160801b03620039198160068901541662003576565b906200392b8160058a01541662003576565b8160405193166020840152166040820152604081526200394b8162002a25565b60405192839160006020840152604080840152606083019062002bfd565b6020830151906200397a8262003565565b5262003565565b50604051633323b46760e01b815230600482015260806024820152938492608484019062002bfd565b9060031983830301604484015260408201908051916040845282518091526020606085019301906000905b80821062003b275750505060200151916020818303910152815180825260208201916020808360051b8301019401926000915b83831062003af357505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60648601525060209392839003915082905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af191821562003ae75760009262003aac575b50817fb66c33d8dd981a05324331a06b40246adf774342c5561bc733d6134dd466a19e92600f6020930155604051908152a1565b91506020823d60201162003ade575b8162003aca6020938362002a41565b81010312620004af57905190600f62003a78565b3d915062003abb565b6040513d6000823e3d90fd5b91939550919360208062003b14600193601f19868203018752895162002bfd565b9701930193019092879594929362003a08565b9180959650939092935190600682101562003b56576020816001938293520195019201879594939291620039d5565b634e487b7160e01b600052602160045260246000fd5b600a600090815291507fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a85b81831062003bb05750508101602001620038db6200388a565b60018160209294939454838588010152019101919062003b97565b60ff191660208086019190915291151560051b84019091019150620038db90506200388a565b806060602080938501015201620037d0565b939150600d85016000526020600020936000915b80831062003c32575091935001602001826200379262003773565b9350919360018160209254838587010152019101909391869362003c17565b60ff191660208381019190915292151560051b90910190910191508390506200379262003773565b62003ca0915060203d60201162003ca7575b62003c97818362002a41565b8101906200352b565b386200365e565b503d62003c8b565b62003cca9150843d861162003ca75762003c97818362002a41565b3862003635565b62003cdc8262003f51565b620035ac565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101562003e53575b506d04ee2d6d415b85acef81000000008083101562003e43575b50662386f26fc100008083101562003e33575b506305f5e1008083101562003e23575b506127108083101562003e13575b50606482101562003e02575b600a8092101562003df7575b6001908160218186019562003d848762002a63565b9662003d94604051988962002a41565b80885262003da5601f199162002a63565b01366020890137860101905b62003dbe575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a83530491821562003df15791908262003db1565b62003db7565b916001019162003d6f565b919060646002910491019162003d63565b6004919392049101913862003d57565b6008919392049101913862003d49565b6010919392049101913862003d39565b6020919392049101913862003d26565b60409350810491503862003d0c565b806040519162003e728362002a25565b602a83526020808401604036823784511562002c6d576030905383519060019182101562002c6d5790607860218601536029915b81831162003ed95750505062003eba575090565b6044906040519063e22e27eb60e01b8252600482015260146024820152fd5b909192600f8116601081101562003f3c57865185101562003f3c576f181899199a1a9b1b9c1cb0b131b232b360811b901a86850183015360041c92801562003f275760001901919062003ea6565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b60009081526008602052600f6040822001908154918262003f7157505050565b8190557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b15620011365781809160246040518095819363ee8ca3b560e01b83528860048401525af1908115620040155750916020917fd2b8cd190f54408a8e1f68c863951d8b6515b9694fef3330e5942ac18a1989999362004003575b50604051908152a1565b6200400e90620029d9565b3862003ff9565b604051903d90823e3d90fd5b90600481106200409457600411620004af57638c03bba960e01b90356001600160e01b031916016200404f57565b60405162461bcd60e51b815260206004820152601960248201527f496e76616c69642066756e6374696f6e2073656c6563746f72000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f496e76616c69642063616c6c64617461206c656e6774680000000000000000006044820152606490fd5b90620041599262004176926104d891620041696040519362004146602096620041058884018862002a41565b82875287870192620042ca8439604080518981019788526001600160a01b039283166020890152959091168682015284860390810185526060018462002a41565b6040519788955180928888019062002bd8565b8401915180938684019062002bd8565b0103808452018262002a41565b90565b600081815260086020818152604080842060018101548154600e909201548351636eb1769f60e11b81526001600160a01b039384166004820152951c821660248601529495948116949193908382604481895afa918215620042bf57879262004286575b508287526008845284872091600383015411600014620042005750505050505090565b8391541660248551809781936370a0823160e01b835260048301525afa9384156200427c57859462004246575b5084526008905282206003015411620041765750600190565b9093508181813d831162004274575b62004261818362002a41565b81010312620014a857519260036200422d565b503d62004255565b83513d87823e3d90fd5b9091508381813d8311620042b7575b620042a1818362002a41565b81010312620042b357519038620041dd565b8680fd5b503d62004295565b85513d89823e3d90fdfe6080346100f857601f6104d838819003918201601f19168301916001600160401b038311848410176100fd578084926060946040528339810103126100f8578051610058604061005160208501610113565b9301610113565b9033156100df57600080546001600160a01b03198082163390811784556040519691956001600160a01b0395909486949192918516907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36002553385600154161760015516836003541617600355169060045416176004556103b090816101288239f35b604051631e4fbdf760e01b815260006004820152602490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100f85756fe608060408181526004908136101561001657600080fd5b600092833560e01c9081630298479d14610230575080634f8632ba146102075780636daf390b146101df578063715018a6146101825780638da5cb5b1461015a57806394f6113414610117578063af640d0f1461013b578063e01ac1da146101175763f2fde38b1461008757600080fd5b34610113576020366003190112610113576001600160a01b0382358181169391929084900361010f576100b8610255565b83156100f957505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8480fd5b8280fd5b505034610137576020366003190112610137576101349035610281565b80f35b5080fd5b8382346101375781600319360112610137576020906002549051908152f35b838234610137578160031936011261013757905490516001600160a01b039091168152602090f35b83346101dc57806003193601126101dc5761019b610255565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b5090346101135782600319360112610113575490516001600160a01b03909116815260209150f35b83823461013757816003193601126101375760035490516001600160a01b039091168152602090f35b8490346101375781600319360112610137576001546001600160a01b03168152602090f35b6000546001600160a01b0316330361026957565b60405163118cdaa760e01b8152336004820152602490fd5b6001546001600160a01b03919082169033829003610344578260045416926003541691604051926323b872dd60e01b8452600484015260248301526044820152602081606481600080965af18015610339576102db575050565b60203d8111610332575b601f8101601f1916820167ffffffffffffffff81118382101761031e576020918391604052810103126101375751801515036101dc5750565b634e487b7160e01b84526041600452602484fd5b503d6102e5565b6040513d84823e3d90fd5b60405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606490fdfea2646970667358221220407cc429e23804d097414bd1ab2188cff78beeb2668a35874914595a8780a82064736f6c63430008140033a26469706673582212200076689d4fe50e35e20859ff21444a0e1e621d06f3bace9b08fc550e1979c9a964736f6c63430008140033000000000000000000000000c325856e5585823aac0d1fd46c35c608d95e65a9000000000000000000000000afd37d0558255aa687167560cd3aaeea75c2841e000000000000000000000000fe9777078ca0d60d2e9f489bf0297b433abccdec000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e516d5453363465456568634c68454c5373587a6f4c57576a47354146463248784e4e587336615164786f78725669000000000000000000000000000000000000

Deployed Bytecode

0x60a08060405260043610156200001f575b5036156200001d57600080fd5b005b600090813560e01c908163049aacfe14620029615750806304d02dc8146200275957806312af8423146200271c578063213ecbba14620026fc57806328f150eb14620026b55780632a5fbb85146200262e5780632c4cb11a14620024d85780632d52e697146200233f5780632dbc99f01462001c5e5780632f622e6b1462001b65578063327f52481462001af157806335daa73114620019865780633aeac4e114620019d35780634949b42914620019a65780634b76d19e146200198657806357fb1d67146200195557806361d027b3146200192a578063715018a614620018c157806373d2e10c146200158a57806379ba50971462001509578063813a2b2a14620014ac578063861b319e1462000981578063867b6efa14620008cb5780638da5cb5b14620008a25780639a198d6114620007f25780639e6dab8214620004b4578063b3a815a11462000450578063c31c9c071462000425578063e30c397814620003fa578063e554404a14620002c9578063e858b9f61462000254578063eb6d3a1114620002295763f2fde38b03620000105734620002265760203660031901126200022657620001d162002abb565b620001db62002c83565b600180546001600160a01b0319166001600160a01b0392831690811790915582549091167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b503462000226578060031936011262000226576005546040516001600160a01b039091168152602090f35b50346200022657602036600319011262000226576004356200027562002c83565b6127108111620002855760065580f35b606460405162461bcd60e51b815260206004820152602060248201527f466565732070657263656e74616765206d757374206265203c3d2031303030306044820152fd5b503462000226576020366003190112620002265760043560075480821015620003dc5750808252600860205260408220546001600160a01b0316338103620003ae5750808252600860205260ff600e604084200154166200037157808252600860205260408220600e01805460ff19166001179055620003498162003f51565b337f0c786fc02b756ed090bb466b9a1e5ac65b7f488613aa201a8058aa32e407f8ee8380a380f35b60405162461bcd60e51b815260206004820152601560248201527413dc99195c88185b1c9958591e481cdd1bdc1c1959605a1b6044820152606490fd5b60405163cc73533d60e01b815260048101929092526001600160a01b03166024820152336044820152606490fd5b6044925060405191633d1e220b60e11b835260048301526024820152fd5b503462000226578060031936011262000226576001546040516001600160a01b039091168152602090f35b503462000226578060031936011262000226576003546040516001600160a01b039091168152602090f35b50346200022657606036600319011262000226576200046e62002ad2565b604435906001600160a01b0382168203620004af57620004ab916200049691600435620040d9565b60405191829160208352602083019062002bfd565b0390f35b600080fd5b5034620002265760403660031901126200022657620004d262002abb565b9080610200604051620004e581620029a6565b8281528260208201528260408201528260608201528260808201528260a08201528260c08201528260e0820152826101008201528261012082015282610140820152826101608201528261018082015260606101a0820152826101c0820152826101e0820152015260018060a01b0382168152600960205260408120546024351015620007b7576001600160a01b0382168152600960205260408120620005c5919062000596906024359062002c54565b90549060031b1c81526008602052604081209260018060a01b0316815260096020526040602435912062002c54565b90549060031b1c600f60405192620005dd84620029a6565b80546001600160a01b03908116855260018201548116602086015260028201541660408501526003810154606085015260048101546080850152600581015460a0850152600681015460c0850152600781015460e085015260088101546101008501526009810154610120850152600a810154610140850152600b810154610160850152600c81015460ff1615156101808501526200067f600d820162002b26565b6101a0850152600e81015460ff811615156101c086015260018060a01b039060081c166101e085015201546102008301526040519182916040835260018060a01b03825116604084015260018060a01b03602083015116606084015260018060a01b036040830151166080840152606082015160a0840152608082015160c084015260a082015160e084015260c082015161010084015260e08201516101208401526101008201516101408401526101208201516101608401526101408201516101808401526101608201516101a084015261018082015115156101c08401526102006101a0830151926200078461022094856101e088015261026087019062002bfd565b6101c08201511515868401526101e08201516001600160a01b031694860194909452015161024084015260208301520390f35b60405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606490fd5b50346200022657806003193601126200022657808060405160208101906307983f4560e21b825260096024820152602481526200082f8162002a25565b51908273dc2b0d2dd2b7759d97d50db4eabdc369731108305af16200085362002cfe565b50156200085d5780f35b60405162461bcd60e51b815260206004820152601860248201527f4665654d20726567697374726174696f6e206661696c656400000000000000006044820152606490fd5b50346200022657806003193601126200022657546040516001600160a01b039091168152602090f35b5034620002265760203660031901126200022657620008e962002abb565b620008f362002c83565b6001600160a01b031680156200093c57600480546001600160a01b031916821790557f205f3a999aef8fdf4bd49352a2d316a93408f48b6ef910bd3c456e3b0bbe95368280a280f35b60405162461bcd60e51b815260206004820152601f60248201527f54726561737572792063616e6e6f74206265207a65726f2061646472657373006044820152606490fd5b50346200022657608036600319011262000226576001600160401b03604435818111620010ca57620009b890369060040162002c24565b6064928335908111620014a857620009d590369060040162002c24565b907f0000000000000000000000003d0ea64786c055824135cf06e37ffb129e98415f6001600160a01b03163303620014735762000a1162002d33565b6007548060043510156200145357506004358652600860205260408620600e81015460ff81166200143a5761012c42018042116200142657600683015411620013ed5760018201805483546040516370a0823160e01b81526001600160a01b03918216600482015292949160209184916024918391165afa918215620013e2578a92620013a3575b50600362000aad9101548092101562002cbc565b602435101562001354578790600881901c6001600160a01b03163b15620011365760405163700d60ed60e11b81526024803560048301529092918391908290849060081c6001600160a01b03165af180156200127e576200133a575b505460055487936001600160a01b03928316939290911683146200132d5762000b52849362000b39838562004021565b600354602435916001600160a01b039091169062002d6f565b8260018060a01b036003541692826040519384928337810182815203925af162000b7b62002cfe565b9015620012e957602081805181010312620004af57602001515b8015620012a55760055485916001600160a01b0390911690813b15620010ca578291602483926040519485938492632e1a7d4d60e01b845260048401525af180156200112b576200128d575b505060043560009081526008602052604081208054600182015460028301546003840180546001600160a01b03938416989484169795969491939092169162000c2e906024359062002e36565b9461271062000c406006548862002e44565b0462000c4d818862002e36565b9060048901549762000c60848662004021565b600e8a015460081c6001600160a01b031690813b156200128957889160248392604051948593849263253d844d60e21b845260048401525af180156200127e5762001267575b5060249060088a0162000cba815462002e58565b9055865462000ccf60098c0191825462002c98565b90554260078b015562000ce760058b01544262002c98565b60068b015560018060a01b036004541660208d604051948580926370a0823160e01b82528560048301525afa9283156200121d57908d92918a9462001228575b508162000d35918462003324565b602060018060a01b03600454166024604051809581936370a0823160e01b835260048301525afa9182156200121d578992620011e0575b5062000d79919262002c98565b116200119d579185929162000d9b849360018060a01b03600354168d62002d6f565b8260018060a01b036003541692826040519384928337810182815203925af162000dc462002cfe565b90156200116b57602081805181010312620004af5760200151928484106200114d57600c86015460ff16156200113a576005546001600160a01b0316803b156200113657818091602460405180948193632e1a7d4d60e01b83528a60048401525af180156200112b5790829162001113575b508080602060405162000e498162002a09565b82815201878b5af162000e5b62002cfe565b5015620010e9575b600a860162000e7485825462002c98565b905560ff600c6005880154970154169050600014620010e2575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee905b549060405196875260018060a01b0316602087015260408601526060850152608084015260a08301527fb892e213448633d7b81e7583f8cf2bd294ad1d3d6bd75aae7a7393083f3c793a60c060043593a3600160025560408051635c08631b60e11b81529190826004817f000000000000000000000000afd37d0558255aa687167560cd3aaeea75c2841e6001600160a01b03165afa8015620010d757839284916200107c575b506001600160a01b03169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8203620010235783808080867f00000000000000000000000092478c7eccb3c7a3932263712c1555dbaea7d56c5af162000fa562002cfe565b501562000fe157507f24e583ad06c0a341b20a393419bb6b35dd48f347397d061a8531a73804420263916040915b82519182526020820152a180f35b60405162461bcd60e51b815260206004820152601e60248201527f5f7472616e736665723a20455448207472616e73666572206661696c656400006044820152fd5b5081604091620010767f24e583ad06c0a341b20a393419bb6b35dd48f347397d061a8531a73804420263947f00000000000000000000000092478c7eccb3c7a3932263712c1555dbaea7d56c8362003324565b62000fd3565b9250506040823d604011620010ce575b816200109b6040938362002a41565b81010312620010ca578151602090920151916001600160a01b0383168303620010c657913862000f4c565b8380fd5b8280fd5b3d91506200108c565b6040513d85823e3d90fd5b9062000ea5565b60405162461bcd60e51b815260206004820152600360248201526253544560e81b60448201528990fd5b6200111e90620029d9565b6200022657803862000e36565b6040513d84823e3d90fd5b5080fd5b6200114784888462003324565b62000e63565b6044848660405191636ce3426d60e11b835260048301526024820152fd5b60405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b60448201528990fd5b8a60405162461bcd60e51b815260206004820152602060248201527f466565207472616e7366657220766572696669636174696f6e206661696c65646044820152fd5b91506020823d60201162001214575b81620011fe6020938362002a41565b81010312620004af5762000d7991519162000d6c565b3d9150620011ef565b6040513d8b823e3d90fd5b925092506020823d6020116200125e575b81620012486020938362002a41565b81010312620004af579051918c91908162000d27565b3d915062001239565b966200127660249298620029d9565b969062000ca6565b6040513d8a823e3d90fd5b8880fd5b6200129890620029d9565b620010c657833862000be1565b60405162461bcd60e51b815260206004820152601e60248201527f47656c61746f206665657320737761702072657475726e6564207a65726f000060448201528490fd5b60405162461bcd60e51b815260206004820152601760248201527f47656c61746f20666565732073776170206661696c656400000000000000000060448201528490fd5b5050505060243562000b95565b6200134a909791939297620029d9565b9590913862000b09565b60405162461bcd60e51b815260206004820152602260248201527f616d6f756e7447656c61746f46656573496e546f6b656e496e20746f6f2068696044820152610ced60f31b81890152608490fd5b9091506020813d602011620013d9575b81620013c26020938362002a41565b81010312620013d5575190600362000a99565b8980fd5b3d9150620013b3565b6040513d8c823e3d90fd5b60405162461bcd60e51b815260206004820152601260248201527114195c9a5bd9081b9bdd08195b185c1cd95960721b60448201528790fd5b634e487b7160e01b89526011600452602489fd5b6024604051630a3e4aef60e31b81526004356004820152fd5b60449060405190633d1e220b60e11b825260043560048301526024820152fd5b60405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201528590fd5b8480fd5b5034620002265760403660031901126200022657620014ca62002abb565b6001600160a01b031681526009602052604081208054602435929083101562000226576020620014fb848462002c54565b90546040519160031b1c8152f35b503462000226578060031936011262000226576001546001600160a01b03338183160362001572576001600160a01b031991821660015582543392811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b60405163118cdaa760e01b8152336004820152602490fd5b5034620002265760c036600319011262000226576004356001600160401b03608435818111620010c657620015c490369060040162002c24565b60a492919235828111620018bd57620015e290369060040162002c24565b929091600754808710156200189f57508587526020946008865260018060a01b03918260408a2054163381036200186f57506064359361012c906200162a8287101562003442565b602435976200163d60648a10156200348f565b6200164762002d33565b8a8c5260088a5260408c20998960038c0155604435988960048d01558860058d01558262001784575b5050505060ff600e8901541615620016f6575b5050506001850154600290950154604080519683166001600160a01b0390811688529290911690911660208601528401929092526060830152608082015233907fabe0aa400a1908e4f4d414cd3d006e426751a5efb172442bb70065d5ce67436b908060a081015b0390a3600160025580f35b620017018962003f51565b4201804211620017705791620016eb93917fabe0aa400a1908e4f4d414cd3d006e426751a5efb172442bb70065d5ce67436b9796959360068a015411156200175c575b5050620017518862003593565b918193949562001683565b62001768918a62002e68565b388062001744565b634e487b7160e01b8a52601160045260248afd5b600d8c019383116200185b579082918e620017ac84620017a5885462002ae9565b88620034ed565b8092601f8511600114620017ed575092620017e1575b50508160011b916000199060031b1c19161790555b3880808062001670565b013590503880620017c2565b8682528082209450919291601f19861691905b8282106200184257505090846001959493921062001827575b505050811b019055620017d7565b0135600019600384901b60f8161c1916905538808062001819565b8060018597829496880135815501960193019062001800565b634e487b7160e01b8e52604160045260248efd5b60405163cc73533d60e01b8152600481018a90526001600160a01b03919091166024820152336044820152606490fd5b8660449160405191633d1e220b60e11b835260048301526024820152fd5b8580fd5b50346200022657806003193601126200022657620018de62002c83565b600180546001600160a01b03199081169091558154908116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503462000226578060031936011262000226576004546040516001600160a01b039091168152602090f35b503462000226578060031936011262000226576020604051737506c12a824d73d9b08564d5afc22c949434755e8152f35b503462000226578060031936011262000226576020600754604051908152f35b50346200022657602036600319011262000226576020620019c960043562004179565b6040519015158152f35b5034620002265760403660031901126200022657620019f162002abb565b620019fb62002ad2565b9062001a0662002c83565b6040516370a0823160e01b81523060048201526001600160a01b039190911691602082602481865afa90811562001ae657849162001a8d575b7f11dd463c4f2edd676b85f050130c7ab2f5832f52becb5444b09a92404aa1498a925062001a6f82828662003324565b604080516001600160a01b039290921682526020820192909252a280f35b90506020823d821162001add575b8162001aaa6020938362002a41565b81010312620010c6577f11dd463c4f2edd676b85f050130c7ab2f5832f52becb5444b09a92404aa1498a91519062001a3f565b3d915062001a9b565b6040513d86823e3d90fd5b50346200022657602036600319011262000226577f85f6cf3df932625818a348efd5ea3d16324e8f7160a6a2dbf264faf0d354b751602062001b3262002abb565b62001b3c62002c83565b600380546001600160a01b0319166001600160a01b03929092169182179055604051908152a180f35b503462000226576020366003190112620002265762001b8362002abb565b62001b8d62002c83565b4790811562001c21576001600160a01b0316908280808084865af162001bb262002cfe565b501562001be75760207fc4825c2033e49b7d8db9d453f0a5953dc550c9452166b576df9f456893f1695f91604051908152a280f35b60405162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b6044820152606490fd5b60405162461bcd60e51b81526020600482015260156024820152744e6f204e617469766520746f20776974686472617760581b6044820152606490fd5b5034620002265760e0366003190112620002265762001c7c62002abb565b62001c8662002ad2565b60a4356001600160401b038111620010c65762001ca890369060040162002c24565b60c4939193356001600160401b038111620018bd5762001ccd90369060040162002c24565b9062001ce061012c608435101562003442565b62001cf1606460443510156200348f565b6001600160a01b03841615801562002303575b8015620022ed575b8015620022c6575b620022985762001d2362002d33565b6040516370a0823160e01b81523360048201526020816024816001600160a01b0389165afa80156200127e57889062002259575b62001d689150604435111562002cbc565b6001600160a01b03851673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0362002251576005546001600160a01b0316915b600754604051806104d88101106001600160401b036104d8830111176200223d576104d8620042ca82396104d881018281523360208201526001600160a01b0388166040820152819060600103908af59182156200127e5762001e8d916040519462001e0786620029a6565b3386526001600160a01b03888116602088015290811660408701526044356060870152606435608087015260843560a087015260c086018b905260e086018b905261010086018b905261012086018b905261014086018b905242610160870152881673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610180860152369162002a7f565b6101a0830152866101c083015260018060a01b03166101e08201528561020082015260075486526008602052604086209060018060a01b038151166001600160601b0360a01b8354161782556001820160018060a01b036020830151166001600160601b0360a01b8254161790556002820160018060a01b036040830151166001600160601b0360a01b825416179055606081015160038301556080810151600483015560a0810151600583015560c0810151600683015560e0810151600783015561010081015160088301556101208101516009830155610140810151600a830155610160810151600b83015562001f9c6101808201511515600c84019060ff801983541691151516179055565b6101a08101518051906001600160401b038211620022295762001fd28262001fc8600d87015462002ae9565b600d8701620034ed565b602090601f8311600114620021b1579180600f9492610200948c92620021a5575b50508160011b916000199060031b1c191617600d8501555b600e84016200202d6101c08301511515829060ff801983541691151516179055565b6101e08201518154610100600160a81b03191660089190911b610100600160a81b03161790550151910155338552600960205260408520600754815490959168010000000000000000821015620021915790620020909160018201815562002c54565b81549060031b906000198098831b921b1916179055620020b260075462002e58565b806007558581019081116200217d5790620020ce929162002e68565b6007548381019081116200216957620020e79062003593565b6007549283019283116200215557604080516001600160a01b039283168152929091166020830152604435908201526064356060820152608435608082015233907faf8bd3c5abe498e30aea149b38afa6e7d9bbe58c9129b38eff2912440734c6e2908060a08101620016eb565b634e487b7160e01b84526011600452602484fd5b634e487b7160e01b85526011600452602485fd5b634e487b7160e01b87526011600452602487fd5b634e487b7160e01b88526041600452602488fd5b01519050388062001ff3565b90600d85018a5260208a20918a5b601f198516811062002210575092600f94926001926102009583601f19811610620021f6575b505050811b01600d8501556200200b565b015160001960f88460031b161c19169055388080620021e5565b91926020600181928685015181550194019201620021bf565b634e487b7160e01b89526041600452602489fd5b634e487b7160e01b8a52604160045260248afd5b849162001d9b565b506020813d6020116200228f575b81620022766020938362002a41565b810103126200228b5762001d68905162001d57565b8780fd5b3d915062002267565b50506040516309f5fa3960e31b81526001600160a01b03928316600482015292909116602483015250604490fd5b506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1462001d14565b506001600160a01b038481169086161462001d0c565b506001600160a01b038516801590816200231f575b5062001d04565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee915014153862002318565b50346200022657604036600319011262000226576004356024356001600160401b038111620010ca576200237890369060040162002c24565b60075480841015620024ba5750828452600860205260408420546001600160a01b03163381036200248a5750620023ae62002d33565b828452600860205260ff600e604086200154161562002451578284526008602052600e604085200160ff19815416905561012c420180421162002169578385526008602052600660408620015411156200243d575b5050620024108162003593565b337f909f03131276f153fa00cded0c338279aadb07b73123f6eac1f11ff6b476e3698380a3600160025580f35b62002449918362002e68565b388062002403565b60405162461bcd60e51b815260206004820152601160248201527013dc99195c881b9bdd081cdd1bdc1c1959607a1b6044820152606490fd5b60405163cc73533d60e01b8152600481018590526001600160a01b03919091166024820152336044820152606490fd5b8360449160405191633d1e220b60e11b835260048301526024820152fd5b50346200022657602036600319011262000226576004358152600860205260409020600160a01b6001900381541681600160a01b60019003600182015416600160a01b600190036002830154166003830154600484015460058501546006860154600787015490600888015492600989015494600a8a015496600b8b015498600c8c015460ff169a600d8d016200256f9062002b26565b9c600e01549e600f01549d60405180608052526080516020015260805160400152608051606001526080516080015260805160a0015260805160c0015260805160e00152608051610100015260805161012001526080516101400152608051610160015215156080516101800152610220806080516101a0015260805101620025f89162002bfd565b9160ff811615156080516101c00152600160a01b600190039060081c166080516101e00152608051610200015260805180910390f35b503462000226576040366003190112620002265760206200264e62002abb565b620026676200265c62002ad2565b6007549283620040d9565b82815191012090604051918383019160ff60f81b83523060601b602185015260358401526055830152605582526200269f82620029ed565b905190206040516001600160a01b039091168152f35b503462000226578060031936011262000226576040517f0000000000000000000000003d0ea64786c055824135cf06e37ffb129e98415f6001600160a01b03168152602090f35b503462000226578060031936011262000226576020600654604051908152f35b50346200022657602036600319011262000226576020906040906001600160a01b036200274862002abb565b168152600983522054604051908152f35b503462000226576020908160031936011262000226576001600160401b03600435818111620010ca5736602382011215620010ca57620027a490369060248160040135910162002a7f565b90620027af62002c83565b81519081116200294d57620027c6600a5462002ae9565b601f8111620028f0575b5083601f8211600114620028495790808495927ff3ff20d88bc3f65f380b8e3b4ed399c7d20e2fd4282dc004a8d106445e0ee35895916200283d575b508160011b916000199060031b1c191617600a555b6200283760405192828493845283019062002bfd565b0390a180f35b9050830151386200280c565b600a84527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a890601f198316855b818110620028d857509183917ff3ff20d88bc3f65f380b8e3b4ed399c7d20e2fd4282dc004a8d106445e0ee35896979460019410620028be575b5050811b01600a5562002821565b85015160001960f88460031b161c191690553880620028b0565b91928760018192868901518155019401920162002876565b6200293b90600a85527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8601f840160051c81019187851062002942575b601f0160051c0190620034d4565b38620027d0565b90915081906200292d565b634e487b7160e01b83526041600452602483fd5b90503462001136578160031936011262001136577f000000000000000000000000afd37d0558255aa687167560cd3aaeea75c2841e6001600160a01b03168152602090f35b61022081019081106001600160401b03821117620029c357604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b038111620029c357604052565b608081019081106001600160401b03821117620029c357604052565b602081019081106001600160401b03821117620029c357604052565b606081019081106001600160401b03821117620029c357604052565b90601f801991011681019081106001600160401b03821117620029c357604052565b6001600160401b038111620029c357601f01601f191660200190565b92919262002a8d8262002a63565b9162002a9d604051938462002a41565b829481845281830111620004af578281602093846000960137010152565b600435906001600160a01b0382168203620004af57565b602435906001600160a01b0382168203620004af57565b90600182811c9216801562002b1b575b602083101462002b0557565b634e487b7160e01b600052602260045260246000fd5b91607f169162002af9565b906040519182600082549262002b3c8462002ae9565b90818452600194858116908160001462002bb3575060011462002b6c575b505062002b6a9250038362002a41565b565b9093915060005260209081600020936000915b81831062002b9a57505062002b6a9350820101388062002b5a565b8554888401850152948501948794509183019162002b7f565b91505062002b6a94506020925060ff191682840152151560051b820101388062002b5a565b60005b83811062002bec5750506000910152565b818101518382015260200162002bdb565b9060209162002c188151809281855285808601910162002bd8565b601f01601f1916010190565b9181601f84011215620004af578235916001600160401b038311620004af5760208381860195010111620004af57565b805482101562002c6d5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b6000546001600160a01b031633036200157257565b9190820180921162002ca657565b634e487b7160e01b600052601160045260246000fd5b1562002cc457565b60405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b6044820152606490fd5b3d1562002d2e573d9062002d128262002a63565b9162002d22604051938462002a41565b82523d6000602084013e565b606090565b600280541462002d435760028055565b604051633ee5aeb560e01b8152600490fd5b90816020910312620004af57518015158103620004af5790565b60405163095ea7b360e01b602082019081526001600160a01b0390931660248201526044810193909352600092839290839062002dba81606481015b03601f19810183528262002a41565b51925af162002dc862002cfe565b8162002e02575b501562002dd857565b60405162461bcd60e51b8152602060048201526002602482015261534160f01b6044820152606490fd5b805180159250821562002e19575b50503862002dcf565b62002e2e925060208091830101910162002d55565b388062002e10565b9190820391821162002ca657565b8181029291811591840414171562002ca657565b600019811462002ca65760010190565b91906000918383526008602052604083209160018060a01b038354169360018060a01b036001850154169160018060a01b036002860154169360038601549161271062002eb86006548562002e44565b049062002ec6828562002e36565b9160048901549462002ed9858462004021565b600e8a015460081c6001600160a01b031690813b156200228b57879160248392604051948593849263253d844d60e21b845260048401525af18015620033195762003303575b506008890162002f30815462002e58565b9055600389015462002f4860098b0191825462002c98565b90554260078a015562002f6060058a01544262002c98565b60068a0155600480546040516370a0823160e01b81526001600160a01b0390911691810182905291906020836024818c5afa9283156200127e578893620032c9575b508162002fb0918a62003324565b60018060a01b036004541690604051916370a0823160e01b835260048301526020826024818c5afa9182156200127e5788926200328c575b5062002ff5919262002c98565b116200324857849262003015849360018060a01b03600354168962002d6f565b8260018060a01b036003541692826040519384928337810182815203925af16200303e62002cfe565b90156200321557602081805181010312620004af5760200151818110620031f857600c86015460ff1615620031c0576005546001600160a01b0316803b15620010c657838091602460405180948193632e1a7d4d60e01b83528760048401525af1801562001ae657908491620031a8575b5080806020604051620030c28162002a09565b82815201848b5af1620030d462002cfe565b50156200317d577fb892e213448633d7b81e7583f8cf2bd294ad1d3d6bd75aae7a7393083f3c793a9560c0955b600a82016200311284825462002c98565b90556005820154600c83015490955060ff1615620031735750600373eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee915b0154604080519687526001600160a01b039092166020870152908501526060840152608083015260a0820152a3565b6003909162003144565b60405162461bcd60e51b815260206004820152600360248201526253544560e81b6044820152606490fd5b620031b390620029d9565b620010ca578238620030af565b7fb892e213448633d7b81e7583f8cf2bd294ad1d3d6bd75aae7a7393083f3c793a9585620031f2838a60c09962003324565b62003101565b60449160405191636ce3426d60e11b835260048301526024820152fd5b60405162461bcd60e51b815260206004820152600b60248201526a14ddd85c0819985a5b195960aa1b6044820152606490fd5b606460405162461bcd60e51b815260206004820152602060248201527f466565207472616e7366657220766572696669636174696f6e206661696c65646044820152fd5b91506020823d602011620032c0575b81620032aa6020938362002a41565b81010312620004af5762002ff591519162002fe8565b3d91506200329b565b9092506020813d602011620032fa575b81620032e86020938362002a41565b81010312620004af5751918162002fa2565b3d9150620032d9565b6200331190969196620029d9565b943862002f1f565b6040513d89823e3d90fd5b60405163a9059cbb60e01b602082019081526001600160a01b039390931660248201526044808201949094529283526200338c916000918291906200336b60648762002a41565b60018060a01b031694519082865af16200338462002cfe565b9083620033da565b8051908115159182620033bc575b5050620033a45750565b60249060405190635274afe760e01b82526004820152fd5b620033d1925060208091830101910162002d55565b1538806200339a565b90620034035750805115620033f157805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158062003438575b62003416575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156200340d565b156200344a57565b60405162461bcd60e51b815260206004820152601760248201527f506572696f64206d757374206265203e3d2035206d696e0000000000000000006044820152606490fd5b156200349757565b60405162461bcd60e51b8152602060048201526015602482015274416d6f756e74496e206d757374206265203e20393960581b6044820152606490fd5b818110620034e0575050565b60008155600101620034d4565b9190601f8111620034fd57505050565b62002b6a926000526020600020906020601f840160051c830193106200294257601f0160051c0190620034d4565b90816020910312620004af575160ff81168103620004af5790565b80511562002c6d5760200190565b80516001101562002c6d5760400190565b80516002101562002c6d5760600190565b906103e86001600160801b038093160291821691820362002ca657565b8060005260086020526040600020600f81015462003cd1575b620035b73062003e62565b8154620035cd906001600160a01b031662003e62565b60018301549091906001600160a01b0316620035e98162003e62565b9060018060a01b0360028601541690620036038262003e62565b9160405160208160048163313ce56760e01b968782525afa801562003ae75760ff6200363d9160209360009162003caf575b501662003ce2565b9260046040518094819382525afa801562003ae75760ff9160009162003c79575b50166200366b9062003ce2565b9160038701546200367c9062003ce2565b93620036884662003ce2565b96604051998a976020890161014090526101608901620036a89162002bfd565b906040890152601f19888203016060890152620036c59162002bfd565b868103601f19016080880152620036dc9162002bfd565b858103601f190160a0870152620036f39162002bfd565b848103601f190160c08601526200370a9162002bfd565b838103601f190160e0850152620037219162002bfd565b828103601f1901610100840152620037399162002bfd565b818103601f1901610120830152600d840154600091620037598262002ae9565b808252916001811690811562003c51575060011462003c03575b50506200379290620037a193601f198483030161014085015262002bfd565b03601f19810184528362002a41565b604051620037af81620029ed565b600381526060366020830137604051620037c981620029ed565b6003815260005b6060811062003bf157506040519160408301908382106001600160401b03831117620029c3576002926200380f92604052818552602085015262003546565b5260046200381e825162003554565b5260056200382d825162003565565b526200385c604051620038408162002a09565b60008152602083015190620038558262003546565b5262003546565b506040516000600a54620038708162002ae9565b808452906001811690811562003bcb575060011462003b6c575b50620038c8620038db83620038ac620039aa989695620038f395038262002a41565b62002dab60405193849260406020850152606084019062002bfd565b828103601f190160408401528762002bfd565b602083015190620038ec8262003554565b5262003554565b506200398162002dab620039696001600160801b03620039198160068901541662003576565b906200392b8160058a01541662003576565b8160405193166020840152166040820152604081526200394b8162002a25565b60405192839160006020840152604080840152606083019062002bfd565b6020830151906200397a8262003565565b5262003565565b50604051633323b46760e01b815230600482015260806024820152938492608484019062002bfd565b9060031983830301604484015260408201908051916040845282518091526020606085019301906000905b80821062003b275750505060200151916020818303910152815180825260208201916020808360051b8301019401926000915b83831062003af357505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60648601525060209392839003915082905060007f000000000000000000000000afd37d0558255aa687167560cd3aaeea75c2841e6001600160a01b03165af191821562003ae75760009262003aac575b50817fb66c33d8dd981a05324331a06b40246adf774342c5561bc733d6134dd466a19e92600f6020930155604051908152a1565b91506020823d60201162003ade575b8162003aca6020938362002a41565b81010312620004af57905190600f62003a78565b3d915062003abb565b6040513d6000823e3d90fd5b91939550919360208062003b14600193601f19868203018752895162002bfd565b9701930193019092879594929362003a08565b9180959650939092935190600682101562003b56576020816001938293520195019201879594939291620039d5565b634e487b7160e01b600052602160045260246000fd5b600a600090815291507fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a85b81831062003bb05750508101602001620038db6200388a565b60018160209294939454838588010152019101919062003b97565b60ff191660208086019190915291151560051b84019091019150620038db90506200388a565b806060602080938501015201620037d0565b939150600d85016000526020600020936000915b80831062003c32575091935001602001826200379262003773565b9350919360018160209254838587010152019101909391869362003c17565b60ff191660208381019190915292151560051b90910190910191508390506200379262003773565b62003ca0915060203d60201162003ca7575b62003c97818362002a41565b8101906200352b565b386200365e565b503d62003c8b565b62003cca9150843d861162003ca75762003c97818362002a41565b3862003635565b62003cdc8262003f51565b620035ac565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008082101562003e53575b506d04ee2d6d415b85acef81000000008083101562003e43575b50662386f26fc100008083101562003e33575b506305f5e1008083101562003e23575b506127108083101562003e13575b50606482101562003e02575b600a8092101562003df7575b6001908160218186019562003d848762002a63565b9662003d94604051988962002a41565b80885262003da5601f199162002a63565b01366020890137860101905b62003dbe575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a83530491821562003df15791908262003db1565b62003db7565b916001019162003d6f565b919060646002910491019162003d63565b6004919392049101913862003d57565b6008919392049101913862003d49565b6010919392049101913862003d39565b6020919392049101913862003d26565b60409350810491503862003d0c565b806040519162003e728362002a25565b602a83526020808401604036823784511562002c6d576030905383519060019182101562002c6d5790607860218601536029915b81831162003ed95750505062003eba575090565b6044906040519063e22e27eb60e01b8252600482015260146024820152fd5b909192600f8116601081101562003f3c57865185101562003f3c576f181899199a1a9b1b9c1cb0b131b232b360811b901a86850183015360041c92801562003f275760001901919062003ea6565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b60009081526008602052600f6040822001908154918262003f7157505050565b8190557f000000000000000000000000afd37d0558255aa687167560cd3aaeea75c2841e6001600160a01b0316803b15620011365781809160246040518095819363ee8ca3b560e01b83528860048401525af1908115620040155750916020917fd2b8cd190f54408a8e1f68c863951d8b6515b9694fef3330e5942ac18a1989999362004003575b50604051908152a1565b6200400e90620029d9565b3862003ff9565b604051903d90823e3d90fd5b90600481106200409457600411620004af57638c03bba960e01b90356001600160e01b031916016200404f57565b60405162461bcd60e51b815260206004820152601960248201527f496e76616c69642066756e6374696f6e2073656c6563746f72000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601760248201527f496e76616c69642063616c6c64617461206c656e6774680000000000000000006044820152606490fd5b90620041599262004176926104d891620041696040519362004146602096620041058884018862002a41565b82875287870192620042ca8439604080518981019788526001600160a01b039283166020890152959091168682015284860390810185526060018462002a41565b6040519788955180928888019062002bd8565b8401915180938684019062002bd8565b0103808452018262002a41565b90565b600081815260086020818152604080842060018101548154600e909201548351636eb1769f60e11b81526001600160a01b039384166004820152951c821660248601529495948116949193908382604481895afa918215620042bf57879262004286575b508287526008845284872091600383015411600014620042005750505050505090565b8391541660248551809781936370a0823160e01b835260048301525afa9384156200427c57859462004246575b5084526008905282206003015411620041765750600190565b9093508181813d831162004274575b62004261818362002a41565b81010312620014a857519260036200422d565b503d62004255565b83513d87823e3d90fd5b9091508381813d8311620042b7575b620042a1818362002a41565b81010312620042b357519038620041dd565b8680fd5b503d62004295565b85513d89823e3d90fdfe6080346100f857601f6104d838819003918201601f19168301916001600160401b038311848410176100fd578084926060946040528339810103126100f8578051610058604061005160208501610113565b9301610113565b9033156100df57600080546001600160a01b03198082163390811784556040519691956001600160a01b0395909486949192918516907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36002553385600154161760015516836003541617600355169060045416176004556103b090816101288239f35b604051631e4fbdf760e01b815260006004820152602490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100f85756fe608060408181526004908136101561001657600080fd5b600092833560e01c9081630298479d14610230575080634f8632ba146102075780636daf390b146101df578063715018a6146101825780638da5cb5b1461015a57806394f6113414610117578063af640d0f1461013b578063e01ac1da146101175763f2fde38b1461008757600080fd5b34610113576020366003190112610113576001600160a01b0382358181169391929084900361010f576100b8610255565b83156100f957505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8480fd5b8280fd5b505034610137576020366003190112610137576101349035610281565b80f35b5080fd5b8382346101375781600319360112610137576020906002549051908152f35b838234610137578160031936011261013757905490516001600160a01b039091168152602090f35b83346101dc57806003193601126101dc5761019b610255565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b5090346101135782600319360112610113575490516001600160a01b03909116815260209150f35b83823461013757816003193601126101375760035490516001600160a01b039091168152602090f35b8490346101375781600319360112610137576001546001600160a01b03168152602090f35b6000546001600160a01b0316330361026957565b60405163118cdaa760e01b8152336004820152602490fd5b6001546001600160a01b03919082169033829003610344578260045416926003541691604051926323b872dd60e01b8452600484015260248301526044820152602081606481600080965af18015610339576102db575050565b60203d8111610332575b601f8101601f1916820167ffffffffffffffff81118382101761031e576020918391604052810103126101375751801515036101dc5750565b634e487b7160e01b84526041600452602484fd5b503d6102e5565b6040513d84823e3d90fd5b60405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b6044820152606490fdfea2646970667358221220407cc429e23804d097414bd1ab2188cff78beeb2668a35874914595a8780a82064736f6c63430008140033a26469706673582212200076689d4fe50e35e20859ff21444a0e1e621d06f3bace9b08fc550e1979c9a964736f6c63430008140033

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

000000000000000000000000c325856e5585823aac0d1fd46c35c608d95e65a9000000000000000000000000afd37d0558255aa687167560cd3aaeea75c2841e000000000000000000000000fe9777078ca0d60d2e9f489bf0297b433abccdec000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002e516d5453363465456568634c68454c5373587a6f4c57576a47354146463248784e4e587336615164786f78725669000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _swapRouter (address): 0xc325856e5585823aaC0D1Fd46c35c608D95E65A9
Arg [1] : _automate (address): 0xafd37d0558255aA687167560cd3AaeEa75c2841E
Arg [2] : _treasury (address): 0xfe9777078Ca0d60d2e9F489bF0297B433AbcCdEC
Arg [3] : _wrappedToken (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38
Arg [4] : _scriptCID (string): QmTS64eEehcLhELSsXzoLWWjG5AFF2HxNNXs6aQdxoxrVi

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000c325856e5585823aac0d1fd46c35c608d95e65a9
Arg [1] : 000000000000000000000000afd37d0558255aa687167560cd3aaeea75c2841e
Arg [2] : 000000000000000000000000fe9777078ca0d60d2e9f489bf0297b433abccdec
Arg [3] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [5] : 000000000000000000000000000000000000000000000000000000000000002e
Arg [6] : 516d5453363465456568634c68454c5373587a6f4c57576a4735414646324878
Arg [7] : 4e4e587336615164786f78725669000000000000000000000000000000000000


Block Transaction 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.