ETH Price: $1,971.86 (+0.16%)
Gas: 0.04 Gwei
 

More Info

Private Name Tags

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Forward ERC20244964362026-02-20 7:01:112 days ago1771570871IN
Mayan: Forwarder 2
0 ETH0.000494592.04215098
Forward ERC20244783812026-02-17 18:35:474 days ago1771353347IN
Mayan: Forwarder 2
0 ETH0.000442212.12095266
Forward Eth243943582026-02-06 0:59:1116 days ago1770339551IN
Mayan: Forwarder 2
0.025 ETH0.001357529.0344156
Forward Eth243942712026-02-06 0:41:3516 days ago1770338495IN
Mayan: Forwarder 2
0.011 ETH0.0033852122.52872281
Forward ERC20243689282026-02-02 11:38:5919 days ago1770032339IN
Mayan: Forwarder 2
0 ETH0.000503212.23113584
Swap And Forward...241745982026-01-06 8:59:5946 days ago1767689999IN
Mayan: Forwarder 2
0 ETH0.000810852.07274637
Forward ERC20239788072025-12-10 0:36:2374 days ago1765326983IN
Mayan: Forwarder 2
0 ETH0.000449972.16882085
Swap And Forward...239463692025-12-05 11:10:5978 days ago1764933059IN
Mayan: Forwarder 2
0 ETH0.000789792.01970361
Swap And Forward...239072152025-11-29 22:09:5984 days ago1764454199IN
Mayan: Forwarder 2
0 ETH0.000852942.0466793
Swap And Forward...239072082025-11-29 22:08:3584 days ago1764454115IN
Mayan: Forwarder 2
0 ETH0.000812972.05241639
Swap And Forward...239071942025-11-29 22:05:4784 days ago1764453947IN
Mayan: Forwarder 2
0 ETH0.000799412.04293532
Swap And Forward...238862832025-11-26 23:47:5987 days ago1764200879IN
Mayan: Forwarder 2
0.19 ETH0.000812822.05154501
Forward ERC20238713892025-11-24 21:31:2389 days ago1764019883IN
Mayan: Forwarder 2
0 ETH0.000038910.21029182
Forward ERC20238601532025-11-23 7:38:3591 days ago1763883515IN
Mayan: Forwarder 2
0 ETH0.000029230.15441802
Forward ERC20238571662025-11-22 21:32:1191 days ago1763847131IN
Mayan: Forwarder 2
0 ETH0.000358732.07372831
Forward Eth238560782025-11-22 17:49:5991 days ago1763833799IN
Mayan: Forwarder 2
1.33 ETH0.000201982.08096647
Forward ERC20238553762025-11-22 15:27:5991 days ago1763825279IN
Mayan: Forwarder 2
0 ETH0.000014090.08188142
Forward ERC20238550342025-11-22 14:19:1191 days ago1763821151IN
Mayan: Forwarder 2
0 ETH0.00003020.17545795
Forward ERC20238545962025-11-22 12:50:2391 days ago1763815823IN
Mayan: Forwarder 2
0 ETH0.000013040.07573653
Forward Eth238501662025-11-21 21:52:1192 days ago1763761931IN
Mayan: Forwarder 2
1.04 ETH0.000217172.23776258
Forward ERC20238485442025-11-21 16:24:3592 days ago1763742275IN
Mayan: Forwarder 2
0 ETH0.000685083.71672403
Swap And Forward...238105162025-11-16 8:20:5998 days ago1763281259IN
Mayan: Forwarder 2
0.07 ETH0.000057170.13930023
Forward ERC20237630932025-11-09 17:08:23104 days ago1762708103IN
Mayan: Forwarder 2
0 ETH0.000394692.08017922
Forward ERC20237199872025-11-03 16:27:11110 days ago1762187231IN
Mayan: Forwarder 2
0 ETH0.001320647.15410777
Forward ERC20236494872025-10-24 19:43:59120 days ago1761335039IN
Mayan: Forwarder 2
0 ETH0.00009970.59521366
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Wrap And Swap ET...243943582026-02-06 0:59:1116 days ago1770339551
Mayan: Forwarder 2
0.025 ETH
Wrap And Swap ET...243942712026-02-06 0:41:3516 days ago1770338495
Mayan: Forwarder 2
0.011 ETH
0x2213bc0b238862832025-11-26 23:47:5987 days ago1764200879
Mayan: Forwarder 2
0.19 ETH
Create Order Wit...238560782025-11-22 17:49:5991 days ago1763833799
Mayan: Forwarder 2
1.33 ETH
Create Order Wit...238501662025-11-21 21:52:1192 days ago1763761931
Mayan: Forwarder 2
1.04 ETH
0x2213bc0b238105162025-11-16 8:20:5998 days ago1763281259
Mayan: Forwarder 2
0.07 ETH
Create Order Wit...236344462025-10-22 17:07:47122 days ago1761152867
Mayan: Forwarder 2
0.003 ETH
Create Order Wit...236335962025-10-22 14:15:59122 days ago1761142559
Mayan: Forwarder 2
0.002 ETH
Create Order Wit...236266332025-10-21 14:48:35123 days ago1761058115
Mayan: Forwarder 2
0.0009 ETH
Create Order Wit...236108032025-10-19 9:31:11125 days ago1760866271
Mayan: Forwarder 2
0.003 ETH
0x2213bc0b235997582025-10-17 20:26:35127 days ago1760732795
Mayan: Forwarder 2
0.048 ETH
Create Order Wit...235982532025-10-17 15:23:23127 days ago1760714603
Mayan: Forwarder 2
0.27598561 ETH
Create Order Wit...235928972025-10-16 21:26:23128 days ago1760649983
Mayan: Forwarder 2
0.07 ETH
Create Order Wit...235896642025-10-16 10:35:23128 days ago1760610923
Mayan: Forwarder 2
0.104 ETH
Create Order Wit...235711252025-10-13 20:18:59131 days ago1760386739
Mayan: Forwarder 2
0.5 ETH
Create Order Wit...235684612025-10-13 11:21:47131 days ago1760354507
Mayan: Forwarder 2
0.123 ETH
Create Order Wit...235562112025-10-11 18:16:47133 days ago1760206607
Mayan: Forwarder 2
0.09 ETH
Create Order Wit...235558552025-10-11 17:04:35133 days ago1760202275
Mayan: Forwarder 2
2 ETH
Create Order Wit...235558272025-10-11 16:58:59133 days ago1760201939
Mayan: Forwarder 2
0.0501 ETH
Create Order Wit...235535282025-10-11 9:16:23133 days ago1760174183
Mayan: Forwarder 2
0.0092 ETH
Create Order Wit...235254132025-10-07 10:54:35137 days ago1759834475
Mayan: Forwarder 2
0.05 ETH
Create Order Wit...235252832025-10-07 10:28:23137 days ago1759832903
Mayan: Forwarder 2
0.3877 ETH
Create Order Wit...235213842025-10-06 21:23:35138 days ago1759785815
Mayan: Forwarder 2
0.00055 ETH
Create Order Wit...235173112025-10-06 7:42:47139 days ago1759736567
Mayan: Forwarder 2
0.622 ETH
Create Order Wit...235025172025-10-04 6:06:59141 days ago1759558019
Mayan: Forwarder 2
0.0015 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
MayanForwarder

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import "./libs/BytesLib.sol";


