MATIC Price: $0.68 (+0.08%)
Gas: 62 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Token Holdings

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Value
Redeem Exact Set...560038242024-04-19 11:19:4211 hrs ago1713525582IN
0x1c0c05a2...b9E4d8320
0 MATIC0.12377713106.70470609
Redeem Exact Set...560003842024-04-19 9:06:0313 hrs ago1713517563IN
0x1c0c05a2...b9E4d8320
0 MATIC0.30309537183.87960355
Issue Exact Set ...559987882024-04-19 8:05:3514 hrs ago1713513935IN
0x1c0c05a2...b9E4d8320
157.21131313 MATIC0.52438537247.4573449
Issue Exact Set ...559979472024-04-19 7:33:2915 hrs ago1713512009IN
0x1c0c05a2...b9E4d8320
296.86743209 MATIC0.40881107252.08471178
Issue Exact Set ...559978082024-04-19 7:28:0315 hrs ago1713511683IN
0x1c0c05a2...b9E4d8320
296.75958177 MATIC0.36449593230.57338193
Issue Exact Set ...559946842024-04-19 5:31:3117 hrs ago1713504691IN
0x1c0c05a2...b9E4d8320
37.8136589 MATIC0.22972048160
Issue Exact Set ...559930662024-04-19 4:31:3318 hrs ago1713501093IN
0x1c0c05a2...b9E4d8320
37.69466275 MATIC0.27402416160
Issue Exact Set ...559878282024-04-19 1:18:3521 hrs ago1713489515IN
0x1c0c05a2...b9E4d8320
0 MATIC0.27584967134.33075234
Redeem Exact Set...559877472024-04-19 1:15:4221 hrs ago1713489342IN
0x1c0c05a2...b9E4d8320
0 MATIC0.37851204175.90574392
Issue Exact Set ...559874862024-04-19 1:05:5121 hrs ago1713488751IN
0x1c0c05a2...b9E4d8320
0 MATIC0.18750055103.88199466
Issue Exact Set ...559872892024-04-19 0:58:5221 hrs ago1713488332IN
0x1c0c05a2...b9E4d8320
0 MATIC0.23525186111.50244371
Issue Exact Set ...559868952024-04-19 0:44:1922 hrs ago1713487459IN
0x1c0c05a2...b9E4d8320
3.43086898 MATIC0.09757721116.98250517
Issue Exact Set ...559864862024-04-19 0:29:4622 hrs ago1713486586IN
0x1c0c05a2...b9E4d8320
3.43304754 MATIC0.1480076197.30326735
Issue Exact Set ...559611092024-04-18 8:57:1037 hrs ago1713430630IN
0x1c0c05a2...b9E4d8320
340.04511284 MATIC0.5150624243.24413822
Issue Exact Set ...559594892024-04-18 7:57:4038 hrs ago1713427060IN
0x1c0c05a2...b9E4d8320
340.68299106 MATIC0.31380059204.90129317
Issue Exact Set ...559473942024-04-18 0:31:0346 hrs ago1713400263IN
0x1c0c05a2...b9E4d8320
36.78103528 MATIC0.2316608160
Issue Exact Set ...559458392024-04-17 23:31:0447 hrs ago1713396664IN
0x1c0c05a2...b9E4d8320
36.54180383 MATIC0.2295568160
Issue Exact Set ...559417352024-04-17 21:01:172 days ago1713387677IN
0x1c0c05a2...b9E4d8320
36.4888203 MATIC0.22963024160
Issue Exact Set ...559367692024-04-17 18:01:212 days ago1713376881IN
0x1c0c05a2...b9E4d8320
36.39750592 MATIC0.34014144160
Issue Exact Set ...559359212024-04-17 17:31:062 days ago1713375066IN
0x1c0c05a2...b9E4d8320
36.36412099 MATIC0.30484496160
Issue Exact Set ...559350842024-04-17 17:01:182 days ago1713373278IN
0x1c0c05a2...b9E4d8320
36.4582488 MATIC0.28953456160
Issue Exact Set ...559221282024-04-17 8:52:352 days ago1713343955IN
0x1c0c05a2...b9E4d8320
3.32484229 MATIC0.30970223213.78191835
Issue Exact Set ...558965442024-04-16 16:31:053 days ago1713285065IN
0x1c0c05a2...b9E4d8320
36.18499033 MATIC0.3260824160
Redeem Exact Set...558860692024-04-16 10:05:423 days ago1713261942IN
0x1c0c05a2...b9E4d8320
0 MATIC0.20814294111.54259532
Redeem Exact Set...558860162024-04-16 10:03:503 days ago1713261830IN
0x1c0c05a2...b9E4d8320
0 MATIC0.22469524107.88190509
View all transactions

Latest 25 internal transactions (View All)

Parent Txn Hash Block From To Value
559987882024-04-19 8:05:3514 hrs ago1713513935
0x1c0c05a2...b9E4d8320
0.11309987 MATIC
559987882024-04-19 8:05:3514 hrs ago1713513935
0x1c0c05a2...b9E4d8320
0.11309987 MATIC
559987882024-04-19 8:05:3514 hrs ago1713513935
0x1c0c05a2...b9E4d8320
157.21131313 MATIC
559979472024-04-19 7:33:2915 hrs ago1713512009
0x1c0c05a2...b9E4d8320
0.1746044 MATIC
559979472024-04-19 7:33:2915 hrs ago1713512009
0x1c0c05a2...b9E4d8320
0.1746044 MATIC
559979472024-04-19 7:33:2915 hrs ago1713512009
0x1c0c05a2...b9E4d8320
296.86743209 MATIC
559978082024-04-19 7:28:0315 hrs ago1713511683
0x1c0c05a2...b9E4d8320
0.17236452 MATIC
559978082024-04-19 7:28:0315 hrs ago1713511683
0x1c0c05a2...b9E4d8320
0.17236452 MATIC
559978082024-04-19 7:28:0315 hrs ago1713511683
0x1c0c05a2...b9E4d8320
296.75958177 MATIC
559946842024-04-19 5:31:3117 hrs ago1713504691
0x1c0c05a2...b9E4d8320
2.48730422 MATIC
559946842024-04-19 5:31:3117 hrs ago1713504691
0x1c0c05a2...b9E4d8320
2.48730422 MATIC
559946842024-04-19 5:31:3117 hrs ago1713504691
0x1c0c05a2...b9E4d8320
37.8136589 MATIC
559930662024-04-19 4:31:3318 hrs ago1713501093
0x1c0c05a2...b9E4d8320
2.47973174 MATIC
559930662024-04-19 4:31:3318 hrs ago1713501093
0x1c0c05a2...b9E4d8320
2.47973174 MATIC
559930662024-04-19 4:31:3318 hrs ago1713501093
0x1c0c05a2...b9E4d8320
37.69466275 MATIC
559868952024-04-19 0:44:1922 hrs ago1713487459
0x1c0c05a2...b9E4d8320
3.43086898 MATIC
559864862024-04-19 0:29:4622 hrs ago1713486586
0x1c0c05a2...b9E4d8320
0.00125775 MATIC
559864862024-04-19 0:29:4622 hrs ago1713486586
0x1c0c05a2...b9E4d8320
0.00125775 MATIC
559864862024-04-19 0:29:4622 hrs ago1713486586
0x1c0c05a2...b9E4d8320
3.43304754 MATIC
559611092024-04-18 8:57:1037 hrs ago1713430630
0x1c0c05a2...b9E4d8320
0.12574582 MATIC
559611092024-04-18 8:57:1037 hrs ago1713430630
0x1c0c05a2...b9E4d8320
0.12574582 MATIC
559611092024-04-18 8:57:1037 hrs ago1713430630
0x1c0c05a2...b9E4d8320
340.04511284 MATIC
559594892024-04-18 7:57:4038 hrs ago1713427060
0x1c0c05a2...b9E4d8320
0.12575156 MATIC
559594892024-04-18 7:57:4038 hrs ago1713427060
0x1c0c05a2...b9E4d8320
0.12575156 MATIC
559594892024-04-18 7:57:4038 hrs ago1713427060
0x1c0c05a2...b9E4d8320
340.68299106 MATIC
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ExchangeIssuanceZeroEx

Compiler Version
v0.6.10+commit.00c0fcaf

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 16 : ExchangeIssuanceZeroEx.sol
/*
    Copyright 2022 Index Cooperative
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    SPDX-License-Identifier: Apache License, Version 2.0
*/
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;

import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Math } from "@openzeppelin/contracts/math/Math.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import { IBasicIssuanceModule } from "../interfaces/IBasicIssuanceModule.sol";
import { IDebtIssuanceModule } from "../interfaces/IDebtIssuanceModule.sol";
import { IController } from "../interfaces/IController.sol";
import { ISetToken } from "../interfaces/ISetToken.sol";
import { IWETH } from "../interfaces/IWETH.sol";
import { PreciseUnitMath } from "../lib/PreciseUnitMath.sol";


