S Price: $0.872759 (+0.82%)

Contract

0x108e823a26C5FB096D1f7c493809ccE9015507a6

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Swap Info56987212025-01-28 17:38:5123 days ago1738085931IN
0x108e823a...9015507a6
0 S0.0139970155.01
Renounce Deploye...51123052025-01-23 10:56:1828 days ago1737629778IN
0x108e823a...9015507a6
0 S0.001385255.01

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GoatSwapper

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 200 runs

Other Settings:
shanghai EvmVersion
File 1 of 6 : GoatSwapper.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

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

contract GoatSwapper {
    using SafeERC20 for IERC20;
    using BytesLib for bytes;

    struct SwapInfo {
        address router;
        bytes data;
        uint256 amountIndex;
    }

    mapping(address => mapping(address => SwapInfo)) public swapInfo;

    address public native;
    address public keeper;
    address public deployer;

    constructor(address _native, address _keeper) {
        native = _native;
        keeper = _keeper;
        deployer = msg.sender;
    }

    modifier onlyManager() {
        require(msg.sender == deployer || msg.sender == keeper, "!manager");
        _;
    }

    /// @notice There is no swap data from  _fromToken to _toToken
    /// @param fromToken Swap from Token
    /// @param toToken Swap to Token
    error NoSwapData(address fromToken, address toToken);

    /// @notice A swap with a route, failed
    /// @param router Router that threw the error
    /// @param data Swap data
    error SwapFailed(address router, bytes data);

    /// @notice Event called for a successful swap
    /// @param caller Who called the swap transaction
    /// @param fromToken Swap from Token
    /// @param toToken Swap to Token
    /// @param amountIn from Amount
    /// @param amountOut to Amount
    event Swap(address indexed caller, address indexed fromToken, address indexed toToken, uint256 amountIn, uint256 amountOut);

    /// @notice Event called when swap info has been set
    /// @param fromToken Swap from Token
    /// @param toToken Swap to Token
    /// @param swapInfo Swap info provided
    event SetSwapInfo(address indexed fromToken, address indexed toToken, SwapInfo swapInfo);


    /// @notice Swap from _fromToken to _toToken
    /// @param _fromToken Swap from Token
    /// @param _toToken Swap to Token
    /// @param _amountIn Amount of from to swap
    function swap(address _fromToken, address _toToken, uint256 _amountIn) external returns (uint256 amountOut) {
        IERC20(_fromToken).safeTransferFrom(msg.sender, address(this), _amountIn);
        _executeSwap(_fromToken, _toToken, _amountIn);
        amountOut = IERC20(_toToken).balanceOf(address(this));
        IERC20(_toToken).safeTransfer(msg.sender, amountOut);
        emit Swap(msg.sender, _fromToken, _toToken, _amountIn, amountOut);
    }

    function _executeSwap(address _fromToken, address _toToken, uint256 _amountIn) private {
        SwapInfo memory swapData = swapInfo[_fromToken][_toToken];
        address router = swapData.router;
        if (router == address(0)) revert NoSwapData(_fromToken, _toToken);
        bytes memory data = swapData.data;

        data = _insertData(data, swapData.amountIndex, abi.encode(_amountIn));

        _approveTokenIfNeeded(_fromToken, router);
        (bool success,) = router.call(data);
        if (!success) revert SwapFailed(router, data);
    }

    function _insertData(bytes memory _data, uint256 _index, bytes memory _newData) private pure returns (bytes memory data) {
        data = bytes.concat(
            bytes.concat(
                _data.slice(0, _index),
                _newData
            ),
            _data.slice(_index + 32, _data.length - (_index + 32))
        );
    }

    /// @notice Set swap info
    /// @param _fromToken Swap from Token
    /// @param _toToken Swap to Token
    /// @param _swapInfo Swap info provided
    function setSwapInfo(address _fromToken, address _toToken, SwapInfo calldata _swapInfo) external onlyManager {
        swapInfo[_fromToken][_toToken] = _swapInfo;
        emit SetSwapInfo(_fromToken, _toToken, _swapInfo);
    }

    /// @notice Set swap info
    /// @param _fromTokens Swap from Token address array
    /// @param _toTokens Swap to Token address array
    /// @param _swapInfos Swap infos 
    function setSwapInfos(address[] calldata _fromTokens, address[] calldata _toTokens, SwapInfo[] calldata _swapInfos) external onlyManager {
        uint256 tokenLength = _fromTokens.length;
        for (uint i; i < tokenLength;) {
            swapInfo[_fromTokens[i]][_toTokens[i]] = _swapInfos[i];
            emit SetSwapInfo(_fromTokens[i], _toTokens[i], _swapInfos[i]);
            unchecked {++i;}
        }
    }

    function _approveTokenIfNeeded(address token, address spender) private {
        if (IERC20(token).allowance(address(this), spender) == 0) {
            IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);
        }
    }

    /// @notice Return the data to swap from native to _token
    /// @param _token Token to swap to
    /// @return router Router used
    /// @return data Swap data
    /// @return amountIndex Bytes index where the swap amount will be inserted
    function fromNative(address _token) external view returns (address router, bytes memory data, uint256 amountIndex) {
        router = swapInfo[native][_token].router;
        data = swapInfo[native][_token].data;
        amountIndex = swapInfo[native][_token].amountIndex;
    }

    /// @notice Return the data to swap from _token to native
    /// @param _token Token to swap to
    /// @return router Router used
    /// @return data Swap data
    /// @return amountIndex Bytes index where the swap amount will be inserted
    function toNative(address _token) external view returns (address router, bytes memory data, uint256 amountIndex) {
        router = swapInfo[_token][native].router;
        data = swapInfo[_token][native].data;
        amountIndex = swapInfo[_token][native].amountIndex;
    }

    /// @notice Set a new keeper address
    /// @param _keeper Keeper address
    function setKeeper(address _keeper) external onlyManager {
        keeper = _keeper;
    }

    /// @notice Renounce the ownership of the deployer so only the manager has permissions
    function renounceDeployer() public onlyManager {
        deployer = address(0);
    }
}

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 6 : BytesLib.sol
// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;


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

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

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

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

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

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

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

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

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

        return tempBytes;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        bytes memory tempBytes;

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

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

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

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

                mstore(tempBytes, _length)

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

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

        return tempBytes;
    }

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

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

        return tempAddress;
    }

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

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

        return tempUint;
    }

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

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

        return tempUint;
    }

    function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {
        require(_start + 3 >= _start, 'toUint24_overflow');
        require(_bytes.length >= _start + 3, 'toUint24_outOfBounds');
        uint24 tempUint;

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

        return tempUint;
    }

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

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

        return tempUint;
    }

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

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

        return tempUint;
    }

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

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

        return tempUint;
    }

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

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

        return tempUint;
    }

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

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

        return tempUint;
    }

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

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

        return tempBytes32;
    }

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

        assembly {
            let length := mload(_preBytes)

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

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

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

        return success;
    }

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

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

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

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

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

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

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

        return success;
    }
}

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "src/=src/",
    "interfaces/=src/interfaces/",
    "test-utils/=test/utils/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "@openzeppelin-4/contracts/=lib/openzeppelin-contracts-4/contracts/",
    "@layerzero/=lib/solidity-examples/contracts/",
    "@aave/=lib/aave-v3-origin/src/",
    "@xerc20/=lib/xERC20/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "@uniswap/v3-core/=lib/v3-core/",
    "@addressbook/=lib/goat-address-book/src/sol/",
    "@trust-security/trustlessPermit/=lib/trustlessPermit/",
    "@uniswapV3-periphery/=lib/v3-periphery/contracts/",
    "@prb/math/=lib/prb-math/",
    "@properties/=lib/properties/",
    "@prb/test/=lib/prb-math/node_modules/@prb/test/",
    "ERC4626/=lib/properties/lib/ERC4626/contracts/",
    "aave-v3-core/=lib/aave-v3-origin/src/core/",
    "aave-v3-origin/=lib/aave-v3-origin/",
    "aave-v3-periphery/=lib/aave-v3-origin/src/periphery/",
    "common/=lib/common/",
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "erc4626-tests/=lib/erc4626-tests/",
    "goat-address-book/=lib/goat-address-book/",
    "openzeppelin-contracts-4/=lib/openzeppelin-contracts-4/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/openzeppelin-contracts-4/contracts/",
    "prb-math/=lib/prb-math/src/",
    "properties/=lib/properties/contracts/",
    "solidity-examples/=lib/solidity-examples/contracts/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
    "solidity-utils/=lib/aave-v3-origin/lib/solidity-utils/",
    "solmate/=lib/solmate/src/",
    "trustlessPermit/=lib/trustlessPermit/",
    "v3-core/=lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/",
    "xERC20/=lib/xERC20/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_native","type":"address"},{"internalType":"address","name":"_keeper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"}],"name":"NoSwapData","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"SwapFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"indexed":false,"internalType":"struct GoatSwapper.SwapInfo","name":"swapInfo","type":"tuple"}],"name":"SetSwapInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"fromNative","outputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"keeper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"native","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceDeployer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_keeper","type":"address"}],"name":"setKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"address","name":"_toToken","type":"address"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"internalType":"struct GoatSwapper.SwapInfo","name":"_swapInfo","type":"tuple"}],"name":"setSwapInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_fromTokens","type":"address[]"},{"internalType":"address[]","name":"_toTokens","type":"address[]"},{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"internalType":"struct GoatSwapper.SwapInfo[]","name":"_swapInfos","type":"tuple[]"}],"name":"setSwapInfos","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"address","name":"_toToken","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"swapInfo","outputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"toNative","outputs":[{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountIndex","type":"uint256"}],"stateMutability":"view","type":"function"}]

