ETH Price: $2,943.47 (-4.04%)
Gas: 2 Gwei

Contract

0x4932D5ff00A91B725Ed89514FB5999BBe8a6A0b6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Swap179726202023-08-22 20:24:23320 days ago1692735863IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0016746925.65917587
Swap179713692023-08-22 16:13:23320 days ago1692720803IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0099865452.76097538
Swap179475652023-08-19 8:14:59323 days ago1692432899IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0035163313.37262138
Swap179133422023-08-14 13:19:47328 days ago1692019187IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0038361621.14137363
Swap177707802023-07-25 14:42:59348 days ago1690296179IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0182919647.51368791
Swap177495982023-07-22 15:35:23351 days ago1690040123IN
0x4932D5ff...Be8a6A0b6
0 ETH0.004251220.05012134
Swap176278112023-07-05 12:54:23368 days ago1688561663IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0143107552.85247004
Swap174993882023-06-17 12:00:23386 days ago1687003223IN
0x4932D5ff...Be8a6A0b6
0 ETH0.00442516.22909246
Swap168015662023-03-11 1:25:23484 days ago1678497923IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0342009967.05761784
Swap168015552023-03-11 1:23:11484 days ago1678497791IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0210644861.92797098
Swap167041382023-02-25 8:32:23498 days ago1677313943IN
0x4932D5ff...Be8a6A0b6
0 ETH0.0071523722.58914673
0x60806040167040372023-02-25 8:11:59498 days ago1677312719IN
 Create: SwapFacade
0 ETH0.0288100824.92564691

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SwapFacade

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 16 : SwapFacade.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "@1inch/solidity-utils/contracts/libraries/SafeERC20.sol";
import "./features/ContractOnlyEthRecipient.sol";
import "./interfaces/ISwapExecutor.sol";
import "./libs/TokenLibrary.sol";
import "./Errors.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";

/**
 * @title SwapFacade
 * @notice This facade performs minReturn safety checks and holds all approves to ensure safety of all arbitrary calls
 */
contract SwapFacade is Ownable2Step {
    using SafeERC20 for IERC20;
    using TokenLibrary for IERC20;

    /// @notice Performs tokens swap
    /// @param executor Address of low level executor used to make actual swaps
    /// @param amount Amount of source tokens user is willing to swap
    /// @param targetToken Token that user is willing to get as result. This will be used for minReturn check to decide if swap executed successfully
    /// @param minReturn Minimal amount of targetToken that user is willing to receive. If not reached transaction reverts
    /// @param deadline Safety parameter against stalled transactions. If deadline reached swap reverts unconditionally
    /// @param swapDescriptions Descriptions that describe how exactly swaps should be performed
    /// @param permit Signed permit for spending `amount` of tokens. Optional. May be used instead of manually approving tokens before calling `swap`
    function swap(
        ISwapExecutor executor,
        uint256 amount,
        IERC20 targetToken,
        uint256 minReturn,
        address payable recipient,
        uint256 deadline,
        ISwapExecutor.SwapDescription[] calldata swapDescriptions,
        bytes calldata permit
    ) external payable returns (uint256) {
        {
            // solhint-disable-next-line not-rely-on-time
            if (deadline < block.timestamp) {
                // solhint-disable-next-line not-rely-on-time
                revert TransactionExpired(deadline, block.timestamp);
            }
        }
        if (amount == 0) {
            revert ZeroInput();
        }
        if (recipient == address(0)) {
            revert ZeroRecipient();
        }
        if (swapDescriptions.length == 0) {
            revert EmptySwap();
        }
        IERC20 sourceToken = swapDescriptions[0].sourceToken;
        if (msg.value > 0) {
            if (msg.value != amount) {
                revert EthValueAmountMismatch();
            } else if (permit.length > 0) {
                revert PermitNotAllowedForEthSwap();
            } else if (!TokenLibrary.isEth(sourceToken)) {
                revert EthValueSourceTokenMismatch();
            }
        }
        else {
            uint256 currentBalance = sourceToken.balanceOf(address(executor));
            if (currentBalance < amount)
            {
                if (permit.length > 0) {
                    SafeERC20.tryPermit(sourceToken, permit);
                }
                sourceToken.safeTransferFrom(msg.sender, address(executor), amount);
            }
        }
        return _swap(executor, targetToken, minReturn, recipient, swapDescriptions);
    }

    /// @notice Performs tokens swap and validates swap success against minReturn value
    function _swap(
        ISwapExecutor executor,
        IERC20 targetToken,
        uint256 minReturn,
        address payable recipient,
        ISwapExecutor.SwapDescription[] calldata swapDescriptions
    ) private returns (uint256) {
        uint256 balanceBeforeSwap = targetToken.universalBalanceOf(recipient);
        executor.executeSwap{value: msg.value}(recipient, targetToken, swapDescriptions);
        uint256 balanceAfterSwap = targetToken.universalBalanceOf(recipient);
        uint256 totalSwappedAmount = balanceAfterSwap - balanceBeforeSwap;
        if (totalSwappedAmount < minReturn) {
            revert MinReturnError(totalSwappedAmount, minReturn);
        }
        return totalSwappedAmount;
    }

    function sweep(IERC20 token, address destination) external onlyOwner {
        token.safeTransfer(destination, IERC20(token).balanceOf(address(this)));
    }
}