contract ExchangeIssuanceZeroEx is Ownable, ReentrancyGuard {

    using Address for address payable;
    using SafeMath for uint256;
    using PreciseUnitMath for uint256;
    using SafeERC20 for IERC20;
    using SafeERC20 for ISetToken;

    struct IssuanceModuleData {
        bool isAllowed;
        bool isDebtIssuanceModule;
    }

    /* ============ Constants ============== */

    // Placeholder address to identify ETH where it is treated as if it was an ERC20 token
    address constant public ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    /* ============ State Variables ============ */

    address public immutable WETH;
    IController public immutable setController;
    address public immutable swapTarget;

    /* ============ Events ============ */

    event ExchangeIssue(
        address indexed _recipient,     // The recipient address of the issued SetTokens
        ISetToken indexed _setToken,    // The issued SetToken
        IERC20 indexed _inputToken,     // The address of the input asset(ERC20/ETH) used to issue the SetTokens
        uint256 _amountInputToken,      // The amount of input tokens used for issuance
        uint256 _amountSetIssued        // The amount of SetTokens received by the recipient
    );

    event ExchangeRedeem(
        address indexed _recipient,     // The recipient adress of the output tokens obtained for redemption
        ISetToken indexed _setToken,    // The redeemed SetToken
        IERC20 indexed _outputToken,    // The address of output asset(ERC20/ETH) received by the recipient
        uint256 _amountSetRedeemed,     // The amount of SetTokens redeemed for output tokens
        uint256 _amountOutputToken      // The amount of output tokens received by the recipient
    );

    /* ============ Modifiers ============ */

    modifier isValidModule(address _issuanceModule) {
        require(setController.isModule(_issuanceModule), "ExchangeIssuance: INVALID ISSUANCE MODULE");
         _;
    }

    constructor(
        address _weth,
        IController _setController,
        address _swapTarget
    )
        public
    {
        setController = _setController;

        WETH = _weth;
        swapTarget = _swapTarget;
    }

    /* ============ External Functions ============ */

    /**
     * Withdraw slippage to selected address
     *
     * @param _tokens    Addresses of tokens to withdraw, specifiy ETH_ADDRESS to withdraw ETH
     * @param _to        Address to send the tokens to
     */
    function withdrawTokens(IERC20[] calldata _tokens, address payable _to) external onlyOwner payable {
        for(uint256 i = 0; i < _tokens.length; i++) {
            if(address(_tokens[i]) == ETH_ADDRESS){
                _to.sendValue(address(this).balance);
            }
            else{
                _tokens[i].safeTransfer(_to, _tokens[i].balanceOf(address(this)));
            }
        }
    }

    receive() external payable {
        // required for weth.withdraw() to work properly
        require(msg.sender == WETH, "ExchangeIssuance: Direct deposits not allowed");
    }

    /* ============ Public Functions ============ */


    /**
     * Runs all the necessary approval functions required for a given ERC20 token.
     * This function can be called when a new token is added to a SetToken during a
     * rebalance.
     *
     * @param _token    Address of the token which needs approval
     * @param _spender  Address of the spender which will be approved to spend token. (Must be a whitlisted issuance module)
     */
    function approveToken(IERC20 _token, address _spender) public  isValidModule(_spender) {
        _safeApprove(_token, _spender, type(uint256).max);
    }

    /**
     * Runs all the necessary approval functions required for a list of ERC20 tokens.
     *
     * @param _tokens    Addresses of the tokens which need approval
     * @param _spender   Address of the spender which will be approved to spend token. (Must be a whitlisted issuance module)
     */
    function approveTokens(IERC20[] calldata _tokens, address _spender) external {
        for (uint256 i = 0; i < _tokens.length; i++) {
            approveToken(_tokens[i], _spender);
        }
    }

    /**
     * Runs all the necessary approval functions required before issuing
     * or redeeming a SetToken. This function need to be called only once before the first time
     * this smart contract is used on any particular SetToken.
     *
     * @param _setToken          Address of the SetToken being initialized
     * @param _issuanceModule    Address of the issuance module which will be approved to spend component tokens.
     */
    function approveSetToken(ISetToken _setToken, address _issuanceModule) external {
        address[] memory components = _setToken.getComponents();
        for (uint256 i = 0; i < components.length; i++) {
            approveToken(IERC20(components[i]), _issuanceModule);
        }
    }

    /**
    * Issues an exact amount of SetTokens for given amount of input ERC20 tokens.
    * The excess amount of tokens is returned in an equivalent amount of ether.
    *
    * @param _setToken              Address of the SetToken to be issued
    * @param _inputToken            Address of the input token
    * @param _amountSetToken        Amount of SetTokens to issue
    * @param _maxAmountInputToken   Maximum amount of input tokens to be used to issue SetTokens.
    * @param _componentQuotes       The encoded 0x transactions to execute 
    *
    * @return totalInputTokenSold   Amount of input token spent for issuance
    */
    function issueExactSetFromToken(
        ISetToken _setToken,
        IERC20 _inputToken,
        uint256 _amountSetToken,
        uint256 _maxAmountInputToken,
        bytes[] memory _componentQuotes,
        address _issuanceModule,
        bool _isDebtIssuance
    )
        isValidModule(_issuanceModule)
        external
        nonReentrant
        returns (uint256)
    {

        _inputToken.safeTransferFrom(msg.sender, address(this), _maxAmountInputToken);
        _safeApprove(_inputToken, swapTarget, _maxAmountInputToken);

        uint256 totalInputTokenSold = _buyComponentsForInputToken(_setToken, _amountSetToken,  _componentQuotes, _inputToken, _issuanceModule, _isDebtIssuance);
        require(totalInputTokenSold <= _maxAmountInputToken, "ExchangeIssuance: OVERSPENT TOKEN");

        IBasicIssuanceModule(_issuanceModule).issue(_setToken, _amountSetToken, msg.sender);

        _returnExcessInputToken(_inputToken, _maxAmountInputToken, totalInputTokenSold);

        emit ExchangeIssue(msg.sender, _setToken, _inputToken, _maxAmountInputToken, _amountSetToken);
        return totalInputTokenSold;
    }


    /**
    * Issues an exact amount of SetTokens for given amount of ETH.
    * The excess amount of tokens is returned in an equivalent amount of ether.
    *
    * @param _setToken              Address of the SetToken to be issued
    * @param _amountSetToken        Amount of SetTokens to issue
    * @param _componentQuotes       The encoded 0x transactions to execute
    *
    * @return amountEthReturn       Amount of ether returned to the caller
    */
    function issueExactSetFromETH(
        ISetToken _setToken,
        uint256 _amountSetToken,
        bytes[] memory _componentQuotes,
        address _issuanceModule,
        bool _isDebtIssuance
    )
        isValidModule(_issuanceModule)
        external
        nonReentrant
        payable
        returns (uint256)
    {
        require(msg.value > 0, "ExchangeIssuance: NO ETH SENT");

        IWETH(WETH).deposit{value: msg.value}();
        _safeApprove(IERC20(WETH), swapTarget, msg.value);

        uint256 totalEthSold = _buyComponentsForInputToken(_setToken, _amountSetToken, _componentQuotes, IERC20(WETH), _issuanceModule, _isDebtIssuance);

        require(totalEthSold <= msg.value, "ExchangeIssuance: OVERSPENT ETH");
        IBasicIssuanceModule(_issuanceModule).issue(_setToken, _amountSetToken, msg.sender);

        uint256 amountEthReturn = msg.value.sub(totalEthSold);
        if (amountEthReturn > 0) {
            IWETH(WETH).withdraw(amountEthReturn);
            payable(msg.sender).sendValue(amountEthReturn);
        }

        emit ExchangeIssue(msg.sender, _setToken, IERC20(ETH_ADDRESS), totalEthSold, _amountSetToken);
        return amountEthReturn; 
    }

    /**
     * Redeems an exact amount of SetTokens for an ERC20 token.
     * The SetToken must be approved by the sender to this contract.
     *
     * @param _setToken             Address of the SetToken being redeemed
     * @param _outputToken          Address of output token
     * @param _amountSetToken       Amount SetTokens to redeem
     * @param _minOutputReceive     Minimum amount of output token to receive
     * @param _componentQuotes      The encoded 0x transactions execute (components -> WETH).
     * @param _issuanceModule       Address of issuance Module to use 
     * @param _isDebtIssuance       Flag indicating wether given issuance module is a debt issuance module
     *
     * @return outputAmount         Amount of output tokens sent to the caller
     */
    function redeemExactSetForToken(
        ISetToken _setToken,
        IERC20 _outputToken,
        uint256 _amountSetToken,
        uint256 _minOutputReceive,
        bytes[] memory _componentQuotes,
        address _issuanceModule,
        bool _isDebtIssuance
    )
        isValidModule(_issuanceModule)
        external
        nonReentrant
        returns (uint256)
    {

        uint256 outputAmount;
        _redeemExactSet(_setToken, _amountSetToken, _issuanceModule);

        outputAmount = _sellComponentsForOutputToken(_setToken, _amountSetToken, _componentQuotes, _outputToken, _issuanceModule, _isDebtIssuance);
        require(outputAmount >= _minOutputReceive, "ExchangeIssuance: INSUFFICIENT OUTPUT AMOUNT");

        // Transfer sender output token
        _outputToken.safeTransfer(msg.sender, outputAmount);
        // Emit event
        emit ExchangeRedeem(msg.sender, _setToken, _outputToken, _amountSetToken, outputAmount);
        // Return output amount
        return outputAmount;
    }

    /**
     * Redeems an exact amount of SetTokens for ETH.
     * The SetToken must be approved by the sender to this contract.
     *
     * @param _setToken             Address of the SetToken being redeemed
     * @param _amountSetToken       Amount SetTokens to redeem
     * @param _minEthReceive        Minimum amount of Eth to receive
     * @param _componentQuotes      The encoded 0x transactions execute
     * @param _issuanceModule       Address of issuance Module to use 
     * @param _isDebtIssuance       Flag indicating wether given issuance module is a debt issuance module
     *
     * @return outputAmount         Amount of output tokens sent to the caller
     */
    function redeemExactSetForETH(
        ISetToken _setToken,
        uint256 _amountSetToken,
        uint256 _minEthReceive,
        bytes[] memory _componentQuotes,
        address _issuanceModule,
        bool _isDebtIssuance
    )
        isValidModule(_issuanceModule)
        external
        nonReentrant
        returns (uint256)
    {
        _redeemExactSet(_setToken, _amountSetToken, _issuanceModule);
        uint ethAmount = _sellComponentsForOutputToken(_setToken, _amountSetToken, _componentQuotes, IERC20(WETH), _issuanceModule, _isDebtIssuance);
        require(ethAmount >= _minEthReceive, "ExchangeIssuance: INSUFFICIENT WETH RECEIVED");

        IWETH(WETH).withdraw(ethAmount);
        (payable(msg.sender)).sendValue(ethAmount);

        emit ExchangeRedeem(msg.sender, _setToken, IERC20(ETH_ADDRESS), _amountSetToken, ethAmount);
        return ethAmount;
         
    }
    

    /**
     * Sets a max approval limit for an ERC20 token, provided the current allowance
     * is less than the required allownce.
     *
     * @param _token    Token to approve
     * @param _spender  Spender address to approve
     */
    function _safeApprove(IERC20 _token, address _spender, uint256 _requiredAllowance) internal {
        uint256 allowance = _token.allowance(address(this), _spender);
        if (allowance < _requiredAllowance) {
            _token.safeIncreaseAllowance(_spender, type(uint256).max - allowance);
        }
    }

    /**
     * Issues an exact amount of SetTokens using WETH.
     * Acquires SetToken components by executing the 0x swaps whose callata is passed in _quotes.
     * Uses the acquired components to issue the SetTokens.
     *
     * @param _setToken             Address of the SetToken being issued
     * @param _amountSetToken       Amount of SetTokens to be issued
     * @param _quotes               The encoded 0x transaction calldata to execute against the 0x ExchangeProxy
     * @param _inputToken           Token to use to pay for issuance. Must be the sellToken of the 0x trades.
     * @param _issuanceModule       Issuance module to use for set token issuance.
     *
     * @return totalInputTokenSold  Total amount of input token spent on this issuance
     */
    function _buyComponentsForInputToken(
        ISetToken _setToken,
        uint256 _amountSetToken,
        bytes[] memory _quotes,
        IERC20 _inputToken,
        address _issuanceModule,
        bool _isDebtIssuance
    ) 
    internal
    returns (uint256 totalInputTokenSold)
    {
        uint256 componentAmountBought;

        (address[] memory components, uint256[] memory componentUnits) = getRequiredIssuanceComponents(_issuanceModule, _isDebtIssuance, _setToken, _amountSetToken);

        uint256 inputTokenBalanceBefore = _inputToken.balanceOf(address(this));
        for (uint256 i = 0; i < components.length; i++) {
            address component = components[i];
            uint256 units = componentUnits[i];

            // If the component is equal to the input token we don't have to trade
            if(component == address(_inputToken)) {
                totalInputTokenSold = totalInputTokenSold.add(units);
                componentAmountBought = units;
            }
            else {
                uint256 componentBalanceBefore = IERC20(component).balanceOf(address(this));
                _fillQuote(_quotes[i]);
                uint256 componentBalanceAfter = IERC20(component).balanceOf(address(this));
                componentAmountBought = componentBalanceAfter.sub(componentBalanceBefore);
                require(componentAmountBought >= units, "ExchangeIssuance: UNDERBOUGHT COMPONENT");
            }
        }
        uint256 inputTokenBalanceAfter = _inputToken.balanceOf(address(this));
        totalInputTokenSold = totalInputTokenSold.add(inputTokenBalanceBefore.sub(inputTokenBalanceAfter));
    }

    /**
     * Redeems a given list of SetToken components for given token.
     *
     * @param _setToken             The set token being swapped.
     * @param _amountSetToken       The amount of set token being swapped.
     * @param _swaps                An array containing ZeroExSwap swaps.
     * @param _outputToken          The token for which to sell the index components must be the same as the buyToken that was specified when generating the swaps
     * @param _issuanceModule    Address of issuance Module to use 
     * @param _isDebtIssuance    Flag indicating wether given issuance module is a debt issuance module
     *
     * @return totalOutputTokenBought  Total amount of output token received after liquidating all SetToken components
     */
    function _sellComponentsForOutputToken(ISetToken _setToken, uint256 _amountSetToken, bytes[] memory _swaps, IERC20 _outputToken, address _issuanceModule, bool _isDebtIssuance)
        internal
        returns (uint256 totalOutputTokenBought)
    {
        (address[] memory components, uint256[] memory componentUnits) = getRequiredRedemptionComponents(_issuanceModule, _isDebtIssuance, _setToken, _amountSetToken);
        uint256 outputTokenBalanceBefore = _outputToken.balanceOf(address(this));
        for (uint256 i = 0; i < _swaps.length; i++) {
            uint256 maxAmountSell = componentUnits[i];

            uint256 componentAmountSold;

            // If the component is equal to the output token we don't have to trade
            if(components[i] == address(_outputToken)) {
                totalOutputTokenBought = totalOutputTokenBought.add(maxAmountSell);
                componentAmountSold = maxAmountSell;
            }
            else {
                _safeApprove(IERC20(components[i]), address(swapTarget), maxAmountSell);
                uint256 componentBalanceBefore = IERC20(components[i]).balanceOf(address(this));
                _fillQuote(_swaps[i]);
                uint256 componentBalanceAfter = IERC20(components[i]).balanceOf(address(this));
                componentAmountSold = componentBalanceBefore.sub(componentBalanceAfter);
                require(maxAmountSell >= componentAmountSold, "ExchangeIssuance: OVERSOLD COMPONENT");
            }

        }
        uint256 outputTokenBalanceAfter = _outputToken.balanceOf(address(this));
        totalOutputTokenBought = totalOutputTokenBought.add(outputTokenBalanceAfter.sub(outputTokenBalanceBefore));
    }

    /**
     * Execute a 0x Swap quote
     *
     * @param _quote          Swap quote as returned by 0x API
     *
     */
    function _fillQuote(
        bytes memory _quote
    )
        internal
        
    {

        (bool success, bytes memory returndata) = swapTarget.call(_quote);

        // Forwarding errors including new custom errors
        // Taken from: https://ethereum.stackexchange.com/a/111187/73805
        if (!success) {
            if (returndata.length == 0) revert();
            assembly {
                revert(add(32, returndata), mload(returndata))
            }
        }

    }

    /**
     * Transfers given amount of set token from the sender and redeems it for underlying components.
     * Obtained component tokens are sent to this contract. 
     *
     * @param _setToken     Address of the SetToken to be redeemed
     * @param _amount       Amount of SetToken to be redeemed
     */
    function _redeemExactSet(ISetToken _setToken, uint256 _amount, address _issuanceModule) internal returns (uint256) {
        _setToken.safeTransferFrom(msg.sender, address(this), _amount);
        IBasicIssuanceModule(_issuanceModule).redeem(_setToken, _amount, address(this));
    }

    /**
     * Returns excess input token
     *
     * @param _inputToken         Address of the input token to return
     * @param _receivedAmount     Amount received by the caller
     * @param _spentAmount        Amount spent for issuance
     */
    function _returnExcessInputToken(IERC20 _inputToken, uint256 _receivedAmount, uint256 _spentAmount) internal {
        uint256 amountTokenReturn = _receivedAmount.sub(_spentAmount);
        if (amountTokenReturn > 0) {
            _inputToken.safeTransfer(msg.sender,  amountTokenReturn);
        }
    }

    /**
     * Returns component positions required for issuance 
     *
     * @param _issuanceModule    Address of issuance Module to use 
     * @param _isDebtIssuance    Flag indicating wether given issuance module is a debt issuance module
     * @param _setToken          Set token to issue
     * @param _amountSetToken    Amount of set token to issue
     */
    function getRequiredIssuanceComponents(address _issuanceModule, bool _isDebtIssuance, ISetToken _setToken, uint256 _amountSetToken) public view returns(address[] memory components, uint256[] memory positions) {
        if(_isDebtIssuance) { 
            (components, positions, ) = IDebtIssuanceModule(_issuanceModule).getRequiredComponentIssuanceUnits(_setToken, _amountSetToken);
        }
        else {
            (components, positions) = IBasicIssuanceModule(_issuanceModule).getRequiredComponentUnitsForIssue(_setToken, _amountSetToken);
        }

    }

    /**
     * Returns component positions required for Redemption 
     *
     * @param _issuanceModule    Address of issuance Module to use 
     * @param _isDebtIssuance    Flag indicating wether given issuance module is a debt issuance module
     * @param _setToken          Set token to issue
     * @param _amountSetToken    Amount of set token to issue
     */
    function getRequiredRedemptionComponents(address _issuanceModule, bool _isDebtIssuance, ISetToken _setToken, uint256 _amountSetToken) public view returns(address[] memory components, uint256[] memory positions) {
        if(_isDebtIssuance) { 
            (components, positions, ) = IDebtIssuanceModule(_issuanceModule).getRequiredComponentRedemptionUnits(_setToken, _amountSetToken);
        }
        else {
            components = _setToken.getComponents();
            positions = new uint256[](components.length);
            for(uint256 i = 0; i < components.length; i++) {
                uint256 unit = uint256(_setToken.getDefaultPositionRealUnit(components[i]));
                positions[i] = unit.preciseMul(_amountSetToken);
            }
        }
    }
}

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

