ETH Price: $3,237.80 (+1.33%)
 
Transaction Hash
Method
Block
From
To
Collect177370752023-07-20 21:32:11560 days ago1689888731IN
0x8335Bec7...3D19473Cb
0 ETH0.0019959136
Portal In176277582023-07-05 12:43:47575 days ago1688561027IN
0x8335Bec7...3D19473Cb
0 ETH0.0137624653.59923427
Portal In175967772023-07-01 4:15:59580 days ago1688184959IN
0x8335Bec7...3D19473Cb
0 ETH0.0045028417.53595812
Portal In175740582023-06-27 23:49:47583 days ago1687909787IN
0x8335Bec7...3D19473Cb
0 ETH0.0032493512.65492639
Portal In175636882023-06-26 12:46:23584 days ago1687783583IN
0x8335Bec7...3D19473Cb
0.01 ETH0.0038255612.4522702
Portal In175636402023-06-26 12:36:47584 days ago1687783007IN
0x8335Bec7...3D19473Cb
0 ETH0.0032241912.55633922
Portal In175499062023-06-24 14:14:59586 days ago1687616099IN
0x8335Bec7...3D19473Cb
0 ETH0.0036200414.09795584
Portal In175401382023-06-23 5:15:23588 days ago1687497323IN
0x8335Bec7...3D19473Cb
0 ETH0.00341713.30724452
Portal In175245042023-06-21 0:35:23590 days ago1687307723IN
0x8335Bec7...3D19473Cb
0 ETH0.0041372216.11282252
Portal In175209302023-06-20 12:32:35590 days ago1687264355IN
0x8335Bec7...3D19473Cb
0 ETH0.0043003216.74723508
Portal In175058282023-06-18 9:38:59592 days ago1687081139IN
0x8335Bec7...3D19473Cb
0 ETH0.003752914.61536497
Portal In174948542023-06-16 20:44:47594 days ago1686948287IN
0x8335Bec7...3D19473Cb
0 ETH0.0046815818.21543709
Portal In174798992023-06-14 18:17:11596 days ago1686766631IN
0x8335Bec7...3D19473Cb
0 ETH0.0087911234.20512393
Portal In174657482023-06-12 18:28:23598 days ago1686594503IN
0x8335Bec7...3D19473Cb
0 ETH0.0051751418.87884575
Portal In174239492023-06-06 21:04:11604 days ago1686085451IN
0x8335Bec7...3D19473Cb
0 ETH0.0084195232.75925881
Portal In174077262023-06-04 14:07:23606 days ago1685887643IN
0x8335Bec7...3D19473Cb
0 ETH0.0083039632.30811585
Portal In173854712023-06-01 10:49:47609 days ago1685616587IN
0x8335Bec7...3D19473Cb
0 ETH0.0071332127.75311684
Portal In173586332023-05-28 16:13:59613 days ago1685290439IN
0x8335Bec7...3D19473Cb
0 ETH0.0128703950.12265801
Portal In173419212023-05-26 7:54:11615 days ago1685087651IN
0x8335Bec7...3D19473Cb
0 ETH0.0064143224.98004186
Portal In173080862023-05-21 13:38:23620 days ago1684676303IN
0x8335Bec7...3D19473Cb
0 ETH0.0095317637.12062961
Portal In172870592023-05-18 14:34:47623 days ago1684420487IN
0x8335Bec7...3D19473Cb
0 ETH0.0152790260.63056383
Portal In172727882023-05-16 14:15:47625 days ago1684246547IN
0x8335Bec7...3D19473Cb
0 ETH0.0147987556.57492076
Portal In172714672023-05-16 9:45:35625 days ago1684230335IN
0x8335Bec7...3D19473Cb
0 ETH0.0308073542.95408618
Portal In172578392023-05-14 11:34:23627 days ago1684064063IN
0x8335Bec7...3D19473Cb
0 ETH0.0099144539.34275165
Portal In172369512023-05-11 11:55:47630 days ago1683806147IN
0x8335Bec7...3D19473Cb
0 ETH0.0199814977.81622918
View all transactions

Latest 5 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
175636882023-06-26 12:46:23584 days ago1687783583
0x8335Bec7...3D19473Cb
0.00997 ETH
164817742023-01-25 5:33:47736 days ago1674624827
0x8335Bec7...3D19473Cb
0.04985 ETH
160948352022-12-02 4:48:59791 days ago1669956539
0x8335Bec7...3D19473Cb
0.0546356 ETH
160680872022-11-28 11:08:23794 days ago1669633703
0x8335Bec7...3D19473Cb
0.00997 ETH
158835702022-11-02 16:36:47820 days ago1667407007
0x8335Bec7...3D19473Cb
0.006979 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UniswapV2PortalIn

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 13 : UniswapV2PortalIn.sol
/// Copyright (C) 2022 Portals.fi

/// @author Portals.fi
/// @notice This contract adds liquidity to Uniswap V2-like pools using any ERC20 token or the network token.

/// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.11;

import "../base/PortalBaseV2.sol";
import "./interface/Babylonian.sol";
import "./interface/IUniswapV2Factory.sol";
import "./interface/IUniswapV2Router.sol";
import "./interface/IUniswapV2Pair.sol";
import "../interface/IPortalRegistry.sol";

/// Thrown when insufficient liquidity is received after deposit
/// @param buyAmount The amount of liquidity received
/// @param minBuyAmount The minimum acceptable quantity of liquidity received
error InsufficientBuy(uint256 buyAmount, uint256 minBuyAmount);