File 2 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma abicoder v1;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "../interfaces/IDaiLikePermit.sol";
import "../interfaces/IPermit2.sol";
import "../interfaces/IWETH.sol";
import "../libraries/RevertReasonForwarder.sol";

/// @title Implements efficient safe methods for ERC20 interface.
library SafeERC20 {
    error SafeTransferFailed();
    error SafeTransferFromFailed();
    error ForceApproveFailed();
    error SafeIncreaseAllowanceFailed();
    error SafeDecreaseAllowanceFailed();
    error SafePermitBadLength();

    address private constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
    bytes4 private constant _PERMIT_LENGHT_ERROR = 0x68275857;  // SafePermitBadLength.selector

    /// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.
    function safeTransferFromUniversal(
        IERC20 token,
        address from,
        address to,
        uint256 amount,
        bool permit2
    ) internal {
        if (permit2) {
            safeTransferFromPermit2(token, from, to, uint160(amount));
        } else {
            safeTransferFrom(token, from, to, amount);
        }
    }

    /// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.
    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bytes4 selector = token.transferFrom.selector;
        bool success;
        /// @solidity memory-safe-assembly
        assembly { // solhint-disable-line no-inline-assembly
            let data := mload(0x40)

            mstore(data, selector)
            mstore(add(data, 0x04), from)
            mstore(add(data, 0x24), to)
            mstore(add(data, 0x44), amount)
            success := call(gas(), token, 0, data, 100, 0x0, 0x20)
            if success {
                switch returndatasize()
                case 0 {
                    success := gt(extcodesize(token), 0)
                }
                default {
                    success := and(gt(returndatasize(), 31), eq(mload(0), 1))
                }
            }
        }
        if (!success) revert SafeTransferFromFailed();
    }

    /// @dev Permit2 version of safeTransferFrom above.
    function safeTransferFromPermit2(
        IERC20 token,
        address from,
        address to,
        uint160 amount
    ) internal {
        bytes4 selector = IPermit2.transferFrom.selector;
        bool success;
        /// @solidity memory-safe-assembly
        assembly { // solhint-disable-line no-inline-assembly
            let data := mload(0x40)

            mstore(data, selector)
            mstore(add(data, 0x04), from)
            mstore(add(data, 0x24), to)
            mstore(add(data, 0x44), amount)
            mstore(add(data, 0x64), token)
            success := call(gas(), _PERMIT2, 0, data, 0x84, 0x0, 0x0)
            if success {
                success := gt(extcodesize(_PERMIT2), 0)
            }
        }
        if (!success) revert SafeTransferFromFailed();
    }

    /// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.
    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        if (!_makeCall(token, token.transfer.selector, to, value)) {
            revert SafeTransferFailed();
        }
    }

    /// @dev If `approve(from, to, amount)` fails, try to `approve(from, to, 0)` before retry.
    function forceApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        if (!_makeCall(token, token.approve.selector, spender, value)) {
            if (
                !_makeCall(token, token.approve.selector, spender, 0) ||
                !_makeCall(token, token.approve.selector, spender, value)
            ) {
                revert ForceApproveFailed();
            }
        }
    }

    /// @dev Allowance increase with safe math check.
    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 allowance = token.allowance(address(this), spender);
        if (value > type(uint256).max - allowance) revert SafeIncreaseAllowanceFailed();
        forceApprove(token, spender, allowance + value);
    }

    /// @dev Allowance decrease with safe math check.
    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 allowance = token.allowance(address(this), spender);
        if (value > allowance) revert SafeDecreaseAllowanceFailed();
        forceApprove(token, spender, allowance - value);
    }

    function safePermit(IERC20 token, bytes calldata permit) internal {
        if (!tryPermit(token, msg.sender, address(this), permit)) RevertReasonForwarder.reRevert();
    }

    function safePermit(IERC20 token, address owner, address spender, bytes calldata permit) internal {
        if (!tryPermit(token, owner, spender, permit)) RevertReasonForwarder.reRevert();
    }

    function tryPermit(IERC20 token, bytes calldata permit) internal returns(bool success) {
        return tryPermit(token, msg.sender, address(this), permit);
    }

    function tryPermit(IERC20 token, address owner, address spender, bytes calldata permit) internal returns(bool success) {
        bytes4 permitSelector = IERC20Permit.permit.selector;
        bytes4 daiPermitSelector = IDaiLikePermit.permit.selector;
        bytes4 permit2Selector = IPermit2.permit.selector;
        /// @solidity memory-safe-assembly
        assembly { // solhint-disable-line no-inline-assembly
            let ptr := mload(0x40)
            switch permit.length
            case 100 {
                mstore(ptr, permitSelector)
                mstore(add(ptr, 0x04), owner)
                mstore(add(ptr, 0x24), spender)

                // Compact IERC20Permit.permit(uint256 value, uint32 deadline, uint256 r, uint256 vs)
                {  // stack too deep
                    let deadline := shr(224, calldataload(add(permit.offset, 0x20)))
                    let vs := calldataload(add(permit.offset, 0x44))

                    calldatacopy(add(ptr, 0x44), permit.offset, 0x20) // value
                    mstore(add(ptr, 0x64), sub(deadline, 1))
                    mstore(add(ptr, 0x84), add(27, shr(255, vs)))
                    calldatacopy(add(ptr, 0xa4), add(permit.offset, 0x24), 0x20) // r
                    mstore(add(ptr, 0xc4), shr(1, shl(1, vs)))
                }
                // IERC20Permit.permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s)
                success := call(gas(), token, 0, ptr, 0xe4, 0, 0)
            }
            case 72 {
                mstore(ptr, daiPermitSelector)
                mstore(add(ptr, 0x04), owner)
                mstore(add(ptr, 0x24), spender)

                // Compact IDaiLikePermit.permit(uint32 nonce, uint32 expiry, uint256 r, uint256 vs)
                {  // stack too deep
                    let expiry := shr(224, calldataload(add(permit.offset, 0x04)))
                    let vs := calldataload(add(permit.offset, 0x28))

                    mstore(add(ptr, 0x44), shr(224, calldataload(permit.offset)))
                    mstore(add(ptr, 0x64), sub(expiry, 1))
                    mstore(add(ptr, 0x84), true)
                    mstore(add(ptr, 0xa4), add(27, shr(255, vs)))
                    calldatacopy(add(ptr, 0xc4), add(permit.offset, 0x08), 0x20) // r
                    mstore(add(ptr, 0xe4), shr(1, shl(1, vs)))
                }
                // IDaiLikePermit.permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s)
                success := call(gas(), token, 0, ptr, 0x104, 0, 0)
            }
            case 224 {
                mstore(ptr, permitSelector)
                calldatacopy(add(ptr, 0x04), permit.offset, permit.length)
                // IERC20Permit.permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s)
                success := call(gas(), token, 0, ptr, add(4, permit.length), 0, 0)
            }
            case 256 {
                mstore(ptr, daiPermitSelector)
                calldatacopy(add(ptr, 0x04), permit.offset, permit.length)
                // IDaiLikePermit.permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s)
                success := call(gas(), token, 0, ptr, add(4, permit.length), 0, 0)
            }
            case 128 {
                // Compact IPermit2.permit(address owner, PermitSingle calldata permitSingle, bytes calldata signature)
                mstore(ptr, permit2Selector)
                mstore(add(ptr, 0x04), owner)
                mstore(add(ptr, 0x24), token)
                calldatacopy(add(ptr, 0x50), permit.offset, 0x14) // amount
                calldatacopy(add(ptr, 0x7e), add(permit.offset, 0x14), 0x06) // expiration
                calldatacopy(add(ptr, 0x9e), add(permit.offset, 0x1a), 0x06) // nonce
                mstore(add(ptr, 0xa4), spender)
                calldatacopy(add(ptr, 0xc4), add(permit.offset, 0x20), 0x20) // sigDeadline
                mstore(add(ptr, 0xe4), 0x100)
                mstore(add(ptr, 0x104), 0x40)
                calldatacopy(add(ptr, 0x124), add(permit.offset, 0x40), 0x20) // r
                calldatacopy(add(ptr, 0x144), add(permit.offset, 0x60), 0x20) // vs
                // IPermit2.permit(address owner, PermitSingle calldata permitSingle, bytes calldata signature)
                success := call(gas(), _PERMIT2, 0, ptr, 388, 0, 0)
            }
            case 384 {
                mstore(ptr, permit2Selector)
                calldatacopy(add(ptr, 0x04), permit.offset, permit.length)
                // IPermit2.permit(address owner, PermitSingle calldata permitSingle, bytes calldata signature)
                success := call(gas(), _PERMIT2, 0, ptr, 388, 0, 0)
            }
            default {
                mstore(ptr, _PERMIT_LENGHT_ERROR)
                revert(ptr, 4)
            }
        }
    }

    function _makeCall(
        IERC20 token,
        bytes4 selector,
        address to,
        uint256 amount
    ) private returns (bool success) {
        /// @solidity memory-safe-assembly
        assembly { // solhint-disable-line no-inline-assembly
            let data := mload(0x40)

            mstore(data, selector)
            mstore(add(data, 0x04), to)
            mstore(add(data, 0x24), amount)
            success := call(gas(), token, 0, data, 0x44, 0x0, 0x20)
            if success {
                switch returndatasize()
                case 0 {
                    success := gt(extcodesize(token), 0)
                }
                default {
                    success := and(gt(returndatasize(), 31), eq(mload(0), 1))
                }
            }
        }
    }

    function safeDeposit(IWETH weth, uint256 amount) internal {
        if (amount > 0) {
            bytes4 selector = IWETH.deposit.selector;
            /// @solidity memory-safe-assembly
            assembly { // solhint-disable-line no-inline-assembly
                mstore(0, selector)
                if iszero(call(gas(), weth, amount, 0, 4, 0, 0)) {
                    returndatacopy(0, 0, returndatasize())
                    revert(0, returndatasize())
                }
            }
        }
    }

    function safeWithdraw(IWETH weth, uint256 amount) internal {
        bytes4 selector = IWETH.withdraw.selector;
        /// @solidity memory-safe-assembly
        assembly {  // solhint-disable-line no-inline-assembly
            mstore(0, selector)
            mstore(4, amount)
            if iszero(call(gas(), weth, 0, 0, 0x24, 0, 0)) {
                returndatacopy(0, 0, returndatasize())
                revert(0, returndatasize())
            }
        }
    }

    function safeWithdrawTo(IWETH weth, uint256 amount, address to) internal {
        safeWithdraw(weth, amount);
        if (to != address(this)) {
            /// @solidity memory-safe-assembly
            assembly {  // solhint-disable-line no-inline-assembly
                if iszero(call(gas(), to, amount, 0, 0, 0, 0)) {
                    returndatacopy(0, 0, returndatasize())
                    revert(0, returndatasize())
                }
            }
        }
    }
}