pragma solidity >=0.6.2 <0.8.0;

/**
 * @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) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @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].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 2 of 16 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

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

pragma solidity >=0.6.0 <0.8.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 IERC20;` 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));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    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. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "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 2 of 16 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.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.
     */
    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.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        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.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

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

pragma solidity >=0.6.0 <0.8.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.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () 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(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        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 virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 2 of 16 : IBasicIssuanceModule.sol
/*
    Copyright 2020 Set Labs Inc.
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    SPDX-License-Identifier: Apache License, Version 2.0
*/
pragma solidity >=0.6.10;

import { ISetToken } from "./ISetToken.sol";

interface IBasicIssuanceModule {
    function getRequiredComponentUnitsForIssue(
        ISetToken _setToken,
        uint256 _quantity
    ) external view returns(address[] memory, uint256[] memory);
    function issue(ISetToken _setToken, uint256 _quantity, address _to) external;
    function redeem(ISetToken _token, uint256 _quantity, address _to) external;
}

File 2 of 16 : IDebtIssuanceModule.sol
/*
    Copyright 2020 Set Labs Inc.
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    SPDX-License-Identifier: Apache License, Version 2.0
*/
pragma solidity >=0.6.10;

import { ISetToken } from "./ISetToken.sol";

interface IDebtIssuanceModule {
    function getRequiredComponentIssuanceUnits(
        ISetToken _setToken,
        uint256 _quantity
    ) external view returns (address[] memory, uint256[] memory, uint256[] memory);
    function getRequiredComponentRedemptionUnits(
        ISetToken _setToken,
        uint256 _quantity
    ) external view returns (address[] memory, uint256[] memory, uint256[] memory);
    function issue(ISetToken _setToken, uint256 _quantity, address _to) external;
    function redeem(ISetToken _token, uint256 _quantity, address _to) external;
}

File 2 of 16 : IController.sol
/*
    Copyright 2020 Set Labs Inc.
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    SPDX-License-Identifier: Apache License, Version 2.0
*/
pragma solidity 0.6.10;

interface IController {
    function addSet(address _setToken) external;
    function feeRecipient() external view returns(address);
    function getModuleFee(address _module, uint256 _feeType) external view returns(uint256);
    function isModule(address _module) external view returns(bool);
    function isSet(address _setToken) external view returns(bool);
    function isSystemContract(address _contractAddress) external view returns (bool);
    function resourceId(uint256 _id) external view returns(address);
}

File 2 of 16 : ISetToken.sol
// SPDX-License-Identifier: Apache License, Version 2.0
pragma solidity 0.6.10;
pragma experimental "ABIEncoderV2";

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

/**
 * @title ISetToken
 * @author Set Protocol
 *
 * Interface for operating with SetTokens.
 */
interface ISetToken is IERC20 {

    /* ============ Enums ============ */

    enum ModuleState {
        NONE,
        PENDING,
        INITIALIZED
    }

    /* ============ Structs ============ */
    /**
     * The base definition of a SetToken Position
     *
     * @param component           Address of token in the Position
     * @param module              If not in default state, the address of associated module
     * @param unit                Each unit is the # of components per 10^18 of a SetToken
     * @param positionState       Position ENUM. Default is 0; External is 1
     * @param data                Arbitrary data
     */
    struct Position {
        address component;
        address module;
        int256 unit;
        uint8 positionState;
        bytes data;
    }

    /**
     * A struct that stores a component's cash position details and external positions
     * This data structure allows O(1) access to a component's cash position units and
     * virtual units.
     *
     * @param virtualUnit               Virtual value of a component's DEFAULT position. Stored as virtual for efficiency
     *                                  updating all units at once via the position multiplier. Virtual units are achieved
     *                                  by dividing a "real" value by the "positionMultiplier"
     * @param componentIndex
     * @param externalPositionModules   List of external modules attached to each external position. Each module
     *                                  maps to an external position
     * @param externalPositions         Mapping of module => ExternalPosition struct for a given component
     */
    struct ComponentPosition {
      int256 virtualUnit;
      address[] externalPositionModules;
      mapping(address => ExternalPosition) externalPositions;
    }

    /**
     * A struct that stores a component's external position details including virtual unit and any
     * auxiliary data.
     *
     * @param virtualUnit       Virtual value of a component's EXTERNAL position.
     * @param data              Arbitrary data
     */
    struct ExternalPosition {
      int256 virtualUnit;
      bytes data;
    }


    /* ============ Functions ============ */

    function addComponent(address _component) external;
    function removeComponent(address _component) external;
    function editDefaultPositionUnit(address _component, int256 _realUnit) external;
    function addExternalPositionModule(address _component, address _positionModule) external;
    function removeExternalPositionModule(address _component, address _positionModule) external;
    function editExternalPositionUnit(address _component, address _positionModule, int256 _realUnit) external;
    function editExternalPositionData(address _component, address _positionModule, bytes calldata _data) external;

    function invoke(address _target, uint256 _value, bytes calldata _data) external returns(bytes memory);

    function editPositionMultiplier(int256 _newMultiplier) external;

    function mint(address _account, uint256 _quantity) external;
    function burn(address _account, uint256 _quantity) external;

    function lock() external;
    function unlock() external;

    function addModule(address _module) external;
    function removeModule(address _module) external;
    function initializeModule() external;

    function setManager(address _manager) external;

    function manager() external view returns (address);
    function moduleStates(address _module) external view returns (ModuleState);
    function getModules() external view returns (address[] memory);

    function getDefaultPositionRealUnit(address _component) external view returns(int256);
    function getExternalPositionRealUnit(address _component, address _positionModule) external view returns(int256);
    function getComponents() external view returns(address[] memory);
    function getExternalPositionModules(address _component) external view returns(address[] memory);
    function getExternalPositionData(address _component, address _positionModule) external view returns(bytes memory);
    function isExternalPositionModule(address _component, address _module) external view returns(bool);
    function isComponent(address _component) external view returns(bool);

    function positionMultiplier() external view returns (int256);
    function getPositions() external view returns (Position[] memory);
    function getTotalComponentRealUnits(address _component) external view returns(int256);

    function isInitializedModule(address _module) external view returns(bool);
    function isPendingModule(address _module) external view returns(bool);
    function isLocked() external view returns (bool);
}

File 2 of 16 : IWETH.sol
// SPDX-License-Identifier: Apache License, Version 2.0
pragma solidity >=0.6.10;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

File 2 of 16 : PreciseUnitMath.sol
/*
    Copyright 2020 Set Labs Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

    SPDX-License-Identifier: Apache License, Version 2.0
*/

pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;

import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { SignedSafeMath } from "@openzeppelin/contracts/math/SignedSafeMath.sol";


/**
 * @title PreciseUnitMath
 * @author Set Protocol
 *
 * Arithmetic for fixed-point numbers with 18 decimals of precision. Some functions taken from
 * dYdX's BaseMath library.
 *
 * CHANGELOG:
 * - 9/21/20: Added safePower function
 */
library PreciseUnitMath {
    using SafeMath for uint256;
    using SignedSafeMath for int256;

    // The number One in precise units.
    uint256 constant internal PRECISE_UNIT = 10 ** 18;
    int256 constant internal PRECISE_UNIT_INT = 10 ** 18;

    // Max unsigned integer value
    uint256 constant internal MAX_UINT_256 = type(uint256).max;
    // Max and min signed integer value
    int256 constant internal MAX_INT_256 = type(int256).max;
    int256 constant internal MIN_INT_256 = type(int256).min;

    /**
     * @dev Getter function since constants can't be read directly from libraries.
     */
    function preciseUnit() internal pure returns (uint256) {
        return PRECISE_UNIT;
    }

    /**
     * @dev Getter function since constants can't be read directly from libraries.
     */
    function preciseUnitInt() internal pure returns (int256) {
        return PRECISE_UNIT_INT;
    }

    /**
     * @dev Getter function since constants can't be read directly from libraries.
     */
    function maxUint256() internal pure returns (uint256) {
        return MAX_UINT_256;
    }

    /**
     * @dev Getter function since constants can't be read directly from libraries.
     */
    function maxInt256() internal pure returns (int256) {
        return MAX_INT_256;
    }

    /**
     * @dev Getter function since constants can't be read directly from libraries.
     */
    function minInt256() internal pure returns (int256) {
        return MIN_INT_256;
    }

    /**
     * @dev Multiplies value a by value b (result is rounded down). It's assumed that the value b is the significand
     * of a number with 18 decimals precision.
     */
    function preciseMul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a.mul(b).div(PRECISE_UNIT);
    }

    /**
     * @dev Multiplies value a by value b (result is rounded towards zero). It's assumed that the value b is the
     * significand of a number with 18 decimals precision.
     */
    function preciseMul(int256 a, int256 b) internal pure returns (int256) {
        return a.mul(b).div(PRECISE_UNIT_INT);
    }

    /**
     * @dev Multiplies value a by value b (result is rounded up). It's assumed that the value b is the significand
     * of a number with 18 decimals precision.
     */
    function preciseMulCeil(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0 || b == 0) {
            return 0;
        }
        return a.mul(b).sub(1).div(PRECISE_UNIT).add(1);
    }

    /**
     * @dev Divides value a by value b (result is rounded down).
     */
    function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        return a.mul(PRECISE_UNIT).div(b);
    }


    /**
     * @dev Divides value a by value b (result is rounded towards 0).
     */
    function preciseDiv(int256 a, int256 b) internal pure returns (int256) {
        return a.mul(PRECISE_UNIT_INT).div(b);
    }

    /**
     * @dev Divides value a by value b (result is rounded up or away from 0).
     */
    function preciseDivCeil(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0, "Cant divide by 0");

        return a > 0 ? a.mul(PRECISE_UNIT).sub(1).div(b).add(1) : 0;
    }

    /**
     * @dev Divides value a by value b (result is rounded down - positive numbers toward 0 and negative away from 0).
     */
    function divDown(int256 a, int256 b) internal pure returns (int256) {
        require(b != 0, "Cant divide by 0");
        require(a != MIN_INT_256 || b != -1, "Invalid input");

        int256 result = a.div(b);
        if (a ^ b < 0 && a % b != 0) {
            result -= 1;
        }

        return result;
    }

    /**
     * @dev Multiplies value a by value b where rounding is towards the lesser number. 
     * (positive values are rounded towards zero and negative values are rounded away from 0). 
     */
    function conservativePreciseMul(int256 a, int256 b) internal pure returns (int256) {
        return divDown(a.mul(b), PRECISE_UNIT_INT);
    }

    /**
     * @dev Divides value a by value b where rounding is towards the lesser number. 
     * (positive values are rounded towards zero and negative values are rounded away from 0). 
     */
    function conservativePreciseDiv(int256 a, int256 b) internal pure returns (int256) {
        return divDown(a.mul(PRECISE_UNIT_INT), b);
    }

    /**
    * @dev Performs the power on a specified value, reverts on overflow.
    */
    function safePower(
        uint256 a,
        uint256 pow
    )
        internal
        pure
        returns (uint256)
    {
        require(a > 0, "Value must be positive");

        uint256 result = 1;
        for (uint256 i = 0; i < pow; i++){
            uint256 previousResult = result;

            // Using safemath multiplication prevents overflows
            result = previousResult.mul(a);
        }

        return result;
    }
}

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

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

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

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