contract UniswapV2PortalIn is PortalBaseV2 {
    using SafeTransferLib for address;
    using SafeTransferLib for ERC20;

    /// @notice Emitted when a portal is entered
    /// @param sellToken The ERC20 token address to spend (address(0) if network token)
    /// @param sellAmount The quantity of sellToken to Portal in
    /// @param buyToken The ERC20 token address to buy (address(0) if network token)
    /// @param buyAmount The quantity of buyToken received
    /// @param fee The fee in BPS
    /// @param sender The  msg.sender
    /// @param partner The front end operator address
    event PortalIn(
        address sellToken,
        uint256 sellAmount,
        address buyToken,
        uint256 buyAmount,
        uint256 fee,
        address indexed sender,
        address indexed partner
    );

    constructor(
        bytes32 protocolId,
        PortalType portalType,
        IPortalRegistry registry,
        address exchange,
        address wrappedNetworkToken,
        uint256 fee
    )
        PortalBaseV2(
            protocolId,
            portalType,
            registry,
            exchange,
            wrappedNetworkToken,
            fee
        )
    {}

    /// @notice Add liquidity to Uniswap V2-like pools with network tokens/ERC20 tokens
    /// @param sellToken The ERC20 token address to spend (address(0) if network token)
    /// @param sellAmount The quantity of sellToken to Portal in
    /// @param intermediateToken The intermediate token to swap to (must be one of the pool tokens)
    /// @param buyToken The pool (i.e. pair) address
    /// @param minBuyAmount The minimum quantity of buyTokens to receive. Reverts otherwise
    /// @param target The excecution target for the intermediate swap
    /// @param data  The encoded call for the intermediate swap
    /// @param partner The front end operator address
    /// @param router The Uniswap V2-like router to be used for adding liquidity
    /// @param returnResidual Return residual, if any, that remains
    /// following the deposit. Note: Probably a waste of gas to set to true
    /// @return buyAmount The quantity of buyToken acquired
    function portalIn(
        address sellToken,
        uint256 sellAmount,
        address intermediateToken,
        address buyToken,
        uint256 minBuyAmount,
        address target,
        bytes calldata data,
        address partner,
        IUniswapV2Router02 router,
        bool returnResidual
    ) external payable pausable returns (uint256 buyAmount) {
        uint256 amount = _transferFromCaller(sellToken, sellAmount);
        amount = _getFeeAmount(amount);
        amount = _execute(sellToken, amount, intermediateToken, target, data);

        buyAmount = _deposit(
            intermediateToken,
            amount,
            buyToken,
            router,
            returnResidual
        );

        if (buyAmount < minBuyAmount)
            revert InsufficientBuy(buyAmount, minBuyAmount);

        emit PortalIn(
            sellToken,
            sellAmount,
            buyToken,
            buyAmount,
            fee,
            msg.sender,
            partner
        );
    }

    /// @notice Sets up the correct token ratio and deposits into the pool
    /// @param sellToken The token address to swap from
    /// @param sellAmount The quantity of tokens to sell
    /// @param buyToken The pool (i.e. pair) address
    /// @param router The router belonging to the protocol to add liquidity to
    /// @param returnResidual Return residual, if any, that remains
    /// following the deposit. Note: Probably a waste of gas to set to true
    /// @return liquidity The quantity of LP tokens acquired
    function _deposit(
        address sellToken,
        uint256 sellAmount,
        address buyToken,
        IUniswapV2Router02 router,
        bool returnResidual
    ) internal returns (uint256 liquidity) {
        IUniswapV2Pair pair = IUniswapV2Pair(buyToken);

        (uint256 res0, uint256 res1, ) = pair.getReserves();

        address token0 = pair.token0();
        address token1 = pair.token1();
        uint256 token0Amount;
        uint256 token1Amount;

        if (sellToken == token0) {
            uint256 swapAmount = _getSwapAmount(res0, sellAmount);
            if (swapAmount <= 0) swapAmount = sellAmount / 2;

            token1Amount = _intraSwap(
                sellToken,
                swapAmount,
                pair.token1(),
                router
            );

            token0Amount = sellAmount - swapAmount;
        } else {
            uint256 swapAmount = _getSwapAmount(res1, sellAmount);
            if (swapAmount <= 0) swapAmount = sellAmount / 2;

            token0Amount = _intraSwap(sellToken, swapAmount, token0, router);

            token1Amount = sellAmount - swapAmount;
        }
        liquidity = _addLiquidity(
            buyToken,
            token0,
            token0Amount,
            token1,
            token1Amount,
            router,
            returnResidual
        );
    }

    /// @notice Returns the optimal intra-pool swap quantity such that
    /// that the proportion of both tokens held subsequent to the swap is
    /// equal to the proportion of the assets in the pool. Assumes typical
    /// Uniswap V2 fee.
    /// @param reserves The reserves of the sellToken
    /// @param amount The total quantity of tokens held
    /// @return The quantity of the sell token to swap
    function _getSwapAmount(uint256 reserves, uint256 amount)
        internal
        pure
        returns (uint256)
    {
        return
            (Babylonian.sqrt(
                reserves * ((amount * 3988000) + (reserves * 3988009))
            ) - (reserves * 1997)) / 1994;
    }

    /// @notice Used for intra-pool swaps of ERC20 assets
    /// @param sellToken The token address to swap from
    /// @param sellAmount The quantity of tokens to sell
    /// @param buyToken The token address to swap to
    /// @param router The Uniswap V2-like router to use for the swap
    /// @return tokenBought The quantity of tokens bought
    function _intraSwap(
        address sellToken,
        uint256 sellAmount,
        address buyToken,
        IUniswapV2Router02 router
    ) internal returns (uint256) {
        if (sellToken == buyToken) {
            return sellAmount;
        }

        _approve(sellToken, address(router), sellAmount);

        address[] memory path = new address[](2);
        path[0] = sellToken;
        path[1] = buyToken;

        uint256 beforeSwap = _getBalance(address(this), buyToken);

        router.swapExactTokensForTokens(
            sellAmount,
            1,
            path,
            address(this),
            block.timestamp
        );

        return _getBalance(address(this), buyToken) - beforeSwap;
    }

    /// @notice Deposits both tokens into the pool
    /// @param token0Amount The quantity of token0 to add to the pool
    /// @param token1 The address of the 1st token in the pool
    /// @param token1Amount The quantity of token1 to add to the pool
    /// @param router The Uniswap V2-like router to use to add liquidity
    /// @param returnResidual Return residual, if any, that remains
    /// following the deposit. Note: Probably a waste of gas to set to true
    /// @return liquidity pool tokens acquired
    function _addLiquidity(
        address buyToken,
        address token0,
        uint256 token0Amount,
        address token1,
        uint256 token1Amount,
        IUniswapV2Router02 router,
        bool returnResidual
    ) internal returns (uint256) {
        _approve(token0, address(router), token0Amount);
        _approve(token1, address(router), token1Amount);

        uint256 beforeLiquidity = _getBalance(msg.sender, buyToken);

        (uint256 amountA, uint256 amountB, ) = router.addLiquidity(
            token0,
            token1,
            token0Amount,
            token1Amount,
            1,
            1,
            msg.sender,
            block.timestamp
        );

        if (returnResidual) {
            if (token0Amount - amountA > 0) {
                ERC20(token0).safeTransfer(msg.sender, token0Amount - amountA);
            }
            if (token1Amount - amountB > 0) {
                ERC20(token1).safeTransfer(msg.sender, token1Amount - amountB);
            }
        }
        return _getBalance(msg.sender, buyToken) - beforeLiquidity;
    }
}