File 3 of 16 : ContractOnlyEthRecipient.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma abicoder v1;

import "../Errors.sol";

/**
 * @title ContractOnlyEthRecipient
 * @notice Base contract that rejects any direct ethereum deposits. This is a failsafe against users who can accidentaly send ether
 */
abstract contract ContractOnlyEthRecipient {
    receive() external payable {
        // solhint-disable-next-line avoid-tx-origin
        if (msg.sender == tx.origin) {
            revert DirectEthDepositIsForbidden();
        }
    }
}

File 4 of 16 : ISwapExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

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

/**
 * @title ISwapExecutor
 * @notice Interface for executing low level swaps, including all relevant structs and enums
 */
interface ISwapExecutor {
    struct TargetSwapDescription {
        uint256 tokenRatio;
        address target;
        bytes data;
        // uint8 callType; first 8 bits
        // uint8 sourceInteraction; next 8 bits
        // uint32 amountOffset; next 32 bits
        // address sourceTokenInteractionTarget; last 160 bits
        uint256 params;
    }

    struct SwapDescription {
        IERC20 sourceToken;
        TargetSwapDescription[] swaps;
    }

    function executeSwap(address payable recipient, IERC20 tokenToTransfer, SwapDescription[] calldata swapDescriptions) external payable;
}