6080604052348015600e575f5ffd5b50604051611789380380611789833981016040819052602b916085565b600180546001600160a01b039384166001600160a01b031991821617909155600280549290931691811691909117909155600380549091163317905560b1565b80516001600160a01b03811681146080575f5ffd5b919050565b5f5f604083850312156095575f5ffd5b609c83606b565b915060a860208401606b565b90509250929050565b6116cb806100be5f395ff3fe608060405234801561000f575f5ffd5b50600436106100a6575f3560e01c806384aad7fd1161006e57806384aad7fd1461013b578063aced16611461014e578063bf6f00d814610161578063d5f3948814610169578063df791e501461017c578063e0146c8e1461019d575f5ffd5b80631147e140146100aa57806311b0b42d146100d5578063336748a2146101005780633c8f579014610115578063748747e614610128575b5f5ffd5b6100bd6100b8366004611089565b6101b0565b6040516100cc939291906110f1565b60405180910390f35b6001546100e8906001600160a01b031681565b6040516001600160a01b0390911681526020016100cc565b61011361010e36600461116c565b6102a2565b005b6100bd610123366004611089565b61047a565b610113610136366004611089565b610568565b61011361014936600461120b565b6105c9565b6002546100e8906001600160a01b031681565b610113610689565b6003546100e8906001600160a01b031681565b61018f61018a36600461126f565b6106da565b6040519081526020016100cc565b6100bd6101ab3660046112ad565b6107c9565b600180546001600160a01b039081165f90815260208181526040808320868516845290915281208054930180549390921692606092906101ef906112e4565b80601f016020809104026020016040519081016040528092919081815260200182805461021b906112e4565b80156102665780601f1061023d57610100808354040283529160200191610266565b820191905f5260205f20905b81548152906001019060200180831161024957829003601f168201915b50506001546001600160a01b039081165f908152602081815260408083209b909316825299909952909720600201549597929650919350505050565b6003546001600160a01b03163314806102c557506002546001600160a01b031633145b6102ea5760405162461bcd60e51b81526004016102e19061131c565b60405180910390fd5b845f5b81811015610470578383828181106103075761030761133e565b90506020028101906103199190611352565b5f5f8a8a8581811061032d5761032d61133e565b90506020020160208101906103429190611089565b6001600160a01b03166001600160a01b031681526020019081526020015f205f8888858181106103745761037461133e565b90506020020160208101906103899190611089565b6001600160a01b0316815260208101919091526040015f206103ab82826113cf565b9050508585828181106103c0576103c061133e565b90506020020160208101906103d59190611089565b6001600160a01b03168888838181106103f0576103f061133e565b90506020020160208101906104059190611089565b6001600160a01b03167fce356dc68ba93633de7c8929e481a61ef7301124ddecd06f9e326896f5e43d4b8686858181106104415761044161133e565b90506020028101906104539190611352565b604051610460919061152c565b60405180910390a36001016102ed565b5050505050505050565b6001600160a01b038181165f908152602081815260408083206001805486168552925282208054910180549190931692606092916104b7906112e4565b80601f01602080910402602001604051908101604052809291908181526020018280546104e3906112e4565b801561052e5780601f106105055761010080835404028352916020019161052e565b820191905f5260205f20905b81548152906001019060200180831161051157829003601f168201915b505050506001600160a01b039586165f90815260208181526040808320600154909916835297905295909520600201549395909450915050565b6003546001600160a01b031633148061058b57506002546001600160a01b031633145b6105a75760405162461bcd60e51b81526004016102e19061131c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314806105ec57506002546001600160a01b031633145b6106085760405162461bcd60e51b81526004016102e19061131c565b6001600160a01b038084165f90815260208181526040808320938616835292905220819061063682826113cf565b905050816001600160a01b0316836001600160a01b03167fce356dc68ba93633de7c8929e481a61ef7301124ddecd06f9e326896f5e43d4b8360405161067c919061152c565b60405180910390a3505050565b6003546001600160a01b03163314806106ac57506002546001600160a01b031633145b6106c85760405162461bcd60e51b81526004016102e19061131c565b600380546001600160a01b0319169055565b5f6106f06001600160a01b038516333085610883565b6106fb8484846108f0565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa15801561073d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061076191906115bb565b90506107776001600160a01b0384163383610ad0565b60408051838152602081018390526001600160a01b03808616929087169133917fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e46062910160405180910390a49392505050565b5f602081815292815260408082209093529081522080546001820180546001600160a01b0390921692916107fc906112e4565b80601f0160208091040260200160405190810160405280929190818152602001828054610828906112e4565b80156108735780601f1061084a57610100808354040283529160200191610873565b820191905f5260205f20905b81548152906001019060200180831161085657829003601f168201915b5050505050908060020154905083565b6040516001600160a01b0384811660248301528381166044830152606482018390526108ea9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610b06565b50505050565b6001600160a01b038084165f90815260208181526040808320868516845282528083208151606081019092528054909416815260018401805493949193919284019161093b906112e4565b80601f0160208091040260200160405190810160405280929190818152602001828054610967906112e4565b80156109b25780601f10610989576101008083540402835291602001916109b2565b820191905f5260205f20905b81548152906001019060200180831161099557829003601f168201915b50505091835250506002919091015460209091015280519091506001600160a01b038116610a065760405163661af8a960e11b81526001600160a01b038087166004830152851660248201526044016102e1565b5f82602001519050610a3e81846040015186604051602001610a2a91815260200190565b604051602081830303815290604052610b67565b9050610a4a8683610bec565b5f826001600160a01b031682604051610a6391906115d2565b5f604051808303815f865af19150503d805f8114610a9c576040519150601f19603f3d011682016040523d82523d5f602084013e610aa1565b606091505b5050905080610ac7578282604051630de816ad60e31b81526004016102e19291906115e3565b50505050505050565b6040516001600160a01b03838116602483015260448201839052610b0191859182169063a9059cbb906064016108b8565b505050565b5f610b1a6001600160a01b03841683610c79565b905080515f14158015610b3e575080806020019051810190610b3c919061160e565b155b15610b0157604051635274afe760e01b81526001600160a01b03841660048201526024016102e1565b6060610b74845f85610c8f565b82604051602001610b8692919061162d565b60408051601f19818403018152919052610bc3610ba485602061166f565b610baf86602061166f565b8751610bbb9190611682565b879190610c8f565b604051602001610bd492919061162d565b60405160208183030381529060405290509392505050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015610c36573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c5a91906115bb565b5f03610c7557610c756001600160a01b038316825f19610d9d565b5050565b6060610c8683835f610e24565b90505b92915050565b606081610c9d81601f61166f565b1015610cdc5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016102e1565b610ce6828461166f565b84511015610d2a5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102e1565b606082158015610d485760405191505f825260208201604052610d92565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015610d81578051835260209283019201610d69565b5050858452601f01601f1916604052505b5090505b9392505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301525f919085169063dd62ed3e90604401602060405180830381865afa158015610dea573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0e91906115bb565b90506108ea8484610e1f858561166f565b610ebd565b606081471015610e495760405163cd78605960e01b81523060048201526024016102e1565b5f5f856001600160a01b03168486604051610e6491906115d2565b5f6040518083038185875af1925050503d805f8114610e9e576040519150601f19603f3d011682016040523d82523d5f602084013e610ea3565b606091505b5091509150610eb3868383610f4c565b9695505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610f0e8482610fa8565b6108ea576040516001600160a01b0384811660248301525f6044830152610f4291869182169063095ea7b3906064016108b8565b6108ea8482610b06565b606082610f6157610f5c82611049565b610d96565b8151158015610f7857506001600160a01b0384163b155b15610fa157604051639996b31560e01b81526001600160a01b03851660048201526024016102e1565b5080610d96565b5f5f5f846001600160a01b031684604051610fc391906115d2565b5f604051808303815f865af19150503d805f8114610ffc576040519150601f19603f3d011682016040523d82523d5f602084013e611001565b606091505b509150915081801561102b57508051158061102b57508080602001905181019061102b919061160e565b801561104057505f856001600160a01b03163b115b95945050505050565b8051156110595780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b0381168114611072575f5ffd5b5f60208284031215611099575f5ffd5b8135610d9681611075565b5f5b838110156110be5781810151838201526020016110a6565b50505f910152565b5f81518084526110dd8160208601602086016110a4565b601f01601f19169290920160200192915050565b6001600160a01b03841681526060602082018190525f90611114908301856110c6565b9050826040830152949350505050565b5f5f83601f840112611134575f5ffd5b50813567ffffffffffffffff81111561114b575f5ffd5b6020830191508360208260051b8501011115611165575f5ffd5b9250929050565b5f5f5f5f5f5f60608789031215611181575f5ffd5b863567ffffffffffffffff811115611197575f5ffd5b6111a389828a01611124565b909750955050602087013567ffffffffffffffff8111156111c2575f5ffd5b6111ce89828a01611124565b909550935050604087013567ffffffffffffffff8111156111ed575f5ffd5b6111f989828a01611124565b979a9699509497509295939492505050565b5f5f5f6060848603121561121d575f5ffd5b833561122881611075565b9250602084013561123881611075565b9150604084013567ffffffffffffffff811115611253575f5ffd5b840160608187031215611264575f5ffd5b809150509250925092565b5f5f5f60608486031215611281575f5ffd5b833561128c81611075565b9250602084013561129c81611075565b929592945050506040919091013590565b5f5f604083850312156112be575f5ffd5b82356112c981611075565b915060208301356112d981611075565b809150509250929050565b600181811c908216806112f857607f821691505b60208210810361131657634e487b7160e01b5f52602260045260245ffd5b50919050565b60208082526008908201526710b6b0b730b3b2b960c11b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b5f8235605e19833603018112611366575f5ffd5b9190910192915050565b634e487b7160e01b5f52604160045260245ffd5b601f821115610b0157805f5260205f20601f840160051c810160208510156113a95750805b601f840160051c820191505b818110156113c8575f81556001016113b5565b5050505050565b81356113da81611075565b81546001600160a01b0319166001600160a01b0391909116178155602082013536839003601e1901811261140c575f5ffd5b8201803567ffffffffffffffff811115611424575f5ffd5b602082019150803603821315611438575f5ffd5b6001830167ffffffffffffffff82111561145457611454611370565b6114688261146283546112e4565b83611384565b5f601f831160018114611499575f84156114825750848201355b5f19600386901b1c1916600185901b1783556114f0565b5f83815260208120601f198616915b828110156114c857878501358255602094850194600190920191016114a8565b50858210156114e4575f1960f88760031b161c19848801351681555b505060018460011b0183555b505050505060409190910135600290910155565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f823561153c81611075565b6001600160a01b031660208381019190915283013536849003601e19018112611563575f5ffd5b830160208101903567ffffffffffffffff81111561157f575f5ffd5b80360382131561158d575f5ffd5b606060408501526115a2608085018284611504565b6040959095013560609490940193909352509192915050565b5f602082840312156115cb575f5ffd5b5051919050565b5f82516113668184602087016110a4565b6001600160a01b03831681526040602082018190525f90611606908301846110c6565b949350505050565b5f6020828403121561161e575f5ffd5b81518015158114610d96575f5ffd5b5f835161163e8184602088016110a4565b8351908301906116528183602088016110a4565b01949350505050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610c8957610c8961165b565b81810381811115610c8957610c8961165b56fea2646970667358221220ef58a50683dc6acc4193573d7ff1a9c7684bd9643c22dcb17426687f889b1da464736f6c634300081b0033000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38000000000000000000000000bd297b4f9991fd23f54e14111ee6190c4fb9f7e1

