ETH Price: $3,814.65 (+6.75%)

Contract

0xE03A338d5c305613AfC3877389DD3B0617233387
 
Amount:Between 1-10
Reset Filter

Transaction Hash
Method
Block
From
To

There are no matching entries

Update your filters to view other transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
154265752022-08-28 7:49:32829 days ago1661672972
Zapper.Fi: Curve Zap Out 2
0.27948811 ETH
154265752022-08-28 7:49:32829 days ago1661672972
Zapper.Fi: Curve Zap Out 2
0.27948811 ETH
153817392022-08-21 4:06:41836 days ago1661054801
Zapper.Fi: Curve Zap Out 2
0.14766215 ETH
153817392022-08-21 4:06:41836 days ago1661054801
Zapper.Fi: Curve Zap Out 2
0.14766215 ETH
153778812022-08-20 13:30:28837 days ago1661002228
Zapper.Fi: Curve Zap Out 2
0.08266266 ETH
153778812022-08-20 13:30:28837 days ago1661002228
Zapper.Fi: Curve Zap Out 2
0.08266266 ETH
153579552022-08-17 9:29:23840 days ago1660728563
Zapper.Fi: Curve Zap Out 2
0.04596371 ETH
153579552022-08-17 9:29:23840 days ago1660728563
Zapper.Fi: Curve Zap Out 2
0.04596371 ETH
153554192022-08-16 23:56:42840 days ago1660694202
Zapper.Fi: Curve Zap Out 2
0.04319447 ETH
153523522022-08-16 12:28:45841 days ago1660652925
Zapper.Fi: Curve Zap Out 2
3.08812131 ETH
153523522022-08-16 12:28:45841 days ago1660652925
Zapper.Fi: Curve Zap Out 2
3.08812131 ETH
153474192022-08-15 17:49:55841 days ago1660585795
Zapper.Fi: Curve Zap Out 2
0.84730534 ETH
153474192022-08-15 17:49:55841 days ago1660585795
Zapper.Fi: Curve Zap Out 2
0.84730534 ETH
153448552022-08-15 7:59:36842 days ago1660550376
Zapper.Fi: Curve Zap Out 2
19.29330172 ETH
153448552022-08-15 7:59:36842 days ago1660550376
Zapper.Fi: Curve Zap Out 2
19.29330172 ETH
153400312022-08-14 13:30:31843 days ago1660483831
Zapper.Fi: Curve Zap Out 2
1.30337106 ETH
153400312022-08-14 13:30:31843 days ago1660483831
Zapper.Fi: Curve Zap Out 2
1.30337106 ETH
153358232022-08-13 21:39:45843 days ago1660426785
Zapper.Fi: Curve Zap Out 2
4.15316322 ETH
153358232022-08-13 21:39:45843 days ago1660426785
Zapper.Fi: Curve Zap Out 2
4.15316322 ETH
153281582022-08-12 17:04:10844 days ago1660323850
Zapper.Fi: Curve Zap Out 2
147.74891199 ETH
153281582022-08-12 17:04:10844 days ago1660323850
Zapper.Fi: Curve Zap Out 2
147.74891199 ETH
153248312022-08-12 4:08:56845 days ago1660277336
Zapper.Fi: Curve Zap Out 2
2.96052714 ETH
153248312022-08-12 4:08:56845 days ago1660277336
Zapper.Fi: Curve Zap Out 2
2.96052714 ETH
153062092022-08-09 5:42:38848 days ago1660023758
Zapper.Fi: Curve Zap Out 2
0.1102332 ETH
153062092022-08-09 5:42:38848 days ago1660023758
Zapper.Fi: Curve Zap Out 2
0.1102332 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Curve_ZapOut_General_V4_2

Compiler Version
v0.5.17+commit.d19bba13

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU GPLv2 license
File 1 of 10 : Curve_ZapOut_General_V4.sol
// ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗
// ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║
// ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║
// ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░██╔══╝░░██║
// ███████╗██║░░██║██║░░░░░██║░░░░░███████╗██║░░██║██╗██║░░░░░██║
// ╚══════╝╚═╝░░╚═╝╚═╝░░░░░╚═╝░░░░░╚══════╝╚═╝░░╚═╝╚═╝╚═╝░░░░░╚═╝
// Copyright (C) 2021 zapper

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//

///@author Zapper
///@notice This contract removes liquidity from Curve pools
// SPDX-License-Identifier: GPL-2.0

pragma solidity ^0.5.7;
import "../_base/ZapOutBaseV2.sol";
import "./Curve_Registry_V2.sol";

interface ICurveSwap {
    function remove_liquidity_one_coin(
        uint256 _token_amount,
        int128 i,
        uint256 min_amount
    ) external;

    function remove_liquidity_one_coin(
        uint256 _token_amount,
        int128 i,
        uint256 min_amount,
        bool removeUnderlying
    ) external;

    function remove_liquidity_one_coin(
        uint256 _token_amount,
        uint256 i,
        uint256 min_amount
    ) external;

    function calc_withdraw_one_coin(uint256 tokenAmount, int128 index)
        external
        view
        returns (uint256);

    function calc_withdraw_one_coin(
        uint256 tokenAmount,
        int128 index,
        bool _use_underlying
    ) external view returns (uint256);

    function calc_withdraw_one_coin(uint256 tokenAmount, uint256 index)
        external
        view
        returns (uint256);
}

interface IWETH {
    function withdraw(uint256 wad) external;

    function deposit() external payable;
}

