GLMR Price: $0.020855 (-1.94%)

Contract

0x3494764d3bE100BA489c8BC5C3438E7629c5e5E5

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Swap39901462023-07-14 7:42:54927 days ago1689320574IN
0x3494764d...629c5e5E5
0 GLMR0.06798743127.96334828
Swap39835642023-07-13 9:23:12928 days ago1689240192IN
0x3494764d...629c5e5E5
0 GLMR0.03367348127.01701915
Swap39835542023-07-13 9:21:12928 days ago1689240072IN
0x3494764d...629c5e5E5
1 GLMR0.02941297126.97601352
Swap39406602023-07-07 8:35:24934 days ago1688718924IN
0x3494764d...629c5e5E5
0 GLMR0.09268052133.33120558
Swap39340192023-07-06 10:14:18935 days ago1688638458IN
0x3494764d...629c5e5E5
0 GLMR0.19176827126.77058562
Swap39334612023-07-06 8:22:00935 days ago1688631720IN
0x3494764d...629c5e5E5
8 GLMR0.13338683127.425

Latest 2 internal transactions

Parent Transaction Hash Block From To
39835542023-07-13 9:21:12928 days ago1689240072
0x3494764d...629c5e5E5
1 GLMR
39334612023-07-06 8:22:00935 days ago1688631720
0x3494764d...629c5e5E5
8 GLMR
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AggregationRouter

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {Ownable} from "./helpers/Ownable.sol";
import {EthReceiver} from "./helpers/EthReceiver.sol";
import {Currency, CurrencyLibrary} from "./libraries/CurrencyLibrary.sol";
import {IAggregationExecutor} from './interfaces/IAggregationExecutor.sol';
import {IAggregationRouter} from './interfaces/IAggregationRouter.sol';
import {ReentrancyGuard} from "solmate/utils/ReentrancyGuard.sol";