File 2 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 4 of 13 : PortalBaseV2.sol
/// Copyright (C) 2022 Portals.fi

/// @author Portals.fi
/// @notice Base contract inherited by Portals

/// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.11;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./interface/IPortalBase.sol";
import "../libraries/solmate/utils/SafeTransferLib.sol";
import "../interface/IWETH.sol";
import "../interface/IPortalRegistry.sol";

abstract contract PortalBaseV2 is IPortalBase, Ownable {
    using SafeTransferLib for address;
    using SafeTransferLib for ERC20;

    // Active status of this contract. If false, contract is active (i.e un-paused)
    bool public paused;

    // Fee in basis points (bps)
    uint256 public fee;

    // The Portal Registry
    IPortalRegistry public registry;

    // The address of the exchange used for swaps
    address public immutable exchange;

    // The address of the wrapped network token (e.g. WETH, wMATIC, wFTM, wAVAX, etc.)
    address public immutable wrappedNetworkToken;

    // Circuit breaker
    modifier pausable() {
        require(!paused, "Paused");
        _;
    }

    constructor(
        bytes32 protocolId,
        PortalType portalType,
        IPortalRegistry _registry,
        address _exchange,
        address _wrappedNetworkToken,
        uint256 _fee
    ) {
        wrappedNetworkToken = _wrappedNetworkToken;
        setFee(_fee);
        exchange = _exchange;
        registry = _registry;
        registry.addPortal(address(this), portalType, protocolId);
        transferOwnership(registry.owner());
    }

    /// @notice Transfers tokens or the network token from the caller to this contract
    /// @param token The address of the token to transfer (address(0) if network token)
    /// @param quantity The quantity of tokens to transfer from the caller
    /// @dev quantity must == msg.value when token == address(0)
    /// @dev msg.value must == 0 when token != address(0)
    /// @return The quantity of tokens or network tokens transferred from the caller to this contract
    function _transferFromCaller(address token, uint256 quantity)
        internal
        virtual
        returns (uint256)
    {
        if (token == address(0)) {
            require(
                msg.value > 0 && msg.value == quantity,
                "Invalid quantity or msg.value"
            );

            return msg.value;
        }

        require(
            quantity > 0 && msg.value == 0,
            "Invalid quantity or msg.value"
        );

        ERC20(token).safeTransferFrom(msg.sender, address(this), quantity);

        return quantity;
    }

    /// @notice Returns the quantity of tokens or network tokens after accounting for the fee
    /// @param quantity The quantity of tokens to subtract the fee from
    /// @return The quantity of tokens or network tokens to transact with less the fee
    function _getFeeAmount(uint256 quantity) internal view returns (uint256) {
        return
            registry.isPortal(msg.sender)
                ? quantity
                : quantity - (quantity * fee) / 10000;
    }

    /// @notice Executes swap or portal data at the target address
    /// @param sellToken The sell token
    /// @param sellAmount The quantity of sellToken (in sellToken base units) to send
    /// @param buyToken The buy token
    /// @param target The execution target for the data
    /// @param data The swap or portal data
    /// @return amountBought Quantity of buyToken acquired
    function _execute(
        address sellToken,
        uint256 sellAmount,
        address buyToken,
        address target,
        bytes memory data
    ) internal virtual returns (uint256 amountBought) {
        if (sellToken == buyToken) {
            return sellAmount;
        }

        if (sellToken == address(0) && buyToken == wrappedNetworkToken) {
            IWETH(wrappedNetworkToken).deposit{ value: sellAmount }();
            return sellAmount;
        }

        if (sellToken == wrappedNetworkToken && buyToken == address(0)) {
            IWETH(wrappedNetworkToken).withdraw(sellAmount);
            return sellAmount;
        }

        uint256 valueToSend;
        if (sellToken == address(0)) {
            valueToSend = sellAmount;
        } else {
            _approve(sellToken, target, sellAmount);
        }

        uint256 initialBalance = _getBalance(address(this), buyToken);

        require(
            target == exchange || registry.isPortal(target),
            "Unauthorized target"
        );
        (bool success, bytes memory returnData) = target.call{
            value: valueToSend
        }(data);
        require(success, string(returnData));

        amountBought = _getBalance(address(this), buyToken) - initialBalance;

        require(amountBought > 0, "Invalid execution");
    }

    /// @notice Get the token or network token balance of an account
    /// @param account The owner of the tokens or network tokens whose balance is being queried
    /// @param token The address of the token (address(0) if network token)
    /// @return The owner's token or network token balance
    function _getBalance(address account, address token)
        internal
        view
        returns (uint256)
    {
        if (token == address(0)) {
            return account.balance;
        } else {
            return ERC20(token).balanceOf(account);
        }
    }

    /// @notice Approve a token for spending with finite allowance
    /// @param token The ERC20 token to approve
    /// @param spender The spender of the token
    /// @param amount The allowance to grant to the spender
    function _approve(
        address token,
        address spender,
        uint256 amount
    ) internal {
        ERC20 _token = ERC20(token);
        _token.safeApprove(spender, 0);
        _token.safeApprove(spender, amount);
    }

    /// @notice Collects tokens or network tokens from this contract
    /// @param tokens An array of the tokens to withdraw (address(0) if network token)
    function collect(address[] calldata tokens) external {
        address collector = registry.collector();
        uint256 qty;

        for (uint256 i = 0; i < tokens.length; i++) {
            if (tokens[i] == address(0)) {
                qty = address(this).balance;
                collector.safeTransferETH(qty);
            } else {
                qty = ERC20(tokens[i]).balanceOf(address(this));
                ERC20(tokens[i]).safeTransfer(collector, qty);
            }
            emit Collect(tokens[i], qty);
        }
    }

    /// @dev Pause or unpause the contract
    function pause() external onlyOwner {
        paused = !paused;
        emit Pause(paused);
    }

    /// @notice Sets the fee
    /// @param _fee The new fee amount between 0.06-1%
    function setFee(uint256 _fee) public onlyOwner {
        require(_fee >= 6 && _fee <= 100, "Invalid Fee");
        emit Fee(fee, _fee);
        fee = _fee;
    }

    /// @notice Updates the registry
    /// @param _registry The address of the new registry
    function updateRegistry(IPortalRegistry _registry) external onlyOwner {
        registry = _registry;
        emit UpdateRegistry(address(registry));
    }

    /// @notice Reverts if networks tokens are sent directly to this contract
    receive() external payable {
        require(msg.sender != tx.origin);
    }
}