contract MayanForwarder {

	using SafeERC20 for IERC20;
	using BytesLib for bytes;

	event SwapAndForwarded(uint256 amount);

	address public guardian;
	address public nextGuardian;
	mapping(address => bool) public swapProtocols;
	mapping(address => bool) public mayanProtocols;

	event ForwardedEth(address mayanProtocol, bytes protocolData);
	event ForwardedERC20(address token, uint256 amount, address mayanProtocol, bytes protocolData);
	event SwapAndForwardedEth(uint256 amountIn, address swapProtocol, address middleToken, uint256 middleAmount, address mayanProtocol, bytes mayanData);
	event SwapAndForwardedERC20(address tokenIn, uint256 amountIn, address swapProtocol, address middleToken, uint256 middleAmount, address mayanProtocol, bytes mayanData);

	error UnsupportedProtocol();

	struct PermitParams {
		uint256 value;
		uint256 deadline;
		uint8 v;
		bytes32 r;
		bytes32 s;
	}

	constructor(address _guardian, address[] memory _swapProtocols, address[] memory _mayanProtocols) {
		guardian = _guardian;
		for (uint256 i = 0; i < _swapProtocols.length; i++) {
			swapProtocols[_swapProtocols[i]] = true;
		}
		for (uint256 i = 0; i < _mayanProtocols.length; i++) {
			mayanProtocols[_mayanProtocols[i]] = true;
		}
	}

	function forwardEth(
		address mayanProtocol,
		bytes calldata protocolData
	) external payable {
		if (!mayanProtocols[mayanProtocol]) {
			revert UnsupportedProtocol();
		}
		(bool success, bytes memory returnedData) = mayanProtocol.call{value: msg.value}(protocolData);
		require(success, string(returnedData));

		emit ForwardedEth(mayanProtocol, protocolData);
	}
	
	function forwardERC20(
		address tokenIn,
		uint256 amountIn,
		PermitParams calldata permitParams,
		address mayanProtocol,
		bytes calldata protocolData
		) external payable {
		if (!mayanProtocols[mayanProtocol]) {
			revert UnsupportedProtocol();
		}

		pullTokenIn(tokenIn, amountIn, permitParams);

		maxApproveIfNeeded(tokenIn, mayanProtocol, amountIn);
		(bool success, bytes memory returnedData) = mayanProtocol.call{value: msg.value}(protocolData);
		require(success, string(returnedData));

		emit ForwardedERC20(tokenIn, amountIn, mayanProtocol, protocolData);
	}

	function swapAndForwardEth(
		uint256 amountIn,
		address swapProtocol,
		bytes calldata swapData,
		address middleToken,
		uint256 minMiddleAmount,
		address mayanProtocol,
		bytes calldata mayanData
	) external payable {
		if (!swapProtocols[swapProtocol] || !mayanProtocols[mayanProtocol]) {
			revert UnsupportedProtocol();
		}
		require(middleToken != address(0), "middleToken cannot be zero address");

		require(msg.value >= amountIn, "insufficient amountIn");
		uint256 middleAmount = IERC20(middleToken).balanceOf(address(this));

		(bool success, bytes memory returnedData) = swapProtocol.call{value: amountIn}(swapData);
		require(success, string(returnedData));

		middleAmount = IERC20(middleToken).balanceOf(address(this)) - middleAmount;
		require(middleAmount >= minMiddleAmount, "MayanForwarder: insufficient middle token amount");

		maxApproveIfNeeded(middleToken, mayanProtocol, middleAmount);

		bytes memory modifiedData = replaceMiddleAmount(mayanData, middleAmount);
		(success, returnedData) = mayanProtocol.call{value: msg.value - amountIn}(modifiedData);
		require(success, string(returnedData));

		emit SwapAndForwardedEth(amountIn, swapProtocol, middleToken, middleAmount, mayanProtocol, mayanData);
	}

	function swapAndForwardERC20(
		address tokenIn,
		uint256 amountIn,
		PermitParams calldata permitParams,
		address swapProtocol,
		bytes calldata swapData,
		address middleToken,
		uint256 minMiddleAmount,
		address mayanProtocol,
		bytes calldata mayanData
	) external payable {
		if (!swapProtocols[swapProtocol] || !mayanProtocols[mayanProtocol]) {
			revert UnsupportedProtocol();
		}
		require(tokenIn != middleToken, "tokenIn and tokenOut must be different");

		pullTokenIn(tokenIn, amountIn, permitParams);

		maxApproveIfNeeded(tokenIn, swapProtocol, amountIn);
		uint256 middleAmount = IERC20(middleToken).balanceOf(address(this));

		(bool success, bytes memory returnedData) = swapProtocol.call{value: 0}(swapData);
		require(success, string(returnedData));

		middleAmount = IERC20(middleToken).balanceOf(address(this)) - middleAmount;
		require(middleAmount >= minMiddleAmount, "insufficient middle token");

		maxApproveIfNeeded(middleToken, mayanProtocol, middleAmount);
		bytes memory modifiedData = replaceMiddleAmount(mayanData, middleAmount);
		(success, returnedData) = mayanProtocol.call{value: msg.value}(modifiedData);
		require(success, string(returnedData));

		transferBackRemaining(tokenIn, amountIn);

		emit SwapAndForwardedERC20(tokenIn, amountIn, swapProtocol, middleToken, middleAmount, mayanProtocol, mayanData);
	}

	function replaceMiddleAmount(bytes calldata mayanData, uint256 middleAmount) internal pure returns(bytes memory) {
		require(mayanData.length >= 68, "Mayan data too short");
		bytes memory modifiedData = new bytes(mayanData.length);

		// Copy the function selector and token in
		for (uint i = 0; i < 36; i++) {
			modifiedData[i] = mayanData[i];
		}

		// Encode the amount and place it into the modified call data
		// Starting from byte 36 to byte 67 (32 bytes for uint256)
		bytes memory encodedAmount = abi.encode(middleAmount);
		for (uint i = 0; i < 32; i++) {
			modifiedData[i + 36] = encodedAmount[i];
		}

		// Copy the rest of the original data after the first argument
		for (uint i = 68; i < mayanData.length; i++) {
			modifiedData[i] = mayanData[i];
		}

		return modifiedData;
	}

	function maxApproveIfNeeded(address tokenAddr, address spender, uint256 amount) internal {
		IERC20 token = IERC20(tokenAddr);
		uint256 currentAllowance = token.allowance(address(this), spender);

		if (currentAllowance < amount) {
			token.safeApprove(spender, 0);
			token.safeApprove(spender, type(uint256).max);
		}
	}

	function execPermit(
		address token,
		address owner,
		PermitParams calldata permitParams
	) internal {
		IERC20Permit(token).permit(
			owner,
			address(this),
			permitParams.value,
			permitParams.deadline,
			permitParams.v,
			permitParams.r,
			permitParams.s
		);
	}

	function pullTokenIn(
		address tokenIn,
		uint256 amountIn,
		PermitParams calldata permitParams
	) internal {
		uint256 allowance = IERC20(tokenIn).allowance(msg.sender, address(this));
		if (allowance < amountIn) {
			execPermit(tokenIn, msg.sender, permitParams);
		}
		IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), amountIn);
	}

	function transferBackRemaining(address token, uint256 maxAmount) internal {
		uint256 remaining = IERC20(token).balanceOf(address(this));
		if (remaining > 0 && remaining <= maxAmount) {
			IERC20(token).safeTransfer(msg.sender, remaining);
		}
	}

	function rescueToken(address token, uint256 amount, address to) public {
		require(msg.sender == guardian, 'only guardian');
		IERC20(token).safeTransfer(to, amount);
	}

	function rescueEth(uint256 amount, address payable to) public {
		require(msg.sender == guardian, 'only guardian');
		require(to != address(0), 'transfer to the zero address');
		to.transfer(amount);
	}

	function changeGuardian(address newGuardian) public {
		require(msg.sender == guardian, 'only guardian');
		nextGuardian = newGuardian;
	}

	function claimGuardian() public {
		require(msg.sender == nextGuardian, 'only next guardian');
		guardian = nextGuardian;
	}

	function setSwapProtocol(address swapProtocol, bool enabled) public {
		require(msg.sender == guardian, 'only guardian');
		swapProtocols[swapProtocol] = enabled;
	}

	function setMayanProtocol(address mayanProtocol, bool enabled) public {
		require(msg.sender == guardian, 'only guardian');
		mayanProtocols[mayanProtocol] = enabled;
	}
}

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