contract AggregationRouter is IAggregationRouter, Ownable, EthReceiver, ReentrancyGuard {
    using CurrencyLibrary for Currency;

    error ZeroMinReturnAmount();
    error EmptyRouteData();
    error InvalidMsgValue();
    error MinimalOutputBalanceViolation();

    event Swap(
        address sender,
        Currency srcToken,
        Currency dstToken,
        address dstReceiver,
        uint256 amount,
        uint256 returnAmount
    );

    /**
     * @notice Retrieves funds accidently sent directly to the contract address
     * @param currency currency to retrieve
     * @param amount amount to retrieve
     */
    function rescueFunds(Currency currency, uint256 amount) external onlyOwner {
        currency.transfer(msg.sender, amount);
    }

    function swap(
        IAggregationExecutor executor,
        SwapDescription memory desc,
        bytes memory route
    ) 
        external 
        payable
        nonReentrant
        returns (
            uint256 returnAmount,
            uint256 spentAmount
        )  
    {
        if (desc.minReturnAmount == 0) revert ZeroMinReturnAmount();
        if (route.length == 0) revert EmptyRouteData();

        Currency srcToken = desc.srcToken;
        Currency dstToken = desc.dstToken;
        address dstReceiver = desc.dstReceiver == address(0) ? msg.sender : desc.dstReceiver;
        uint256 dstBalanceInitial = dstToken.balanceOf(dstReceiver);

        bool srcNative = srcToken.isNative();
        if (srcNative && msg.value < desc.amount) revert InvalidMsgValue();

        if (!srcNative) {
            srcToken.transferFrom(msg.sender, address(executor), desc.amount);
        }

        {
            bytes memory callData = abi.encodeCall(executor.excute, (msg.sender, desc, route));
            (bool success, bytes memory returnData) = address(executor).call{value: msg.value}(callData);
            if (!success) {
                assembly {
                    revert(add(returnData, 32), mload(returnData))
                }
            }
        }

        spentAmount = desc.amount;
        uint256 dstBalanceFinal = dstToken.balanceOf(dstReceiver);
        returnAmount = dstBalanceFinal - dstBalanceInitial;

        if (returnAmount < desc.minReturnAmount) revert MinimalOutputBalanceViolation();

        emit Swap(msg.sender, desc.srcToken, desc.dstToken, dstReceiver, desc.amount, returnAmount);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

abstract contract Ownable {
    address public owner;
    address public ownerCandidate;

    error InvalidCaller();
    error NotCandidate();

    /// @notice Emitted when the owner of the factory is changed
    /// @param oldOwner The owner before the owner was changed
    /// @param newOwner The owner after the owner was changed
    event OwnerChanged(address indexed oldOwner, address indexed newOwner);

    event Candidate(address indexed newOwner);

    modifier onlyOwner() {
        if (msg.sender != owner) revert InvalidCaller();
        _;
    }

    constructor() {
        owner = msg.sender;
        emit OwnerChanged(address(0), msg.sender);
    }

    function setOwnerCandidate(address _candidate) external onlyOwner {
        ownerCandidate = _candidate;
        emit Candidate(_candidate);
    }

    function candidateConfirm() external {
        if (msg.sender != ownerCandidate) revert NotCandidate();
        emit OwnerChanged(owner, ownerCandidate);
        owner = ownerCandidate;
        ownerCandidate = address(0);
    }
}

File 3 of 14 : EthReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

abstract contract EthReceiver {
    error EthDepositRejected();

    receive() external payable {
        _receive();
    }

    function _receive() internal virtual {
        if (msg.sender == tx.origin) revert EthDepositRejected();
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeTransferLib} from 'solmate/utils/SafeTransferLib.sol';
import {Constants} from "./Constants.sol";

type Currency is address;

/// @title CurrencyLibrary
/// @dev This library allows for transferring and holding native tokens and ERC20 tokens
library CurrencyLibrary {
    using CurrencyLibrary for Currency;
    using SafeERC20 for IERC20;
    using SafeTransferLib for address;

    /// @notice Thrown when a native transfer fails
    error NativeTransferFailed();

    /// @notice Thrown when an ERC20 transfer fails
    error ERC20TransferFailed();

    /// @notice Thrown when an ERC20 approve fails
    error ERC20ApproveFailed();

    Currency public constant NATIVE = Currency.wrap(Constants.NATIVE_ADDRESS);

    function transfer(Currency currency, address to, uint256 amount) internal {
        if (currency.isNative()) {
            to.safeTransferETH(amount);
        } else {
            IERC20(Currency.unwrap(currency)).safeTransfer(to, amount);
        }
    }

    function transferFrom(Currency currency, address from, address to, uint256 amount) internal {
        if (currency.isNative()) {
            revert NativeTransferFailed();
        } else {
            IERC20(Currency.unwrap(currency)).safeTransferFrom(from, to, amount);
        }
    }

    function approve(Currency currency, address to, uint256 amount) internal {
        if (currency.isNative()) {
            revert ERC20ApproveFailed();
        } else {
            IERC20(Currency.unwrap(currency)).safeIncreaseAllowance(to, amount);
        }
    }

    function balanceOfSelf(Currency currency) internal view returns (uint256) {
        return balanceOf(currency, address(this));
    }

    function balanceOf(Currency currency, address owner) internal view returns (uint256) {
        if (currency.isNative()) {
            return owner.balance;
        } else {
            return IERC20(Currency.unwrap(currency)).balanceOf(owner);
        }
    }

    function equals(Currency currency, Currency other) internal pure returns (bool) {
        return Currency.unwrap(currency) == Currency.unwrap(other);
    }

    function isNative(Currency currency) internal pure returns (bool) {
        return Currency.unwrap(currency) == Currency.unwrap(NATIVE);
    }
}

File 5 of 14 : IAggregationExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IAggregationRouter} from '../interfaces/IAggregationRouter.sol';

interface IAggregationExecutor {
    function excute(
        address msgSender,
        IAggregationRouter.SwapDescription memory desc,
        bytes memory route
    ) external payable;
}

File 6 of 14 : IAggregationRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IAggregationExecutor} from "./IAggregationExecutor.sol";
import {Currency} from "../libraries/CurrencyLibrary.sol";

interface IAggregationRouter {
    struct SwapDescription {
        Currency srcToken;
        Currency dstToken;
        address dstReceiver;
        uint256 amount;
        uint256 minReturnAmount;
    }

    function swap(
        IAggregationExecutor executor,
        SwapDescription memory desc,
        bytes memory route
    ) external payable returns (uint256 returnAmount, uint256 spentAmount);
}

File 7 of 14 : ReentrancyGuard.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Gas optimized reentrancy protection for smart contracts.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ReentrancyGuard.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol)
abstract contract ReentrancyGuard {
    uint256 private locked = 1;

    modifier nonReentrant() virtual {
        require(locked == 1, "REENTRANCY");

        locked = 2;

        _;

        locked = 1;
    }
}

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