uint8 constant CALL_TYPE_DIRECT = 0;
uint8 constant CALL_TYPE_CALCULATED = 1;
uint8 constant SOURCE_TOKEN_INTERACTION_NONE = 0;
uint8 constant SOURCE_TOKEN_INTERACTION_TRANSFER = 1;
uint8 constant SOURCE_TOKEN_INTERACTION_APPROVE = 2;

File 5 of 16 : TokenLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma abicoder v1;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@1inch/solidity-utils/contracts/libraries/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

/**
 * @title TokenLibrary
 * @notice Library for basic interactions with tokens (such as deposits, withdrawals, transfers)
 */
library TokenLibrary {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    function isEth(IERC20 token) internal pure returns(bool) {
        return address(token) == address(0) || address(token) == address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
    }

    function universalBalanceOf(IERC20 token, address account) internal view returns (uint256) {
        if (isEth(token)) {
            return account.balance;
        } else {
            return token.balanceOf(account);
        }
    }

    function universalTransfer(IERC20 token, address payable to, uint256 amount) internal {
        if (amount == 0) {
            return;
        }
        if (isEth(token)) {
            to.transfer(amount);
        } else {
            token.safeTransfer(to, amount);
        }
    }
}

File 6 of 16 : Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
pragma abicoder v1;