File 5 of 13 : IPortalBase.sol
/// Copyright (C) 2022 Portals.fi

/// @author Portals.fi
/// @notice Interface for the Base contract inherited by Portals

/// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.11;

interface IPortalBase {
    /// @notice Emitted when a portal is collected
    /// @param token The ERC20 token address to collect (address(0) if network token)
    /// @param amount The quantity of th token to collect
    event Collect(address token, uint256 amount);

    /// @notice Emitted when the fee is changed
    /// @param oldFee The ERC20 token address to collect (address(0) if network token)
    /// @param newFee The quantity of th token to collect
    event Fee(uint256 oldFee, uint256 newFee);

    /// @notice Emitted when a portal is paused
    /// @param paused The active status of this contract. If false, contract is active (i.e un-paused)
    event Pause(bool paused);

    /// @notice Emitted when the registry is upated
    /// @param registry The address of the new registry
    event UpdateRegistry(address registry);
}

File 6 of 13 : IPortalRegistry.sol
/// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.11;

enum PortalType {
    IN,
    OUT
}

interface IPortalRegistry {
    function addPortal(
        address portal,
        PortalType portalType,
        bytes32 protocolId
    ) external;

    function addPortalFactory(
        address portalFactory,
        PortalType portalType,
        bytes32 protocolId
    ) external;

    function removePortal(bytes32 protocolId, PortalType portalType) external;

    function owner() external view returns (address owner);

    function registrars(address origin) external view returns (bool isDeployer);

    function collector() external view returns (address collector);

    function isPortal(address portal) external view returns (bool isPortal);
}

File 7 of 13 : IWETH.sol
/// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.11;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256 wad) external;
}

File 8 of 13 : ERC20.sol
// 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);
    }
}

File 9 of 13 : SafeTransferLib.sol
// 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;

        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;

        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), from) // Append the "from" argument.
            mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.

            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;

        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), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            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;

        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), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            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 10 of 13 : Babylonian.sol
/// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

library Babylonian {
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}

File 11 of 13 : IUniswapV2Factory.sol
/// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
interface IUniswapV2Factory {
    function getPair(address tokenA, address tokenB)
        external
        view
        returns (address);
}

File 12 of 13 : IUniswapV2Pair.sol
/// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

interface IUniswapV2Pair {
    function token0() external pure returns (address);

    function token1() external pure returns (address);

    function getReserves()
        external
        view
        returns (
            uint112 _reserve0,
            uint112 _reserve1,
            uint32 _blockTimestampLast
        );
}

File 13 of 13 : IUniswapV2Router.sol
/// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