pragma solidity ^0.8.0;

/**
 * @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.
 */
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].
     */
    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 v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount) external returns (bool);
}

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

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../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 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @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.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @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, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * 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.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @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`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <goncalo.sa@consensys.net>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;


library BytesLib {
    function concat(
        bytes memory _preBytes,
        bytes memory _postBytes
    )
        internal
        pure
        returns (bytes memory)
    {
        bytes memory tempBytes;

        assembly {
            // Get a location of some free memory and store it in tempBytes as
            // Solidity does for memory variables.
            tempBytes := mload(0x40)

            // Store the length of the first bytes array at the beginning of
            // the memory for tempBytes.
            let length := mload(_preBytes)
            mstore(tempBytes, length)

            // Maintain a memory counter for the current write location in the
            // temp bytes array by adding the 32 bytes for the array length to
            // the starting location.
            let mc := add(tempBytes, 0x20)
            // Stop copying when the memory counter reaches the length of the
            // first bytes array.
            let end := add(mc, length)

            for {
                // Initialize a copy counter to the start of the _preBytes data,
                // 32 bytes into its memory.
                let cc := add(_preBytes, 0x20)
            } lt(mc, end) {
                // Increase both counters by 32 bytes each iteration.
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                // Write the _preBytes data into the tempBytes memory 32 bytes
                // at a time.
                mstore(mc, mload(cc))
            }

            // Add the length of _postBytes to the current length of tempBytes
            // and store it as the new length in the first 32 bytes of the
            // tempBytes memory.
            length := mload(_postBytes)
            mstore(tempBytes, add(length, mload(tempBytes)))

            // Move the memory counter back from a multiple of 0x20 to the
            // actual end of the _preBytes data.
            mc := end
            // Stop copying when the memory counter reaches the new combined
            // length of the arrays.
            end := add(mc, length)

            for {
                let cc := add(_postBytes, 0x20)
            } lt(mc, end) {
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                mstore(mc, mload(cc))
            }

            // Update the free-memory pointer by padding our last write location
            // to 32 bytes: add 31 bytes to the end of tempBytes to move to the
            // next 32 byte block, then round down to the nearest multiple of
            // 32. If the sum of the length of the two arrays is zero then add
            // one before rounding down to leave a blank 32 bytes (the length block with 0).
            mstore(0x40, and(
              add(add(end, iszero(add(length, mload(_preBytes)))), 31),
              not(31) // Round down to the nearest 32 bytes.
            ))
        }

        return tempBytes;
    }

    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
        assembly {
            // Read the first 32 bytes of _preBytes storage, which is the length
            // of the array. (We don't need to use the offset into the slot
            // because arrays use the entire slot.)
            let fslot := sload(_preBytes.slot)
            // Arrays of 31 bytes or less have an even value in their slot,
            // while longer arrays have an odd value. The actual length is
            // the slot divided by two for odd values, and the lowest order
            // byte divided by two for even values.
            // If the slot is even, bitwise and the slot with 255 and divide by
            // two to get the length. If the slot is odd, bitwise and the slot
            // with -1 and divide by two.
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)
            let newlength := add(slength, mlength)
            // slength can contain both the length and contents of the array
            // if length < 32 bytes so let's prepare for that
            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
            switch add(lt(slength, 32), lt(newlength, 32))
            case 2 {
                // Since the new array still fits in the slot, we just need to
                // update the contents of the slot.
                // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
                sstore(
                    _preBytes.slot,
                    // all the modifications to the slot are inside this
                    // next block
                    add(
                        // we can just add to the slot contents because the
                        // bytes we want to change are the LSBs
                        fslot,
                        add(
                            mul(
                                div(
                                    // load the bytes from memory
                                    mload(add(_postBytes, 0x20)),
                                    // zero all bytes to the right
                                    exp(0x100, sub(32, mlength))
                                ),
                                // and now shift left the number of bytes to
                                // leave space for the length in the slot
                                exp(0x100, sub(32, newlength))
                            ),
                            // increase length by the double of the memory
                            // bytes length
                            mul(mlength, 2)
                        )
                    )
                )
            }
            case 1 {
                // The stored value fits in the slot, but the combined value
                // will exceed it.
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // The contents of the _postBytes array start 32 bytes into
                // the structure. Our first read should obtain the `submod`
                // bytes that can fit into the unused space in the last word
                // of the stored array. To get this, we read 32 bytes starting
                // from `submod`, so the data we read overlaps with the array
                // contents by `submod` bytes. Masking the lowest-order
                // `submod` bytes allows us to add that value directly to the
                // stored value.

                let submod := sub(32, slength)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(
                    sc,
                    add(
                        and(
                            fslot,
                            0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
                        ),
                        and(mload(mc), mask)
                    )
                )

                for {
                    mc := add(mc, 0x20)
                    sc := add(sc, 1)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
            default {
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                // Start copying to the last used word of the stored array.
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // Copy over the first `submod` bytes of the new data as in
                // case 1 above.
                let slengthmod := mod(slength, 32)
                let mlengthmod := mod(mlength, 32)
                let submod := sub(32, slengthmod)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(sc, add(sload(sc), and(mload(mc), mask)))

                for {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
        }
    }

    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    )
        internal
        pure
        returns (bytes memory)
    {
        require(_length + 31 >= _length, "slice_overflow");
        require(_bytes.length >= _start + _length, "slice_outOfBounds");

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)
                //zero out the 32 bytes slice we are about to return
                //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {
        require(_bytes.length >= _start + 1 , "toUint8_outOfBounds");
        uint8 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x1), _start))
        }

        return tempUint;
    }

    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {
        require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
        uint16 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x2), _start))
        }

        return tempUint;
    }

    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {
        require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }

    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {
        require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
        uint64 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x8), _start))
        }

        return tempUint;
    }

    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {
        require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
        uint96 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0xc), _start))
        }

        return tempUint;
    }

    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {
        require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
        uint128 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x10), _start))
        }

        return tempUint;
    }

    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
        require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
        uint256 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {
        require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
        bytes32 tempBytes32;

        assembly {
            tempBytes32 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes32;
    }

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                // the next line is the loop condition:
                // while(uint256(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(
        bytes storage _preBytes,
        bytes memory _postBytes
    )
        internal
        view
        returns (bool)
    {
        bool success = true;

        assembly {
            // we know _preBytes_offset is 0
            let fslot := sload(_preBytes.slot)
            // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

            // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
                // slength can contain both the length and contents of the array
                // if length < 32 bytes so let's prepare for that
                // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                        // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                            // unsuccess:
                            success := 0
                        }
                    }
                    default {
                        // cb is a circuit breaker in the for loop since there's
                        //  no said feature for inline assembly loops
                        // cb = 1 - don't breaker
                        // cb = 0 - break
                        let cb := 1

                        // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes.slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                        // the next line is the loop condition:
                        // while(uint256(mc < end) + cb == 2)
                        for {} eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                                // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_guardian","type":"address"},{"internalType":"address[]","name":"_swapProtocols","type":"address[]"},{"internalType":"address[]","name":"_mayanProtocols","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"UnsupportedProtocol","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"mayanProtocol","type":"address"},{"indexed":false,"internalType":"bytes","name":"protocolData","type":"bytes"}],"name":"ForwardedERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"mayanProtocol","type":"address"},{"indexed":false,"internalType":"bytes","name":"protocolData","type":"bytes"}],"name":"ForwardedEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SwapAndForwarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"address","name":"swapProtocol","type":"address"},{"indexed":false,"internalType":"address","name":"middleToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"middleAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"mayanProtocol","type":"address"},{"indexed":false,"internalType":"bytes","name":"mayanData","type":"bytes"}],"name":"SwapAndForwardedERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"address","name":"swapProtocol","type":"address"},{"indexed":false,"internalType":"address","name":"middleToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"middleAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"mayanProtocol","type":"address"},{"indexed":false,"internalType":"bytes","name":"mayanData","type":"bytes"}],"name":"SwapAndForwardedEth","type":"event"},{"inputs":[{"internalType":"address","name":"newGuardian","type":"address"}],"name":"changeGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"components":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct MayanForwarder.PermitParams","name":"permitParams","type":"tuple"},{"internalType":"address","name":"mayanProtocol","type":"address"},{"internalType":"bytes","name":"protocolData","type":"bytes"}],"name":"forwardERC20","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"mayanProtocol","type":"address"},{"internalType":"bytes","name":"protocolData","type":"bytes"}],"name":"forwardEth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"guardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mayanProtocols","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"to","type":"address"}],"name":"rescueEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"rescueToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"mayanProtocol","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setMayanProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"swapProtocol","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setSwapProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"components":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct MayanForwarder.PermitParams","name":"permitParams","type":"tuple"},{"internalType":"address","name":"swapProtocol","type":"address"},{"internalType":"bytes","name":"swapData","type":"bytes"},{"internalType":"address","name":"middleToken","type":"address"},{"internalType":"uint256","name":"minMiddleAmount","type":"uint256"},{"internalType":"address","name":"mayanProtocol","type":"address"},{"internalType":"bytes","name":"mayanData","type":"bytes"}],"name":"swapAndForwardERC20","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"swapProtocol","type":"address"},{"internalType":"bytes","name":"swapData","type":"bytes"},{"internalType":"address","name":"middleToken","type":"address"},{"internalType":"uint256","name":"minMiddleAmount","type":"uint256"},{"internalType":"address","name":"mayanProtocol","type":"address"},{"internalType":"bytes","name":"mayanData","type":"bytes"}],"name":"swapAndForwardEth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"swapProtocols","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620021b1380380620021b183398101604081905262000034916200021b565b600080546001600160a01b0319166001600160a01b0385161781555b8251811015620000c8576001600260008584815181106200008157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580620000bf8162000295565b91505062000050565b5060005b81518110156200014457600160036000848481518110620000fd57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806200013b8162000295565b915050620000cc565b50505050620002d3565b80516001600160a01b03811681146200016657600080fd5b919050565b600082601f8301126200017c578081fd5b815160206001600160401b03808311156200019b576200019b620002bd565b8260051b604051601f19603f83011681018181108482111715620001c357620001c3620002bd565b60405284815283810192508684018288018501891015620001e2578687fd5b8692505b858310156200020f57620001fa816200014e565b845292840192600192909201918401620001e6565b50979650505050505050565b60008060006060848603121562000230578283fd5b6200023b846200014e565b60208501519093506001600160401b038082111562000258578384fd5b62000266878388016200016b565b935060408601519150808211156200027c578283fd5b506200028b868287016200016b565b9150509250925092565b6000600019821415620002b657634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fd5b611ece80620002e36000396000f3fe6080604052600436106100dd5760003560e01c8063af56ca031161007f578063e4269fc411610059578063e4269fc41461023c578063f8a67a621461024f578063fa74fd431461026f578063ffe805411461028257600080fd5b8063af56ca03146101c9578063b0f584ff14610209578063b25ea8fb1461021c57600080fd5b8063459656ee116100bb578063459656ee146101545780634818e84d146101695780637fc920eb14610189578063a44382fe146101a957600080fd5b80632fcb4f04146100e257806330dedc5714610104578063452a932014610117575b600080fd5b3480156100ee57600080fd5b506101026100fd366004611899565b6102b2565b005b610102610112366004611a0c565b610307565b34801561012357600080fd5b50600054610137906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016057600080fd5b506101026106c0565b34801561017557600080fd5b50600154610137906001600160a01b031681565b34801561019557600080fd5b506101026101a43660046118bc565b610733565b3480156101b557600080fd5b506101026101c43660046118bc565b610788565b3480156101d557600080fd5b506101f96101e4366004611899565b60036020526000908152604090205460ff1681565b604051901515815260200161014b565b6101026102173660046118f4565b6107dd565b34801561022857600080fd5b50610102610237366004611b2a565b6108de565b61010261024a366004611988565b610999565b34801561025b57600080fd5b5061010261026a366004611947565b610ab7565b61010261027d366004611b4e565b610af5565b34801561028e57600080fd5b506101f961029d366004611899565b60026020526000908152604090205460ff1681565b6000546001600160a01b031633146102e55760405162461bcd60e51b81526004016102dc90611d70565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03881660009081526002602052604090205460ff16158061034857506001600160a01b03831660009081526003602052604090205460ff16155b156103665760405163743f26e160e01b815260040160405180910390fd5b846001600160a01b03168b6001600160a01b031614156103d75760405162461bcd60e51b815260206004820152602660248201527f746f6b656e496e20616e6420746f6b656e4f7574206d7573742062652064696660448201526519995c995b9d60d21b60648201526084016102dc565b6103e28b8b8b610ee3565b6103ed8b898c610f93565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a082319060240160206040518083038186803b15801561042f57600080fd5b505afa158015610443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104679190611b12565b90506000808a6001600160a01b031660008b8b604051610488929190611c56565b60006040518083038185875af1925050503d80600081146104c5576040519150601f19603f3d011682016040523d82523d6000602084013e6104ca565b606091505b50915091508181906104ef5760405162461bcd60e51b81526004016102dc9190611d3d565b506040516370a0823160e01b815230600482015283906001600160a01b038a16906370a082319060240160206040518083038186803b15801561053157600080fd5b505afa158015610545573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105699190611b12565b6105739190611dfe565b9250868310156105c55760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e74206d6964646c6520746f6b656e0000000000000060448201526064016102dc565b6105d0888785610f93565b60006105dd868686611053565b9050866001600160a01b031634826040516105f89190611c66565b60006040518083038185875af1925050503d8060008114610635576040519150601f19603f3d011682016040523d82523d6000602084013e61063a565b606091505b509093509150818361065f5760405162461bcd60e51b81526004016102dc9190611d3d565b5061066a8f8f6112b1565b7f23278f58875126c795a4072b98b5851fe9b21cea19895b02a6224fefbb1e32988f8f8e8c888c8c8c6040516106a7989796959493929190611cb0565b60405180910390a1505050505050505050505050505050565b6001546001600160a01b0316331461070f5760405162461bcd60e51b815260206004820152601260248201527137b7363c903732bc3a1033bab0b93234b0b760711b60448201526064016102dc565b600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b0316331461075d5760405162461bcd60e51b81526004016102dc90611d70565b6001600160a01b03919091166000908152600260205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107b25760405162461bcd60e51b81526004016102dc90611d70565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6001600160a01b03831660009081526003602052604090205460ff166108165760405163743f26e160e01b815260040160405180910390fd5b600080846001600160a01b0316348585604051610834929190611c56565b60006040518083038185875af1925050503d8060008114610871576040519150601f19603f3d011682016040523d82523d6000602084013e610876565b606091505b509150915081819061089b5760405162461bcd60e51b81526004016102dc9190611d3d565b507fb8543d214cab9591941648db8d40126a163bfd0db4a865678320b921e13980438585856040516108cf93929190611c82565b60405180910390a15050505050565b6000546001600160a01b031633146109085760405162461bcd60e51b81526004016102dc90611d70565b6001600160a01b03811661095e5760405162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f20616464726573730000000060448201526064016102dc565b6040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610994573d6000803e3d6000fd5b505050565b6001600160a01b03831660009081526003602052604090205460ff166109d25760405163743f26e160e01b815260040160405180910390fd5b6109dd868686610ee3565b6109e8868487610f93565b600080846001600160a01b0316348585604051610a06929190611c56565b60006040518083038185875af1925050503d8060008114610a43576040519150601f19603f3d011682016040523d82523d6000602084013e610a48565b606091505b5091509150818190610a6d5760405162461bcd60e51b81526004016102dc9190611d3d565b507fbf150db6b4a14b084f7346b4bc300f552ce867afe55be27bce2d6b37e3307cda8888878787604051610aa5959493929190611d09565b60405180910390a15050505050505050565b6000546001600160a01b03163314610ae15760405162461bcd60e51b81526004016102dc90611d70565b6109946001600160a01b0384168284611352565b6001600160a01b03881660009081526002602052604090205460ff161580610b3657506001600160a01b03831660009081526003602052604090205460ff16155b15610b545760405163743f26e160e01b815260040160405180910390fd5b6001600160a01b038516610bb55760405162461bcd60e51b815260206004820152602260248201527f6d6964646c65546f6b656e2063616e6e6f74206265207a65726f206164647265604482015261737360f01b60648201526084016102dc565b88341015610bfd5760405162461bcd60e51b815260206004820152601560248201527434b739bab33334b1b4b2b73a1030b6b7bab73a24b760591b60448201526064016102dc565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a082319060240160206040518083038186803b158015610c3f57600080fd5b505afa158015610c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c779190611b12565b90506000808a6001600160a01b03168c8b8b604051610c97929190611c56565b60006040518083038185875af1925050503d8060008114610cd4576040519150601f19603f3d011682016040523d82523d6000602084013e610cd9565b606091505b5091509150818190610cfe5760405162461bcd60e51b81526004016102dc9190611d3d565b506040516370a0823160e01b815230600482015283906001600160a01b038a16906370a082319060240160206040518083038186803b158015610d4057600080fd5b505afa158015610d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d789190611b12565b610d829190611dfe565b925086831015610ded5760405162461bcd60e51b815260206004820152603060248201527f4d6179616e466f727761726465723a20696e73756666696369656e74206d696460448201526f191b19481d1bdad95b88185b5bdd5b9d60821b60648201526084016102dc565b610df8888785610f93565b6000610e05868686611053565b90506001600160a01b038716610e1b8e34611dfe565b82604051610e299190611c66565b60006040518083038185875af1925050503d8060008114610e66576040519150601f19603f3d011682016040523d82523d6000602084013e610e6b565b606091505b5090935091508183610e905760405162461bcd60e51b81526004016102dc9190611d3d565b507f7cbff921ae1f3ea71284120d2aabde13587df067f2bb5c831ea6e35d7a9242ac8d8d8b878b8b8b604051610ecc9796959493929190611d97565b60405180910390a150505050505050505050505050565b604051636eb1769f60e11b81523360048201523060248201526000906001600160a01b0385169063dd62ed3e9060440160206040518083038186803b158015610f2b57600080fd5b505afa158015610f3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f639190611b12565b905082811015610f7857610f788433846113b5565b610f8d6001600160a01b03851633308661146d565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152849160009183169063dd62ed3e9060440160206040518083038186803b158015610fdf57600080fd5b505afa158015610ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110179190611b12565b90508281101561104c576110366001600160a01b0383168560006114a5565b61104c6001600160a01b038316856000196114a5565b5050505050565b6060604483101561109d5760405162461bcd60e51b815260206004820152601460248201527313585e585b8819185d18481d1bdbc81cda1bdc9d60621b60448201526064016102dc565b60008367ffffffffffffffff8111156110c657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156110f0576020820181803683370190505b50905060005b60248110156111725785858281811061111f57634e487b7160e01b600052603260045260246000fd5b9050013560f81c60f81b82828151811061114957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508061116a81611e41565b9150506110f6565b5060008360405160200161118891815260200190565b604051602081830303815290604052905060005b6020811015611227578181815181106111c557634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916836111e0836024611de6565b815181106111fe57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508061121f81611e41565b91505061119c565b5060445b858110156112a65786868281811061125357634e487b7160e01b600052603260045260246000fd5b9050013560f81c60f81b83828151811061127d57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508061129e81611e41565b91505061122b565b509095945050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b1580156112f357600080fd5b505afa158015611307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132b9190611b12565b905060008111801561133d5750818111155b15610994576109946001600160a01b03841633835b6040516001600160a01b03831660248201526044810182905261099490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526115c9565b6001600160a01b03831663d505accf8330843560208601356113dd6060880160408901611c0c565b6040516001600160e01b031960e088901b1681526001600160a01b0395861660048201529490931660248501526044840191909152606483015260ff166084820152606084013560a4820152608084013560c482015260e401600060405180830381600087803b15801561145057600080fd5b505af1158015611464573d6000803e3d6000fd5b50505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610f8d9085906323b872dd60e01b9060840161137e565b80158061152e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156114f457600080fd5b505afa158015611508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152c9190611b12565b155b6115995760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016102dc565b6040516001600160a01b03831660248201526044810182905261099490849063095ea7b360e01b9060640161137e565b600061161e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661169e9092919063ffffffff16565b905080516000148061163f57508080602001905181019061163f9190611af6565b6109945760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102dc565b60606116ad84846000856116b5565b949350505050565b6060824710156117165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102dc565b600080866001600160a01b031685876040516117329190611c66565b60006040518083038185875af1925050503d806000811461176f576040519150601f19603f3d011682016040523d82523d6000602084013e611774565b606091505b509150915061178587838387611790565b979650505050505050565b606083156117fc5782516117f5576001600160a01b0385163b6117f55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102dc565b50816116ad565b6116ad83838151156118115781518083602001fd5b8060405162461bcd60e51b81526004016102dc9190611d3d565b803561183681611e72565b919050565b60008083601f84011261184c578182fd5b50813567ffffffffffffffff811115611863578182fd5b60208301915083602082850101111561187b57600080fd5b9250929050565b600060a08284031215611893578081fd5b50919050565b6000602082840312156118aa578081fd5b81356118b581611e72565b9392505050565b600080604083850312156118ce578081fd5b82356118d981611e72565b915060208301356118e981611e8a565b809150509250929050565b600080600060408486031215611908578081fd5b833561191381611e72565b9250602084013567ffffffffffffffff81111561192e578182fd5b61193a8682870161183b565b9497909650939450505050565b60008060006060848603121561195b578283fd5b833561196681611e72565b925060208401359150604084013561197d81611e72565b809150509250925092565b60008060008060008061012087890312156119a1578182fd5b86356119ac81611e72565b9550602087013594506119c28860408901611882565b935060e08701356119d281611e72565b925061010087013567ffffffffffffffff8111156119ee578283fd5b6119fa89828a0161183b565b979a9699509497509295939492505050565b60008060008060008060008060008060006101a08c8e031215611a2d578485fd5b611a378c35611e72565b8b359a5060208c01359950611a4f8d60408e01611882565b9850611a5e60e08d0135611e72565b60e08c0135975067ffffffffffffffff806101008e01351115611a7f578586fd5b611a908e6101008f01358f0161183b565b9098509650611aa26101208e0161182b565b95506101408d01359450611ab96101608e0161182b565b9350806101808e01351115611acc578283fd5b50611ade8d6101808e01358e0161183b565b81935080925050509295989b509295989b9093969950565b600060208284031215611b07578081fd5b81516118b581611e8a565b600060208284031215611b23578081fd5b5051919050565b60008060408385031215611b3c578182fd5b8235915060208301356118e981611e72565b600080600080600080600080600060e08a8c031215611b6b578485fd5b8935985060208a0135611b7d81611e72565b975060408a013567ffffffffffffffff80821115611b99578687fd5b611ba58d838e0161183b565b909950975060608c01359150611bba82611e72565b90955060808b0135945060a08b013590611bd382611e72565b90935060c08b01359080821115611be8578384fd5b50611bf58c828d0161183b565b915080935050809150509295985092959850929598565b600060208284031215611c1d578081fd5b813560ff811681146118b5578182fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8183823760009101908152919050565b60008251611c78818460208701611e15565b9190910192915050565b6001600160a01b0384168152604060208201819052600090611ca79083018486611c2d565b95945050505050565b6001600160a01b038981168252602082018990528781166040830152868116606083015260808201869052841660a082015260e060c08201819052600090611cfb9083018486611c2d565b9a9950505050505050505050565b6001600160a01b03868116825260208201869052841660408201526080606082018190526000906117859083018486611c2d565b6020815260008251806020840152611d5c816040850160208701611e15565b601f01601f19169190910160400192915050565b6020808252600d908201526c37b7363c9033bab0b93234b0b760991b604082015260600190565b8781526001600160a01b0387811660208301528681166040830152606082018690528416608082015260c060a08201819052600090611dd99083018486611c2d565b9998505050505050505050565b60008219821115611df957611df9611e5c565b500190565b600082821015611e1057611e10611e5c565b500390565b60005b83811015611e30578181015183820152602001611e18565b83811115610f8d5750506000910152565b6000600019821415611e5557611e55611e5c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611e8757600080fd5b50565b8015158114611e8757600080fdfea2646970667358221220176b35b7e098e21adeeb0836a2056b80125acddf51a74296ed548c4785653bd164736f6c63430008040033000000000000000000000000933e3922e04d47a466e60a20e486b372b64f1ea8000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000111111125421ca6dc452d289314280a0f8842a650000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a4ef5efb2f42edc4f7f5f3ab5557455db55e2464

Deployed Bytecode

0x6080604052600436106100dd5760003560e01c8063af56ca031161007f578063e4269fc411610059578063e4269fc41461023c578063f8a67a621461024f578063fa74fd431461026f578063ffe805411461028257600080fd5b8063af56ca03146101c9578063b0f584ff14610209578063b25ea8fb1461021c57600080fd5b8063459656ee116100bb578063459656ee146101545780634818e84d146101695780637fc920eb14610189578063a44382fe146101a957600080fd5b80632fcb4f04146100e257806330dedc5714610104578063452a932014610117575b600080fd5b3480156100ee57600080fd5b506101026100fd366004611899565b6102b2565b005b610102610112366004611a0c565b610307565b34801561012357600080fd5b50600054610137906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016057600080fd5b506101026106c0565b34801561017557600080fd5b50600154610137906001600160a01b031681565b34801561019557600080fd5b506101026101a43660046118bc565b610733565b3480156101b557600080fd5b506101026101c43660046118bc565b610788565b3480156101d557600080fd5b506101f96101e4366004611899565b60036020526000908152604090205460ff1681565b604051901515815260200161014b565b6101026102173660046118f4565b6107dd565b34801561022857600080fd5b50610102610237366004611b2a565b6108de565b61010261024a366004611988565b610999565b34801561025b57600080fd5b5061010261026a366004611947565b610ab7565b61010261027d366004611b4e565b610af5565b34801561028e57600080fd5b506101f961029d366004611899565b60026020526000908152604090205460ff1681565b6000546001600160a01b031633146102e55760405162461bcd60e51b81526004016102dc90611d70565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03881660009081526002602052604090205460ff16158061034857506001600160a01b03831660009081526003602052604090205460ff16155b156103665760405163743f26e160e01b815260040160405180910390fd5b846001600160a01b03168b6001600160a01b031614156103d75760405162461bcd60e51b815260206004820152602660248201527f746f6b656e496e20616e6420746f6b656e4f7574206d7573742062652064696660448201526519995c995b9d60d21b60648201526084016102dc565b6103e28b8b8b610ee3565b6103ed8b898c610f93565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a082319060240160206040518083038186803b15801561042f57600080fd5b505afa158015610443573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104679190611b12565b90506000808a6001600160a01b031660008b8b604051610488929190611c56565b60006040518083038185875af1925050503d80600081146104c5576040519150601f19603f3d011682016040523d82523d6000602084013e6104ca565b606091505b50915091508181906104ef5760405162461bcd60e51b81526004016102dc9190611d3d565b506040516370a0823160e01b815230600482015283906001600160a01b038a16906370a082319060240160206040518083038186803b15801561053157600080fd5b505afa158015610545573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105699190611b12565b6105739190611dfe565b9250868310156105c55760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e74206d6964646c6520746f6b656e0000000000000060448201526064016102dc565b6105d0888785610f93565b60006105dd868686611053565b9050866001600160a01b031634826040516105f89190611c66565b60006040518083038185875af1925050503d8060008114610635576040519150601f19603f3d011682016040523d82523d6000602084013e61063a565b606091505b509093509150818361065f5760405162461bcd60e51b81526004016102dc9190611d3d565b5061066a8f8f6112b1565b7f23278f58875126c795a4072b98b5851fe9b21cea19895b02a6224fefbb1e32988f8f8e8c888c8c8c6040516106a7989796959493929190611cb0565b60405180910390a1505050505050505050505050505050565b6001546001600160a01b0316331461070f5760405162461bcd60e51b815260206004820152601260248201527137b7363c903732bc3a1033bab0b93234b0b760711b60448201526064016102dc565b600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b0316331461075d5760405162461bcd60e51b81526004016102dc90611d70565b6001600160a01b03919091166000908152600260205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107b25760405162461bcd60e51b81526004016102dc90611d70565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6001600160a01b03831660009081526003602052604090205460ff166108165760405163743f26e160e01b815260040160405180910390fd5b600080846001600160a01b0316348585604051610834929190611c56565b60006040518083038185875af1925050503d8060008114610871576040519150601f19603f3d011682016040523d82523d6000602084013e610876565b606091505b509150915081819061089b5760405162461bcd60e51b81526004016102dc9190611d3d565b507fb8543d214cab9591941648db8d40126a163bfd0db4a865678320b921e13980438585856040516108cf93929190611c82565b60405180910390a15050505050565b6000546001600160a01b031633146109085760405162461bcd60e51b81526004016102dc90611d70565b6001600160a01b03811661095e5760405162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f20616464726573730000000060448201526064016102dc565b6040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610994573d6000803e3d6000fd5b505050565b6001600160a01b03831660009081526003602052604090205460ff166109d25760405163743f26e160e01b815260040160405180910390fd5b6109dd868686610ee3565b6109e8868487610f93565b600080846001600160a01b0316348585604051610a06929190611c56565b60006040518083038185875af1925050503d8060008114610a43576040519150601f19603f3d011682016040523d82523d6000602084013e610a48565b606091505b5091509150818190610a6d5760405162461bcd60e51b81526004016102dc9190611d3d565b507fbf150db6b4a14b084f7346b4bc300f552ce867afe55be27bce2d6b37e3307cda8888878787604051610aa5959493929190611d09565b60405180910390a15050505050505050565b6000546001600160a01b03163314610ae15760405162461bcd60e51b81526004016102dc90611d70565b6109946001600160a01b0384168284611352565b6001600160a01b03881660009081526002602052604090205460ff161580610b3657506001600160a01b03831660009081526003602052604090205460ff16155b15610b545760405163743f26e160e01b815260040160405180910390fd5b6001600160a01b038516610bb55760405162461bcd60e51b815260206004820152602260248201527f6d6964646c65546f6b656e2063616e6e6f74206265207a65726f206164647265604482015261737360f01b60648201526084016102dc565b88341015610bfd5760405162461bcd60e51b815260206004820152601560248201527434b739bab33334b1b4b2b73a1030b6b7bab73a24b760591b60448201526064016102dc565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a082319060240160206040518083038186803b158015610c3f57600080fd5b505afa158015610c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c779190611b12565b90506000808a6001600160a01b03168c8b8b604051610c97929190611c56565b60006040518083038185875af1925050503d8060008114610cd4576040519150601f19603f3d011682016040523d82523d6000602084013e610cd9565b606091505b5091509150818190610cfe5760405162461bcd60e51b81526004016102dc9190611d3d565b506040516370a0823160e01b815230600482015283906001600160a01b038a16906370a082319060240160206040518083038186803b158015610d4057600080fd5b505afa158015610d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d789190611b12565b610d829190611dfe565b925086831015610ded5760405162461bcd60e51b815260206004820152603060248201527f4d6179616e466f727761726465723a20696e73756666696369656e74206d696460448201526f191b19481d1bdad95b88185b5bdd5b9d60821b60648201526084016102dc565b610df8888785610f93565b6000610e05868686611053565b90506001600160a01b038716610e1b8e34611dfe565b82604051610e299190611c66565b60006040518083038185875af1925050503d8060008114610e66576040519150601f19603f3d011682016040523d82523d6000602084013e610e6b565b606091505b5090935091508183610e905760405162461bcd60e51b81526004016102dc9190611d3d565b507f7cbff921ae1f3ea71284120d2aabde13587df067f2bb5c831ea6e35d7a9242ac8d8d8b878b8b8b604051610ecc9796959493929190611d97565b60405180910390a150505050505050505050505050565b604051636eb1769f60e11b81523360048201523060248201526000906001600160a01b0385169063dd62ed3e9060440160206040518083038186803b158015610f2b57600080fd5b505afa158015610f3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f639190611b12565b905082811015610f7857610f788433846113b5565b610f8d6001600160a01b03851633308661146d565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152849160009183169063dd62ed3e9060440160206040518083038186803b158015610fdf57600080fd5b505afa158015610ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110179190611b12565b90508281101561104c576110366001600160a01b0383168560006114a5565b61104c6001600160a01b038316856000196114a5565b5050505050565b6060604483101561109d5760405162461bcd60e51b815260206004820152601460248201527313585e585b8819185d18481d1bdbc81cda1bdc9d60621b60448201526064016102dc565b60008367ffffffffffffffff8111156110c657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156110f0576020820181803683370190505b50905060005b60248110156111725785858281811061111f57634e487b7160e01b600052603260045260246000fd5b9050013560f81c60f81b82828151811061114957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508061116a81611e41565b9150506110f6565b5060008360405160200161118891815260200190565b604051602081830303815290604052905060005b6020811015611227578181815181106111c557634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916836111e0836024611de6565b815181106111fe57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508061121f81611e41565b91505061119c565b5060445b858110156112a65786868281811061125357634e487b7160e01b600052603260045260246000fd5b9050013560f81c60f81b83828151811061127d57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053508061129e81611e41565b91505061122b565b509095945050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b1580156112f357600080fd5b505afa158015611307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132b9190611b12565b905060008111801561133d5750818111155b15610994576109946001600160a01b03841633835b6040516001600160a01b03831660248201526044810182905261099490849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526115c9565b6001600160a01b03831663d505accf8330843560208601356113dd6060880160408901611c0c565b6040516001600160e01b031960e088901b1681526001600160a01b0395861660048201529490931660248501526044840191909152606483015260ff166084820152606084013560a4820152608084013560c482015260e401600060405180830381600087803b15801561145057600080fd5b505af1158015611464573d6000803e3d6000fd5b50505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610f8d9085906323b872dd60e01b9060840161137e565b80158061152e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156114f457600080fd5b505afa158015611508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152c9190611b12565b155b6115995760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016102dc565b6040516001600160a01b03831660248201526044810182905261099490849063095ea7b360e01b9060640161137e565b600061161e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661169e9092919063ffffffff16565b905080516000148061163f57508080602001905181019061163f9190611af6565b6109945760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102dc565b60606116ad84846000856116b5565b949350505050565b6060824710156117165760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102dc565b600080866001600160a01b031685876040516117329190611c66565b60006040518083038185875af1925050503d806000811461176f576040519150601f19603f3d011682016040523d82523d6000602084013e611774565b606091505b509150915061178587838387611790565b979650505050505050565b606083156117fc5782516117f5576001600160a01b0385163b6117f55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102dc565b50816116ad565b6116ad83838151156118115781518083602001fd5b8060405162461bcd60e51b81526004016102dc9190611d3d565b803561183681611e72565b919050565b60008083601f84011261184c578182fd5b50813567ffffffffffffffff811115611863578182fd5b60208301915083602082850101111561187b57600080fd5b9250929050565b600060a08284031215611893578081fd5b50919050565b6000602082840312156118aa578081fd5b81356118b581611e72565b9392505050565b600080604083850312156118ce578081fd5b82356118d981611e72565b915060208301356118e981611e8a565b809150509250929050565b600080600060408486031215611908578081fd5b833561191381611e72565b9250602084013567ffffffffffffffff81111561192e578182fd5b61193a8682870161183b565b9497909650939450505050565b60008060006060848603121561195b578283fd5b833561196681611e72565b925060208401359150604084013561197d81611e72565b809150509250925092565b60008060008060008061012087890312156119a1578182fd5b86356119ac81611e72565b9550602087013594506119c28860408901611882565b935060e08701356119d281611e72565b925061010087013567ffffffffffffffff8111156119ee578283fd5b6119fa89828a0161183b565b979a9699509497509295939492505050565b60008060008060008060008060008060006101a08c8e031215611a2d578485fd5b611a378c35611e72565b8b359a5060208c01359950611a4f8d60408e01611882565b9850611a5e60e08d0135611e72565b60e08c0135975067ffffffffffffffff806101008e01351115611a7f578586fd5b611a908e6101008f01358f0161183b565b9098509650611aa26101208e0161182b565b95506101408d01359450611ab96101608e0161182b565b9350806101808e01351115611acc578283fd5b50611ade8d6101808e01358e0161183b565b81935080925050509295989b509295989b9093969950565b600060208284031215611b07578081fd5b81516118b581611e8a565b600060208284031215611b23578081fd5b5051919050565b60008060408385031215611b3c578182fd5b8235915060208301356118e981611e72565b600080600080600080600080600060e08a8c031215611b6b578485fd5b8935985060208a0135611b7d81611e72565b975060408a013567ffffffffffffffff80821115611b99578687fd5b611ba58d838e0161183b565b909950975060608c01359150611bba82611e72565b90955060808b0135945060a08b013590611bd382611e72565b90935060c08b01359080821115611be8578384fd5b50611bf58c828d0161183b565b915080935050809150509295985092959850929598565b600060208284031215611c1d578081fd5b813560ff811681146118b5578182fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8183823760009101908152919050565b60008251611c78818460208701611e15565b9190910192915050565b6001600160a01b0384168152604060208201819052600090611ca79083018486611c2d565b95945050505050565b6001600160a01b038981168252602082018990528781166040830152868116606083015260808201869052841660a082015260e060c08201819052600090611cfb9083018486611c2d565b9a9950505050505050505050565b6001600160a01b03868116825260208201869052841660408201526080606082018190526000906117859083018486611c2d565b6020815260008251806020840152611d5c816040850160208701611e15565b601f01601f19169190910160400192915050565b6020808252600d908201526c37b7363c9033bab0b93234b0b760991b604082015260600190565b8781526001600160a01b0387811660208301528681166040830152606082018690528416608082015260c060a08201819052600090611dd99083018486611c2d565b9998505050505050505050565b60008219821115611df957611df9611e5c565b500190565b600082821015611e1057611e10611e5c565b500390565b60005b83811015611e30578181015183820152602001611e18565b83811115610f8d5750506000910152565b6000600019821415611e5557611e55611e5c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611e8757600080fd5b50565b8015158114611e8757600080fdfea2646970667358221220176b35b7e098e21adeeb0836a2056b80125acddf51a74296ed548c4785653bd164736f6c63430008040033

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

000000000000000000000000933e3922e04d47a466e60a20e486b372b64f1ea8000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000111111125421ca6dc452d289314280a0f8842a650000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a4ef5efb2f42edc4f7f5f3ab5557455db55e2464

-----Decoded View---------------
Arg [0] : _guardian (address): 0x933E3922E04d47a466e60A20e486b372B64F1Ea8
Arg [1] : _swapProtocols (address[]): 0x111111125421cA6dc452d289314280a0f8842A65
Arg [2] : _mayanProtocols (address[]): 0xa4EF5EFB2F42edC4f7F5F3Ab5557455DB55E2464

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 000000000000000000000000933e3922e04d47a466e60a20e486b372b64f1ea8
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [4] : 000000000000000000000000111111125421ca6dc452d289314280a0f8842a65
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 000000000000000000000000a4ef5efb2f42edc4f7f5f3ab5557455db55e2464


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.