pragma solidity ^0.8.19;

/**
 * @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.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.19;

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 An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

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

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

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

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

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

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

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

    /**
     * @dev 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);
        if (nonceAfter != nonceBefore + 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

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

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

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

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

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument.
            mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

File 11 of 14 : Constants.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

library Constants {
    /// @dev Used as a flag for identifying the transfer of ETH instead of a token
    address internal constant NATIVE_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    /// @dev Used as a impossible pool address
    address internal constant IMPOSSIBLE_POOL_ADDRESS = 0x0000000000000000000000000000000000000001;
    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
}

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

pragma solidity ^0.8.19;

/**
 * @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) (utils/Address.sol)

pragma solidity ^0.8.19;

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

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

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

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

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

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, 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, defaultRevert);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with a
     * `customRevert` function as a fallback when `target` reverts.
     *
     * Requirements:
     *
     * - `customRevert` must be a reverting function.
     *
     * _Available since v5.0._
     */
    function functionCall(
        address target,
        bytes memory data,
        function() internal view customRevert
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, customRevert);
    }

    /**
     * @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, defaultRevert);
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with a `customRevert` function as a fallback revert reason when `target` reverts.
     *
     * Requirements:
     *
     * - `customRevert` must be a reverting function.
     *
     * _Available since v5.0._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        function() internal view customRevert
    ) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, customRevert);
    }

    /**
     * @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, defaultRevert);
    }

    /**
     * @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,
        function() internal view customRevert
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, customRevert);
    }

    /**
     * @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, defaultRevert);
    }

    /**
     * @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,
        function() internal view customRevert
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, customRevert);
    }

    /**
     * @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 `customRevert`) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v5.0._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        function() internal view customRevert
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check if target is a contract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                if (target.code.length == 0) {
                    revert AddressEmptyCode(target);
                }
            }
            return returndata;
        } else {
            _revert(returndata, customRevert);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or with a default revert error.
     *
     * _Available since v5.0._
     */
    function verifyCallResult(bool success, bytes memory returndata) internal view returns (bytes memory) {
        return verifyCallResult(success, returndata, defaultRevert);
    }

    /**
     * @dev Same as {xref-Address-verifyCallResult-bool-bytes-}[`verifyCallResult`], but with a
     * `customRevert` function as a fallback when `success` is `false`.
     *
     * Requirements:
     *
     * - `customRevert` must be a reverting function.
     *
     * _Available since v5.0._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        function() internal view customRevert
    ) internal view returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, customRevert);
        }
    }

    /**
     * @dev Default reverting function when no `customRevert` is provided in a function call.
     */
    function defaultRevert() internal pure {
        revert FailedInnerCall();
    }

    function _revert(bytes memory returndata, function() internal view customRevert) private view {
        // 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 {
            customRevert();
            revert FailedInnerCall();
        }
    }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 800
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EmptyRouteData","type":"error"},{"inputs":[],"name":"EthDepositRejected","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidCaller","type":"error"},{"inputs":[],"name":"InvalidMsgValue","type":"error"},{"inputs":[],"name":"MinimalOutputBalanceViolation","type":"error"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NotCandidate","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"ZeroMinReturnAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"Candidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"Currency","name":"srcToken","type":"address"},{"indexed":false,"internalType":"Currency","name":"dstToken","type":"address"},{"indexed":false,"internalType":"address","name":"dstReceiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"returnAmount","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[],"name":"candidateConfirm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerCandidate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"Currency","name":"currency","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_candidate","type":"address"}],"name":"setOwnerCandidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAggregationExecutor","name":"executor","type":"address"},{"components":[{"internalType":"Currency","name":"srcToken","type":"address"},{"internalType":"Currency","name":"dstToken","type":"address"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"}],"internalType":"struct IAggregationRouter.SwapDescription","name":"desc","type":"tuple"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256","name":"spentAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052600160025534801561001557600080fd5b50600080546001600160a01b0319163390811782556040519091907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c908290a3610d19806100646000396000f3fe6080604052600436106100695760003560e01c80638da5cb5b116100435780638da5cb5b146100ef5780639a2f2dfa1461010f578063a036c7b11461012f57600080fd5b80633f0232301461007d5780635f504a821461009257806378e3214f146100cf57600080fd5b3661007857610076610157565b005b600080fd5b34801561008957600080fd5b50610076610179565b34801561009e57600080fd5b506001546100b2906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100db57600080fd5b506100766100ea3660046109f2565b610215565b3480156100fb57600080fd5b506000546100b2906001600160a01b031681565b34801561011b57600080fd5b5061007661012a366004610a1e565b610258565b61014261013d366004610b0e565b6102da565b604080519283526020830191909152016100c6565b32330361017757604051631b10b0f960e01b815260040160405180910390fd5b565b6001546001600160a01b031633146101a457604051634f32a51b60e01b815260040160405180910390fd5b600154600080546040516001600160a01b0393841693909116917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91a3600180546000805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b03841617909155169055565b6000546001600160a01b03163314610240576040516348f5c3ed60e01b815260040160405180910390fd5b6102546001600160a01b03831633836105e3565b5050565b6000546001600160a01b03163314610283576040516348f5c3ed60e01b815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f8cc40b9abca4a505a92028908f9d913d621d18112c69412806506f02333f26b490600090a250565b6000806002546001146103345760405162461bcd60e51b815260206004820152600a60248201527f5245454e5452414e43590000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b60028055608084015160000361035d5760405163c74165e360e01b815260040160405180910390fd5b825160000361037f5760405163d2fab0b160e01b815260040160405180910390fd5b8351602085015160408601516000906001600160a01b0316156103a65786604001516103a8565b335b905060006103bf6001600160a01b03841683610633565b90506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148080156103f15750886060015134105b1561040f57604051631841b4e160e01b815260040160405180910390fd5b80610431576060890151610431906001600160a01b0387169033908d906106dd565b60008a6001600160a01b031663f8d09f48338c8c60405160240161045793929190610bec565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808c6001600160a01b031634846040516104b79190610c6b565b60006040518083038185875af1925050503d80600081146104f4576040519150601f19603f3d011682016040523d82523d6000602084013e6104f9565b606091505b50915091508161050b57805160208201fd5b50505060608901519550600061052a6001600160a01b03861685610633565b90506105368382610c87565b9750896080015188101561055d5760405163858a872160e01b815260040160405180910390fd5b89516020808c01516060808e0151604080513381526001600160a01b03968716958101959095529285168484015293881690830152608082019290925260a081018a905290517f20efd6d5195b7b50273f01cd79a27989255356f9f13293edc53ee142accfdb759181900360c00190a15050505050506001600281905550935093915050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384160361061f5761061a6001600160a01b03831682610735565b505050565b61061a6001600160a01b0384168383610790565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384160361066a57506001600160a01b038116316106d7565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190610ca8565b90505b92915050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0385160361071a57604051633d2cec6f60e21b815260040160405180910390fd5b61072f6001600160a01b038516848484610804565b50505050565b600080600080600085875af190508061061a5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c454400000000000000000000000000604482015260640161032b565b6040516001600160a01b0383811660248301526044820183905261061a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061083d565b6040516001600160a01b03848116602483015283811660448301526064820183905261072f9186918216906323b872dd906084016107bd565b60006108526001600160a01b038416836108a0565b905080516000141580156108775750808060200190518101906108759190610cc1565b155b1561061a57604051635274afe760e01b81526001600160a01b038416600482015260240161032b565b60606106d4838360006108b16108ca565b604051630a12f52160e11b815260040160405180910390fd5b6060824710156108ef5760405163cd78605960e01b815230600482015260240161032b565b600080866001600160a01b0316858760405161090b9190610c6b565b60006040518083038185875af1925050503d8060008114610948576040519150601f19603f3d011682016040523d82523d6000602084013e61094d565b606091505b509150915061095e8783838761096b565b925050505b949350505050565b606083156109b95782516000036109b257846001600160a01b03163b6000036109b257604051639996b31560e01b81526001600160a01b038616600482015260240161032b565b5081610963565b61096383838151156109ce5781518083602001fd5b6108b18163ffffffff16565b6001600160a01b03811681146109ef57600080fd5b50565b60008060408385031215610a0557600080fd5b8235610a10816109da565b946020939093013593505050565b600060208284031215610a3057600080fd5b8135610a3b816109da565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715610a7b57610a7b610a42565b60405290565b600082601f830112610a9257600080fd5b813567ffffffffffffffff80821115610aad57610aad610a42565b604051601f8301601f19908116603f01168101908282118183101715610ad557610ad5610a42565b81604052838152866020858801011115610aee57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600083850360e0811215610b2457600080fd5b8435610b2f816109da565b935060a0601f1982011215610b4357600080fd5b50610b4c610a58565b6020850135610b5a816109da565b81526040850135610b6a816109da565b60208201526060850135610b7d816109da565b6040820152608085810135606083015260a086013590820152915060c084013567ffffffffffffffff811115610bb257600080fd5b610bbe86828701610a81565b9150509250925092565b60005b83811015610be3578181015183820152602001610bcb565b50506000910152565b60006001600160a01b0380861683528085511660208401528060208601511660408401528060408601511660608401525060608401516080830152608084015160a083015260e060c083015282518060e0840152610100610c538282860160208801610bc8565b80601f19601f84011685010192505050949350505050565b60008251610c7d818460208701610bc8565b9190910192915050565b818103818111156106d757634e487b7160e01b600052601160045260246000fd5b600060208284031215610cba57600080fd5b5051919050565b600060208284031215610cd357600080fd5b81518015158114610a3b57600080fdfea26469706673582212207a3b8f0a8939503f27575745b381399a63eb1c90593f800c118a5e6b811197ea64736f6c63430008130033

Deployed Bytecode

0x6080604052600436106100695760003560e01c80638da5cb5b116100435780638da5cb5b146100ef5780639a2f2dfa1461010f578063a036c7b11461012f57600080fd5b80633f0232301461007d5780635f504a821461009257806378e3214f146100cf57600080fd5b3661007857610076610157565b005b600080fd5b34801561008957600080fd5b50610076610179565b34801561009e57600080fd5b506001546100b2906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100db57600080fd5b506100766100ea3660046109f2565b610215565b3480156100fb57600080fd5b506000546100b2906001600160a01b031681565b34801561011b57600080fd5b5061007661012a366004610a1e565b610258565b61014261013d366004610b0e565b6102da565b604080519283526020830191909152016100c6565b32330361017757604051631b10b0f960e01b815260040160405180910390fd5b565b6001546001600160a01b031633146101a457604051634f32a51b60e01b815260040160405180910390fd5b600154600080546040516001600160a01b0393841693909116917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91a3600180546000805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b03841617909155169055565b6000546001600160a01b03163314610240576040516348f5c3ed60e01b815260040160405180910390fd5b6102546001600160a01b03831633836105e3565b5050565b6000546001600160a01b03163314610283576040516348f5c3ed60e01b815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f8cc40b9abca4a505a92028908f9d913d621d18112c69412806506f02333f26b490600090a250565b6000806002546001146103345760405162461bcd60e51b815260206004820152600a60248201527f5245454e5452414e43590000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b60028055608084015160000361035d5760405163c74165e360e01b815260040160405180910390fd5b825160000361037f5760405163d2fab0b160e01b815260040160405180910390fd5b8351602085015160408601516000906001600160a01b0316156103a65786604001516103a8565b335b905060006103bf6001600160a01b03841683610633565b90506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148080156103f15750886060015134105b1561040f57604051631841b4e160e01b815260040160405180910390fd5b80610431576060890151610431906001600160a01b0387169033908d906106dd565b60008a6001600160a01b031663f8d09f48338c8c60405160240161045793929190610bec565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808c6001600160a01b031634846040516104b79190610c6b565b60006040518083038185875af1925050503d80600081146104f4576040519150601f19603f3d011682016040523d82523d6000602084013e6104f9565b606091505b50915091508161050b57805160208201fd5b50505060608901519550600061052a6001600160a01b03861685610633565b90506105368382610c87565b9750896080015188101561055d5760405163858a872160e01b815260040160405180910390fd5b89516020808c01516060808e0151604080513381526001600160a01b03968716958101959095529285168484015293881690830152608082019290925260a081018a905290517f20efd6d5195b7b50273f01cd79a27989255356f9f13293edc53ee142accfdb759181900360c00190a15050505050506001600281905550935093915050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384160361061f5761061a6001600160a01b03831682610735565b505050565b61061a6001600160a01b0384168383610790565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384160361066a57506001600160a01b038116316106d7565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa1580156106b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d49190610ca8565b90505b92915050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0385160361071a57604051633d2cec6f60e21b815260040160405180910390fd5b61072f6001600160a01b038516848484610804565b50505050565b600080600080600085875af190508061061a5760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c454400000000000000000000000000604482015260640161032b565b6040516001600160a01b0383811660248301526044820183905261061a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061083d565b6040516001600160a01b03848116602483015283811660448301526064820183905261072f9186918216906323b872dd906084016107bd565b60006108526001600160a01b038416836108a0565b905080516000141580156108775750808060200190518101906108759190610cc1565b155b1561061a57604051635274afe760e01b81526001600160a01b038416600482015260240161032b565b60606106d4838360006108b16108ca565b604051630a12f52160e11b815260040160405180910390fd5b6060824710156108ef5760405163cd78605960e01b815230600482015260240161032b565b600080866001600160a01b0316858760405161090b9190610c6b565b60006040518083038185875af1925050503d8060008114610948576040519150601f19603f3d011682016040523d82523d6000602084013e61094d565b606091505b509150915061095e8783838761096b565b925050505b949350505050565b606083156109b95782516000036109b257846001600160a01b03163b6000036109b257604051639996b31560e01b81526001600160a01b038616600482015260240161032b565b5081610963565b61096383838151156109ce5781518083602001fd5b6108b18163ffffffff16565b6001600160a01b03811681146109ef57600080fd5b50565b60008060408385031215610a0557600080fd5b8235610a10816109da565b946020939093013593505050565b600060208284031215610a3057600080fd5b8135610a3b816109da565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715610a7b57610a7b610a42565b60405290565b600082601f830112610a9257600080fd5b813567ffffffffffffffff80821115610aad57610aad610a42565b604051601f8301601f19908116603f01168101908282118183101715610ad557610ad5610a42565b81604052838152866020858801011115610aee57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600083850360e0811215610b2457600080fd5b8435610b2f816109da565b935060a0601f1982011215610b4357600080fd5b50610b4c610a58565b6020850135610b5a816109da565b81526040850135610b6a816109da565b60208201526060850135610b7d816109da565b6040820152608085810135606083015260a086013590820152915060c084013567ffffffffffffffff811115610bb257600080fd5b610bbe86828701610a81565b9150509250925092565b60005b83811015610be3578181015183820152602001610bcb565b50506000910152565b60006001600160a01b0380861683528085511660208401528060208601511660408401528060408601511660608401525060608401516080830152608084015160a083015260e060c083015282518060e0840152610100610c538282860160208801610bc8565b80601f19601f84011685010192505050949350505050565b60008251610c7d818460208701610bc8565b9190910192915050565b818103818111156106d757634e487b7160e01b600052601160045260246000fd5b600060208284031215610cba57600080fd5b5051919050565b600060208284031215610cd357600080fd5b81518015158114610a3b57600080fdfea26469706673582212207a3b8f0a8939503f27575745b381399a63eb1c90593f800c118a5e6b811197ea64736f6c63430008130033

Block Transaction Gas Used Reward
view all blocks collator

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

Validator Index Block Amount
View All Withdrawals

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

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