contract Curve_ZapOut_General_V4_2 is ZapOutBaseV2_1 {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address private constant wethTokenAddress =
        address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);

    Curve_Registry_V2 public curveReg;

    mapping(address => bool) public approvedTargets;

    mapping(address => bool) internal v2Pool;

    constructor(
        Curve_Registry_V2 _curveRegistry,
        uint256 _goodwill,
        uint256 _affiliateSplit
    ) public ZapBaseV1(_goodwill, _affiliateSplit) {
        approvedTargets[0xDef1C0ded9bec7F1a1670819833240f027b25EfF] = true;
        v2Pool[0x80466c64868E1ab14a1Ddf27A676C3fcBE638Fe5] = true;
        curveReg = _curveRegistry;
    }

    event zapOut(
        address sender,
        address pool,
        address token,
        uint256 tokensRec
    );

    /**
    @notice This method removes the liquidity from curve pools to ETH/ERC tokens
    @param swapAddress indicates Curve swap address for the pool
    @param incomingCrv indicates the amount of lp tokens to remove
    @param intermediateToken specifies in which token to exit the curve pool
    @param toToken indicates the ETH/ERC token to which tokens to convert
    @param minToTokens indicates the minimum amount of toTokens to receive
    @param _swapTarget Excecution target for the first swap
    @param _swapCallData DEX quote data
    @param affiliate Affiliate address to share fees
    @param shouldSellEntireBalance True if incomingCrv is determined at execution time (i.e. contract is caller)
    @return ToTokensBought- indicates the amount of toTokens received
     */
    function ZapOut(
        address swapAddress,
        uint256 incomingCrv,
        address intermediateToken,
        address toToken,
        uint256 minToTokens,
        address _swapTarget,
        bytes calldata _swapCallData,
        address affiliate,
        bool shouldSellEntireBalance
    ) external stopInEmergency returns (uint256 ToTokensBought) {
        address poolTokenAddress = curveReg.getTokenAddress(swapAddress);

        // get lp tokens
        incomingCrv = _pullTokens(
            poolTokenAddress,
            incomingCrv,
            shouldSellEntireBalance
        );

        if (intermediateToken == address(0)) {
            intermediateToken = ETHAddress;
        }

        // perform zapOut
        ToTokensBought = _zapOut(
            swapAddress,
            incomingCrv,
            intermediateToken,
            toToken,
            _swapTarget,
            _swapCallData
        );
        require(ToTokensBought >= minToTokens, "High Slippage");

        uint256 totalGoodwillPortion;

        // Transfer tokens
        if (toToken == address(0)) {
            totalGoodwillPortion = _subtractGoodwill(
                ETHAddress,
                ToTokensBought,
                affiliate,
                true
            );
            Address.sendValue(
                msg.sender,
                ToTokensBought.sub(totalGoodwillPortion)
            );
        } else {
            totalGoodwillPortion = _subtractGoodwill(
                toToken,
                ToTokensBought,
                affiliate,
                true
            );

            IERC20(toToken).safeTransfer(
                msg.sender,
                ToTokensBought.sub(totalGoodwillPortion)
            );
        }

        emit zapOut(msg.sender, swapAddress, toToken, ToTokensBought);

        return ToTokensBought.sub(totalGoodwillPortion);
    }

    function _zapOut(
        address swapAddress,
        uint256 incomingCrv,
        address intermediateToken,
        address toToken,
        address _swapTarget,
        bytes memory _swapCallData
    ) internal returns (uint256 ToTokensBought) {
        (bool isUnderlying, uint256 underlyingIndex) =
            curveReg.isUnderlyingToken(swapAddress, intermediateToken);

        // not metapool
        if (isUnderlying) {
            uint256 intermediateBought =
                _exitCurve(
                    swapAddress,
                    incomingCrv,
                    underlyingIndex,
                    intermediateToken
                );

            if (intermediateToken == ETHAddress) intermediateToken = address(0);

            ToTokensBought = _fillQuote(
                intermediateToken,
                toToken,
                intermediateBought,
                _swapTarget,
                _swapCallData
            );
        } else {
            // from metapool
            address[4] memory poolTokens = curveReg.getPoolTokens(swapAddress);
            address intermediateSwapAddress;
            uint8 i;
            for (; i < 4; i++) {
                if (curveReg.getSwapAddress(poolTokens[i]) != address(0)) {
                    intermediateSwapAddress = curveReg.getSwapAddress(
                        poolTokens[i]
                    );
                    break;
                }
            }
            // _exitCurve to intermediateSwapAddress Token
            uint256 intermediateCrvBought =
                _exitMetaCurve(swapAddress, incomingCrv, i, poolTokens[i]);
            // _performZapOut: fromPool = intermediateSwapAddress
            ToTokensBought = _zapOut(
                intermediateSwapAddress,
                intermediateCrvBought,
                intermediateToken,
                toToken,
                _swapTarget,
                _swapCallData
            );
        }
    }

    /**
    @notice This method removes the liquidity from meta curve pools
    @param swapAddress indicates the curve pool address from which liquidity to be removed.
    @param incomingCrv indicates the amount of liquidity to be removed from the pool
    @param index indicates the index of underlying token of the pool in which liquidity will be removed. 
    @return tokensReceived- indicates the amount of reserve tokens received 
    */
    function _exitMetaCurve(
        address swapAddress,
        uint256 incomingCrv,
        uint256 index,
        address exitTokenAddress
    ) internal returns (uint256 tokensReceived) {
        address tokenAddress = curveReg.getTokenAddress(swapAddress);
        _approveToken(tokenAddress, swapAddress);

        uint256 iniTokenBal = IERC20(exitTokenAddress).balanceOf(address(this));
        ICurveSwap(swapAddress).remove_liquidity_one_coin(
            incomingCrv,
            int128(index),
            0
        );
        tokensReceived = (IERC20(exitTokenAddress).balanceOf(address(this)))
            .sub(iniTokenBal);

        require(tokensReceived > 0, "Could not receive reserve tokens");
    }

    /**
    @notice This method removes the liquidity from given curve pool
    @param swapAddress indicates the curve pool address from which liquidity to be removed.
    @param incomingCrv indicates the amount of liquidity to be removed from the pool
    @param index indicates the index of underlying token of the pool in which liquidity will be removed. 
    @return tokensReceived- indicates the amount of reserve tokens received 
    */
    function _exitCurve(
        address swapAddress,
        uint256 incomingCrv,
        uint256 index,
        address exitTokenAddress
    ) internal returns (uint256 tokensReceived) {
        address depositAddress = curveReg.getDepositAddress(swapAddress);

        address tokenAddress = curveReg.getTokenAddress(swapAddress);
        _approveToken(tokenAddress, depositAddress);

        address balanceToken =
            exitTokenAddress == ETHAddress ? address(0) : exitTokenAddress;

        uint256 iniTokenBal = _getBalance(balanceToken);

        if (curveReg.shouldAddUnderlying(swapAddress)) {
            // aave
            ICurveSwap(depositAddress).remove_liquidity_one_coin(
                incomingCrv,
                int128(index),
                0,
                true
            );
        } else if (v2Pool[swapAddress]) {
            ICurveSwap(depositAddress).remove_liquidity_one_coin(
                incomingCrv,
                index,
                0
            );
        } else {
            ICurveSwap(depositAddress).remove_liquidity_one_coin(
                incomingCrv,
                int128(index),
                0
            );
        }

        tokensReceived = _getBalance(balanceToken).sub(iniTokenBal);

        require(tokensReceived > 0, "Could not receive reserve tokens");
    }

    /**
    @notice This method swaps the fromToken to toToken using the 0x swap
    @param _fromTokenAddress indicates the ETH/ERC20 token
    @param _toTokenAddress indicates the ETH/ERC20 token
    @param _amount indicates the amount of from tokens to swap
    @param _swapTarget Excecution target for the first swap
    @param _swapCallData DEX quote data
    */
    function _fillQuote(
        address _fromTokenAddress,
        address _toTokenAddress,
        uint256 _amount,
        address _swapTarget,
        bytes memory _swapCallData
    ) internal returns (uint256 amountBought) {
        if (_fromTokenAddress == _toTokenAddress) return _amount;

        if (
            _fromTokenAddress == wethTokenAddress &&
            _toTokenAddress == address(0)
        ) {
            IWETH(wethTokenAddress).withdraw(_amount);
            return _amount;
        } else if (
            _fromTokenAddress == address(0) &&
            _toTokenAddress == wethTokenAddress
        ) {
            IWETH(wethTokenAddress).deposit.value(_amount)();
            return _amount;
        }

        uint256 valueToSend;
        if (_fromTokenAddress == address(0)) valueToSend = _amount;
        else _approveToken(_fromTokenAddress, _swapTarget, _amount);

        uint256 iniBal = _getBalance(_toTokenAddress);
        require(approvedTargets[_swapTarget], "Target not Authorized");
        (bool success, ) = _swapTarget.call.value(valueToSend)(_swapCallData);
        require(success, "Error Swapping Tokens");
        uint256 finalBal = _getBalance(_toTokenAddress);

        amountBought = finalBal.sub(iniBal);

        require(amountBought > 0, "Swapped To Invalid Intermediate");
    }

    /**
    @notice Utility function to determine the quantity and address of a token being removed
    @param swapAddress indicates the curve pool address from which liquidity to be removed
    @param tokenAddress token to be removed
    @param liquidity Quantity of LP tokens to remove.
    @return  amount Quantity of token removed
    */
    function removeLiquidityReturn(
        address swapAddress,
        address tokenAddress,
        uint256 liquidity
    ) external view returns (uint256 amount) {
        if (tokenAddress == address(0)) tokenAddress = ETHAddress;
        (bool underlying, uint256 index) =
            curveReg.isUnderlyingToken(swapAddress, tokenAddress);
        if (underlying) {
            if (v2Pool[swapAddress]) {
                return
                    ICurveSwap(curveReg.getDepositAddress(swapAddress))
                        .calc_withdraw_one_coin(liquidity, uint256(index));
            } else if (curveReg.shouldAddUnderlying(swapAddress)) {
                return
                    ICurveSwap(curveReg.getDepositAddress(swapAddress))
                        .calc_withdraw_one_coin(liquidity, int128(index), true);
            } else {
                return
                    ICurveSwap(curveReg.getDepositAddress(swapAddress))
                        .calc_withdraw_one_coin(liquidity, int128(index));
            }
        } else {
            address[4] memory poolTokens = curveReg.getPoolTokens(swapAddress);
            address intermediateSwapAddress;
            for (uint256 i = 0; i < 4; i++) {
                intermediateSwapAddress = curveReg.getSwapAddress(
                    poolTokens[i]
                );
                if (intermediateSwapAddress != address(0)) break;
            }
            uint256 metaTokensRec =
                ICurveSwap(swapAddress).calc_withdraw_one_coin(
                    liquidity,
                    int128(1)
                );

            (, index) = curveReg.isUnderlyingToken(
                intermediateSwapAddress,
                tokenAddress
            );

            return
                ICurveSwap(intermediateSwapAddress).calc_withdraw_one_coin(
                    metaTokensRec,
                    int128(index)
                );
        }
    }

    function updateCurveRegistry(Curve_Registry_V2 newCurveRegistry)
        external
        onlyOwner
    {
        require(newCurveRegistry != curveReg, "Already using this Registry");
        curveReg = newCurveRegistry;
    }

    function setApprovedTargets(
        address[] calldata targets,
        bool[] calldata isApproved
    ) external onlyOwner {
        require(targets.length == isApproved.length, "Invalid Input length");

        for (uint256 i = 0; i < targets.length; i++) {
            approvedTargets[targets[i]] = isApproved[i];
        }
    }

    function setV2Pool(address[] calldata pool, bool[] calldata isV2Pool)
        external
        onlyOwner
    {
        require(pool.length == isV2Pool.length, "Invalid Input length");

        for (uint256 i = 0; i < pool.length; i++) {
            v2Pool[pool[i]] = isV2Pool[i];
        }
    }
}

File 2 of 10 : Curve_Registry_V2.sol
// ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗
// ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║
// ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║
// ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░██╔══╝░░██║
// ███████╗██║░░██║██║░░░░░██║░░░░░███████╗██║░░██║██╗██║░░░░░██║
// ╚══════╝╚═╝░░╚═╝╚═╝░░░░░╚═╝░░░░░╚══════╝╚═╝░░╚═╝╚═╝╚═╝░░░░░╚═╝
// Copyright (C) 2020 zapper

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//

///@author Zapper
///@notice Registry for Curve Pools with Utility functions.

pragma solidity ^0.5.7;

import "../oz/ownership/Ownable.sol";
import "../oz/token/ERC20/SafeERC20.sol";

interface ICurveAddressProvider {
    function get_registry() external view returns (address);

    function get_address(uint256 _id) external view returns (address);
}

interface ICurveRegistry {
    function get_pool_from_lp_token(address lpToken)
        external
        view
        returns (address);

    function get_lp_token(address swapAddress) external view returns (address);

    function get_n_coins(address _pool)
        external
        view
        returns (uint256[2] memory);

    function get_coins(address _pool) external view returns (address[8] memory);

    function get_underlying_coins(address _pool)
        external
        view
        returns (address[8] memory);
}

interface ICurveFactoryRegistry {
    function get_n_coins(address _pool)
        external
        view
        returns (uint256, uint256);

    function get_coins(address _pool) external view returns (address[2] memory);

    function get_underlying_coins(address _pool)
        external
        view
        returns (address[8] memory);
}