enum EnumType {
    SourceTokenInteraction,
    TargetTokenInteraction,
    CallType
}

enum UniswapV3LikeProtocol {
    Uniswap,
    Kyber
}

error EthValueAmountMismatch();
error EthValueSourceTokenMismatch();
error MinReturnError(uint256, uint256);
error EmptySwapOnExecutor();
error EmptySwap();
error ZeroInput();
error ZeroRecipient();
error TransactionExpired(uint256, uint256);
error PermitNotAllowedForEthSwap();
error SwapTotalAmountCannotBeZero();
error SwapAmountCannotBeZero();
error DirectEthDepositIsForbidden();
error MStableInvalidSwapType(uint256);
error AddressCannotBeZero();
error TransferFromNotAllowed();
error EnumOutOfRangeValue(EnumType, uint256);
error BadUniswapV3LikePool(UniswapV3LikeProtocol);

File 7 of 16 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

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

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

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

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

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

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() external {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 8 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}

File 9 of 16 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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);
}

File 10 of 16 : IDaiLikePermit.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma abicoder v1;

interface IDaiLikePermit {
    function permit(
        address holder,
        address spender,
        uint256 nonce,
        uint256 expiry,
        bool allowed,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

File 11 of 16 : IPermit2.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IPermit2 {
    struct PermitDetails {
        // ERC20 token address
        address token;
        // the maximum amount allowed to spend
        uint160 amount;
        // timestamp at which a spender's token allowances become invalid
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }
    /// @notice The permit message signed for a single token allownce
    struct PermitSingle {
        // the permit data for a single token alownce
        PermitDetails details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }
    /// @notice Packed allowance
    struct PackedAllowance {
        // amount allowed
        uint160 amount;
        // permission expiry
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    function transferFrom(address user, address spender, uint160 amount, address token) external;

    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;

    function allowance(address user, address token, address spender) external view returns (PackedAllowance memory);
}

File 12 of 16 : IWETH.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma abicoder v1;

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

interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256 amount) external;
}

File 13 of 16 : RevertReasonForwarder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma abicoder v1;

/// @title Revert reason forwarder.
library RevertReasonForwarder {
    /// @dev Forwards latest externall call revert.
    function reRevert() internal pure {
        // bubble up revert reason from latest external call
        /// @solidity memory-safe-assembly
        assembly { // solhint-disable-line no-inline-assembly
            let ptr := mload(0x40)
            returndatacopy(ptr, 0, returndatasize())
            revert(ptr, returndatasize())
        }
    }
}

File 14 of 16 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 15 of 16 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 16 of 16 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"EmptySwap","type":"error"},{"inputs":[],"name":"EthValueAmountMismatch","type":"error"},{"inputs":[],"name":"EthValueSourceTokenMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"MinReturnError","type":"error"},{"inputs":[],"name":"PermitNotAllowedForEthSwap","type":"error"},{"inputs":[],"name":"SafeTransferFailed","type":"error"},{"inputs":[],"name":"SafeTransferFromFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"TransactionExpired","type":"error"},{"inputs":[],"name":"ZeroInput","type":"error"},{"inputs":[],"name":"ZeroRecipient","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISwapExecutor","name":"executor","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"contract IERC20","name":"targetToken","type":"address"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"contract IERC20","name":"sourceToken","type":"address"},{"components":[{"internalType":"uint256","name":"tokenRatio","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"params","type":"uint256"}],"internalType":"struct ISwapExecutor.TargetSwapDescription[]","name":"swaps","type":"tuple[]"}],"internalType":"struct ISwapExecutor.SwapDescription[]","name":"swapDescriptions","type":"tuple[]"},{"internalType":"bytes","name":"permit","type":"bytes"}],"name":"swap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"destination","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001a3361001f565b610096565b600180546001600160a01b031916905561004381610046602090811b6106a617901c565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611395806100a56000396000f3fe6080604052600436106100705760003560e01c8063b87b27381161004e578063b87b2738146100f2578063b8dc491b14610113578063e30c397814610133578063f2fde38b1461015e57600080fd5b8063715018a61461007557806379ba50971461008c5780638da5cb5b146100a1575b600080fd5b34801561008157600080fd5b5061008a61017e565b005b34801561009857600080fd5b5061008a610192565b3480156100ad57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610105610100366004610e9a565b61024c565b6040519081526020016100e9565b34801561011f57600080fd5b5061008a61012e366004610f93565b610538565b34801561013f57600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff166100c8565b34801561016a57600080fd5b5061008a610179366004610fcc565b6105f6565b61018661071b565b610190600061079c565b565b600154339073ffffffffffffffffffffffffffffffffffffffff168114610240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102498161079c565b50565b600042861015610291576040517f300249d700000000000000000000000000000000000000000000000000000000815260048101879052426024820152604401610237565b896000036102cb576040517faf458c0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8716610318576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000849003610353576040517fb494d17500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008585600081811061036857610368610ff0565b905060200281019061037a919061101f565b610388906020810190610fcc565b90503415610445578a34146103c9576040517f5e3b87b400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8215610401576040517f283e650d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61040a816107cd565b610440576040517f2b27b8bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61051a565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d81166004830152600091908316906370a0823190602401602060405180830381865afa1580156104b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d9919061105d565b90508b8110156105185783156104f6576104f4828686610821565b505b61051873ffffffffffffffffffffffffffffffffffffffff8316338f8f610838565b505b6105288c8b8b8b8a8a6108d5565b9c9b505050505050505050505050565b61054061071b565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526105f290829073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa1580156105b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d4919061105d565b73ffffffffffffffffffffffffffffffffffffffff851691906109f8565b5050565b6105fe61071b565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561066160005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610237565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055610249816106a6565b600073ffffffffffffffffffffffffffffffffffffffff8216158061081b575073ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b92915050565b60006108308433308686610a5f565b949350505050565b60006323b872dd60e01b905060006040518281528560048201528460248201528360448201526020600060648360008b5af19150508015610896573d801561088c57600160005114601f3d11169150610894565b6000873b1191505b505b806108cd576040517ff405907100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b6000806108f873ffffffffffffffffffffffffffffffffffffffff881686610d23565b90508773ffffffffffffffffffffffffffffffffffffffff16632e0ca20134878a88886040518663ffffffff1660e01b815260040161093a94939291906110bf565b6000604051808303818588803b15801561095357600080fd5b505af1158015610967573d6000803e3d6000fd5b50505050506000610997868973ffffffffffffffffffffffffffffffffffffffff16610d2390919063ffffffff16565b905060006109a58383611321565b9050878110156109eb576040517f643f0c860000000000000000000000000000000000000000000000000000000081526004810182905260248101899052604401610237565b9998505050505050505050565b610a24837fa9059cbb000000000000000000000000000000000000000000000000000000008484610ddc565b610a5a576040517ffb7f507900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6040516000907fd505accf00000000000000000000000000000000000000000000000000000000907f8fcbaf0c00000000000000000000000000000000000000000000000000000000907f2b67b57000000000000000000000000000000000000000000000000000000000908560648114610b265760488114610ba35760e08114610c2a576101008114610c485760808114610c66576101808114610ced577f68275857000000000000000000000000000000000000000000000000000000008252600482fd5b848252896004830152886024830152602088013560e01c604489013560208a60448601376001820360648501528060ff1c601b016084850152602060248b0160a48601377f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660c48401525060008060e484828f5af19550610d15565b838252896004830152886024830152600488013560e01c6028890135893560e01c6044850152600182036064850152600160848501528060ff1c601b0160a4850152602060088b0160c48601377f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660e48401525060008061010484828f5af19550610d15565b84825286886004840137600080886004018460008f5af19550610d15565b83825286886004840137600080886004018460008f5af19550610d15565b8282528960048301528a60248301526014886050840137600660148901607e8401376006601a8901609e8401378860a4830152602080890160c484013761010060e483015260406101048301526020604089016101248401376020606089016101448401376000806101848460006e22d473030f116ddee9f6b43ac78ba35af19550610d15565b828252868860048401376000806101848460006e22d473030f116ddee9f6b43ac78ba35af195505b505050505095945050505050565b6000610d2e836107cd565b15610d51575073ffffffffffffffffffffffffffffffffffffffff81163161081b565b8273ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381865afa158015610dbd573d6000803e3d6000fd5b505050506040513d6020811015610dd357600080fd5b50519392505050565b60006040518481528360048201528260248201526020600060448360008a5af19150508015610830573d8015610e1e57600160005114601f3d11169150610e26565b6000863b1191505b50949350505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461024957600080fd5b60008083601f840112610e6357600080fd5b50813567ffffffffffffffff811115610e7b57600080fd5b602083019150836020828501011115610e9357600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215610eba57600080fd5b8a35610ec581610e2f565b995060208b0135985060408b0135610edc81610e2f565b975060608b0135965060808b0135610ef381610e2f565b955060a08b0135945060c08b013567ffffffffffffffff80821115610f1757600080fd5b818d0191508d601f830112610f2b57600080fd5b813581811115610f3a57600080fd5b8e60208260051b8501011115610f4f57600080fd5b6020830196508095505060e08d0135915080821115610f6d57600080fd5b50610f7a8d828e01610e51565b915080935050809150509295989b9194979a5092959850565b60008060408385031215610fa657600080fd5b8235610fb181610e2f565b91506020830135610fc181610e2f565b809150509250929050565b600060208284031215610fde57600080fd5b8135610fe981610e2f565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261105357600080fd5b9190910192915050565b60006020828403121561106f57600080fd5b5051919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60006060820173ffffffffffffffffffffffffffffffffffffffff8088168452602081881681860152606060408601528286845260808601905060808760051b87010193508760005b88811015611311577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808887030183527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1808b36030183351261116957600080fd5b8a8335016040880161117b8235610e2f565b878235168952868201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18336030181126111b557600080fd5b90910190813587830167ffffffffffffffff808311156111d457600080fd5b8260051b8036038313156111e757600080fd5b60408b8e0152938390526060938c018401936000908d017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6136889003015b858310156112f6577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08f8803018252843581811261126257600080fd5b88018d8101358852604081013561127881610e2f565b8f16888f01526060810135368290038b01811261129457600080fd5b810160408101908f0135868111156112ab57600080fd5b8036038213156112ba57600080fd5b608060408b01526112cf60808b018284611076565b915050608082013560608a015280985050508c850194508c82019150600183019250611225565b50949c50505096880196505050928501925050600101611108565b50939a9950505050505050505050565b60008282101561135a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea2646970667358221220026587ba64601b20d9c9b08323484bfae751be7276ed44a975969cf65f8c693764736f6c634300080f0033