pragma solidity >=0.6.0 <0.8.0;

/**
 * @title SignedSafeMath
 * @dev Signed math operations with safety checks that revert on error.
 */
library SignedSafeMath {
    int256 constant private _INT256_MIN = -2**255;

    /**
     * @dev Returns the multiplication of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(int256 a, int256 b) internal pure returns (int256) {
        // 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;
        }

        require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow");

        int256 c = a * b;
        require(c / a == b, "SignedSafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two signed 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(int256 a, int256 b) internal pure returns (int256) {
        require(b != 0, "SignedSafeMath: division by zero");
        require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow");

        int256 c = a / b;

        return c;
    }

    /**
     * @dev Returns the subtraction of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(int256 a, int256 b) internal pure returns (int256) {
        int256 c = a - b;
        require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow");

        return c;
    }

    /**
     * @dev Returns the addition of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(int256 a, int256 b) internal pure returns (int256) {
        int256 c = a + b;
        require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");

        return c;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"contract IController","name":"_setController","type":"address"},{"internalType":"address","name":"_swapTarget","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"_inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountInputToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountSetIssued","type":"uint256"}],"name":"ExchangeIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":true,"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"_outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountSetRedeemed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountOutputToken","type":"uint256"}],"name":"ExchangeRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"address","name":"_issuanceModule","type":"address"}],"name":"approveSetToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"approveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"_tokens","type":"address[]"},{"internalType":"address","name":"_spender","type":"address"}],"name":"approveTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_issuanceModule","type":"address"},{"internalType":"bool","name":"_isDebtIssuance","type":"bool"},{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"}],"name":"getRequiredIssuanceComponents","outputs":[{"internalType":"address[]","name":"components","type":"address[]"},{"internalType":"uint256[]","name":"positions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_issuanceModule","type":"address"},{"internalType":"bool","name":"_isDebtIssuance","type":"bool"},{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"}],"name":"getRequiredRedemptionComponents","outputs":[{"internalType":"address[]","name":"components","type":"address[]"},{"internalType":"uint256[]","name":"positions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"internalType":"bytes[]","name":"_componentQuotes","type":"bytes[]"},{"internalType":"address","name":"_issuanceModule","type":"address"},{"internalType":"bool","name":"_isDebtIssuance","type":"bool"}],"name":"issueExactSetFromETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"contract IERC20","name":"_inputToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"internalType":"uint256","name":"_maxAmountInputToken","type":"uint256"},{"internalType":"bytes[]","name":"_componentQuotes","type":"bytes[]"},{"internalType":"address","name":"_issuanceModule","type":"address"},{"internalType":"bool","name":"_isDebtIssuance","type":"bool"}],"name":"issueExactSetFromToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"internalType":"uint256","name":"_minEthReceive","type":"uint256"},{"internalType":"bytes[]","name":"_componentQuotes","type":"bytes[]"},{"internalType":"address","name":"_issuanceModule","type":"address"},{"internalType":"bool","name":"_isDebtIssuance","type":"bool"}],"name":"redeemExactSetForETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"contract IERC20","name":"_outputToken","type":"address"},{"internalType":"uint256","name":"_amountSetToken","type":"uint256"},{"internalType":"uint256","name":"_minOutputReceive","type":"uint256"},{"internalType":"bytes[]","name":"_componentQuotes","type":"bytes[]"},{"internalType":"address","name":"_issuanceModule","type":"address"},{"internalType":"bool","name":"_isDebtIssuance","type":"bool"}],"name":"redeemExactSetForToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setController","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapTarget","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"_tokens","type":"address[]"},{"internalType":"address payable","name":"_to","type":"address"}],"name":"withdrawTokens","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e06040523480156200001157600080fd5b5060405162003101380380620031018339810160408190526200003491620000c2565b6000620000496001600160e01b03620000be16565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180556001600160601b0319606092831b811660a05292821b8316608052901b1660c0526200012e565b3390565b600080600060608486031215620000d7578283fd5b8351620000e48162000115565b6020850151909350620000f78162000115565b60408501519092506200010a8162000115565b809150509250925092565b6001600160a01b03811681146200012b57600080fd5b50565b60805160601c60a05160601c60c05160601c612f4d620001b4600039806106ac5280610a8552806111f75280611bae5280611fa552508061036d52806105ad5280610aa95280610ad05280610e1552806110625250806101125280610d285280610f095280610f68528061115f52806111d6528061122652806113045250612f4d6000f3fe6080604052600436106101025760003560e01c80638da5cb5b11610095578063b50452b211610064578063b50452b2146102c1578063bb4cee01146102e1578063c132e27f14610301578063c224337914610314578063f2fde38b146103345761015a565b80638da5cb5b146102625780639b8862ec14610277578063a734f06e14610297578063ad5c4648146102ac5761015a565b8063715018a6116100d1578063715018a6146101f65780637e7f0cde1461020b5780638b2704ec1461022d5780638cd6944a146102425761015a565b806303105b041461015f5780630e8cc7051461017f5780635590febd146101925780636b211d8f146101c85761015a565b3661015a57336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146101585760405162461bcd60e51b815260040161014f906129c6565b60405180910390fd5b005b600080fd5b34801561016b57600080fd5b5061015861017a366004612606565b610354565b61015861018d366004612595565b610420565b34801561019e57600080fd5b506101b26101ad36600461263e565b6105a8565b6040516101bf9190612e67565b60405180910390f35b3480156101d457600080fd5b506101e86101e336600461242d565b6107d8565b6040516101bf929190612896565b34801561020257600080fd5b50610158610a04565b34801561021757600080fd5b50610220610a83565b6040516101bf919061282b565b34801561023957600080fd5b50610220610aa7565b34801561024e57600080fd5b506101b261025d36600461263e565b610acb565b34801561026e57600080fd5b50610220610c55565b34801561028357600080fd5b50610158610292366004612606565b610c64565b3480156102a357600080fd5b50610220610d0e565b3480156102b857600080fd5b50610220610d26565b3480156102cd57600080fd5b506101e86102dc36600461242d565b610d4a565b3480156102ed57600080fd5b506101b26102fc366004612758565b610e10565b6101b261030f3660046126d9565b61105d565b34801561032057600080fd5b5061015861032f366004612595565b6113e1565b34801561034057600080fd5b5061015861034f366004612411565b61141e565b6040516342f6e38960e01b815281906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342f6e389906103a290849060040161282b565b60206040518083038186803b1580156103ba57600080fd5b505afa1580156103ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f291906125ea565b61040e5760405162461bcd60e51b815260040161014f90612aed565b61041b83836000196114d4565b505050565b61042861157a565b6000546001600160a01b039081169116146104555760405162461bcd60e51b815260040161014f90612c77565b60005b828110156105a25773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84848381811061048157fe5b90506020020160208101906104969190612411565b6001600160a01b031614156104c3576104be6001600160a01b0383164763ffffffff61157e16565b61059a565b61059a828585848181106104d357fe5b90506020020160208101906104e89190612411565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610513919061282b565b60206040518083038186803b15801561052b57600080fd5b505afa15801561053f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056391906127df565b86868581811061056f57fe5b90506020020160208101906105849190612411565b6001600160a01b0316919063ffffffff61161a16565b600101610458565b50505050565b6000827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166342f6e389826040518263ffffffff1660e01b81526004016105f7919061282b565b60206040518083038186803b15801561060f57600080fd5b505afa158015610623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064791906125ea565b6106635760405162461bcd60e51b815260040161014f90612aed565b600260015414156106865760405162461bcd60e51b815260040161014f90612e30565b60026001556106a66001600160a01b03891633308963ffffffff61167016565b6106d1887f0000000000000000000000000000000000000000000000000000000000000000886114d4565b60006106e18a89888c8989611691565b9050868111156107035760405162461bcd60e51b815260040161014f90612cf0565b6040516336bc7a3d60e11b81526001600160a01b03861690636d78f47a90610733908d908c903390600401612924565b600060405180830381600087803b15801561074d57600080fd5b505af1158015610761573d6000803e3d6000fd5b505050506107708988836119a6565b886001600160a01b03168a6001600160a01b0316336001600160a01b03167f44b3b16472a909f781f712646232271ffd156fff642d4895b700146a404626018a8c6040516107bf929190612e70565b60405180910390a4600180559998505050505050505050565b606080841561086e576040516335c729db60e11b81526001600160a01b03871690636b8e53b69061080f908790879060040161287d565b60006040518083038186803b15801561082757600080fd5b505afa15801561083b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108639190810190612511565b5090925090506109fb565b836001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b1580156108a757600080fd5b505afa1580156108bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108e3919081019061247d565b9150815167ffffffffffffffff811180156108fd57600080fd5b50604051908082528060200260200182016040528015610927578160200160208202803683370190505b50905060005b82518110156109f9576000856001600160a01b03166366cb8d2f85848151811061095357fe5b60200260200101516040518263ffffffff1660e01b8152600401610977919061282b565b60206040518083038186803b15801561098f57600080fd5b505afa1580156109a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c791906127df565b90506109d9818663ffffffff6119da16565b8383815181106109e557fe5b60209081029190910101525060010161092d565b505b94509492505050565b610a0c61157a565b6000546001600160a01b03908116911614610a395760405162461bcd60e51b815260040161014f90612c77565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166342f6e389826040518263ffffffff1660e01b8152600401610b1a919061282b565b60206040518083038186803b158015610b3257600080fd5b505afa158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a91906125ea565b610b865760405162461bcd60e51b815260040161014f90612aed565b60026001541415610ba95760405162461bcd60e51b815260040161014f90612e30565b60026001556000610bbb8a8987611a0d565b50610bca8a89888c8989611a93565b905086811015610bec5760405162461bcd60e51b815260040161014f9061297a565b610c066001600160a01b038a16338363ffffffff61161a16565b886001600160a01b03168a6001600160a01b0316336001600160a01b03167f9f8f1a845f52c0a7086f16f355a092a5acf0cca219c831409b9e5b1c39af9f9f8b856040516107bf929190612e70565b6000546001600160a01b031690565b6060826001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b158015610c9f57600080fd5b505afa158015610cb3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cdb919081019061247d565b905060005b81518110156105a257610d06828281518110610cf857fe5b602002602001015184610354565b600101610ce0565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b7f000000000000000000000000000000000000000000000000000000000000000081565b6060808415610d815760405163131e26b960e01b81526001600160a01b0387169063131e26b99061080f908790879060040161287d565b604051637a4ffd0360e01b81526001600160a01b03871690637a4ffd0390610daf908790879060040161287d565b60006040518083038186803b158015610dc757600080fd5b505afa158015610ddb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e0391908101906124b0565b9097909650945050505050565b6000827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166342f6e389826040518263ffffffff1660e01b8152600401610e5f919061282b565b60206040518083038186803b158015610e7757600080fd5b505afa158015610e8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eaf91906125ea565b610ecb5760405162461bcd60e51b815260040161014f90612aed565b60026001541415610eee5760405162461bcd60e51b815260040161014f90612e30565b6002600155610efe888886611a0d565b506000610f2f8989887f00000000000000000000000000000000000000000000000000000000000000008989611a93565b905086811015610f515760405162461bcd60e51b815260040161014f90612bea565b604051632e1a7d4d60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632e1a7d4d90610f9d908490600401612e67565b600060405180830381600087803b158015610fb757600080fd5b505af1158015610fcb573d6000803e3d6000fd5b50610fe2925033915083905063ffffffff61157e16565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316896001600160a01b0316336001600160a01b03167f9f8f1a845f52c0a7086f16f355a092a5acf0cca219c831409b9e5b1c39af9f9f8b85604051611045929190612e70565b60405180910390a46001805598975050505050505050565b6000827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166342f6e389826040518263ffffffff1660e01b81526004016110ac919061282b565b60206040518083038186803b1580156110c457600080fd5b505afa1580156110d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fc91906125ea565b6111185760405162461bcd60e51b815260040161014f90612aed565b6002600154141561113b5760405162461bcd60e51b815260040161014f90612e30565b60026001553461115d5760405162461bcd60e51b815260040161014f90612d68565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156111b857600080fd5b505af11580156111cc573d6000803e3d6000fd5b505050505061121c7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000346114d4565b600061124c8888887f00000000000000000000000000000000000000000000000000000000000000008989611691565b90503481111561126e5760405162461bcd60e51b815260040161014f90612bb3565b6040516336bc7a3d60e11b81526001600160a01b03861690636d78f47a9061129e908b908b903390600401612924565b600060405180830381600087803b1580156112b857600080fd5b505af11580156112cc573d6000803e3d6000fd5b5050505060006112e58234611df890919063ffffffff16565b9050801561137e57604051632e1a7d4d60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632e1a7d4d90611339908490600401612e67565b600060405180830381600087803b15801561135357600080fd5b505af1158015611367573d6000803e3d6000fd5b5061137e925033915083905063ffffffff61157e16565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316896001600160a01b0316336001600160a01b03167f44b3b16472a909f781f712646232271ffd156fff642d4895b700146a40462601858c604051611045929190612e70565b60005b828110156105a2576114168484838181106113fb57fe5b90506020020160208101906114109190612411565b83610354565b6001016113e4565b61142661157a565b6000546001600160a01b039081169116146114535760405162461bcd60e51b815260040161014f90612c77565b6001600160a01b0381166114795760405162461bcd60e51b815260040161014f90612a13565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e90611505903090879060040161283f565b60206040518083038186803b15801561151d57600080fd5b505afa158015611531573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155591906127df565b9050818110156105a2576105a26001600160a01b03851684831963ffffffff611e3a16565b3390565b8047101561159e5760405162461bcd60e51b815260040161014f90612b36565b6000826001600160a01b0316826040516115b790612828565b60006040518083038185875af1925050503d80600081146115f4576040519150601f19603f3d011682016040523d82523d6000602084013e6115f9565b606091505b505090508061041b5760405162461bcd60e51b815260040161014f90612a90565b61041b8363a9059cbb60e01b848460405160240161163992919061287d565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611eeb565b6105a2846323b872dd60e01b85858560405160240161163993929190612859565b6000806060806116a386868c8c610d4a565b915091506000876001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016116d5919061282b565b60206040518083038186803b1580156116ed57600080fd5b505afa158015611701573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172591906127df565b905060005b83518110156118f457600084828151811061174157fe5b60200260200101519050600084838151811061175957fe5b602002602001015190508a6001600160a01b0316826001600160a01b031614156117975761178d888263ffffffff611f7a16565b97508096506118ea565b6040516370a0823160e01b81526000906001600160a01b038416906370a08231906117c690309060040161282b565b60206040518083038186803b1580156117de57600080fd5b505afa1580156117f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181691906127df565b90506118348d858151811061182757fe5b6020026020010151611f9f565b6040516370a0823160e01b81526000906001600160a01b038516906370a082319061186390309060040161282b565b60206040518083038186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b391906127df565b90506118c5818363ffffffff611df816565b9850828910156118e75760405162461bcd60e51b815260040161014f90612d9f565b50505b505060010161172a565b506040516370a0823160e01b81526000906001600160a01b038a16906370a082319061192490309060040161282b565b60206040518083038186803b15801561193c57600080fd5b505afa158015611950573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197491906127df565b9050611996611989838363ffffffff611df816565b879063ffffffff611f7a16565b9c9b505050505050505050505050565b60006119b8838363ffffffff611df816565b905080156105a2576105a26001600160a01b038516338363ffffffff61161a16565b6000611a04670de0b6b3a76400006119f8858563ffffffff61203a16565b9063ffffffff61207416565b90505b92915050565b6000611a2a6001600160a01b03851633308663ffffffff61167016565b604051635c833bfd60e01b81526001600160a01b03831690635c833bfd90611a5a90879087903090600401612924565b600060405180830381600087803b158015611a7457600080fd5b505af1158015611a88573d6000803e3d6000fd5b505050509392505050565b6000606080611aa485858b8b6107d8565b915091506000866001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611ad6919061282b565b60206040518083038186803b158015611aee57600080fd5b505afa158015611b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2691906127df565b905060005b8851811015611d47576000838281518110611b4257fe5b602002602001015190506000896001600160a01b0316868481518110611b6457fe5b60200260200101516001600160a01b03161415611b9557611b8b878363ffffffff611f7a16565b9650819050611d3d565b611bd3868481518110611ba457fe5b60200260200101517f0000000000000000000000000000000000000000000000000000000000000000846114d4565b6000868481518110611be157fe5b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611c14919061282b565b60206040518083038186803b158015611c2c57600080fd5b505afa158015611c40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6491906127df565b9050611c758c858151811061182757fe5b6000878581518110611c8357fe5b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611cb6919061282b565b60206040518083038186803b158015611cce57600080fd5b505afa158015611ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0691906127df565b9050611d18828263ffffffff611df816565b925082841015611d3a5760405162461bcd60e51b815260040161014f90612cac565b50505b5050600101611b2b565b506040516370a0823160e01b81526000906001600160a01b038916906370a0823190611d7790309060040161282b565b60206040518083038186803b158015611d8f57600080fd5b505afa158015611da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc791906127df565b9050611de9611ddc828463ffffffff611df816565b869063ffffffff611f7a16565b9b9a5050505050505050505050565b6000611a0483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b6000611eca82856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b8152600401611e6e92919061283f565b60206040518083038186803b158015611e8657600080fd5b505afa158015611e9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebe91906127df565b9063ffffffff611f7a16565b90506105a28463095ea7b360e01b858460405160240161163992919061287d565b6060611f40826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120e79092919063ffffffff16565b80519091501561041b5780806020019051810190611f5e91906125ea565b61041b5760405162461bcd60e51b815260040161014f90612de6565b600082820183811015611a045760405162461bcd60e51b815260040161014f90612a59565b600060607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031683604051611fdb919061280c565b6000604051808303816000865af19150503d8060008114612018576040519150601f19603f3d011682016040523d82523d6000602084013e61201d565b606091505b50915091508161041b57805161203257600080fd5b805181602001fd5b60008261204957506000611a07565b8282028284828161205657fe5b0414611a045760405162461bcd60e51b815260040161014f90612c36565b6000611a0483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120fe565b600081848411156120da5760405162461bcd60e51b815260040161014f9190612947565b50508183035b9392505050565b60606120f68484600085612135565b949350505050565b6000818361211f5760405162461bcd60e51b815260040161014f9190612947565b50600083858161212b57fe5b0495945050505050565b6060824710156121575760405162461bcd60e51b815260040161014f90612b6d565b612160856121f6565b61217c5760405162461bcd60e51b815260040161014f90612d31565b60006060866001600160a01b03168587604051612199919061280c565b60006040518083038185875af1925050503d80600081146121d6576040519150601f19603f3d011682016040523d82523d6000602084013e6121db565b606091505b50915091506121eb8282866121fc565b979650505050505050565b3b151590565b6060831561220b5750816120e0565b82511561221b5782518084602001fd5b8160405162461bcd60e51b815260040161014f9190612947565b600082601f830112612245578081fd5b815161225861225382612ea5565b612e7e565b81815291506020808301908481018184028601820187101561227957600080fd5b60005b848110156122a157815161228f81612ef1565b8452928201929082019060010161227c565b505050505092915050565b6000601f83818401126122bd578182fd5b82356122cb61225382612ea5565b818152925060208084019085810160005b8481101561235e578135880189603f8201126122f757600080fd5b8381013567ffffffffffffffff81111561231057600080fd5b612321818901601f19168601612e7e565b81815260408c8184860101111561233757600080fd5b828185018884013750600091810186019190915285525092820192908201906001016122dc565b50505050505092915050565b60008083601f84011261237b578182fd5b50813567ffffffffffffffff811115612392578182fd5b60208301915083602080830285010111156123ac57600080fd5b9250929050565b600082601f8301126123c3578081fd5b81516123d161225382612ea5565b8181529150602080830190848101818402860182018710156123f257600080fd5b60005b848110156122a1578151845292820192908201906001016123f5565b600060208284031215612422578081fd5b8135611a0481612ef1565b60008060008060808587031215612442578283fd5b843561244d81612ef1565b9350602085013561245d81612f09565b9250604085013561246d81612ef1565b9396929550929360600135925050565b60006020828403121561248e578081fd5b815167ffffffffffffffff8111156124a4578182fd5b6120f684828501612235565b600080604083850312156124c2578182fd5b825167ffffffffffffffff808211156124d9578384fd5b6124e586838701612235565b935060208501519150808211156124fa578283fd5b50612507858286016123b3565b9150509250929050565b600080600060608486031215612525578283fd5b835167ffffffffffffffff8082111561253c578485fd5b61254887838801612235565b9450602086015191508082111561255d578384fd5b612569878388016123b3565b9350604086015191508082111561257e578283fd5b5061258b868287016123b3565b9150509250925092565b6000806000604084860312156125a9578283fd5b833567ffffffffffffffff8111156125bf578384fd5b6125cb8682870161236a565b90945092505060208401356125df81612ef1565b809150509250925092565b6000602082840312156125fb578081fd5b8151611a0481612f09565b60008060408385031215612618578182fd5b823561262381612ef1565b9150602083013561263381612ef1565b809150509250929050565b600080600080600080600060e0888a031215612658578485fd5b873561266381612ef1565b9650602088013561267381612ef1565b95506040880135945060608801359350608088013567ffffffffffffffff81111561269c578384fd5b6126a88a828b016122ac565b93505060a08801356126b981612ef1565b915060c08801356126c981612f09565b8091505092959891949750929550565b600080600080600060a086880312156126f0578283fd5b85356126fb81612ef1565b945060208601359350604086013567ffffffffffffffff81111561271d578384fd5b612729888289016122ac565b935050606086013561273a81612ef1565b9150608086013561274a81612f09565b809150509295509295909350565b60008060008060008060c08789031215612770578384fd5b863561277b81612ef1565b95506020870135945060408701359350606087013567ffffffffffffffff8111156127a4578283fd5b6127b089828a016122ac565b93505060808701356127c181612ef1565b915060a08701356127d181612f09565b809150509295509295509295565b6000602082840312156127f0578081fd5b5051919050565b815260200190565b6001600160a01b03169052565b6000825161281e818460208701612ec5565b9190910192915050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b604080825283519082018190526000906020906060840190828701845b828110156128d6576128c68483516127ff565b92840192908401906001016128b3565b505050838103828501528085516128ed8184612e67565b91508387019250845b81811015612917576129098385516127f7565b9385019392506001016128f6565b5090979650505050505050565b6001600160a01b0393841681526020810192909252909116604082015260600190565b6000602082528251806020840152612966816040850160208701612ec5565b601f01601f19169190910160400192915050565b6020808252602c908201527f45786368616e676549737375616e63653a20494e53554646494349454e54204f60408201526b155514155508105353d5539560a21b606082015260800190565b6020808252602d908201527f45786368616e676549737375616e63653a20446972656374206465706f73697460408201526c1cc81b9bdd08185b1b1bddd959609a1b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252603a908201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260408201527f6563697069656e74206d61792068617665207265766572746564000000000000606082015260800190565b60208082526029908201527f45786368616e676549737375616e63653a20494e56414c49442049535355414e6040820152684345204d4f44554c4560b81b606082015260800190565b6020808252601d908201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252601f908201527f45786368616e676549737375616e63653a204f5645525350454e542045544800604082015260600190565b6020808252602c908201527f45786368616e676549737375616e63653a20494e53554646494349454e54205760408201526b11551208149150d15255915160a21b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526024908201527f45786368616e676549737375616e63653a204f564552534f4c4420434f4d504f6040820152631391539560e21b606082015260800190565b60208082526021908201527f45786368616e676549737375616e63653a204f5645525350454e5420544f4b456040820152602760f91b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601d908201527f45786368616e676549737375616e63653a204e4f204554482053454e54000000604082015260600190565b60208082526027908201527f45786368616e676549737375616e63653a20554e444552424f5547485420434f604082015266135413d391539560ca1b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715612e9d57600080fd5b604052919050565b600067ffffffffffffffff821115612ebb578081fd5b5060209081020190565b60005b83811015612ee0578181015183820152602001612ec8565b838111156105a25750506000910152565b6001600160a01b0381168114612f0657600080fd5b50565b8015158114612f0657600080fdfea264697066735822122026b2250ff78026a8e750c0366b6e77c860a76725b31349524420c5d1b37b895664736f6c634300060a00330000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb2000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff

Deployed Bytecode

0x6080604052600436106101025760003560e01c80638da5cb5b11610095578063b50452b211610064578063b50452b2146102c1578063bb4cee01146102e1578063c132e27f14610301578063c224337914610314578063f2fde38b146103345761015a565b80638da5cb5b146102625780639b8862ec14610277578063a734f06e14610297578063ad5c4648146102ac5761015a565b8063715018a6116100d1578063715018a6146101f65780637e7f0cde1461020b5780638b2704ec1461022d5780638cd6944a146102425761015a565b806303105b041461015f5780630e8cc7051461017f5780635590febd146101925780636b211d8f146101c85761015a565b3661015a57336001600160a01b037f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127016146101585760405162461bcd60e51b815260040161014f906129c6565b60405180910390fd5b005b600080fd5b34801561016b57600080fd5b5061015861017a366004612606565b610354565b61015861018d366004612595565b610420565b34801561019e57600080fd5b506101b26101ad36600461263e565b6105a8565b6040516101bf9190612e67565b60405180910390f35b3480156101d457600080fd5b506101e86101e336600461242d565b6107d8565b6040516101bf929190612896565b34801561020257600080fd5b50610158610a04565b34801561021757600080fd5b50610220610a83565b6040516101bf919061282b565b34801561023957600080fd5b50610220610aa7565b34801561024e57600080fd5b506101b261025d36600461263e565b610acb565b34801561026e57600080fd5b50610220610c55565b34801561028357600080fd5b50610158610292366004612606565b610c64565b3480156102a357600080fd5b50610220610d0e565b3480156102b857600080fd5b50610220610d26565b3480156102cd57600080fd5b506101e86102dc36600461242d565b610d4a565b3480156102ed57600080fd5b506101b26102fc366004612758565b610e10565b6101b261030f3660046126d9565b61105d565b34801561032057600080fd5b5061015861032f366004612595565b6113e1565b34801561034057600080fd5b5061015861034f366004612411565b61141e565b6040516342f6e38960e01b815281906001600160a01b037f00000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb216906342f6e389906103a290849060040161282b565b60206040518083038186803b1580156103ba57600080fd5b505afa1580156103ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f291906125ea565b61040e5760405162461bcd60e51b815260040161014f90612aed565b61041b83836000196114d4565b505050565b61042861157a565b6000546001600160a01b039081169116146104555760405162461bcd60e51b815260040161014f90612c77565b60005b828110156105a25773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84848381811061048157fe5b90506020020160208101906104969190612411565b6001600160a01b031614156104c3576104be6001600160a01b0383164763ffffffff61157e16565b61059a565b61059a828585848181106104d357fe5b90506020020160208101906104e89190612411565b6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610513919061282b565b60206040518083038186803b15801561052b57600080fd5b505afa15801561053f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056391906127df565b86868581811061056f57fe5b90506020020160208101906105849190612411565b6001600160a01b0316919063ffffffff61161a16565b600101610458565b50505050565b6000827f00000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb26001600160a01b03166342f6e389826040518263ffffffff1660e01b81526004016105f7919061282b565b60206040518083038186803b15801561060f57600080fd5b505afa158015610623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064791906125ea565b6106635760405162461bcd60e51b815260040161014f90612aed565b600260015414156106865760405162461bcd60e51b815260040161014f90612e30565b60026001556106a66001600160a01b03891633308963ffffffff61167016565b6106d1887f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff886114d4565b60006106e18a89888c8989611691565b9050868111156107035760405162461bcd60e51b815260040161014f90612cf0565b6040516336bc7a3d60e11b81526001600160a01b03861690636d78f47a90610733908d908c903390600401612924565b600060405180830381600087803b15801561074d57600080fd5b505af1158015610761573d6000803e3d6000fd5b505050506107708988836119a6565b886001600160a01b03168a6001600160a01b0316336001600160a01b03167f44b3b16472a909f781f712646232271ffd156fff642d4895b700146a404626018a8c6040516107bf929190612e70565b60405180910390a4600180559998505050505050505050565b606080841561086e576040516335c729db60e11b81526001600160a01b03871690636b8e53b69061080f908790879060040161287d565b60006040518083038186803b15801561082757600080fd5b505afa15801561083b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108639190810190612511565b5090925090506109fb565b836001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b1580156108a757600080fd5b505afa1580156108bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108e3919081019061247d565b9150815167ffffffffffffffff811180156108fd57600080fd5b50604051908082528060200260200182016040528015610927578160200160208202803683370190505b50905060005b82518110156109f9576000856001600160a01b03166366cb8d2f85848151811061095357fe5b60200260200101516040518263ffffffff1660e01b8152600401610977919061282b565b60206040518083038186803b15801561098f57600080fd5b505afa1580156109a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c791906127df565b90506109d9818663ffffffff6119da16565b8383815181106109e557fe5b60209081029190910101525060010161092d565b505b94509492505050565b610a0c61157a565b6000546001600160a01b03908116911614610a395760405162461bcd60e51b815260040161014f90612c77565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff81565b7f00000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb281565b6000827f00000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb26001600160a01b03166342f6e389826040518263ffffffff1660e01b8152600401610b1a919061282b565b60206040518083038186803b158015610b3257600080fd5b505afa158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a91906125ea565b610b865760405162461bcd60e51b815260040161014f90612aed565b60026001541415610ba95760405162461bcd60e51b815260040161014f90612e30565b60026001556000610bbb8a8987611a0d565b50610bca8a89888c8989611a93565b905086811015610bec5760405162461bcd60e51b815260040161014f9061297a565b610c066001600160a01b038a16338363ffffffff61161a16565b886001600160a01b03168a6001600160a01b0316336001600160a01b03167f9f8f1a845f52c0a7086f16f355a092a5acf0cca219c831409b9e5b1c39af9f9f8b856040516107bf929190612e70565b6000546001600160a01b031690565b6060826001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b158015610c9f57600080fd5b505afa158015610cb3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cdb919081019061247d565b905060005b81518110156105a257610d06828281518110610cf857fe5b602002602001015184610354565b600101610ce0565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b7f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127081565b6060808415610d815760405163131e26b960e01b81526001600160a01b0387169063131e26b99061080f908790879060040161287d565b604051637a4ffd0360e01b81526001600160a01b03871690637a4ffd0390610daf908790879060040161287d565b60006040518083038186803b158015610dc757600080fd5b505afa158015610ddb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e0391908101906124b0565b9097909650945050505050565b6000827f00000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb26001600160a01b03166342f6e389826040518263ffffffff1660e01b8152600401610e5f919061282b565b60206040518083038186803b158015610e7757600080fd5b505afa158015610e8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eaf91906125ea565b610ecb5760405162461bcd60e51b815260040161014f90612aed565b60026001541415610eee5760405162461bcd60e51b815260040161014f90612e30565b6002600155610efe888886611a0d565b506000610f2f8989887f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12708989611a93565b905086811015610f515760405162461bcd60e51b815260040161014f90612bea565b604051632e1a7d4d60e01b81526001600160a01b037f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12701690632e1a7d4d90610f9d908490600401612e67565b600060405180830381600087803b158015610fb757600080fd5b505af1158015610fcb573d6000803e3d6000fd5b50610fe2925033915083905063ffffffff61157e16565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316896001600160a01b0316336001600160a01b03167f9f8f1a845f52c0a7086f16f355a092a5acf0cca219c831409b9e5b1c39af9f9f8b85604051611045929190612e70565b60405180910390a46001805598975050505050505050565b6000827f00000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb26001600160a01b03166342f6e389826040518263ffffffff1660e01b81526004016110ac919061282b565b60206040518083038186803b1580156110c457600080fd5b505afa1580156110d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fc91906125ea565b6111185760405162461bcd60e51b815260040161014f90612aed565b6002600154141561113b5760405162461bcd60e51b815260040161014f90612e30565b60026001553461115d5760405162461bcd60e51b815260040161014f90612d68565b7f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12706001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156111b857600080fd5b505af11580156111cc573d6000803e3d6000fd5b505050505061121c7f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12707f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff346114d4565b600061124c8888887f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12708989611691565b90503481111561126e5760405162461bcd60e51b815260040161014f90612bb3565b6040516336bc7a3d60e11b81526001600160a01b03861690636d78f47a9061129e908b908b903390600401612924565b600060405180830381600087803b1580156112b857600080fd5b505af11580156112cc573d6000803e3d6000fd5b5050505060006112e58234611df890919063ffffffff16565b9050801561137e57604051632e1a7d4d60e01b81526001600160a01b037f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12701690632e1a7d4d90611339908490600401612e67565b600060405180830381600087803b15801561135357600080fd5b505af1158015611367573d6000803e3d6000fd5b5061137e925033915083905063ffffffff61157e16565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316896001600160a01b0316336001600160a01b03167f44b3b16472a909f781f712646232271ffd156fff642d4895b700146a40462601858c604051611045929190612e70565b60005b828110156105a2576114168484838181106113fb57fe5b90506020020160208101906114109190612411565b83610354565b6001016113e4565b61142661157a565b6000546001600160a01b039081169116146114535760405162461bcd60e51b815260040161014f90612c77565b6001600160a01b0381166114795760405162461bcd60e51b815260040161014f90612a13565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e90611505903090879060040161283f565b60206040518083038186803b15801561151d57600080fd5b505afa158015611531573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155591906127df565b9050818110156105a2576105a26001600160a01b03851684831963ffffffff611e3a16565b3390565b8047101561159e5760405162461bcd60e51b815260040161014f90612b36565b6000826001600160a01b0316826040516115b790612828565b60006040518083038185875af1925050503d80600081146115f4576040519150601f19603f3d011682016040523d82523d6000602084013e6115f9565b606091505b505090508061041b5760405162461bcd60e51b815260040161014f90612a90565b61041b8363a9059cbb60e01b848460405160240161163992919061287d565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611eeb565b6105a2846323b872dd60e01b85858560405160240161163993929190612859565b6000806060806116a386868c8c610d4a565b915091506000876001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016116d5919061282b565b60206040518083038186803b1580156116ed57600080fd5b505afa158015611701573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172591906127df565b905060005b83518110156118f457600084828151811061174157fe5b60200260200101519050600084838151811061175957fe5b602002602001015190508a6001600160a01b0316826001600160a01b031614156117975761178d888263ffffffff611f7a16565b97508096506118ea565b6040516370a0823160e01b81526000906001600160a01b038416906370a08231906117c690309060040161282b565b60206040518083038186803b1580156117de57600080fd5b505afa1580156117f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181691906127df565b90506118348d858151811061182757fe5b6020026020010151611f9f565b6040516370a0823160e01b81526000906001600160a01b038516906370a082319061186390309060040161282b565b60206040518083038186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b391906127df565b90506118c5818363ffffffff611df816565b9850828910156118e75760405162461bcd60e51b815260040161014f90612d9f565b50505b505060010161172a565b506040516370a0823160e01b81526000906001600160a01b038a16906370a082319061192490309060040161282b565b60206040518083038186803b15801561193c57600080fd5b505afa158015611950573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197491906127df565b9050611996611989838363ffffffff611df816565b879063ffffffff611f7a16565b9c9b505050505050505050505050565b60006119b8838363ffffffff611df816565b905080156105a2576105a26001600160a01b038516338363ffffffff61161a16565b6000611a04670de0b6b3a76400006119f8858563ffffffff61203a16565b9063ffffffff61207416565b90505b92915050565b6000611a2a6001600160a01b03851633308663ffffffff61167016565b604051635c833bfd60e01b81526001600160a01b03831690635c833bfd90611a5a90879087903090600401612924565b600060405180830381600087803b158015611a7457600080fd5b505af1158015611a88573d6000803e3d6000fd5b505050509392505050565b6000606080611aa485858b8b6107d8565b915091506000866001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611ad6919061282b565b60206040518083038186803b158015611aee57600080fd5b505afa158015611b02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b2691906127df565b905060005b8851811015611d47576000838281518110611b4257fe5b602002602001015190506000896001600160a01b0316868481518110611b6457fe5b60200260200101516001600160a01b03161415611b9557611b8b878363ffffffff611f7a16565b9650819050611d3d565b611bd3868481518110611ba457fe5b60200260200101517f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff846114d4565b6000868481518110611be157fe5b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611c14919061282b565b60206040518083038186803b158015611c2c57600080fd5b505afa158015611c40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6491906127df565b9050611c758c858151811061182757fe5b6000878581518110611c8357fe5b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611cb6919061282b565b60206040518083038186803b158015611cce57600080fd5b505afa158015611ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0691906127df565b9050611d18828263ffffffff611df816565b925082841015611d3a5760405162461bcd60e51b815260040161014f90612cac565b50505b5050600101611b2b565b506040516370a0823160e01b81526000906001600160a01b038916906370a0823190611d7790309060040161282b565b60206040518083038186803b158015611d8f57600080fd5b505afa158015611da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc791906127df565b9050611de9611ddc828463ffffffff611df816565b869063ffffffff611f7a16565b9b9a5050505050505050505050565b6000611a0483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b6000611eca82856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b8152600401611e6e92919061283f565b60206040518083038186803b158015611e8657600080fd5b505afa158015611e9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebe91906127df565b9063ffffffff611f7a16565b90506105a28463095ea7b360e01b858460405160240161163992919061287d565b6060611f40826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120e79092919063ffffffff16565b80519091501561041b5780806020019051810190611f5e91906125ea565b61041b5760405162461bcd60e51b815260040161014f90612de6565b600082820183811015611a045760405162461bcd60e51b815260040161014f90612a59565b600060607f000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff6001600160a01b031683604051611fdb919061280c565b6000604051808303816000865af19150503d8060008114612018576040519150601f19603f3d011682016040523d82523d6000602084013e61201d565b606091505b50915091508161041b57805161203257600080fd5b805181602001fd5b60008261204957506000611a07565b8282028284828161205657fe5b0414611a045760405162461bcd60e51b815260040161014f90612c36565b6000611a0483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120fe565b600081848411156120da5760405162461bcd60e51b815260040161014f9190612947565b50508183035b9392505050565b60606120f68484600085612135565b949350505050565b6000818361211f5760405162461bcd60e51b815260040161014f9190612947565b50600083858161212b57fe5b0495945050505050565b6060824710156121575760405162461bcd60e51b815260040161014f90612b6d565b612160856121f6565b61217c5760405162461bcd60e51b815260040161014f90612d31565b60006060866001600160a01b03168587604051612199919061280c565b60006040518083038185875af1925050503d80600081146121d6576040519150601f19603f3d011682016040523d82523d6000602084013e6121db565b606091505b50915091506121eb8282866121fc565b979650505050505050565b3b151590565b6060831561220b5750816120e0565b82511561221b5782518084602001fd5b8160405162461bcd60e51b815260040161014f9190612947565b600082601f830112612245578081fd5b815161225861225382612ea5565b612e7e565b81815291506020808301908481018184028601820187101561227957600080fd5b60005b848110156122a157815161228f81612ef1565b8452928201929082019060010161227c565b505050505092915050565b6000601f83818401126122bd578182fd5b82356122cb61225382612ea5565b818152925060208084019085810160005b8481101561235e578135880189603f8201126122f757600080fd5b8381013567ffffffffffffffff81111561231057600080fd5b612321818901601f19168601612e7e565b81815260408c8184860101111561233757600080fd5b828185018884013750600091810186019190915285525092820192908201906001016122dc565b50505050505092915050565b60008083601f84011261237b578182fd5b50813567ffffffffffffffff811115612392578182fd5b60208301915083602080830285010111156123ac57600080fd5b9250929050565b600082601f8301126123c3578081fd5b81516123d161225382612ea5565b8181529150602080830190848101818402860182018710156123f257600080fd5b60005b848110156122a1578151845292820192908201906001016123f5565b600060208284031215612422578081fd5b8135611a0481612ef1565b60008060008060808587031215612442578283fd5b843561244d81612ef1565b9350602085013561245d81612f09565b9250604085013561246d81612ef1565b9396929550929360600135925050565b60006020828403121561248e578081fd5b815167ffffffffffffffff8111156124a4578182fd5b6120f684828501612235565b600080604083850312156124c2578182fd5b825167ffffffffffffffff808211156124d9578384fd5b6124e586838701612235565b935060208501519150808211156124fa578283fd5b50612507858286016123b3565b9150509250929050565b600080600060608486031215612525578283fd5b835167ffffffffffffffff8082111561253c578485fd5b61254887838801612235565b9450602086015191508082111561255d578384fd5b612569878388016123b3565b9350604086015191508082111561257e578283fd5b5061258b868287016123b3565b9150509250925092565b6000806000604084860312156125a9578283fd5b833567ffffffffffffffff8111156125bf578384fd5b6125cb8682870161236a565b90945092505060208401356125df81612ef1565b809150509250925092565b6000602082840312156125fb578081fd5b8151611a0481612f09565b60008060408385031215612618578182fd5b823561262381612ef1565b9150602083013561263381612ef1565b809150509250929050565b600080600080600080600060e0888a031215612658578485fd5b873561266381612ef1565b9650602088013561267381612ef1565b95506040880135945060608801359350608088013567ffffffffffffffff81111561269c578384fd5b6126a88a828b016122ac565b93505060a08801356126b981612ef1565b915060c08801356126c981612f09565b8091505092959891949750929550565b600080600080600060a086880312156126f0578283fd5b85356126fb81612ef1565b945060208601359350604086013567ffffffffffffffff81111561271d578384fd5b612729888289016122ac565b935050606086013561273a81612ef1565b9150608086013561274a81612f09565b809150509295509295909350565b60008060008060008060c08789031215612770578384fd5b863561277b81612ef1565b95506020870135945060408701359350606087013567ffffffffffffffff8111156127a4578283fd5b6127b089828a016122ac565b93505060808701356127c181612ef1565b915060a08701356127d181612f09565b809150509295509295509295565b6000602082840312156127f0578081fd5b5051919050565b815260200190565b6001600160a01b03169052565b6000825161281e818460208701612ec5565b9190910192915050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b604080825283519082018190526000906020906060840190828701845b828110156128d6576128c68483516127ff565b92840192908401906001016128b3565b505050838103828501528085516128ed8184612e67565b91508387019250845b81811015612917576129098385516127f7565b9385019392506001016128f6565b5090979650505050505050565b6001600160a01b0393841681526020810192909252909116604082015260600190565b6000602082528251806020840152612966816040850160208701612ec5565b601f01601f19169190910160400192915050565b6020808252602c908201527f45786368616e676549737375616e63653a20494e53554646494349454e54204f60408201526b155514155508105353d5539560a21b606082015260800190565b6020808252602d908201527f45786368616e676549737375616e63653a20446972656374206465706f73697460408201526c1cc81b9bdd08185b1b1bddd959609a1b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252603a908201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260408201527f6563697069656e74206d61792068617665207265766572746564000000000000606082015260800190565b60208082526029908201527f45786368616e676549737375616e63653a20494e56414c49442049535355414e6040820152684345204d4f44554c4560b81b606082015260800190565b6020808252601d908201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252601f908201527f45786368616e676549737375616e63653a204f5645525350454e542045544800604082015260600190565b6020808252602c908201527f45786368616e676549737375616e63653a20494e53554646494349454e54205760408201526b11551208149150d15255915160a21b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526024908201527f45786368616e676549737375616e63653a204f564552534f4c4420434f4d504f6040820152631391539560e21b606082015260800190565b60208082526021908201527f45786368616e676549737375616e63653a204f5645525350454e5420544f4b456040820152602760f91b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601d908201527f45786368616e676549737375616e63653a204e4f204554482053454e54000000604082015260600190565b60208082526027908201527f45786368616e676549737375616e63653a20554e444552424f5547485420434f604082015266135413d391539560ca1b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715612e9d57600080fd5b604052919050565b600067ffffffffffffffff821115612ebb578081fd5b5060209081020190565b60005b83811015612ee0578181015183820152602001612ec8565b838111156105a25750506000910152565b6001600160a01b0381168114612f0657600080fd5b50565b8015158114612f0657600080fdfea264697066735822122026b2250ff78026a8e750c0366b6e77c860a76725b31349524420c5d1b37b895664736f6c634300060a0033

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

0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb2000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff

-----Decoded View---------------
Arg [0] : _weth (address): 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270
Arg [1] : _setController (address): 0x75FBBDEAfE23a48c0736B2731b956b7a03aDcfB2
Arg [2] : _swapTarget (address): 0xDef1C0ded9bec7F1a1670819833240f027b25EfF

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270
Arg [1] : 00000000000000000000000075fbbdeafe23a48c0736b2731b956b7a03adcfb2
Arg [2] : 000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
Chain Token Portfolio % Price Amount Value
MATIC41.80%$64,3180.00635106$408.49
MATIC9.42%$14.046.5543$92.02
MATIC9.19%$3,089.810.0291$89.77
MATIC6.32%$7.548.1938$61.78
MATIC5.12%$35.071.4261$50.01
MATIC3.24%$83.9592$31.67
MATIC2.66%$86.290.3016$26.03
MATIC2.32%$2.2710.0075$22.72
MATIC2.05%$0.67825929.5428$20.04
MATIC1.92%$0.44553742.1007$18.76
MATIC1.86%$118.2171$18.22
MATIC1.46%$6.562.1814$14.31
MATIC0.91%$6,883.120.00129381$8.91
MATIC0.90%$1.984.4188$8.75
MATIC0.75%$2.972.4686$7.33
MATIC0.70%$3,370.910.00202301$6.82
MATIC0.68%$55.190.1198$6.61
MATIC0.60%$0.01239474.0584$5.87
MATIC0.46%$186.740.0242$4.53
MATIC0.44%$0.7525215.7609$4.34
MATIC0.41%$0.4362499.2089$4.02
MATIC0.24%$0.4364195.2645$2.3
MATIC0.23%$63,9810.00003439$2.2
MATIC0.21%$62.90.0327$2.05
MATIC0.21%$0.7519242.7073$2.04
MATIC0.18%$3,085.770.00056138$1.73
MATIC0.16%$11.5337$1.54
MATIC0.14%$2.150.6173$1.33
MATIC0.14%$0.4179883.1668$1.32
MATIC0.13%$0.8569941.5207$1.3
MATIC0.12%$0.5891961.9129$1.13
MATIC0.10%$0.7900531.2963$1.02
MATIC0.10%$0.2605363.8889$1.01
MATIC0.08%$0.6754431.0874$0.7344
MATIC0.07%$2,961.190.00022739$0.6733
MATIC0.07%$12.140.0535$0.6492
MATIC0.06%$0.2489412.336$0.5815
MATIC0.06%$0.9988720.5403$0.5396
MATIC0.05%$1.020.5276$0.536
MATIC0.05%$1.030.4433$0.4561
MATIC0.03%$10.2911$0.291
MATIC0.03%$10.2759$0.2758
MATIC0.03%$20.1297$0.2593
MATIC0.03%$10.2592$0.2591
MATIC0.03%$0.738170.3483$0.2571
MATIC0.02%$8.740.0268$0.234
MATIC0.02%$3.540.0645$0.2284
MATIC0.02%$0.021610.3398$0.2233
MATIC0.02%$0.9503440.224$0.2128
MATIC0.02%$10.1684$0.1684
MATIC0.02%$1.230.1358$0.167
MATIC0.02%$0.9990070.1516$0.1514
MATIC0.01%$0.000072,100$0.1463
MATIC0.01%$36.530.00292272$0.1067
BASE4.12%$0.0134163,000$40.25
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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