contract Curve_Registry_V2 is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    ICurveAddressProvider private constant CurveAddressProvider =
        ICurveAddressProvider(0x0000000022D53366457F9d5E68Ec105046FC4383);
    ICurveRegistry public CurveRegistry;

    ICurveFactoryRegistry public FactoryRegistry;

    address private constant wbtcToken =
        0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
    address private constant sbtcCrvToken =
        0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3;
    address internal constant ETHAddress =
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    mapping(address => bool) public shouldAddUnderlying;
    mapping(address => address) private depositAddresses;

    constructor() public {
        CurveRegistry = ICurveRegistry(CurveAddressProvider.get_registry());
        FactoryRegistry = ICurveFactoryRegistry(
            CurveAddressProvider.get_address(3)
        );
    }

    function isCurvePool(address swapAddress) public view returns (bool) {
        if (CurveRegistry.get_lp_token(swapAddress) != address(0)) {
            return true;
        }
        return false;
    }

    function isFactoryPool(address swapAddress) public view returns (bool) {
        if (FactoryRegistry.get_coins(swapAddress)[0] != address(0)) {
            return true;
        }
        return false;
    }

    /**
    @notice This function is used to get the curve pool deposit address
    @notice The deposit address is used for pools with wrapped (c, y) tokens
    @param swapAddress Curve swap address for the pool
    @return curve pool deposit address or the swap address not mapped
    */
    function getDepositAddress(address swapAddress)
        external
        view
        returns (address depositAddress)
    {
        depositAddress = depositAddresses[swapAddress];
        if (depositAddress == address(0)) return swapAddress;
    }

    /**
    @notice This function is used to get the curve pool swap address
    @notice The token and swap address is the same for metapool factory pools
    @param swapAddress Curve swap address for the pool
    @return curve pool swap address or address(0) if pool doesnt exist
    */
    function getSwapAddress(address tokenAddress)
        external
        view
        returns (address swapAddress)
    {
        swapAddress = CurveRegistry.get_pool_from_lp_token(tokenAddress);
        if (swapAddress != address(0)) {
            return swapAddress;
        }
        if (isFactoryPool(swapAddress)) {
            return tokenAddress;
        }
        return address(0);
    }

    /**
    @notice This function is used to check the curve pool token address
    @notice The token and swap address is the same for metapool factory pools
    @param swapAddress Curve swap address for the pool
    @return curve pool token address or address(0) if pool doesnt exist
    */
    function getTokenAddress(address swapAddress)
        external
        view
        returns (address tokenAddress)
    {
        tokenAddress = CurveRegistry.get_lp_token(swapAddress);
        if (tokenAddress != address(0)) {
            return tokenAddress;
        }
        if (isFactoryPool(swapAddress)) {
            return swapAddress;
        }
        return address(0);
    }

    /**
    @notice Checks the number of non-underlying tokens in a pool
    @param swapAddress Curve swap address for the pool
    @return number of underlying tokens in the pool
    */
    function getNumTokens(address swapAddress) public view returns (uint256) {
        if (isCurvePool(swapAddress)) {
            return CurveRegistry.get_n_coins(swapAddress)[0];
        } else {
            (uint256 numTokens, ) = FactoryRegistry.get_n_coins(swapAddress);
            return numTokens;
        }
    }

    /**
    @notice This function is used to check if the curve pool is a metapool
    @notice all factory pools are metapools
    @param swapAddress Curve swap address for the pool
    @return true if the pool is a metapool, false otherwise
    */
    function isMetaPool(address swapAddress) public view returns (bool) {
        if (isCurvePool(swapAddress)) {
            uint256[2] memory poolTokenCounts =
                CurveRegistry.get_n_coins(swapAddress);
            if (poolTokenCounts[0] == poolTokenCounts[1]) return false;
            else return true;
        }
        if (isFactoryPool(swapAddress)) return true;
    }

    /**
    @notice This function returns an array of underlying pool token addresses
    @param swapAddress Curve swap address for the pool
    @return returns 4 element array containing the addresses of the pool tokens (0 address if pool contains < 4 tokens)
    */
    function getPoolTokens(address swapAddress)
        public
        view
        returns (address[4] memory poolTokens)
    {
        if (isMetaPool(swapAddress)) {
            if (isFactoryPool(swapAddress)) {
                address[2] memory poolUnderlyingCoins =
                    FactoryRegistry.get_coins(swapAddress);
                for (uint256 i = 0; i < 2; i++) {
                    poolTokens[i] = poolUnderlyingCoins[i];
                }
            } else {
                address[8] memory poolUnderlyingCoins =
                    CurveRegistry.get_coins(swapAddress);
                for (uint256 i = 0; i < 2; i++) {
                    poolTokens[i] = poolUnderlyingCoins[i];
                }
            }

            return poolTokens;
        } else {
            address[8] memory poolUnderlyingCoins;
            if (isBtcPool(swapAddress) && !isMetaPool(swapAddress)) {
                poolUnderlyingCoins = CurveRegistry.get_coins(swapAddress);
            } else {
                poolUnderlyingCoins = CurveRegistry.get_underlying_coins(
                    swapAddress
                );
            }
            for (uint256 i = 0; i < 4; i++) {
                poolTokens[i] = poolUnderlyingCoins[i];
            }
        }
    }

    /**
    @notice This function checks if the curve pool contains WBTC
    @param swapAddress Curve swap address for the pool
    @return true if the pool contains WBTC, false otherwise
    */
    function isBtcPool(address swapAddress) public view returns (bool) {
        address[8] memory poolTokens = CurveRegistry.get_coins(swapAddress);
        for (uint256 i = 0; i < 4; i++) {
            if (poolTokens[i] == wbtcToken || poolTokens[i] == sbtcCrvToken)
                return true;
        }
        return false;
    }

    /**
    @notice This function checks if the curve pool contains ETH
    @param swapAddress Curve swap address for the pool
    @return true if the pool contains ETH, false otherwise
    */
    function isEthPool(address swapAddress) external view returns (bool) {
        address[8] memory poolTokens = CurveRegistry.get_coins(swapAddress);
        for (uint256 i = 0; i < 4; i++) {
            if (poolTokens[i] == ETHAddress) {
                return true;
            }
        }
        return false;
    }

    /**
    @notice This function is used to check if the pool contains the token
    @param swapAddress Curve swap address for the pool
    @param tokenContractAddress contract address of the token
    @return true if the pool contains the token, false otherwise
    @return index of the token in the pool, 0 if pool does not contain the token
    */
    function isUnderlyingToken(
        address swapAddress,
        address tokenContractAddress
    ) external view returns (bool, uint256) {
        address[4] memory poolTokens = getPoolTokens(swapAddress);
        for (uint256 i = 0; i < 4; i++) {
            if (poolTokens[i] == address(0)) return (false, 0);
            if (poolTokens[i] == tokenContractAddress) return (true, i);
        }
    }

    /**
    @notice Updates to the latest curve registry from the address provider
    */
    function update_curve_registry() external onlyOwner {
        address new_address = CurveAddressProvider.get_registry();

        require(address(CurveRegistry) != new_address, "Already updated");

        CurveRegistry = ICurveRegistry(new_address);
    }

    /**
    @notice Updates to the latest curve registry from the address provider
    */
    function update_factory_registry() external onlyOwner {
        address new_address = CurveAddressProvider.get_address(3);

        require(address(FactoryRegistry) != new_address, "Already updated");

        FactoryRegistry = ICurveFactoryRegistry(new_address);
    }

    /**
    @notice Add new pools which use the _use_underlying bool
    @param swapAddresses Curve swap addresses for the pool
    @param addUnderlying True if underlying tokens are always added
    */
    function updateShouldAddUnderlying(
        address[] calldata swapAddresses,
        bool[] calldata addUnderlying
    ) external onlyOwner {
        require(
            swapAddresses.length == addUnderlying.length,
            "Mismatched arrays"
        );
        for (uint256 i = 0; i < swapAddresses.length; i++) {
            shouldAddUnderlying[swapAddresses[i]] = addUnderlying[i];
        }
    }

    /**
    @notice Add new pools which use uamounts for add_liquidity
    @param swapAddresses Curve swap addresses to map from
    @param _depositAddresses Curve deposit addresses to map to
    */
    function updateDepositAddresses(
        address[] calldata swapAddresses,
        address[] calldata _depositAddresses
    ) external onlyOwner {
        require(
            swapAddresses.length == _depositAddresses.length,
            "Mismatched arrays"
        );
        for (uint256 i = 0; i < swapAddresses.length; i++) {
            depositAddresses[swapAddresses[i]] = _depositAddresses[i];
        }
    }

    /**
    //@notice Add new pools which use the _use_underlying bool
    */
    function withdrawTokens(address[] calldata tokens) external onlyOwner {
        for (uint256 i = 0; i < tokens.length; i++) {
            uint256 qty;

            if (tokens[i] == ETHAddress) {
                qty = address(this).balance;
                Address.sendValue(Address.toPayable(owner()), qty);
            } else {
                qty = IERC20(tokens[i]).balanceOf(address(this));
                IERC20(tokens[i]).safeTransfer(owner(), qty);
            }
        }
    }
}

File 3 of 10 : ZapBaseV1.sol
pragma solidity ^0.5.7;

import "../oz/ownership/Ownable.sol";
import "../oz/token/ERC20/SafeERC20.sol";

contract ZapBaseV1 is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    bool public stopped = false;

    // if true, goodwill is not deducted
    mapping(address => bool) public feeWhitelist;

    uint256 public goodwill;
    // % share of goodwill (0-100 %)
    uint256 affiliateSplit;
    // restrict affiliates
    mapping(address => bool) public affiliates;
    // affiliate => token => amount
    mapping(address => mapping(address => uint256)) public affiliateBalance;
    // token => amount
    mapping(address => uint256) public totalAffiliateBalance;

    address internal constant ETHAddress =
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    constructor(uint256 _goodwill, uint256 _affiliateSplit) public {
        goodwill = _goodwill;
        affiliateSplit = _affiliateSplit;
    }

    // circuit breaker modifiers
    modifier stopInEmergency {
        if (stopped) {
            revert("Temporarily Paused");
        } else {
            _;
        }
    }

    function _getBalance(address token)
        internal
        view
        returns (uint256 balance)
    {
        if (token == address(0)) {
            balance = address(this).balance;
        } else {
            balance = IERC20(token).balanceOf(address(this));
        }
    }

    function _approveToken(address token, address spender) internal {
        IERC20 _token = IERC20(token);
        if (_token.allowance(address(this), spender) > 0) return;
        else {
            _token.safeApprove(spender, uint256(-1));
        }
    }

    function _approveToken(
        address token,
        address spender,
        uint256 amount
    ) internal {
        IERC20 _token = IERC20(token);
        _token.safeApprove(spender, 0);
        _token.safeApprove(spender, amount);
    }

    // - to Pause the contract
    function toggleContractActive() public onlyOwner {
        stopped = !stopped;
    }

    function set_feeWhitelist(address zapAddress, bool status)
        external
        onlyOwner
    {
        feeWhitelist[zapAddress] = status;
    }

    function set_new_goodwill(uint256 _new_goodwill) public onlyOwner {
        require(
            _new_goodwill >= 0 && _new_goodwill <= 100,
            "GoodWill Value not allowed"
        );
        goodwill = _new_goodwill;
    }

    function set_new_affiliateSplit(uint256 _new_affiliateSplit)
        external
        onlyOwner
    {
        require(
            _new_affiliateSplit <= 100,
            "Affiliate Split Value not allowed"
        );
        affiliateSplit = _new_affiliateSplit;
    }

    function set_affiliate(address _affiliate, bool _status)
        external
        onlyOwner
    {
        affiliates[_affiliate] = _status;
    }

    ///@notice Withdraw goodwill share, retaining affilliate share
    function withdrawTokens(address[] calldata tokens) external onlyOwner {
        for (uint256 i = 0; i < tokens.length; i++) {
            uint256 qty;

            if (tokens[i] == ETHAddress) {
                qty = address(this).balance.sub(
                    totalAffiliateBalance[tokens[i]]
                );
                Address.sendValue(Address.toPayable(owner()), qty);
            } else {
                qty = IERC20(tokens[i]).balanceOf(address(this)).sub(
                    totalAffiliateBalance[tokens[i]]
                );
                IERC20(tokens[i]).safeTransfer(owner(), qty);
            }
        }
    }

    ///@notice Withdraw affilliate share, retaining goodwill share
    function affilliateWithdraw(address[] calldata tokens) external {
        uint256 tokenBal;
        for (uint256 i = 0; i < tokens.length; i++) {
            tokenBal = affiliateBalance[msg.sender][tokens[i]];
            affiliateBalance[msg.sender][tokens[i]] = 0;
            totalAffiliateBalance[tokens[i]] = totalAffiliateBalance[tokens[i]]
                .sub(tokenBal);

            if (tokens[i] == ETHAddress) {
                Address.sendValue(msg.sender, tokenBal);
            } else {
                IERC20(tokens[i]).safeTransfer(msg.sender, tokenBal);
            }
        }
    }

    function() external payable {
        require(msg.sender != tx.origin, "Do not send ETH directly");
    }
}