Deployed Bytecode

0x6080604052600436106100705760003560e01c8063b87b27381161004e578063b87b2738146100f2578063b8dc491b14610113578063e30c397814610133578063f2fde38b1461015e57600080fd5b8063715018a61461007557806379ba50971461008c5780638da5cb5b146100a1575b600080fd5b34801561008157600080fd5b5061008a61017e565b005b34801561009857600080fd5b5061008a610192565b3480156100ad57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610105610100366004610e9a565b61024c565b6040519081526020016100e9565b34801561011f57600080fd5b5061008a61012e366004610f93565b610538565b34801561013f57600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff166100c8565b34801561016a57600080fd5b5061008a610179366004610fcc565b6105f6565b61018661071b565b610190600061079c565b565b600154339073ffffffffffffffffffffffffffffffffffffffff168114610240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6102498161079c565b50565b600042861015610291576040517f300249d700000000000000000000000000000000000000000000000000000000815260048101879052426024820152604401610237565b896000036102cb576040517faf458c0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8716610318576040517fd27b444300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000849003610353576040517fb494d17500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008585600081811061036857610368610ff0565b905060200281019061037a919061101f565b610388906020810190610fcc565b90503415610445578a34146103c9576040517f5e3b87b400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8215610401576040517f283e650d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61040a816107cd565b610440576040517f2b27b8bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61051a565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d81166004830152600091908316906370a0823190602401602060405180830381865afa1580156104b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d9919061105d565b90508b8110156105185783156104f6576104f4828686610821565b505b61051873ffffffffffffffffffffffffffffffffffffffff8316338f8f610838565b505b6105288c8b8b8b8a8a6108d5565b9c9b505050505050505050505050565b61054061071b565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526105f290829073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa1580156105b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d4919061105d565b73ffffffffffffffffffffffffffffffffffffffff851691906109f8565b5050565b6105fe61071b565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915561066160005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610190576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610237565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055610249816106a6565b600073ffffffffffffffffffffffffffffffffffffffff8216158061081b575073ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b92915050565b60006108308433308686610a5f565b949350505050565b60006323b872dd60e01b905060006040518281528560048201528460248201528360448201526020600060648360008b5af19150508015610896573d801561088c57600160005114601f3d11169150610894565b6000873b1191505b505b806108cd576040517ff405907100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b6000806108f873ffffffffffffffffffffffffffffffffffffffff881686610d23565b90508773ffffffffffffffffffffffffffffffffffffffff16632e0ca20134878a88886040518663ffffffff1660e01b815260040161093a94939291906110bf565b6000604051808303818588803b15801561095357600080fd5b505af1158015610967573d6000803e3d6000fd5b50505050506000610997868973ffffffffffffffffffffffffffffffffffffffff16610d2390919063ffffffff16565b905060006109a58383611321565b9050878110156109eb576040517f643f0c860000000000000000000000000000000000000000000000000000000081526004810182905260248101899052604401610237565b9998505050505050505050565b610a24837fa9059cbb000000000000000000000000000000000000000000000000000000008484610ddc565b610a5a576040517ffb7f507900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6040516000907fd505accf00000000000000000000000000000000000000000000000000000000907f8fcbaf0c00000000000000000000000000000000000000000000000000000000907f2b67b57000000000000000000000000000000000000000000000000000000000908560648114610b265760488114610ba35760e08114610c2a576101008114610c485760808114610c66576101808114610ced577f68275857000000000000000000000000000000000000000000000000000000008252600482fd5b848252896004830152886024830152602088013560e01c604489013560208a60448601376001820360648501528060ff1c601b016084850152602060248b0160a48601377f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660c48401525060008060e484828f5af19550610d15565b838252896004830152886024830152600488013560e01c6028890135893560e01c6044850152600182036064850152600160848501528060ff1c601b0160a4850152602060088b0160c48601377f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660e48401525060008061010484828f5af19550610d15565b84825286886004840137600080886004018460008f5af19550610d15565b83825286886004840137600080886004018460008f5af19550610d15565b8282528960048301528a60248301526014886050840137600660148901607e8401376006601a8901609e8401378860a4830152602080890160c484013761010060e483015260406101048301526020604089016101248401376020606089016101448401376000806101848460006e22d473030f116ddee9f6b43ac78ba35af19550610d15565b828252868860048401376000806101848460006e22d473030f116ddee9f6b43ac78ba35af195505b505050505095945050505050565b6000610d2e836107cd565b15610d51575073ffffffffffffffffffffffffffffffffffffffff81163161081b565b8273ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381865afa158015610dbd573d6000803e3d6000fd5b505050506040513d6020811015610dd357600080fd5b50519392505050565b60006040518481528360048201528260248201526020600060448360008a5af19150508015610830573d8015610e1e57600160005114601f3d11169150610e26565b6000863b1191505b50949350505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461024957600080fd5b60008083601f840112610e6357600080fd5b50813567ffffffffffffffff811115610e7b57600080fd5b602083019150836020828501011115610e9357600080fd5b9250929050565b6000806000806000806000806000806101008b8d031215610eba57600080fd5b8a35610ec581610e2f565b995060208b0135985060408b0135610edc81610e2f565b975060608b0135965060808b0135610ef381610e2f565b955060a08b0135945060c08b013567ffffffffffffffff80821115610f1757600080fd5b818d0191508d601f830112610f2b57600080fd5b813581811115610f3a57600080fd5b8e60208260051b8501011115610f4f57600080fd5b6020830196508095505060e08d0135915080821115610f6d57600080fd5b50610f7a8d828e01610e51565b915080935050809150509295989b9194979a5092959850565b60008060408385031215610fa657600080fd5b8235610fb181610e2f565b91506020830135610fc181610e2f565b809150509250929050565b600060208284031215610fde57600080fd5b8135610fe981610e2f565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc183360301811261105357600080fd5b9190910192915050565b60006020828403121561106f57600080fd5b5051919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60006060820173ffffffffffffffffffffffffffffffffffffffff8088168452602081881681860152606060408601528286845260808601905060808760051b87010193508760005b88811015611311577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808887030183527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1808b36030183351261116957600080fd5b8a8335016040880161117b8235610e2f565b878235168952868201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18336030181126111b557600080fd5b90910190813587830167ffffffffffffffff808311156111d457600080fd5b8260051b8036038313156111e757600080fd5b60408b8e0152938390526060938c018401936000908d017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6136889003015b858310156112f6577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08f8803018252843581811261126257600080fd5b88018d8101358852604081013561127881610e2f565b8f16888f01526060810135368290038b01811261129457600080fd5b810160408101908f0135868111156112ab57600080fd5b8036038213156112ba57600080fd5b608060408b01526112cf60808b018284611076565b915050608082013560608a015280985050508c850194508c82019150600183019250611225565b50949c50505096880196505050928501925050600101611108565b50939a9950505050505050505050565b60008282101561135a577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea2646970667358221220026587ba64601b20d9c9b08323484bfae751be7276ed44a975969cf65f8c693764736f6c634300080f0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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.