interface IUniswapV2Router02 {
    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        );

    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountA, uint256 amountB);

    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function factory() external pure returns (address);
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"bytes32","name":"protocolId","type":"bytes32"},{"internalType":"enum PortalType","name":"portalType","type":"uint8"},{"internalType":"contract IPortalRegistry","name":"registry","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"address","name":"wrappedNetworkToken","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"InsufficientBuy","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"Fee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"paused","type":"bool"}],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sellToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"sellAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"buyToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"buyAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"partner","type":"address"}],"name":"PortalIn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"registry","type":"address"}],"name":"UpdateRegistry","type":"event"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchange","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sellToken","type":"address"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"address","name":"intermediateToken","type":"address"},{"internalType":"address","name":"buyToken","type":"address"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"contract IUniswapV2Router02","name":"router","type":"address"},{"internalType":"bool","name":"returnResidual","type":"bool"}],"name":"portalIn","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IPortalRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPortalRegistry","name":"_registry","type":"address"}],"name":"updateRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedNetworkToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c06040523480156200001157600080fd5b50604051620023e3380380620023e3833981016040819052620000349162000377565b858585858585620000453362000172565b6001600160a01b03821660a0526200005d81620001c2565b6001600160a01b03838116608052600280546001600160a01b031916918616918217905560405163dc54e91360e01b815263dc54e91390620000a890309089908b90600401620003f6565b600060405180830381600087803b158015620000c357600080fd5b505af1158015620000d8573d6000803e3d6000fd5b5050505062000160600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000134573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200015a919062000436565b620002a1565b5050505050505050505050506200045d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b03163314620002115760405162461bcd60e51b81526020600482018190526024820152600080516020620023c383398151915260448201526064015b60405180910390fd5b6006811015801562000224575060648111155b620002605760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642046656560a81b604482015260640162000208565b60015460408051918252602082018390527fa6205f24a082c01e6c705e20c1a026c246eedf9800b87b84440f05e8271aaf27910160405180910390a1600155565b6000546001600160a01b03163314620002ec5760405162461bcd60e51b81526020600482018190526024820152600080516020620023c3833981519152604482015260640162000208565b6001600160a01b038116620003535760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000208565b6200035e8162000172565b50565b6001600160a01b03811681146200035e57600080fd5b60008060008060008060c087890312156200039157600080fd5b86519550602087015160028110620003a857600080fd5b6040880151909550620003bb8162000361565b6060880151909450620003ce8162000361565b6080880151909350620003e18162000361565b8092505060a087015190509295509295509295565b6001600160a01b038416815260608101600284106200042557634e487b7160e01b600052602160045260246000fd5b602082019390935260400152919050565b6000602082840312156200044957600080fd5b8151620004568162000361565b9392505050565b60805160a051611f1d620004a66000396000818161010101528181610d9b01528181610dd601528181610e520152610ecc01526000818161026c0152610f6a0152611f1d6000f3fe6080604052600436106100d65760003560e01c80638456cb591161007f578063bf3570c911610059578063bf3570c914610239578063d2f7265a1461025a578063ddca3f431461028e578063f2fde38b146102a457600080fd5b80638456cb59146101e65780638da5cb5b146101fb578063a4520aee1461021957600080fd5b806369fe0e2d116100b057806369fe0e2d14610191578063715018a6146101b15780637b103999146101c657600080fd5b8063041bf7bc146100ef5780631a5da6c8146101405780635c975abb1461016057600080fd5b366100ea57333214156100e857600080fd5b005b600080fd5b3480156100fb57600080fd5b506101237f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014c57600080fd5b506100e861015b3660046119ad565b6102c4565b34801561016c57600080fd5b5060005461018190600160a01b900460ff1681565b6040519015158152602001610137565b34801561019d57600080fd5b506100e86101ac3660046119ca565b610384565b3480156101bd57600080fd5b506100e861047d565b3480156101d257600080fd5b50600254610123906001600160a01b031681565b3480156101f257600080fd5b506100e86104e3565b34801561020757600080fd5b506000546001600160a01b0316610123565b34801561022557600080fd5b506100e86102343660046119e3565b6105be565b61024c610247366004611a7c565b6107f7565b604051908152602001610137565b34801561026657600080fd5b506101237f000000000000000000000000000000000000000000000000000000000000000081565b34801561029a57600080fd5b5061024c60015481565b3480156102b057600080fd5b506100e86102bf3660046119ad565b610997565b6000546001600160a01b031633146103235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527fe882cd4ecccebb4897bd9859948ab1e5a95e1ff3a4769e6c2893f05230e912639060200160405180910390a150565b6000546001600160a01b031633146103de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b600681101580156103f0575060648111155b61043c5760405162461bcd60e51b815260206004820152600b60248201527f496e76616c696420466565000000000000000000000000000000000000000000604482015260640161031a565b60015460408051918252602082018390527fa6205f24a082c01e6c705e20c1a026c246eedf9800b87b84440f05e8271aaf27910160405180910390a1600155565b6000546001600160a01b031633146104d75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6104e16000610a79565b565b6000546001600160a01b0316331461053d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6000805460ff600160a01b80830482161581027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff90931692909217928390556040517f9422424b175dda897495a07b091ef74a3ef715cf6d866fc972954c1c7f459304936105b49390049091161515815260200190565b60405180910390a1565b600254604080517f913e77ad00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163913e77ad9160048083019260209291908290030181865afa158015610621573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106459190611b81565b90506000805b838110156107f057600085858381811061066757610667611b9e565b905060200201602081019061067c91906119ad565b6001600160a01b031614156106a6574791506106a16001600160a01b03841683610ad6565b610775565b8484828181106106b8576106b8611b9e565b90506020020160208101906106cd91906119ad565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015610713573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107379190611bb4565b9150610775838387878581811061075057610750611b9e565b905060200201602081019061076591906119ad565b6001600160a01b03169190610b36565b7f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc8499998585838181106107a8576107a8611b9e565b90506020020160208101906107bd91906119ad565b604080516001600160a01b039092168252602082018590520160405180910390a1806107e881611be3565b91505061064b565b5050505050565b60008054600160a01b900460ff16156108525760405162461bcd60e51b815260206004820152600660248201527f5061757365640000000000000000000000000000000000000000000000000000604482015260640161031a565b600061085e8d8d610bdb565b905061086981610cc5565b90506108ae8d828d8b8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610d6492505050565b90506108bd8b828c8787611156565b915088821015610903576040517fc634b00600000000000000000000000000000000000000000000000000000000815260048101839052602481018a905260440161031a565b846001600160a01b0316336001600160a01b03167fc4d7bc58a132fd4a1b9d658b0a30809bcfb6b4959c1d3d4eb2e300d3a15099be8f8f8e8760015460405161097f9594939291906001600160a01b03958616815260208101949094529190931660408301526060820192909252608081019190915260a00190565b60405180910390a3509b9a5050505050505050505050565b6000546001600160a01b031633146109f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6001600160a01b038116610a6d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161031a565b610a7681610a79565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080600080600085875af1905080610b315760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c454400000000000000000000000000604482015260640161031a565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610bd55760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c45440000000000000000000000000000000000604482015260640161031a565b50505050565b60006001600160a01b038316610c4d57600034118015610bfa57508134145b610c465760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b5034610cbf565b600082118015610c5b575034155b610ca75760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b610cbc6001600160a01b0384163330856113d4565b50805b92915050565b6002546040516313eb467160e01b81523360048201526000916001600160a01b0316906313eb467190602401602060405180830381865afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190611bfe565b610d605761271060015483610d479190611c1b565b610d519190611c3a565b610d5b9083611c5c565b610cbf565b5090565b6000836001600160a01b0316866001600160a01b03161415610d8757508361114d565b6001600160a01b038616158015610dcf57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316145b15610e50577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e2f57600080fd5b505af1158015610e43573d6000803e3d6000fd5b505050505084905061114d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b0316148015610e9857506001600160a01b038416155b15610f38576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610f1857600080fd5b505af1158015610f2c573d6000803e3d6000fd5b5050505084905061114d565b60006001600160a01b038716610f4f575084610f5a565b610f5a878588611479565b6000610f6630876114a3565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b0316148061101157506002546040516313eb467160e01b81526001600160a01b038781166004830152909116906313eb467190602401602060405180830381865afa158015610fed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110119190611bfe565b61105d5760405162461bcd60e51b815260206004820152601360248201527f556e617574686f72697a65642074617267657400000000000000000000000000604482015260640161031a565b600080866001600160a01b031684876040516110799190611c9f565b60006040518083038185875af1925050503d80600081146110b6576040519150601f19603f3d011682016040523d82523d6000602084013e6110bb565b606091505b50915091508181906110e05760405162461bcd60e51b815260040161031a9190611cbb565b50826110ec308a6114a3565b6110f69190611c5c565b9450600085116111485760405162461bcd60e51b815260206004820152601160248201527f496e76616c696420657865637574696f6e000000000000000000000000000000604482015260640161031a565b505050505b95945050505050565b600080849050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c19190611d0c565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611226573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124a9190611b81565b90506000846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561128c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b09190611b81565b9050600080836001600160a01b03168d6001600160a01b031614156113745760006112db878e611535565b9050600081116112f3576112f060028e611c3a565b90505b6113608e828a6001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611336573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135a9190611b81565b8e611597565b915061136c818e611c5c565b9250506113b4565b6000611380868e611535565b9050600081116113985761139560028e611c3a565b90505b6113a48e82878e611597565b92506113b0818e611c5c565b9150505b6113c38b858486858f8f611715565b9d9c50505050505050505050505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806107f05760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c4544000000000000000000000000604482015260640161031a565b8261148f6001600160a01b038216846000611889565b610bd56001600160a01b0382168484611889565b60006001600160a01b0382166114c457506001600160a01b03821631610cbf565b6040516370a0823160e01b81526001600160a01b0384811660048301528316906370a0823190602401602060405180830381865afa15801561150a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152e9190611bb4565b9050610cbf565b60006107ca611546846107cd611c1b565b61157c61155686623cda29611c1b565b61156386623cda20611c1b565b61156d9190611d5c565b6115779087611c1b565b611928565b6115869190611c5c565b6115909190611c3a565b9392505050565b6000826001600160a01b0316856001600160a01b031614156115ba57508261170d565b6115c5858386611479565b60408051600280825260608201835260009260208301908036833701905050905085816000815181106115fa576115fa611b9e565b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061162e5761162e611b9e565b60200260200101906001600160a01b031690816001600160a01b031681525050600061165a30866114a3565b6040517f38ed17390000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906338ed1739906116ab908990600190879030904290600401611d8a565b6000604051808303816000875af11580156116ca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116f29190810190611dfb565b50806116fe30876114a3565b6117089190611c5c565b925050505b949350505050565b6000611722878488611479565b61172d858486611479565b6000611739338a6114a3565b6040517fe8e337000000000000000000000000000000000000000000000000000000000081526001600160a01b038a811660048301528881166024830152604482018a90526064820188905260016084830181905260a48301523360c48301524260e483015291925060009182919087169063e8e3370090610104016060604051808303816000875af11580156117d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f89190611eb9565b5091509150841561186557600061180f838b611c5c565b11156118345761183433611823848c611c5c565b6001600160a01b038d169190610b36565b60006118408289611c5c565b11156118655761186533611854838a611c5c565b6001600160a01b038b169190610b36565b82611870338d6114a3565b61187a9190611c5c565b9b9a5050505050505050505050565b60006040517f095ea7b3000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610bd55760405162461bcd60e51b815260206004820152600e60248201527f415050524f56455f4641494c4544000000000000000000000000000000000000604482015260640161031a565b600060038211156119895750806000611942600283611c3a565b61194d906001611d5c565b90505b81811015611983579050806002816119688186611c3a565b6119729190611d5c565b61197c9190611c3a565b9050611950565b50919050565b8115611993575060015b919050565b6001600160a01b0381168114610a7657600080fd5b6000602082840312156119bf57600080fd5b813561159081611998565b6000602082840312156119dc57600080fd5b5035919050565b600080602083850312156119f657600080fd5b823567ffffffffffffffff80821115611a0e57600080fd5b818501915085601f830112611a2257600080fd5b813581811115611a3157600080fd5b8660208260051b8501011115611a4657600080fd5b60209290920196919550909350505050565b803561199381611998565b8015158114610a7657600080fd5b803561199381611a63565b60008060008060008060008060008060006101408c8e031215611a9e57600080fd5b8b35611aa981611998565b9a5060208c0135995060408c0135611ac081611998565b985060608c0135611ad081611998565b975060808c0135965060a08c0135611ae781611998565b955060c08c013567ffffffffffffffff80821115611b0457600080fd5b818e0191508e601f830112611b1857600080fd5b813581811115611b2757600080fd5b8f6020828501011115611b3957600080fd5b602083019750809650505050611b5160e08d01611a58565b9250611b606101008d01611a58565b9150611b6f6101208d01611a71565b90509295989b509295989b9093969950565b600060208284031215611b9357600080fd5b815161159081611998565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611bc657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bf757611bf7611bcd565b5060010190565b600060208284031215611c1057600080fd5b815161159081611a63565b6000816000190483118215151615611c3557611c35611bcd565b500290565b600082611c5757634e487b7160e01b600052601260045260246000fd5b500490565b600082821015611c6e57611c6e611bcd565b500390565b60005b83811015611c8e578181015183820152602001611c76565b83811115610bd55750506000910152565b60008251611cb1818460208701611c73565b9190910192915050565b6020815260008251806020840152611cda816040850160208701611c73565b601f01601f19169190910160400192915050565b80516dffffffffffffffffffffffffffff8116811461199357600080fd5b600080600060608486031215611d2157600080fd5b611d2a84611cee565b9250611d3860208501611cee565b9150604084015163ffffffff81168114611d5157600080fd5b809150509250925092565b60008219821115611d6f57611d6f611bcd565b500190565b634e487b7160e01b600052604160045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611dda5784516001600160a01b031683529383019391830191600101611db5565b50506001600160a01b03969096166060850152505050608001529392505050565b60006020808385031215611e0e57600080fd5b825167ffffffffffffffff80821115611e2657600080fd5b818501915085601f830112611e3a57600080fd5b815181811115611e4c57611e4c611d74565b8060051b604051601f19603f83011681018181108582111715611e7157611e71611d74565b604052918252848201925083810185019188831115611e8f57600080fd5b938501935b82851015611ead57845184529385019392850192611e94565b98975050505050505050565b600080600060608486031215611ece57600080fd5b835192506020840151915060408401519050925092509256fea26469706673582212205b51264b8a9a7282f5c13c8f1eefe091be19fb101b9ffed28cd38af5178688e664736f6c634300080b00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572756e6973776170763200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ea49d02c248b357b99670d9e9741f54f72df9cb3000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000001e