Deployed Bytecode

0x608060405234801561000f575f5ffd5b50600436106100a6575f3560e01c806384aad7fd1161006e57806384aad7fd1461013b578063aced16611461014e578063bf6f00d814610161578063d5f3948814610169578063df791e501461017c578063e0146c8e1461019d575f5ffd5b80631147e140146100aa57806311b0b42d146100d5578063336748a2146101005780633c8f579014610115578063748747e614610128575b5f5ffd5b6100bd6100b8366004611089565b6101b0565b6040516100cc939291906110f1565b60405180910390f35b6001546100e8906001600160a01b031681565b6040516001600160a01b0390911681526020016100cc565b61011361010e36600461116c565b6102a2565b005b6100bd610123366004611089565b61047a565b610113610136366004611089565b610568565b61011361014936600461120b565b6105c9565b6002546100e8906001600160a01b031681565b610113610689565b6003546100e8906001600160a01b031681565b61018f61018a36600461126f565b6106da565b6040519081526020016100cc565b6100bd6101ab3660046112ad565b6107c9565b600180546001600160a01b039081165f90815260208181526040808320868516845290915281208054930180549390921692606092906101ef906112e4565b80601f016020809104026020016040519081016040528092919081815260200182805461021b906112e4565b80156102665780601f1061023d57610100808354040283529160200191610266565b820191905f5260205f20905b81548152906001019060200180831161024957829003601f168201915b50506001546001600160a01b039081165f908152602081815260408083209b909316825299909952909720600201549597929650919350505050565b6003546001600160a01b03163314806102c557506002546001600160a01b031633145b6102ea5760405162461bcd60e51b81526004016102e19061131c565b60405180910390fd5b845f5b81811015610470578383828181106103075761030761133e565b90506020028101906103199190611352565b5f5f8a8a8581811061032d5761032d61133e565b90506020020160208101906103429190611089565b6001600160a01b03166001600160a01b031681526020019081526020015f205f8888858181106103745761037461133e565b90506020020160208101906103899190611089565b6001600160a01b0316815260208101919091526040015f206103ab82826113cf565b9050508585828181106103c0576103c061133e565b90506020020160208101906103d59190611089565b6001600160a01b03168888838181106103f0576103f061133e565b90506020020160208101906104059190611089565b6001600160a01b03167fce356dc68ba93633de7c8929e481a61ef7301124ddecd06f9e326896f5e43d4b8686858181106104415761044161133e565b90506020028101906104539190611352565b604051610460919061152c565b60405180910390a36001016102ed565b5050505050505050565b6001600160a01b038181165f908152602081815260408083206001805486168552925282208054910180549190931692606092916104b7906112e4565b80601f01602080910402602001604051908101604052809291908181526020018280546104e3906112e4565b801561052e5780601f106105055761010080835404028352916020019161052e565b820191905f5260205f20905b81548152906001019060200180831161051157829003601f168201915b505050506001600160a01b039586165f90815260208181526040808320600154909916835297905295909520600201549395909450915050565b6003546001600160a01b031633148061058b57506002546001600160a01b031633145b6105a75760405162461bcd60e51b81526004016102e19061131c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b03163314806105ec57506002546001600160a01b031633145b6106085760405162461bcd60e51b81526004016102e19061131c565b6001600160a01b038084165f90815260208181526040808320938616835292905220819061063682826113cf565b905050816001600160a01b0316836001600160a01b03167fce356dc68ba93633de7c8929e481a61ef7301124ddecd06f9e326896f5e43d4b8360405161067c919061152c565b60405180910390a3505050565b6003546001600160a01b03163314806106ac57506002546001600160a01b031633145b6106c85760405162461bcd60e51b81526004016102e19061131c565b600380546001600160a01b0319169055565b5f6106f06001600160a01b038516333085610883565b6106fb8484846108f0565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa15801561073d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061076191906115bb565b90506107776001600160a01b0384163383610ad0565b60408051838152602081018390526001600160a01b03808616929087169133917fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e46062910160405180910390a49392505050565b5f602081815292815260408082209093529081522080546001820180546001600160a01b0390921692916107fc906112e4565b80601f0160208091040260200160405190810160405280929190818152602001828054610828906112e4565b80156108735780601f1061084a57610100808354040283529160200191610873565b820191905f5260205f20905b81548152906001019060200180831161085657829003601f168201915b5050505050908060020154905083565b6040516001600160a01b0384811660248301528381166044830152606482018390526108ea9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610b06565b50505050565b6001600160a01b038084165f90815260208181526040808320868516845282528083208151606081019092528054909416815260018401805493949193919284019161093b906112e4565b80601f0160208091040260200160405190810160405280929190818152602001828054610967906112e4565b80156109b25780601f10610989576101008083540402835291602001916109b2565b820191905f5260205f20905b81548152906001019060200180831161099557829003601f168201915b50505091835250506002919091015460209091015280519091506001600160a01b038116610a065760405163661af8a960e11b81526001600160a01b038087166004830152851660248201526044016102e1565b5f82602001519050610a3e81846040015186604051602001610a2a91815260200190565b604051602081830303815290604052610b67565b9050610a4a8683610bec565b5f826001600160a01b031682604051610a6391906115d2565b5f604051808303815f865af19150503d805f8114610a9c576040519150601f19603f3d011682016040523d82523d5f602084013e610aa1565b606091505b5050905080610ac7578282604051630de816ad60e31b81526004016102e19291906115e3565b50505050505050565b6040516001600160a01b03838116602483015260448201839052610b0191859182169063a9059cbb906064016108b8565b505050565b5f610b1a6001600160a01b03841683610c79565b905080515f14158015610b3e575080806020019051810190610b3c919061160e565b155b15610b0157604051635274afe760e01b81526001600160a01b03841660048201526024016102e1565b6060610b74845f85610c8f565b82604051602001610b8692919061162d565b60408051601f19818403018152919052610bc3610ba485602061166f565b610baf86602061166f565b8751610bbb9190611682565b879190610c8f565b604051602001610bd492919061162d565b60405160208183030381529060405290509392505050565b604051636eb1769f60e11b81523060048201526001600160a01b03828116602483015283169063dd62ed3e90604401602060405180830381865afa158015610c36573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c5a91906115bb565b5f03610c7557610c756001600160a01b038316825f19610d9d565b5050565b6060610c8683835f610e24565b90505b92915050565b606081610c9d81601f61166f565b1015610cdc5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016102e1565b610ce6828461166f565b84511015610d2a5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102e1565b606082158015610d485760405191505f825260208201604052610d92565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015610d81578051835260209283019201610d69565b5050858452601f01601f1916604052505b5090505b9392505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301525f919085169063dd62ed3e90604401602060405180830381865afa158015610dea573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0e91906115bb565b90506108ea8484610e1f858561166f565b610ebd565b606081471015610e495760405163cd78605960e01b81523060048201526024016102e1565b5f5f856001600160a01b03168486604051610e6491906115d2565b5f6040518083038185875af1925050503d805f8114610e9e576040519150601f19603f3d011682016040523d82523d5f602084013e610ea3565b606091505b5091509150610eb3868383610f4c565b9695505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610f0e8482610fa8565b6108ea576040516001600160a01b0384811660248301525f6044830152610f4291869182169063095ea7b3906064016108b8565b6108ea8482610b06565b606082610f6157610f5c82611049565b610d96565b8151158015610f7857506001600160a01b0384163b155b15610fa157604051639996b31560e01b81526001600160a01b03851660048201526024016102e1565b5080610d96565b5f5f5f846001600160a01b031684604051610fc391906115d2565b5f604051808303815f865af19150503d805f8114610ffc576040519150601f19603f3d011682016040523d82523d5f602084013e611001565b606091505b509150915081801561102b57508051158061102b57508080602001905181019061102b919061160e565b801561104057505f856001600160a01b03163b115b95945050505050565b8051156110595780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50565b6001600160a01b0381168114611072575f5ffd5b5f60208284031215611099575f5ffd5b8135610d9681611075565b5f5b838110156110be5781810151838201526020016110a6565b50505f910152565b5f81518084526110dd8160208601602086016110a4565b601f01601f19169290920160200192915050565b6001600160a01b03841681526060602082018190525f90611114908301856110c6565b9050826040830152949350505050565b5f5f83601f840112611134575f5ffd5b50813567ffffffffffffffff81111561114b575f5ffd5b6020830191508360208260051b8501011115611165575f5ffd5b9250929050565b5f5f5f5f5f5f60608789031215611181575f5ffd5b863567ffffffffffffffff811115611197575f5ffd5b6111a389828a01611124565b909750955050602087013567ffffffffffffffff8111156111c2575f5ffd5b6111ce89828a01611124565b909550935050604087013567ffffffffffffffff8111156111ed575f5ffd5b6111f989828a01611124565b979a9699509497509295939492505050565b5f5f5f6060848603121561121d575f5ffd5b833561122881611075565b9250602084013561123881611075565b9150604084013567ffffffffffffffff811115611253575f5ffd5b840160608187031215611264575f5ffd5b809150509250925092565b5f5f5f60608486031215611281575f5ffd5b833561128c81611075565b9250602084013561129c81611075565b929592945050506040919091013590565b5f5f604083850312156112be575f5ffd5b82356112c981611075565b915060208301356112d981611075565b809150509250929050565b600181811c908216806112f857607f821691505b60208210810361131657634e487b7160e01b5f52602260045260245ffd5b50919050565b60208082526008908201526710b6b0b730b3b2b960c11b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b5f8235605e19833603018112611366575f5ffd5b9190910192915050565b634e487b7160e01b5f52604160045260245ffd5b601f821115610b0157805f5260205f20601f840160051c810160208510156113a95750805b601f840160051c820191505b818110156113c8575f81556001016113b5565b5050505050565b81356113da81611075565b81546001600160a01b0319166001600160a01b0391909116178155602082013536839003601e1901811261140c575f5ffd5b8201803567ffffffffffffffff811115611424575f5ffd5b602082019150803603821315611438575f5ffd5b6001830167ffffffffffffffff82111561145457611454611370565b6114688261146283546112e4565b83611384565b5f601f831160018114611499575f84156114825750848201355b5f19600386901b1c1916600185901b1783556114f0565b5f83815260208120601f198616915b828110156114c857878501358255602094850194600190920191016114a8565b50858210156114e4575f1960f88760031b161c19848801351681555b505060018460011b0183555b505050505060409190910135600290910155565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b602081525f823561153c81611075565b6001600160a01b031660208381019190915283013536849003601e19018112611563575f5ffd5b830160208101903567ffffffffffffffff81111561157f575f5ffd5b80360382131561158d575f5ffd5b606060408501526115a2608085018284611504565b6040959095013560609490940193909352509192915050565b5f602082840312156115cb575f5ffd5b5051919050565b5f82516113668184602087016110a4565b6001600160a01b03831681526040602082018190525f90611606908301846110c6565b949350505050565b5f6020828403121561161e575f5ffd5b81518015158114610d96575f5ffd5b5f835161163e8184602088016110a4565b8351908301906116528183602088016110a4565b01949350505050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610c8957610c8961165b565b81810381811115610c8957610c8961165b56fea2646970667358221220ef58a50683dc6acc4193573d7ff1a9c7684bd9643c22dcb17426687f889b1da464736f6c634300081b0033

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

000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38000000000000000000000000bd297b4f9991fd23f54e14111ee6190c4fb9f7e1

-----Decoded View---------------
Arg [0] : _native (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38
Arg [1] : _keeper (address): 0xbd297B4f9991FD23f54e14111EE6190C4Fb9F7e1

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [1] : 000000000000000000000000bd297b4f9991fd23f54e14111ee6190c4fb9f7e1


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