File 4 of 10 : ZapOutBaseV2.sol
pragma solidity ^0.5.7;

import "./ZapBaseV1.sol";

contract ZapOutBaseV2_1 is ZapBaseV1 {
    /**
    @dev Transfer tokens from msg.sender to this contract
    @param token The ERC20 token to transfer to this contract
    @param shouldSellEntireBalance If True transfers entrire allowable amount from another contract
    @return Quantity of tokens transferred to this contract
     */
    function _pullTokens(
        address token,
        uint256 amount,
        bool shouldSellEntireBalance
    ) internal returns (uint256) {
        if (shouldSellEntireBalance) {
            require(
                Address.isContract(msg.sender),
                "ERR: shouldSellEntireBalance is true for EOA"
            );

            IERC20 _token = IERC20(token);
            uint256 allowance = _token.allowance(msg.sender, address(this));
            _token.safeTransferFrom(msg.sender, address(this), allowance);

            return allowance;
        } else {
            IERC20(token).safeTransferFrom(msg.sender, address(this), amount);

            return amount;
        }
    }

    function _subtractGoodwill(
        address token,
        uint256 amount,
        address affiliate,
        bool enableGoodwill
    ) internal returns (uint256 totalGoodwillPortion) {
        bool whitelisted = feeWhitelist[msg.sender];
        if (enableGoodwill && !whitelisted && goodwill > 0) {
            totalGoodwillPortion = SafeMath.div(
                SafeMath.mul(amount, goodwill),
                10000
            );

            if (affiliates[affiliate]) {
                if (token == address(0)) {
                    token = ETHAddress;
                }

                uint256 affiliatePortion =
                    totalGoodwillPortion.mul(affiliateSplit).div(100);
                affiliateBalance[affiliate][token] = affiliateBalance[
                    affiliate
                ][token]
                    .add(affiliatePortion);
                totalAffiliateBalance[token] = totalAffiliateBalance[token].add(
                    affiliatePortion
                );
            }
        }
    }
}

File 5 of 10 : Context.sol
pragma solidity ^0.5.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 GSN 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.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor() internal {}

    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 6 of 10 : SafeMath.sol
pragma solidity ^0.5.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     *
     * _Available since v2.4.0._
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

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

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

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

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 7 of 10 : Ownable.sol
pragma solidity ^0.5.0;