Deployed Bytecode

0x6080604052600436106100d65760003560e01c80638456cb591161007f578063bf3570c911610059578063bf3570c914610239578063d2f7265a1461025a578063ddca3f431461028e578063f2fde38b146102a457600080fd5b80638456cb59146101e65780638da5cb5b146101fb578063a4520aee1461021957600080fd5b806369fe0e2d116100b057806369fe0e2d14610191578063715018a6146101b15780637b103999146101c657600080fd5b8063041bf7bc146100ef5780631a5da6c8146101405780635c975abb1461016057600080fd5b366100ea57333214156100e857600080fd5b005b600080fd5b3480156100fb57600080fd5b506101237f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014c57600080fd5b506100e861015b3660046119ad565b6102c4565b34801561016c57600080fd5b5060005461018190600160a01b900460ff1681565b6040519015158152602001610137565b34801561019d57600080fd5b506100e86101ac3660046119ca565b610384565b3480156101bd57600080fd5b506100e861047d565b3480156101d257600080fd5b50600254610123906001600160a01b031681565b3480156101f257600080fd5b506100e86104e3565b34801561020757600080fd5b506000546001600160a01b0316610123565b34801561022557600080fd5b506100e86102343660046119e3565b6105be565b61024c610247366004611a7c565b6107f7565b604051908152602001610137565b34801561026657600080fd5b506101237f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff81565b34801561029a57600080fd5b5061024c60015481565b3480156102b057600080fd5b506100e86102bf3660046119ad565b610997565b6000546001600160a01b031633146103235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527fe882cd4ecccebb4897bd9859948ab1e5a95e1ff3a4769e6c2893f05230e912639060200160405180910390a150565b6000546001600160a01b031633146103de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b600681101580156103f0575060648111155b61043c5760405162461bcd60e51b815260206004820152600b60248201527f496e76616c696420466565000000000000000000000000000000000000000000604482015260640161031a565b60015460408051918252602082018390527fa6205f24a082c01e6c705e20c1a026c246eedf9800b87b84440f05e8271aaf27910160405180910390a1600155565b6000546001600160a01b031633146104d75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6104e16000610a79565b565b6000546001600160a01b0316331461053d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6000805460ff600160a01b80830482161581027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff90931692909217928390556040517f9422424b175dda897495a07b091ef74a3ef715cf6d866fc972954c1c7f459304936105b49390049091161515815260200190565b60405180910390a1565b600254604080517f913e77ad00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163913e77ad9160048083019260209291908290030181865afa158015610621573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106459190611b81565b90506000805b838110156107f057600085858381811061066757610667611b9e565b905060200201602081019061067c91906119ad565b6001600160a01b031614156106a6574791506106a16001600160a01b03841683610ad6565b610775565b8484828181106106b8576106b8611b9e565b90506020020160208101906106cd91906119ad565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015610713573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107379190611bb4565b9150610775838387878581811061075057610750611b9e565b905060200201602081019061076591906119ad565b6001600160a01b03169190610b36565b7f4256a058fa2b123d727576d3d31e3a272db98ee5fe264e229610ce43dc8499998585838181106107a8576107a8611b9e565b90506020020160208101906107bd91906119ad565b604080516001600160a01b039092168252602082018590520160405180910390a1806107e881611be3565b91505061064b565b5050505050565b60008054600160a01b900460ff16156108525760405162461bcd60e51b815260206004820152600660248201527f5061757365640000000000000000000000000000000000000000000000000000604482015260640161031a565b600061085e8d8d610bdb565b905061086981610cc5565b90506108ae8d828d8b8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610d6492505050565b90506108bd8b828c8787611156565b915088821015610903576040517fc634b00600000000000000000000000000000000000000000000000000000000815260048101839052602481018a905260440161031a565b846001600160a01b0316336001600160a01b03167fc4d7bc58a132fd4a1b9d658b0a30809bcfb6b4959c1d3d4eb2e300d3a15099be8f8f8e8760015460405161097f9594939291906001600160a01b03958616815260208101949094529190931660408301526060820192909252608081019190915260a00190565b60405180910390a3509b9a5050505050505050505050565b6000546001600160a01b031633146109f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161031a565b6001600160a01b038116610a6d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161031a565b610a7681610a79565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080600080600085875af1905080610b315760405162461bcd60e51b815260206004820152601360248201527f4554485f5452414e534645525f4641494c454400000000000000000000000000604482015260640161031a565b505050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610bd55760405162461bcd60e51b815260206004820152600f60248201527f5452414e534645525f4641494c45440000000000000000000000000000000000604482015260640161031a565b50505050565b60006001600160a01b038316610c4d57600034118015610bfa57508134145b610c465760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b5034610cbf565b600082118015610c5b575034155b610ca75760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207175616e74697479206f72206d73672e76616c7565000000604482015260640161031a565b610cbc6001600160a01b0384163330856113d4565b50805b92915050565b6002546040516313eb467160e01b81523360048201526000916001600160a01b0316906313eb467190602401602060405180830381865afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d329190611bfe565b610d605761271060015483610d479190611c1b565b610d519190611c3a565b610d5b9083611c5c565b610cbf565b5090565b6000836001600160a01b0316866001600160a01b03161415610d8757508361114d565b6001600160a01b038616158015610dcf57507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316846001600160a01b0316145b15610e50577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e2f57600080fd5b505af1158015610e43573d6000803e3d6000fd5b505050505084905061114d565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b0316148015610e9857506001600160a01b038416155b15610f38576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018690527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610f1857600080fd5b505af1158015610f2c573d6000803e3d6000fd5b5050505084905061114d565b60006001600160a01b038716610f4f575084610f5a565b610f5a878588611479565b6000610f6630876114a3565b90507f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff6001600160a01b0316856001600160a01b0316148061101157506002546040516313eb467160e01b81526001600160a01b038781166004830152909116906313eb467190602401602060405180830381865afa158015610fed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110119190611bfe565b61105d5760405162461bcd60e51b815260206004820152601360248201527f556e617574686f72697a65642074617267657400000000000000000000000000604482015260640161031a565b600080866001600160a01b031684876040516110799190611c9f565b60006040518083038185875af1925050503d80600081146110b6576040519150601f19603f3d011682016040523d82523d6000602084013e6110bb565b606091505b50915091508181906110e05760405162461bcd60e51b815260040161031a9190611cbb565b50826110ec308a6114a3565b6110f69190611c5c565b9450600085116111485760405162461bcd60e51b815260206004820152601160248201527f496e76616c696420657865637574696f6e000000000000000000000000000000604482015260640161031a565b505050505b95945050505050565b600080849050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561119d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c19190611d0c565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611226573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124a9190611b81565b90506000846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561128c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b09190611b81565b9050600080836001600160a01b03168d6001600160a01b031614156113745760006112db878e611535565b9050600081116112f3576112f060028e611c3a565b90505b6113608e828a6001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611336573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135a9190611b81565b8e611597565b915061136c818e611c5c565b9250506113b4565b6000611380868e611535565b9050600081116113985761139560028e611c3a565b90505b6113a48e82878e611597565b92506113b0818e611c5c565b9150505b6113c38b858486858f8f611715565b9d9c50505050505050505050505050565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806107f05760405162461bcd60e51b815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c4544000000000000000000000000604482015260640161031a565b8261148f6001600160a01b038216846000611889565b610bd56001600160a01b0382168484611889565b60006001600160a01b0382166114c457506001600160a01b03821631610cbf565b6040516370a0823160e01b81526001600160a01b0384811660048301528316906370a0823190602401602060405180830381865afa15801561150a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152e9190611bb4565b9050610cbf565b60006107ca611546846107cd611c1b565b61157c61155686623cda29611c1b565b61156386623cda20611c1b565b61156d9190611d5c565b6115779087611c1b565b611928565b6115869190611c5c565b6115909190611c3a565b9392505050565b6000826001600160a01b0316856001600160a01b031614156115ba57508261170d565b6115c5858386611479565b60408051600280825260608201835260009260208301908036833701905050905085816000815181106115fa576115fa611b9e565b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061162e5761162e611b9e565b60200260200101906001600160a01b031690816001600160a01b031681525050600061165a30866114a3565b6040517f38ed17390000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906338ed1739906116ab908990600190879030904290600401611d8a565b6000604051808303816000875af11580156116ca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116f29190810190611dfb565b50806116fe30876114a3565b6117089190611c5c565b925050505b949350505050565b6000611722878488611479565b61172d858486611479565b6000611739338a6114a3565b6040517fe8e337000000000000000000000000000000000000000000000000000000000081526001600160a01b038a811660048301528881166024830152604482018a90526064820188905260016084830181905260a48301523360c48301524260e483015291925060009182919087169063e8e3370090610104016060604051808303816000875af11580156117d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f89190611eb9565b5091509150841561186557600061180f838b611c5c565b11156118345761183433611823848c611c5c565b6001600160a01b038d169190610b36565b60006118408289611c5c565b11156118655761186533611854838a611c5c565b6001600160a01b038b169190610b36565b82611870338d6114a3565b61187a9190611c5c565b9b9a5050505050505050505050565b60006040517f095ea7b3000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610bd55760405162461bcd60e51b815260206004820152600e60248201527f415050524f56455f4641494c4544000000000000000000000000000000000000604482015260640161031a565b600060038211156119895750806000611942600283611c3a565b61194d906001611d5c565b90505b81811015611983579050806002816119688186611c3a565b6119729190611d5c565b61197c9190611c3a565b9050611950565b50919050565b8115611993575060015b919050565b6001600160a01b0381168114610a7657600080fd5b6000602082840312156119bf57600080fd5b813561159081611998565b6000602082840312156119dc57600080fd5b5035919050565b600080602083850312156119f657600080fd5b823567ffffffffffffffff80821115611a0e57600080fd5b818501915085601f830112611a2257600080fd5b813581811115611a3157600080fd5b8660208260051b8501011115611a4657600080fd5b60209290920196919550909350505050565b803561199381611998565b8015158114610a7657600080fd5b803561199381611a63565b60008060008060008060008060008060006101408c8e031215611a9e57600080fd5b8b35611aa981611998565b9a5060208c0135995060408c0135611ac081611998565b985060608c0135611ad081611998565b975060808c0135965060a08c0135611ae781611998565b955060c08c013567ffffffffffffffff80821115611b0457600080fd5b818e0191508e601f830112611b1857600080fd5b813581811115611b2757600080fd5b8f6020828501011115611b3957600080fd5b602083019750809650505050611b5160e08d01611a58565b9250611b606101008d01611a58565b9150611b6f6101208d01611a71565b90509295989b509295989b9093969950565b600060208284031215611b9357600080fd5b815161159081611998565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611bc657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bf757611bf7611bcd565b5060010190565b600060208284031215611c1057600080fd5b815161159081611a63565b6000816000190483118215151615611c3557611c35611bcd565b500290565b600082611c5757634e487b7160e01b600052601260045260246000fd5b500490565b600082821015611c6e57611c6e611bcd565b500390565b60005b83811015611c8e578181015183820152602001611c76565b83811115610bd55750506000910152565b60008251611cb1818460208701611c73565b9190910192915050565b6020815260008251806020840152611cda816040850160208701611c73565b601f01601f19169190910160400192915050565b80516dffffffffffffffffffffffffffff8116811461199357600080fd5b600080600060608486031215611d2157600080fd5b611d2a84611cee565b9250611d3860208501611cee565b9150604084015163ffffffff81168114611d5157600080fd5b809150509250925092565b60008219821115611d6f57611d6f611bcd565b500190565b634e487b7160e01b600052604160045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611dda5784516001600160a01b031683529383019391830191600101611db5565b50506001600160a01b03969096166060850152505050608001529392505050565b60006020808385031215611e0e57600080fd5b825167ffffffffffffffff80821115611e2657600080fd5b818501915085601f830112611e3a57600080fd5b815181811115611e4c57611e4c611d74565b8060051b604051601f19603f83011681018181108582111715611e7157611e71611d74565b604052918252848201925083810185019188831115611e8f57600080fd5b938501935b82851015611ead57845184529385019392850192611e94565b98975050505050505050565b600080600060608486031215611ece57600080fd5b835192506020840151915060408401519050925092509256fea26469706673582212205b51264b8a9a7282f5c13c8f1eefe091be19fb101b9ffed28cd38af5178688e664736f6c634300080b0033

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

756e6973776170763200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ea49d02c248b357b99670d9e9741f54f72df9cb3000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000001e

-----Decoded View---------------
Arg [0] : protocolId (bytes32): 0x756e697377617076320000000000000000000000000000000000000000000000
Arg [1] : portalType (uint8): 0
Arg [2] : registry (address): 0xEa49D02c248b357B99670d9E9741F54f72dF9Cb3
Arg [3] : exchange (address): 0xDef1C0ded9bec7F1a1670819833240f027b25EfF
Arg [4] : wrappedNetworkToken (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [5] : fee (uint256): 30

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 756e697377617076320000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 000000000000000000000000ea49d02c248b357b99670d9e9741f54f72df9cb3
Arg [3] : 000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff
Arg [4] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [5] : 000000000000000000000000000000000000000000000000000000000000001e


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ 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.