import "../GSN/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.
 *
 * 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.
 */
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() internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _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 onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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 onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(
            newOwner != address(0),
            "Ownable: new owner is the zero address"
        );
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 8 of 10 : IERC20.sol
pragma solidity ^0.5.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
interface IERC20 {
    function decimals() external view returns (uint8);

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

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

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

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

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

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

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

File 9 of 10 : SafeERC20.sol
pragma solidity ^0.5.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transfer.selector, to, value)
        );
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
        );
    }

    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, value)
        );
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance =
            token.allowance(address(this), spender).add(value);
        callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance =
            token.allowance(address(this), spender).sub(
                value,
                "SafeERC20: decreased allowance below zero"
            );
        callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    /**
     * @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.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: ERC20 operation did not succeed"
            );
        }
    }
}

File 10 of 10 : Address.sol
pragma solidity ^0.5.5;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;

        bytes32 accountHash =
            0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            codehash := extcodehash(account)
        }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account)
        internal
        pure
        returns (address payable)
    {
        return address(uint160(account));
    }

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

        // solhint-disable-next-line avoid-call-value
        (bool success, ) = recipient.call.value(amount)("");
        require(
            success,
            "Address: unable to send value, recipient may have reverted"
        );
    }
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract Curve_Registry_V2","name":"_curveRegistry","type":"address"},{"internalType":"uint256","name":"_goodwill","type":"uint256"},{"internalType":"uint256","name":"_affiliateSplit","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"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":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokensRec","type":"uint256"}],"name":"zapOut","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"internalType":"address","name":"swapAddress","type":"address"},{"internalType":"uint256","name":"incomingCrv","type":"uint256"},{"internalType":"address","name":"intermediateToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"minToTokens","type":"uint256"},{"internalType":"address","name":"_swapTarget","type":"address"},{"internalType":"bytes","name":"_swapCallData","type":"bytes"},{"internalType":"address","name":"affiliate","type":"address"},{"internalType":"bool","name":"shouldSellEntireBalance","type":"bool"}],"name":"ZapOut","outputs":[{"internalType":"uint256","name":"ToTokensBought","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"affiliateBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"affiliates","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"affilliateWithdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedTargets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"curveReg","outputs":[{"internalType":"contract Curve_Registry_V2","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"goodwill","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"swapAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"removeLiquidityReturn","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"bool[]","name":"isApproved","type":"bool[]"}],"name":"setApprovedTargets","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"pool","type":"address[]"},{"internalType":"bool[]","name":"isV2Pool","type":"bool[]"}],"name":"setV2Pool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_affiliate","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"set_affiliate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"zapAddress","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"set_feeWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_new_affiliateSplit","type":"uint256"}],"name":"set_new_affiliateSplit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_new_goodwill","type":"uint256"}],"name":"set_new_goodwill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"stopped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"toggleContractActive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalAffiliateBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract Curve_Registry_V2","name":"newCurveRegistry","type":"address"}],"name":"updateCurveRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"withdrawTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

60806040526000805460ff60a01b191690553480156200001e57600080fd5b506040516200378338038062003783833981810160405260608110156200004457600080fd5b5080516020820151604090920151909190818160006200006c6001600160e01b036200015f16565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060029190915560035550507f7aa0b0d2bc12a96893b4425a8ec467207b2288f9c2c8ef3a8d1b6f01ec3522398054600160ff1991821681179092557380466c64868e1ab14a1ddf27a676c3fcbe638fe560005260096020527f0fd6878006f392cfba4fb025fdb8dee0b117b351becbf0ab229d178251fa5a4780549091169091179055600780546001600160a01b0319166001600160a01b039290921691909117905562000163565b3390565b61361080620001736000396000f3fe60806040526004361061014b5760003560e01c806375f12b21116100b6578063d8f6eb5b1161006f578063d8f6eb5b146105ce578063dee5b7e014610690578063e5953382146106d3578063f2fde38b14610706578063f99b277e14610739578063fbec27bf146108045761014b565b806375f12b211461045e5780638da5cb5b146104735780638f32d59b146104885780639735a6341461049d5780639779d1a614610568578063d408f6571461059b5761014b565b80633ff428c7116101085780633ff428c71461030d5780634f51e29414610348578063550bfa561461038f5780635de0398e146103b95780635ecb16cd146103ce578063715018a6146104495761014b565b806301e980d4146101a25780630dc9de85146101cc5780631385d24c146102475780631781261f1461025c57806318b135e3146102a9578063374b09f8146102dc575b333214156101a0576040805162461bcd60e51b815260206004820152601860248201527f446f206e6f742073656e6420455448206469726563746c790000000000000000604482015290519081900360640190fd5b005b3480156101ae57600080fd5b506101a0600480360360208110156101c557600080fd5b503561083f565b3480156101d857600080fd5b506101a0600480360360208110156101ef57600080fd5b810190602081018135600160201b81111561020957600080fd5b82018360208201111561021b57600080fd5b803590602001918460208302840111600160201b8311171561023c57600080fd5b5090925090506108cb565b34801561025357600080fd5b506101a0610aab565b34801561026857600080fd5b506102976004803603604081101561027f57600080fd5b506001600160a01b0381358116916020013516610b13565b60408051918252519081900360200190f35b3480156102b557600080fd5b50610297600480360360208110156102cc57600080fd5b50356001600160a01b0316610b30565b3480156102e857600080fd5b506102f1610b42565b604080516001600160a01b039092168252519081900360200190f35b34801561031957600080fd5b506101a06004803603604081101561033057600080fd5b506001600160a01b0381351690602001351515610b51565b34801561035457600080fd5b5061037b6004803603602081101561036b57600080fd5b50356001600160a01b0316610bc3565b604080519115158252519081900360200190f35b34801561039b57600080fd5b506101a0600480360360208110156103b257600080fd5b5035610bd8565b3480156103c557600080fd5b50610297610c7a565b3480156103da57600080fd5b506101a0600480360360208110156103f157600080fd5b810190602081018135600160201b81111561040b57600080fd5b82018360208201111561041d57600080fd5b803590602001918460208302840111600160201b8311171561043e57600080fd5b509092509050610c80565b34801561045557600080fd5b506101a0610e83565b34801561046a57600080fd5b5061037b610f14565b34801561047f57600080fd5b506102f1610f24565b34801561049457600080fd5b5061037b610f33565b3480156104a957600080fd5b506101a0600480360360408110156104c057600080fd5b810190602081018135600160201b8111156104da57600080fd5b8201836020820111156104ec57600080fd5b803590602001918460208302840111600160201b8311171561050d57600080fd5b919390929091602081019035600160201b81111561052a57600080fd5b82018360208201111561053c57600080fd5b803590602001918460208302840111600160201b8311171561055d57600080fd5b509092509050610f57565b34801561057457600080fd5b5061037b6004803603602081101561058b57600080fd5b50356001600160a01b0316611059565b3480156105a757600080fd5b5061037b600480360360208110156105be57600080fd5b50356001600160a01b031661106e565b3480156105da57600080fd5b5061029760048036036101208110156105f257600080fd5b6001600160a01b0382358116926020810135926040820135831692606083013581169260808101359260a08201359092169181019060e0810160c0820135600160201b81111561064157600080fd5b82018360208201111561065357600080fd5b803590602001918460018302840111600160201b8311171561067457600080fd5b91935091506001600160a01b0381351690602001351515611083565b34801561069c57600080fd5b50610297600480360360608110156106b357600080fd5b506001600160a01b03813581169160208101359091169060400135611346565b3480156106df57600080fd5b506101a0600480360360208110156106f657600080fd5b50356001600160a01b0316611a27565b34801561071257600080fd5b506101a06004803603602081101561072957600080fd5b50356001600160a01b0316611af3565b34801561074557600080fd5b506101a06004803603604081101561075c57600080fd5b810190602081018135600160201b81111561077657600080fd5b82018360208201111561078857600080fd5b803590602001918460208302840111600160201b831117156107a957600080fd5b919390929091602081019035600160201b8111156107c657600080fd5b8201836020820111156107d857600080fd5b803590602001918460208302840111600160201b831117156107f957600080fd5b509092509050611b46565b34801561081057600080fd5b506101a06004803603604081101561082757600080fd5b506001600160a01b0381351690602001351515611c41565b610847610f33565b610886576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b60648111156108c65760405162461bcd60e51b815260040180806020018281038252602181526020018061350f6021913960400191505060405180910390fd5b600355565b6000805b82811015610aa557336000908152600560205260408120908585848181106108f357fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020549150600060056000336001600160a01b03166001600160a01b03168152602001908152602001600020600086868581811061095b57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055506109e282600660008787868181106109a357fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002054611cb390919063ffffffff16565b600660008686858181106109f257fe5b602090810292909201356001600160a01b03168352508101919091526040016000205573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee848483818110610a3657fe5b905060200201356001600160a01b03166001600160a01b03161415610a6457610a5f3383611cfe565b610a9d565b610a9d3383868685818110610a7557fe5b905060200201356001600160a01b03166001600160a01b0316611de39092919063ffffffff16565b6001016108cf565b50505050565b610ab3610f33565b610af2576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6000805460ff60a01b198116600160a01b9182900460ff1615909102179055565b600560209081526000928352604080842090915290825290205481565b60066020526000908152604090205481565b6007546001600160a01b031681565b610b59610f33565b610b98576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b60046020526000908152604090205460ff1681565b610be0610f33565b610c1f576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6064811115610c75576040805162461bcd60e51b815260206004820152601a60248201527f476f6f6457696c6c2056616c7565206e6f7420616c6c6f776564000000000000604482015290519081900360640190fd5b600255565b60025481565b610c88610f33565b610cc7576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b60005b81811015610e7e57600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee848484818110610cf557fe5b905060200201356001600160a01b03166001600160a01b03161415610d8757610d6760066000868686818110610d2757fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b031681526020019081526020016000205447611cb390919063ffffffff16565b9050610d82610d7c610d77610f24565b611e35565b82611cfe565b610e75565b610e5b60066000868686818110610d9a57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002054858585818110610dd757fe5b604080516370a0823160e01b81523060048201529051602092830294909401356001600160a01b0316936370a08231935060248083019392829003018186803b158015610e2357600080fd5b505afa158015610e37573d6000803e3d6000fd5b505050506040513d6020811015610e4d57600080fd5b50519063ffffffff611cb316565b9050610e75610e68610f24565b82868686818110610a7557fe5b50600101610cca565b505050565b610e8b610f33565b610eca576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600054600160a01b900460ff1681565b6000546001600160a01b031690565b600080546001600160a01b0316610f48611e3c565b6001600160a01b031614905090565b610f5f610f33565b610f9e576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b828114610fe9576040805162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c84092dce0eae840d8cadccee8d60631b604482015290519081900360640190fd5b60005b838110156110525782828281811061100057fe5b9050602002013515156008600087878581811061101957fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101610fec565b5050505050565b60086020526000908152604090205460ff1681565b60016020526000908152604090205460ff1681565b60008054600160a01b900460ff16156110d8576040805162461bcd60e51b815260206004820152601260248201527115195b5c1bdc985c9a5b1e4814185d5cd95960721b604482015290519081900360640190fd5b6007546040805163b8d7b66960e01b81526001600160a01b038e811660048301529151600093929092169163b8d7b66991602480820192602092909190829003018186803b15801561112957600080fd5b505afa15801561113d573d6000803e3d6000fd5b505050506040513d602081101561115357600080fd5b50519050611162818c85611e40565b9a506001600160a01b038a1661118a5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee99505b6111ce8c8c8c8c8b8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611f5192505050565b915087821015611215576040805162461bcd60e51b815260206004820152600d60248201526c4869676820536c69707061676560981b604482015290519081900360640190fd5b60006001600160a01b038a166112665761124673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84876001612269565b90506112613361125c858463ffffffff611cb316565b611cfe565b6112a0565b6112738a84876001612269565b90506112a033611289858463ffffffff611cb316565b6001600160a01b038d16919063ffffffff611de316565b7ff2d3e32195f8631c70e1d996c9bd5d4a3369d0580786dcd662bf13139310355d338e8c8660405180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b0316815260200182815260200194505050505060405180910390a1611335838263ffffffff611cb316565b9d9c50505050505050505050505050565b60006001600160a01b03831661136e5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee92505b600754604080516301e09fa360e41b81526001600160a01b038781166004830152868116602483015282516000948594921692631e09fa30926044808301939192829003018186803b1580156113c357600080fd5b505afa1580156113d7573d6000803e3d6000fd5b505050506040513d60408110156113ed57600080fd5b50805160209091015190925090508115611742576001600160a01b03861660009081526009602052604090205460ff1615611521576007546040805163d83a7f6760e01b81526001600160a01b0389811660048301529151919092169163d83a7f67916024808301926020929190829003018186803b15801561146f57600080fd5b505afa158015611483573d6000803e3d6000fd5b505050506040513d602081101561149957600080fd5b5051604080516327d8462f60e11b8152600481018790526024810184905290516001600160a01b0390921691634fb08c5e91604480820192602092909190829003018186803b1580156114eb57600080fd5b505afa1580156114ff573d6000803e3d6000fd5b505050506040513d602081101561151557600080fd5b50519250611a20915050565b60075460408051630a6954a960e21b81526001600160a01b038981166004830152915191909216916329a552a4916024808301926020929190829003018186803b15801561156e57600080fd5b505afa158015611582573d6000803e3d6000fd5b505050506040513d602081101561159857600080fd5b505115611674576007546040805163d83a7f6760e01b81526001600160a01b0389811660048301529151919092169163d83a7f67916024808301926020929190829003018186803b1580156115ec57600080fd5b505afa158015611600573d6000803e3d6000fd5b505050506040513d602081101561161657600080fd5b50516040805163314ca9dd60e21b815260048101879052600f84810b900b60248201526001604482015290516001600160a01b039092169163c532a77491606480820192602092909190829003018186803b1580156114eb57600080fd5b6007546040805163d83a7f6760e01b81526001600160a01b0389811660048301529151919092169163d83a7f67916024808301926020929190829003018186803b1580156116c157600080fd5b505afa1580156116d5573d6000803e3d6000fd5b505050506040513d60208110156116eb57600080fd5b50516040805163cc2b27d760e01b815260048101879052600f84810b900b602482015290516001600160a01b039092169163cc2b27d791604480820192602092909190829003018186803b1580156114eb57600080fd5b61174a61346f565b6007546040805163ca4f280360e01b81526001600160a01b038a811660048301529151919092169163ca4f2803916024808301926080929190829003018186803b15801561179757600080fd5b505afa1580156117ab573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525060808110156117d057600080fd5b5090506000805b6004811015611892576007546001600160a01b031663bbff1a668483600481106117fd57fe5b60200201516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561184857600080fd5b505afa15801561185c573d6000803e3d6000fd5b505050506040513d602081101561187257600080fd5b505191506001600160a01b0382161561188a57611892565b6001016117d7565b506040805163cc2b27d760e01b8152600481018890526001602482015290516000916001600160a01b038b169163cc2b27d791604480820192602092909190829003018186803b1580156118e557600080fd5b505afa1580156118f9573d6000803e3d6000fd5b505050506040513d602081101561190f57600080fd5b5051600754604080516301e09fa360e41b81526001600160a01b0386811660048301528c81166024830152825194955090921692631e09fa30926044808201939291829003018186803b15801561196557600080fd5b505afa158015611979573d6000803e3d6000fd5b505050506040513d604081101561198f57600080fd5b506020908101516040805163cc2b27d760e01b815260048101859052600f83810b900b602482015290519196506001600160a01b0385169263cc2b27d792604480840193829003018186803b1580156119e757600080fd5b505afa1580156119fb573d6000803e3d6000fd5b505050506040513d6020811015611a1157600080fd5b50519550611a20945050505050565b9392505050565b611a2f610f33565b611a6e576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6007546001600160a01b0382811691161415611ad1576040805162461bcd60e51b815260206004820152601b60248201527f416c7265616479207573696e6720746869732052656769737472790000000000604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b611afb610f33565b611b3a576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b611b43816123c3565b50565b611b4e610f33565b611b8d576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b828114611bd8576040805162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c84092dce0eae840d8cadccee8d60631b604482015290519081900360640190fd5b60005b8381101561105257828282818110611bef57fe5b90506020020135151560096000878785818110611c0857fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101611bdb565b611c49610f33565b611c88576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000611cf583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612463565b90505b92915050565b80471015611d53576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114611d9e576040519150601f19603f3d011682016040523d82523d6000602084013e611da3565b606091505b5050905080610e7e5760405162461bcd60e51b815260040180806020018281038252603a8152602001806134b4603a913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610e7e9084906124fa565b805b919050565b3390565b60008115611f2f57611e51336126b2565b611e8c5760405162461bcd60e51b815260040180806020018281038252602c815260200180613550602c913960400191505060405180910390fd5b60408051636eb1769f60e11b8152336004820152306024820152905185916000916001600160a01b0384169163dd62ed3e916044808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b50519050611f266001600160a01b03831633308463ffffffff6126ee16565b9150611a209050565b611f4a6001600160a01b03851633308663ffffffff6126ee16565b5081611a20565b600754604080516301e09fa360e41b81526001600160a01b03898116600483015287811660248301528251600094859485949390911692631e09fa309260448083019392829003018186803b158015611fa957600080fd5b505afa158015611fbd573d6000803e3d6000fd5b505050506040513d6040811015611fd357600080fd5b50805160209091015190925090508115612036576000611ff58a8a848b612748565b90506001600160a01b03881673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561202157600097505b61202e8888838989612aea565b93505061225d565b61203e61346f565b6007546040805163ca4f280360e01b81526001600160a01b038d811660048301529151919092169163ca4f2803916024808301926080929190829003018186803b15801561208b57600080fd5b505afa15801561209f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525060808110156120c457600080fd5b5090506000805b60048160ff161015612225576007546000906001600160a01b031663bbff1a668560ff8516600481106120fa57fe5b60200201516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561214557600080fd5b505afa158015612159573d6000803e3d6000fd5b505050506040513d602081101561216f57600080fd5b50516001600160a01b03161461221d576007546001600160a01b031663bbff1a668460ff84166004811061219f57fe5b60200201516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156121ea57600080fd5b505afa1580156121fe573d6000803e3d6000fd5b505050506040513d602081101561221457600080fd5b50519150612225565b6001016120cb565b60006122468d8d60ff851687816004811061223c57fe5b6020020151612e70565b905061225683828d8d8d8d611f51565b9650505050505b50509695505050505050565b3360009081526001602052604081205460ff16828015612287575080155b801561229557506000600254115b156123ba576122b16122a986600254613090565b6127106130e9565b6001600160a01b03851660009081526004602052604090205490925060ff16156123ba576001600160a01b0386166122fb5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee95505b600061232360646123176003548661309090919063ffffffff16565b9063ffffffff6130e916565b6001600160a01b038087166000908152600560209081526040808320938c168352929052205490915061235c908263ffffffff61312b16565b6001600160a01b038087166000908152600560209081526040808320938c16835292815282822093909355600690925290205461239f908263ffffffff61312b16565b6001600160a01b038816600090815260066020526040902055505b50949350505050565b6001600160a01b0381166124085760405162461bcd60e51b815260040180806020018281038252602681526020018061348e6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156124f25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124b757818101518382015260200161249f565b50505050905090810190601f1680156124e45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b61250c826001600160a01b03166126b2565b61255d576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061259b5780518252601f19909201916020918201910161257c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146125fd576040519150601f19603f3d011682016040523d82523d6000602084013e612602565b606091505b509150915081612659576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610aa55780806020019051602081101561267557600080fd5b5051610aa55760405162461bcd60e51b815260040180806020018281038252602a81526020018061357c602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906126e657508115155b949350505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610aa59085906124fa565b6007546040805163d83a7f6760e01b81526001600160a01b03878116600483015291516000938493169163d83a7f67916024808301926020929190829003018186803b15801561279757600080fd5b505afa1580156127ab573d6000803e3d6000fd5b505050506040513d60208110156127c157600080fd5b50516007546040805163b8d7b66960e01b81526001600160a01b038a811660048301529151939450600093919092169163b8d7b669916024808301926020929190829003018186803b15801561281657600080fd5b505afa15801561282a573d6000803e3d6000fd5b505050506040513d602081101561284057600080fd5b5051905061284e8183613185565b60006001600160a01b03851673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461287a578461287d565b60005b9050600061288a82613232565b60075460408051630a6954a960e21b81526001600160a01b038d8116600483015291519394509116916329a552a491602480820192602092909190829003018186803b1580156128d957600080fd5b505afa1580156128ed573d6000803e3d6000fd5b505050506040513d602081101561290357600080fd5b505115612987576040805163517a55a360e01b8152600481018a9052600f89810b900b60248201526000604482018190526001606483015291516001600160a01b0387169263517a55a3926084808201939182900301818387803b15801561296a57600080fd5b505af115801561297e573d6000803e3d6000fd5b50505050612a6e565b6001600160a01b03891660009081526009602052604090205460ff16156129fc576040805163f1dc3cc960e01b8152600481018a90526024810189905260006044820181905291516001600160a01b0387169263f1dc3cc9926064808201939182900301818387803b15801561296a57600080fd5b60408051630d2680e960e11b8152600481018a9052600f89810b900b602482015260006044820181905291516001600160a01b03871692631a4d01d2926064808201939182900301818387803b158015612a5557600080fd5b505af1158015612a69573d6000803e3d6000fd5b505050505b612a8781612a7b84613232565b9063ffffffff611cb316565b945060008511612ade576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f742072656365697665207265736572766520746f6b656e73604482015290519081900360640190fd5b50505050949350505050565b6000846001600160a01b0316866001600160a01b03161415612b0d575082612e67565b6001600160a01b03861673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2148015612b4057506001600160a01b038516155b15612bbf5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d856040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612b9f57600080fd5b505af1158015612bb3573d6000803e3d6000fd5b50505050839050612e67565b6001600160a01b038616158015612bf257506001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b15612c675773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015612c4657600080fd5b505af1158015612c5a573d6000803e3d6000fd5b5050505050839050612e67565b60006001600160a01b038716612c7e575083612c89565b612c898785876132c1565b6000612c9487613232565b6001600160a01b03861660009081526008602052604090205490915060ff16612cfc576040805162461bcd60e51b815260206004820152601560248201527415185c99d95d081b9bdd08105d5d1a1bdc9a5e9959605a1b604482015290519081900360640190fd5b6000856001600160a01b031683866040518082805190602001908083835b60208310612d395780518252601f199092019160209182019101612d1a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612d9b576040519150601f19603f3d011682016040523d82523d6000602084013e612da0565b606091505b5050905080612dee576040805162461bcd60e51b81526020600482015260156024820152744572726f72205377617070696e6720546f6b656e7360581b604482015290519081900360640190fd5b6000612df989613232565b9050612e0b818463ffffffff611cb316565b945060008511612e62576040805162461bcd60e51b815260206004820152601f60248201527f5377617070656420546f20496e76616c696420496e7465726d65646961746500604482015290519081900360640190fd5b505050505b95945050505050565b6007546040805163b8d7b66960e01b81526001600160a01b03878116600483015291516000938493169163b8d7b669916024808301926020929190829003018186803b158015612ebf57600080fd5b505afa158015612ed3573d6000803e3d6000fd5b505050506040513d6020811015612ee957600080fd5b50519050612ef78187613185565b604080516370a0823160e01b815230600482015290516000916001600160a01b038616916370a0823191602480820192602092909190829003018186803b158015612f4157600080fd5b505afa158015612f55573d6000803e3d6000fd5b505050506040513d6020811015612f6b57600080fd5b505160408051630d2680e960e11b815260048101899052600f88810b900b602482015260006044820181905291519293506001600160a01b038a1692631a4d01d29260648084019391929182900301818387803b158015612fcb57600080fd5b505af1158015612fdf573d6000803e3d6000fd5b5050604080516370a0823160e01b8152306004820152905161302f93508492506001600160a01b038816916370a08231916024808301926020929190829003018186803b158015610e2357600080fd5b925060008311613086576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f742072656365697665207265736572766520746f6b656e73604482015290519081900360640190fd5b5050949350505050565b60008261309f57506000611cf8565b828202828482816130ac57fe5b0414611cf55760405162461bcd60e51b81526004018080602001828103825260218152602001806134ee6021913960400191505060405180910390fd5b6000611cf583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506132f7565b600082820183811015611cf5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60408051636eb1769f60e11b81523060048201526001600160a01b038381166024830152915184926000929084169163dd62ed3e91604480820192602092909190829003018186803b1580156131da57600080fd5b505afa1580156131ee573d6000803e3d6000fd5b505050506040513d602081101561320457600080fd5b50511115613212575061322e565b610e7e6001600160a01b0382168360001963ffffffff61335c16565b5050565b60006001600160a01b038216613249575047611e37565b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561328f57600080fd5b505afa1580156132a3573d6000803e3d6000fd5b505050506040513d60208110156132b957600080fd5b505192915050565b826132dd6001600160a01b03821684600063ffffffff61335c16565b610aa56001600160a01b038216848463ffffffff61335c16565b600081836133465760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156124b757818101518382015260200161249f565b50600083858161335257fe5b0495945050505050565b8015806133e2575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156133b457600080fd5b505afa1580156133c8573d6000803e3d6000fd5b505050506040513d60208110156133de57600080fd5b5051155b61341d5760405162461bcd60e51b81526004018080602001828103825260368152602001806135a66036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610e7e9084906124fa565b6040518060800160405280600490602082028038833950919291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416666696c696174652053706c69742056616c7565206e6f7420616c6c6f7765644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552523a2073686f756c6453656c6c456e7469726542616c616e6365206973207472756520666f7220454f415361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a7231582044992668aae0f7936b5be4e6f5379a5fe251c6b24433468a65bba5bbe4827a6b64736f6c634300051100320000000000000000000000008aee0a8a05a319bfca41ff2e95c48f3f8638321100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061014b5760003560e01c806375f12b21116100b6578063d8f6eb5b1161006f578063d8f6eb5b146105ce578063dee5b7e014610690578063e5953382146106d3578063f2fde38b14610706578063f99b277e14610739578063fbec27bf146108045761014b565b806375f12b211461045e5780638da5cb5b146104735780638f32d59b146104885780639735a6341461049d5780639779d1a614610568578063d408f6571461059b5761014b565b80633ff428c7116101085780633ff428c71461030d5780634f51e29414610348578063550bfa561461038f5780635de0398e146103b95780635ecb16cd146103ce578063715018a6146104495761014b565b806301e980d4146101a25780630dc9de85146101cc5780631385d24c146102475780631781261f1461025c57806318b135e3146102a9578063374b09f8146102dc575b333214156101a0576040805162461bcd60e51b815260206004820152601860248201527f446f206e6f742073656e6420455448206469726563746c790000000000000000604482015290519081900360640190fd5b005b3480156101ae57600080fd5b506101a0600480360360208110156101c557600080fd5b503561083f565b3480156101d857600080fd5b506101a0600480360360208110156101ef57600080fd5b810190602081018135600160201b81111561020957600080fd5b82018360208201111561021b57600080fd5b803590602001918460208302840111600160201b8311171561023c57600080fd5b5090925090506108cb565b34801561025357600080fd5b506101a0610aab565b34801561026857600080fd5b506102976004803603604081101561027f57600080fd5b506001600160a01b0381358116916020013516610b13565b60408051918252519081900360200190f35b3480156102b557600080fd5b50610297600480360360208110156102cc57600080fd5b50356001600160a01b0316610b30565b3480156102e857600080fd5b506102f1610b42565b604080516001600160a01b039092168252519081900360200190f35b34801561031957600080fd5b506101a06004803603604081101561033057600080fd5b506001600160a01b0381351690602001351515610b51565b34801561035457600080fd5b5061037b6004803603602081101561036b57600080fd5b50356001600160a01b0316610bc3565b604080519115158252519081900360200190f35b34801561039b57600080fd5b506101a0600480360360208110156103b257600080fd5b5035610bd8565b3480156103c557600080fd5b50610297610c7a565b3480156103da57600080fd5b506101a0600480360360208110156103f157600080fd5b810190602081018135600160201b81111561040b57600080fd5b82018360208201111561041d57600080fd5b803590602001918460208302840111600160201b8311171561043e57600080fd5b509092509050610c80565b34801561045557600080fd5b506101a0610e83565b34801561046a57600080fd5b5061037b610f14565b34801561047f57600080fd5b506102f1610f24565b34801561049457600080fd5b5061037b610f33565b3480156104a957600080fd5b506101a0600480360360408110156104c057600080fd5b810190602081018135600160201b8111156104da57600080fd5b8201836020820111156104ec57600080fd5b803590602001918460208302840111600160201b8311171561050d57600080fd5b919390929091602081019035600160201b81111561052a57600080fd5b82018360208201111561053c57600080fd5b803590602001918460208302840111600160201b8311171561055d57600080fd5b509092509050610f57565b34801561057457600080fd5b5061037b6004803603602081101561058b57600080fd5b50356001600160a01b0316611059565b3480156105a757600080fd5b5061037b600480360360208110156105be57600080fd5b50356001600160a01b031661106e565b3480156105da57600080fd5b5061029760048036036101208110156105f257600080fd5b6001600160a01b0382358116926020810135926040820135831692606083013581169260808101359260a08201359092169181019060e0810160c0820135600160201b81111561064157600080fd5b82018360208201111561065357600080fd5b803590602001918460018302840111600160201b8311171561067457600080fd5b91935091506001600160a01b0381351690602001351515611083565b34801561069c57600080fd5b50610297600480360360608110156106b357600080fd5b506001600160a01b03813581169160208101359091169060400135611346565b3480156106df57600080fd5b506101a0600480360360208110156106f657600080fd5b50356001600160a01b0316611a27565b34801561071257600080fd5b506101a06004803603602081101561072957600080fd5b50356001600160a01b0316611af3565b34801561074557600080fd5b506101a06004803603604081101561075c57600080fd5b810190602081018135600160201b81111561077657600080fd5b82018360208201111561078857600080fd5b803590602001918460208302840111600160201b831117156107a957600080fd5b919390929091602081019035600160201b8111156107c657600080fd5b8201836020820111156107d857600080fd5b803590602001918460208302840111600160201b831117156107f957600080fd5b509092509050611b46565b34801561081057600080fd5b506101a06004803603604081101561082757600080fd5b506001600160a01b0381351690602001351515611c41565b610847610f33565b610886576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b60648111156108c65760405162461bcd60e51b815260040180806020018281038252602181526020018061350f6021913960400191505060405180910390fd5b600355565b6000805b82811015610aa557336000908152600560205260408120908585848181106108f357fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020549150600060056000336001600160a01b03166001600160a01b03168152602001908152602001600020600086868581811061095b57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055506109e282600660008787868181106109a357fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002054611cb390919063ffffffff16565b600660008686858181106109f257fe5b602090810292909201356001600160a01b03168352508101919091526040016000205573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee848483818110610a3657fe5b905060200201356001600160a01b03166001600160a01b03161415610a6457610a5f3383611cfe565b610a9d565b610a9d3383868685818110610a7557fe5b905060200201356001600160a01b03166001600160a01b0316611de39092919063ffffffff16565b6001016108cf565b50505050565b610ab3610f33565b610af2576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6000805460ff60a01b198116600160a01b9182900460ff1615909102179055565b600560209081526000928352604080842090915290825290205481565b60066020526000908152604090205481565b6007546001600160a01b031681565b610b59610f33565b610b98576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b60046020526000908152604090205460ff1681565b610be0610f33565b610c1f576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6064811115610c75576040805162461bcd60e51b815260206004820152601a60248201527f476f6f6457696c6c2056616c7565206e6f7420616c6c6f776564000000000000604482015290519081900360640190fd5b600255565b60025481565b610c88610f33565b610cc7576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b60005b81811015610e7e57600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee848484818110610cf557fe5b905060200201356001600160a01b03166001600160a01b03161415610d8757610d6760066000868686818110610d2757fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b031681526020019081526020016000205447611cb390919063ffffffff16565b9050610d82610d7c610d77610f24565b611e35565b82611cfe565b610e75565b610e5b60066000868686818110610d9a57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002054858585818110610dd757fe5b604080516370a0823160e01b81523060048201529051602092830294909401356001600160a01b0316936370a08231935060248083019392829003018186803b158015610e2357600080fd5b505afa158015610e37573d6000803e3d6000fd5b505050506040513d6020811015610e4d57600080fd5b50519063ffffffff611cb316565b9050610e75610e68610f24565b82868686818110610a7557fe5b50600101610cca565b505050565b610e8b610f33565b610eca576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600054600160a01b900460ff1681565b6000546001600160a01b031690565b600080546001600160a01b0316610f48611e3c565b6001600160a01b031614905090565b610f5f610f33565b610f9e576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b828114610fe9576040805162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c84092dce0eae840d8cadccee8d60631b604482015290519081900360640190fd5b60005b838110156110525782828281811061100057fe5b9050602002013515156008600087878581811061101957fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101610fec565b5050505050565b60086020526000908152604090205460ff1681565b60016020526000908152604090205460ff1681565b60008054600160a01b900460ff16156110d8576040805162461bcd60e51b815260206004820152601260248201527115195b5c1bdc985c9a5b1e4814185d5cd95960721b604482015290519081900360640190fd5b6007546040805163b8d7b66960e01b81526001600160a01b038e811660048301529151600093929092169163b8d7b66991602480820192602092909190829003018186803b15801561112957600080fd5b505afa15801561113d573d6000803e3d6000fd5b505050506040513d602081101561115357600080fd5b50519050611162818c85611e40565b9a506001600160a01b038a1661118a5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee99505b6111ce8c8c8c8c8b8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611f5192505050565b915087821015611215576040805162461bcd60e51b815260206004820152600d60248201526c4869676820536c69707061676560981b604482015290519081900360640190fd5b60006001600160a01b038a166112665761124673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84876001612269565b90506112613361125c858463ffffffff611cb316565b611cfe565b6112a0565b6112738a84876001612269565b90506112a033611289858463ffffffff611cb316565b6001600160a01b038d16919063ffffffff611de316565b7ff2d3e32195f8631c70e1d996c9bd5d4a3369d0580786dcd662bf13139310355d338e8c8660405180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b0316815260200182815260200194505050505060405180910390a1611335838263ffffffff611cb316565b9d9c50505050505050505050505050565b60006001600160a01b03831661136e5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee92505b600754604080516301e09fa360e41b81526001600160a01b038781166004830152868116602483015282516000948594921692631e09fa30926044808301939192829003018186803b1580156113c357600080fd5b505afa1580156113d7573d6000803e3d6000fd5b505050506040513d60408110156113ed57600080fd5b50805160209091015190925090508115611742576001600160a01b03861660009081526009602052604090205460ff1615611521576007546040805163d83a7f6760e01b81526001600160a01b0389811660048301529151919092169163d83a7f67916024808301926020929190829003018186803b15801561146f57600080fd5b505afa158015611483573d6000803e3d6000fd5b505050506040513d602081101561149957600080fd5b5051604080516327d8462f60e11b8152600481018790526024810184905290516001600160a01b0390921691634fb08c5e91604480820192602092909190829003018186803b1580156114eb57600080fd5b505afa1580156114ff573d6000803e3d6000fd5b505050506040513d602081101561151557600080fd5b50519250611a20915050565b60075460408051630a6954a960e21b81526001600160a01b038981166004830152915191909216916329a552a4916024808301926020929190829003018186803b15801561156e57600080fd5b505afa158015611582573d6000803e3d6000fd5b505050506040513d602081101561159857600080fd5b505115611674576007546040805163d83a7f6760e01b81526001600160a01b0389811660048301529151919092169163d83a7f67916024808301926020929190829003018186803b1580156115ec57600080fd5b505afa158015611600573d6000803e3d6000fd5b505050506040513d602081101561161657600080fd5b50516040805163314ca9dd60e21b815260048101879052600f84810b900b60248201526001604482015290516001600160a01b039092169163c532a77491606480820192602092909190829003018186803b1580156114eb57600080fd5b6007546040805163d83a7f6760e01b81526001600160a01b0389811660048301529151919092169163d83a7f67916024808301926020929190829003018186803b1580156116c157600080fd5b505afa1580156116d5573d6000803e3d6000fd5b505050506040513d60208110156116eb57600080fd5b50516040805163cc2b27d760e01b815260048101879052600f84810b900b602482015290516001600160a01b039092169163cc2b27d791604480820192602092909190829003018186803b1580156114eb57600080fd5b61174a61346f565b6007546040805163ca4f280360e01b81526001600160a01b038a811660048301529151919092169163ca4f2803916024808301926080929190829003018186803b15801561179757600080fd5b505afa1580156117ab573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525060808110156117d057600080fd5b5090506000805b6004811015611892576007546001600160a01b031663bbff1a668483600481106117fd57fe5b60200201516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561184857600080fd5b505afa15801561185c573d6000803e3d6000fd5b505050506040513d602081101561187257600080fd5b505191506001600160a01b0382161561188a57611892565b6001016117d7565b506040805163cc2b27d760e01b8152600481018890526001602482015290516000916001600160a01b038b169163cc2b27d791604480820192602092909190829003018186803b1580156118e557600080fd5b505afa1580156118f9573d6000803e3d6000fd5b505050506040513d602081101561190f57600080fd5b5051600754604080516301e09fa360e41b81526001600160a01b0386811660048301528c81166024830152825194955090921692631e09fa30926044808201939291829003018186803b15801561196557600080fd5b505afa158015611979573d6000803e3d6000fd5b505050506040513d604081101561198f57600080fd5b506020908101516040805163cc2b27d760e01b815260048101859052600f83810b900b602482015290519196506001600160a01b0385169263cc2b27d792604480840193829003018186803b1580156119e757600080fd5b505afa1580156119fb573d6000803e3d6000fd5b505050506040513d6020811015611a1157600080fd5b50519550611a20945050505050565b9392505050565b611a2f610f33565b611a6e576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6007546001600160a01b0382811691161415611ad1576040805162461bcd60e51b815260206004820152601b60248201527f416c7265616479207573696e6720746869732052656769737472790000000000604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b611afb610f33565b611b3a576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b611b43816123c3565b50565b611b4e610f33565b611b8d576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b828114611bd8576040805162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c84092dce0eae840d8cadccee8d60631b604482015290519081900360640190fd5b60005b8381101561105257828282818110611bef57fe5b90506020020135151560096000878785818110611c0857fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101611bdb565b611c49610f33565b611c88576040805162461bcd60e51b81526020600482018190526024820152600080516020613530833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000611cf583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612463565b90505b92915050565b80471015611d53576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114611d9e576040519150601f19603f3d011682016040523d82523d6000602084013e611da3565b606091505b5050905080610e7e5760405162461bcd60e51b815260040180806020018281038252603a8152602001806134b4603a913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610e7e9084906124fa565b805b919050565b3390565b60008115611f2f57611e51336126b2565b611e8c5760405162461bcd60e51b815260040180806020018281038252602c815260200180613550602c913960400191505060405180910390fd5b60408051636eb1769f60e11b8152336004820152306024820152905185916000916001600160a01b0384169163dd62ed3e916044808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b50519050611f266001600160a01b03831633308463ffffffff6126ee16565b9150611a209050565b611f4a6001600160a01b03851633308663ffffffff6126ee16565b5081611a20565b600754604080516301e09fa360e41b81526001600160a01b03898116600483015287811660248301528251600094859485949390911692631e09fa309260448083019392829003018186803b158015611fa957600080fd5b505afa158015611fbd573d6000803e3d6000fd5b505050506040513d6040811015611fd357600080fd5b50805160209091015190925090508115612036576000611ff58a8a848b612748565b90506001600160a01b03881673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561202157600097505b61202e8888838989612aea565b93505061225d565b61203e61346f565b6007546040805163ca4f280360e01b81526001600160a01b038d811660048301529151919092169163ca4f2803916024808301926080929190829003018186803b15801561208b57600080fd5b505afa15801561209f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525060808110156120c457600080fd5b5090506000805b60048160ff161015612225576007546000906001600160a01b031663bbff1a668560ff8516600481106120fa57fe5b60200201516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561214557600080fd5b505afa158015612159573d6000803e3d6000fd5b505050506040513d602081101561216f57600080fd5b50516001600160a01b03161461221d576007546001600160a01b031663bbff1a668460ff84166004811061219f57fe5b60200201516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156121ea57600080fd5b505afa1580156121fe573d6000803e3d6000fd5b505050506040513d602081101561221457600080fd5b50519150612225565b6001016120cb565b60006122468d8d60ff851687816004811061223c57fe5b6020020151612e70565b905061225683828d8d8d8d611f51565b9650505050505b50509695505050505050565b3360009081526001602052604081205460ff16828015612287575080155b801561229557506000600254115b156123ba576122b16122a986600254613090565b6127106130e9565b6001600160a01b03851660009081526004602052604090205490925060ff16156123ba576001600160a01b0386166122fb5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee95505b600061232360646123176003548661309090919063ffffffff16565b9063ffffffff6130e916565b6001600160a01b038087166000908152600560209081526040808320938c168352929052205490915061235c908263ffffffff61312b16565b6001600160a01b038087166000908152600560209081526040808320938c16835292815282822093909355600690925290205461239f908263ffffffff61312b16565b6001600160a01b038816600090815260066020526040902055505b50949350505050565b6001600160a01b0381166124085760405162461bcd60e51b815260040180806020018281038252602681526020018061348e6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156124f25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124b757818101518382015260200161249f565b50505050905090810190601f1680156124e45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b61250c826001600160a01b03166126b2565b61255d576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061259b5780518252601f19909201916020918201910161257c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146125fd576040519150601f19603f3d011682016040523d82523d6000602084013e612602565b606091505b509150915081612659576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610aa55780806020019051602081101561267557600080fd5b5051610aa55760405162461bcd60e51b815260040180806020018281038252602a81526020018061357c602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906126e657508115155b949350505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610aa59085906124fa565b6007546040805163d83a7f6760e01b81526001600160a01b03878116600483015291516000938493169163d83a7f67916024808301926020929190829003018186803b15801561279757600080fd5b505afa1580156127ab573d6000803e3d6000fd5b505050506040513d60208110156127c157600080fd5b50516007546040805163b8d7b66960e01b81526001600160a01b038a811660048301529151939450600093919092169163b8d7b669916024808301926020929190829003018186803b15801561281657600080fd5b505afa15801561282a573d6000803e3d6000fd5b505050506040513d602081101561284057600080fd5b5051905061284e8183613185565b60006001600160a01b03851673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461287a578461287d565b60005b9050600061288a82613232565b60075460408051630a6954a960e21b81526001600160a01b038d8116600483015291519394509116916329a552a491602480820192602092909190829003018186803b1580156128d957600080fd5b505afa1580156128ed573d6000803e3d6000fd5b505050506040513d602081101561290357600080fd5b505115612987576040805163517a55a360e01b8152600481018a9052600f89810b900b60248201526000604482018190526001606483015291516001600160a01b0387169263517a55a3926084808201939182900301818387803b15801561296a57600080fd5b505af115801561297e573d6000803e3d6000fd5b50505050612a6e565b6001600160a01b03891660009081526009602052604090205460ff16156129fc576040805163f1dc3cc960e01b8152600481018a90526024810189905260006044820181905291516001600160a01b0387169263f1dc3cc9926064808201939182900301818387803b15801561296a57600080fd5b60408051630d2680e960e11b8152600481018a9052600f89810b900b602482015260006044820181905291516001600160a01b03871692631a4d01d2926064808201939182900301818387803b158015612a5557600080fd5b505af1158015612a69573d6000803e3d6000fd5b505050505b612a8781612a7b84613232565b9063ffffffff611cb316565b945060008511612ade576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f742072656365697665207265736572766520746f6b656e73604482015290519081900360640190fd5b50505050949350505050565b6000846001600160a01b0316866001600160a01b03161415612b0d575082612e67565b6001600160a01b03861673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2148015612b4057506001600160a01b038516155b15612bbf5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d856040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612b9f57600080fd5b505af1158015612bb3573d6000803e3d6000fd5b50505050839050612e67565b6001600160a01b038616158015612bf257506001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b15612c675773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015612c4657600080fd5b505af1158015612c5a573d6000803e3d6000fd5b5050505050839050612e67565b60006001600160a01b038716612c7e575083612c89565b612c898785876132c1565b6000612c9487613232565b6001600160a01b03861660009081526008602052604090205490915060ff16612cfc576040805162461bcd60e51b815260206004820152601560248201527415185c99d95d081b9bdd08105d5d1a1bdc9a5e9959605a1b604482015290519081900360640190fd5b6000856001600160a01b031683866040518082805190602001908083835b60208310612d395780518252601f199092019160209182019101612d1a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612d9b576040519150601f19603f3d011682016040523d82523d6000602084013e612da0565b606091505b5050905080612dee576040805162461bcd60e51b81526020600482015260156024820152744572726f72205377617070696e6720546f6b656e7360581b604482015290519081900360640190fd5b6000612df989613232565b9050612e0b818463ffffffff611cb316565b945060008511612e62576040805162461bcd60e51b815260206004820152601f60248201527f5377617070656420546f20496e76616c696420496e7465726d65646961746500604482015290519081900360640190fd5b505050505b95945050505050565b6007546040805163b8d7b66960e01b81526001600160a01b03878116600483015291516000938493169163b8d7b669916024808301926020929190829003018186803b158015612ebf57600080fd5b505afa158015612ed3573d6000803e3d6000fd5b505050506040513d6020811015612ee957600080fd5b50519050612ef78187613185565b604080516370a0823160e01b815230600482015290516000916001600160a01b038616916370a0823191602480820192602092909190829003018186803b158015612f4157600080fd5b505afa158015612f55573d6000803e3d6000fd5b505050506040513d6020811015612f6b57600080fd5b505160408051630d2680e960e11b815260048101899052600f88810b900b602482015260006044820181905291519293506001600160a01b038a1692631a4d01d29260648084019391929182900301818387803b158015612fcb57600080fd5b505af1158015612fdf573d6000803e3d6000fd5b5050604080516370a0823160e01b8152306004820152905161302f93508492506001600160a01b038816916370a08231916024808301926020929190829003018186803b158015610e2357600080fd5b925060008311613086576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f742072656365697665207265736572766520746f6b656e73604482015290519081900360640190fd5b5050949350505050565b60008261309f57506000611cf8565b828202828482816130ac57fe5b0414611cf55760405162461bcd60e51b81526004018080602001828103825260218152602001806134ee6021913960400191505060405180910390fd5b6000611cf583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506132f7565b600082820183811015611cf5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60408051636eb1769f60e11b81523060048201526001600160a01b038381166024830152915184926000929084169163dd62ed3e91604480820192602092909190829003018186803b1580156131da57600080fd5b505afa1580156131ee573d6000803e3d6000fd5b505050506040513d602081101561320457600080fd5b50511115613212575061322e565b610e7e6001600160a01b0382168360001963ffffffff61335c16565b5050565b60006001600160a01b038216613249575047611e37565b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561328f57600080fd5b505afa1580156132a3573d6000803e3d6000fd5b505050506040513d60208110156132b957600080fd5b505192915050565b826132dd6001600160a01b03821684600063ffffffff61335c16565b610aa56001600160a01b038216848463ffffffff61335c16565b600081836133465760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156124b757818101518382015260200161249f565b50600083858161335257fe5b0495945050505050565b8015806133e2575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156133b457600080fd5b505afa1580156133c8573d6000803e3d6000fd5b505050506040513d60208110156133de57600080fd5b5051155b61341d5760405162461bcd60e51b81526004018080602001828103825260368152602001806135a66036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610e7e9084906124fa565b6040518060800160405280600490602082028038833950919291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77416666696c696174652053706c69742056616c7565206e6f7420616c6c6f7765644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552523a2073686f756c6453656c6c456e7469726542616c616e6365206973207472756520666f7220454f415361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a7231582044992668aae0f7936b5be4e6f5379a5fe251c6b24433468a65bba5bbe4827a6b64736f6c63430005110032

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

0000000000000000000000008aee0a8a05a319bfca41ff2e95c48f3f8638321100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _curveRegistry (address): 0x8AEE0a8A05A319BfCa41fF2E95C48f3F86383211
Arg [1] : _goodwill (uint256): 0
Arg [2] : _affiliateSplit (uint256): 0

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000008aee0a8a05a319bfca41ff2e95c48f3f86383211
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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