ETH Price: $3,429.81 (-1.94%)
Gas: 5 Gwei

Contract

0x4C628b57D05FD0B99Ef05ECA6C59bC31DA53782d
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Sell Domani Fund201637562024-06-24 19:53:4723 days ago1719258827IN
0x4C628b57...1DA53782d
0 ETH0.003012365.95168471
Buy Domani Fund184090822023-10-22 23:23:11269 days ago1698016991IN
0x4C628b57...1DA53782d
0.45623636 ETH0.005109110.24291931
Sell Domani Fund182230412023-09-26 22:50:59295 days ago1695768659IN
0x4C628b57...1DA53782d
0 ETH0.007013668.36069338
Buy Domani Fund182230272023-09-26 22:48:11295 days ago1695768491IN
0x4C628b57...1DA53782d
0.04668199 ETH0.008925019.42793889
Sell Domani Fund176150792023-07-03 18:00:35380 days ago1688407235IN
0x4C628b57...1DA53782d
0 ETH0.0156928231.00509451
Sell Domani Fund170978012023-04-21 22:45:11453 days ago1682117111IN
0x4C628b57...1DA53782d
0 ETH0.0257858142.56497599
Sell Domani Fund170239672023-04-11 9:27:59463 days ago1681205279IN
0x4C628b57...1DA53782d
0 ETH0.0099733919.70527451
Buy Domani Fund169758622023-04-04 13:37:35470 days ago1680615455IN
0x4C628b57...1DA53782d
0.79782817 ETH0.0165329132.54671565
Buy Domani Fund169472432023-03-31 12:40:35474 days ago1680266435IN
0x4C628b57...1DA53782d
0.74862469 ETH0.0134460926.9566769
Sell Domani Fund169125952023-03-26 15:48:47479 days ago1679845727IN
0x4C628b57...1DA53782d
0 ETH0.0101266420.00772164
Buy Domani Fund168939972023-03-24 1:09:11482 days ago1679620151IN
0x4C628b57...1DA53782d
0.6743103 ETH0.0084324316.90530596
Sell Domani Fund168658492023-03-20 2:15:47486 days ago1679278547IN
0x4C628b57...1DA53782d
0 ETH0.0097056419.17593367
Sell Domani Fund168658372023-03-20 2:13:23486 days ago1679278403IN
0x4C628b57...1DA53782d
0 ETH0.0101716120.46681566
Sell Domani Fund167334422023-03-01 11:21:59504 days ago1677669719IN
0x4C628b57...1DA53782d
0 ETH0.0206052740.71086836
Buy Domani Fund166895142023-02-23 7:07:47510 days ago1677136067IN
0x4C628b57...1DA53782d
0.52255359 ETH0.0133397326.26060469
Buy Domani Fund166769812023-02-21 12:49:35512 days ago1676983775IN
0x4C628b57...1DA53782d
0.74503127 ETH0.0124978825.48140234
Buy Domani Fund166766482023-02-21 11:42:35512 days ago1676979755IN
0x4C628b57...1DA53782d
0 ETH0.0116360424.90379014
Buy Domani Fund166766482023-02-21 11:42:35512 days ago1676979755IN
0x4C628b57...1DA53782d
0.68971438 ETH0.0122145824.90379014
Buy Domani Fund166766322023-02-21 11:39:23512 days ago1676979563IN
0x4C628b57...1DA53782d
0.68737975 ETH0.0115662223.58187935
Buy Domani Fund166765612023-02-21 11:24:59512 days ago1676978699IN
0x4C628b57...1DA53782d
0 ETH0.0172394525.13201139
Buy Domani Fund166764962023-02-21 11:11:59512 days ago1676977919IN
0x4C628b57...1DA53782d
0 ETH0.0117743424.75823283
Sell Domani Fund166760272023-02-21 9:37:11512 days ago1676972231IN
0x4C628b57...1DA53782d
0 ETH0.0113929326.00070882
Sell Domani Fund166760172023-02-21 9:35:11512 days ago1676972111IN
0x4C628b57...1DA53782d
0 ETH0.0156264728.70239046
Buy Domani Fund166722222023-02-20 20:46:11513 days ago1676925971IN
0x4C628b57...1DA53782d
0.75509123 ETH0.0137623527.59071167
Buy Domani Fund166721282023-02-20 20:27:23513 days ago1676924843IN
0x4C628b57...1DA53782d
0 ETH0.0145033930.49667154
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
201637562024-06-24 19:53:4723 days ago1719258827
0x4C628b57...1DA53782d
0.02144282 ETH
201637562024-06-24 19:53:4723 days ago1719258827
0x4C628b57...1DA53782d
0.02144282 ETH
184090822023-10-22 23:23:11269 days ago1698016991
0x4C628b57...1DA53782d
0.00226983 ETH
184090822023-10-22 23:23:11269 days ago1698016991
0x4C628b57...1DA53782d
0.06208352 ETH
184090822023-10-22 23:23:11269 days ago1698016991
0x4C628b57...1DA53782d
0.06435335 ETH
184090822023-10-22 23:23:11269 days ago1698016991
0x4C628b57...1DA53782d
0.19701519 ETH
184090822023-10-22 23:23:11269 days ago1698016991
0x4C628b57...1DA53782d
0.19701519 ETH
184090822023-10-22 23:23:11269 days ago1698016991
0x4C628b57...1DA53782d
0.45623636 ETH
182230412023-09-26 22:50:59295 days ago1695768659
0x4C628b57...1DA53782d
0.014953 ETH
182230412023-09-26 22:50:59295 days ago1695768659
0x4C628b57...1DA53782d
0.014953 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.00023224 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.014953 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.01518525 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.02511298 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.02511298 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.02984603 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.02984603 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.04198535 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.04198535 ETH
182230272023-09-26 22:48:11295 days ago1695768491
0x4C628b57...1DA53782d
0.04668199 ETH
176150792023-07-03 18:00:35380 days ago1688407235
0x4C628b57...1DA53782d
0.07240728 ETH
176150792023-07-03 18:00:35380 days ago1688407235
0x4C628b57...1DA53782d
0.07240728 ETH
170978012023-04-21 22:45:11453 days ago1682117111
0x4C628b57...1DA53782d
0.11863206 ETH
170978012023-04-21 22:45:11453 days ago1682117111
0x4C628b57...1DA53782d
0.11863206 ETH
170239672023-04-11 9:27:59463 days ago1681205279
0x4C628b57...1DA53782d
0.08718364 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DomaniDex

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Apache-2.0 license
File 1 of 20 : DomaniDex.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental "ABIEncoderV2";

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IDomaniDex} from "./interfaces/IDomaniDex.sol";
import {IController} from "../interfaces/IController.sol";
import {IDomani} from "../interfaces/IDomani.sol";
import {IBasicIssuanceModule} from "../interfaces/IBasicIssuanceModule.sol";
import {IWNative} from "./interfaces/IWNative.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/SafeCast.sol";
import {PreciseUnitMath} from "../lib/PreciseUnitMath.sol";
import {ExplicitERC20} from "../lib/ExplicitERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {DelegateCall} from "./lib/DelegateCall.sol";
import {DomaniDexConstants} from "./lib/DomaniDexConstants.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

/**
 * @title DomaniDex
 * @author Domani Protocol
 *
 * DomaniDex is a smart contract used to swap generic ERC20 with Domani funds
 * using multiple dex supported
 *
 */
contract DomaniDex is IDomaniDex, Ownable, ReentrancyGuard {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;
  using SafeERC20 for IDomani;
  using PreciseUnitMath for uint256;
  using SafeCast for int256;
  using Address for address payable;
  using DelegateCall for address;

  string private constant EXACT_INPUT_SIG =
    "swapExactInput(bytes,(uint256,uint256,bytes,bool,uint256,address))";

  string private constant EXACT_OUTPUT_SIG =
    "swapExactOutput(bytes,(uint256,uint256,bytes,bool,uint256,address))";

  IController public immutable override controller;

  IWNative public immutable override wNative;

  IBasicIssuanceModule public override basicIssuanceModule;

  mapping(bytes32 => Implementation) private idToImplementation;

  modifier onlyValidFund(IDomani _fund) {
    require(controller.isSet(address(_fund)), "Must be a valid Domani fund");
    _;
  }

  /**
   * Set initial variables
   * @param _controller Address of controller contract
   * @param _basicIssuanceModule Address issuance module
   * @param _wNative Wrapper of the native token of the blockchain
   * @param _owner Owner of the dex
   */
  constructor(
    IController _controller,
    IBasicIssuanceModule _basicIssuanceModule,
    IWNative _wNative,
    address _owner
  ) {
    controller = _controller;
    _setBasicIssuanceModule(_basicIssuanceModule, _controller);
    wNative = _wNative;
    transferOwnership(_owner);
  }

  receive() external payable {}

  /**
   * Change the issuance module used
   * @param _basicIssuanceModule Address of the new issuance module
   */
  function setBasicIssuanceModule(IBasicIssuanceModule _basicIssuanceModule) external onlyOwner {
    _setBasicIssuanceModule(_basicIssuanceModule, controller);
  }

  /**
   * Register the specific implementation for a dex
   * @param _identifier Name of dex identifier to register
   * @param _dexAddr Address of the dex implementation to register
   * @param _dexInfo Specific info of the dex that will be used in the swaps
   */
  function registerImplementation(
    string calldata _identifier,
    address _dexAddr,
    bytes calldata _dexInfo
  ) external onlyOwner() {
    require(_dexAddr != address(0), "Implementation address can not be the 0x00");
    Implementation storage implementation = idToImplementation[keccak256(abi.encode(_identifier))];
    implementation.dexAddr = _dexAddr;
    implementation.dexInfo = _dexInfo;
    emit ImplementationRegistered(_identifier, _dexAddr, _dexInfo);
  }

  /**
   * Remove a registered implementation
   * @param _identifier Name of dex identifier to remove
   */
  function removeImplementation(string calldata _identifier) external onlyOwner() {
    bytes32 identifierHash = keccak256(abi.encode(_identifier));
    require(
      idToImplementation[identifierHash].dexAddr != address(0),
      "Implementation with this id is not registered"
    );
    delete idToImplementation[identifierHash];
    emit ImplementationRemoved(_identifier);
  }

  /**
   * Swap a generic ERC20 for a quantity of a Domani fund
   * @param _inputDexParams See InputDexParams in IDomaniDex
   * @return inputAmountUsed Amount of the ERC20 used for buying the fund
   */
  function buyDomaniFund(InputDexParams calldata _inputDexParams)
    external
    payable
    override
    nonReentrant
    onlyValidFund(_inputDexParams.fund)
    returns (uint256 inputAmountUsed)
  {
    require(block.timestamp <= _inputDexParams.expiration, "Transaction expired");
    bool isNativeInput = address(_inputDexParams.swapToken) == DomaniDexConstants.NATIVE_ADDR;

    if (!isNativeInput) {
      require(msg.value == 0, "ETH not required for an ERC20 transfer");
      ExplicitERC20.transferFrom(
        _inputDexParams.swapToken,
        msg.sender,
        address(this),
        _inputDexParams.maxOrMinSwapTokenAmount
      );
    }

    uint256 startingAmount = isNativeInput ? msg.value : _inputDexParams.maxOrMinSwapTokenAmount;

    uint256 remainingInputAmount = startingAmount;

    (address[] memory components, uint256[] memory notionalUnits) = getRequiredComponents(
      _inputDexParams.fund,
      _inputDexParams.fundQuantity,
      true
    );
    uint256 componentsNumber = components.length;
    require(componentsNumber == _inputDexParams.swaps.length, "Wrong number of input swaps");

    for (uint256 i = 0; i < componentsNumber; i++) {
      if (address(_inputDexParams.swapToken) == components[i]) {
        remainingInputAmount = remainingInputAmount.sub(notionalUnits[i]);
      } else if (isNativeInput && components[i] == address(wNative)) {
        wNative.deposit{value: notionalUnits[i]}();
        remainingInputAmount = remainingInputAmount.sub(notionalUnits[i]);
      } else {
        Swap memory swap = _inputDexParams.swaps[i];
        Implementation storage implementation = idToImplementation[
          keccak256(abi.encode(swap.identifier))
        ];
        address dexAddress = implementation.dexAddr;
        require(dexAddress != address(0), "Implementation not supported");
        SwapParams memory swapParams = SwapParams(
          notionalUnits[i],
          remainingInputAmount,
          swap.swapData,
          isNativeInput,
          _inputDexParams.expiration,
          address(this)
        );
        bytes memory result = dexAddress.functionDelegateCall(
          abi.encodeWithSignature(EXACT_OUTPUT_SIG, implementation.dexInfo, swapParams)
        );
        ReturnValues memory returnValues = abi.decode(result, (ReturnValues));
        require(
          returnValues.inputToken == address(_inputDexParams.swapToken) &&
            returnValues.outputToken == components[i],
          "Wrong input or output token in the swap"
        );

        remainingInputAmount = remainingInputAmount.sub(returnValues.inputAmount);
      }
      IERC20(components[i]).safeApprove(address(basicIssuanceModule), notionalUnits[i]);
    }

    if (remainingInputAmount > 0) {
      if (isNativeInput) {
        msg.sender.sendValue(remainingInputAmount);
      } else {
        _inputDexParams.swapToken.safeTransfer(msg.sender, remainingInputAmount);
      }
    }

    basicIssuanceModule.issue(
      _inputDexParams.fund,
      _inputDexParams.fundQuantity,
      _inputDexParams.recipient
    );

    inputAmountUsed = startingAmount.sub(remainingInputAmount);

    emit DomaniSwap(
      msg.sender,
      address(_inputDexParams.swapToken),
      inputAmountUsed,
      _inputDexParams.recipient,
      address(_inputDexParams.fund),
      _inputDexParams.fundQuantity
    );
  }

  /**
   * Swap a quantity of a Domani fund for a generic ERC20
   * @param _inputDexParams See InputDexParams in IDomaniDex
   * @return outputAmountReceived Amount of the ERC20 received from the fund selling
   */
  function sellDomaniFund(InputDexParams calldata _inputDexParams)
    external
    override
    nonReentrant
    onlyValidFund(_inputDexParams.fund)
    returns (uint256 outputAmountReceived)
  {
    require(block.timestamp <= _inputDexParams.expiration, "Transaction expired");

    ExplicitERC20.transferFrom(
      _inputDexParams.fund,
      msg.sender,
      address(this),
      _inputDexParams.fundQuantity
    );

    (address[] memory components, uint256[] memory notionalUnits) = getRequiredComponents(
      _inputDexParams.fund,
      _inputDexParams.fundQuantity,
      false
    );
    uint256 componentsNumber = components.length;
    require(componentsNumber == _inputDexParams.swaps.length, "Wrong number of input swaps");

    basicIssuanceModule.redeem(_inputDexParams.fund, _inputDexParams.fundQuantity, address(this));

    bool isNativeOutput = address(_inputDexParams.swapToken) == DomaniDexConstants.NATIVE_ADDR;

    address dexAddress;
    bytes memory result;
    for (uint256 i = 0; i < componentsNumber; i++) {
      if (address(_inputDexParams.swapToken) == components[i]) {
        outputAmountReceived = outputAmountReceived.add(notionalUnits[i]);
        _inputDexParams.swapToken.safeTransfer(_inputDexParams.recipient, notionalUnits[i]);
      } else if (isNativeOutput && components[i] == address(wNative)) {
        wNative.withdraw(notionalUnits[i]);
        outputAmountReceived = outputAmountReceived.add(notionalUnits[i]);
        payable(_inputDexParams.recipient).sendValue(notionalUnits[i]);
      } else {
        Swap memory swap = _inputDexParams.swaps[i];
        Implementation storage implementation = idToImplementation[
          keccak256(abi.encode(swap.identifier))
        ];
        dexAddress = implementation.dexAddr;
        require(dexAddress != address(0), "Implementation not supported");
        SwapParams memory swapParams = SwapParams(
          notionalUnits[i],
          0,
          swap.swapData,
          isNativeOutput,
          _inputDexParams.expiration,
          _inputDexParams.recipient
        );

        result = dexAddress.functionDelegateCall(
          abi.encodeWithSignature(EXACT_INPUT_SIG, implementation.dexInfo, swapParams)
        );

        ReturnValues memory returnValues = abi.decode(result, (ReturnValues));
        require(
          returnValues.inputToken == components[i] &&
            returnValues.outputToken == address(_inputDexParams.swapToken),
          "Wrong input or output token in the swap"
        );
        outputAmountReceived = outputAmountReceived.add(returnValues.outputAmount);
      }
    }

    require(
      outputAmountReceived >= _inputDexParams.maxOrMinSwapTokenAmount,
      "Amount received less than minimum"
    );

    emit DomaniSwap(
      msg.sender,
      address(_inputDexParams.fund),
      _inputDexParams.fundQuantity,
      _inputDexParams.recipient,
      address(_inputDexParams.swapToken),
      outputAmountReceived
    );
  }

  /**
   * Swap a quantity of a Domani fund for a generic ERC20
   * @param _token Address of the token to sweep (for native token use NATIVE_ADDR)
   * @param _recipient Address receiving the amount of token
   * @return Amount of token received
   */
  function sweepToken(IERC20 _token, address payable _recipient)
    external
    override
    nonReentrant
    returns (uint256)
  {
    bool isETH = address(_token) == DomaniDexConstants.NATIVE_ADDR;
    uint256 balance = isETH ? address(this).balance : _token.balanceOf(address(this));
    if (balance > 0) {
      if (isETH) {
        _recipient.sendValue(balance);
      } else {
        _token.safeTransfer(_recipient, balance);
      }
    }
    return balance;
  }

  /**
   * Get address and info of a supported dex
   * @param _identifier Name of dex identifier to get
   * @return See Implementation struct in IDomaniDexGeneral
   */
  function getImplementation(string calldata _identifier)
    external
    view
    override
    returns (Implementation memory)
  {
    return idToImplementation[keccak256(abi.encode(_identifier))];
  }

  /**
   * Get the dummy address to identify native token
   * @return Address used fot native token
   */
  function nativeTokenAddress() external pure override returns (address) {
    return DomaniDexConstants.NATIVE_ADDR;
  }

  /**
   * Get addresses and amounts of the components of a Domani fund
   * @param _fund Address of the fund
   * @param _quantity Qunatity of the fund
   * @param _isIssue True for fund buying, false for fund selling
   * @return Addresses and amounts of the components for the specific quantity of the fund
   */
  function getRequiredComponents(
    IDomani _fund,
    uint256 _quantity,
    bool _isIssue
  ) public view override onlyValidFund(_fund) returns (address[] memory, uint256[] memory) {
    address[] memory components = _fund.getComponents();

    uint256[] memory notionalUnits = new uint256[](components.length);

    uint256 singleUnit;
    for (uint256 i = 0; i < components.length; i++) {
      singleUnit = _fund.getDefaultPositionRealUnit(components[i]).toUint256();
      notionalUnits[i] = _isIssue
        ? singleUnit.preciseMulCeil(_quantity)
        : singleUnit.preciseMul(_quantity);
    }

    return (components, notionalUnits);
  }

  function _setBasicIssuanceModule(
    IBasicIssuanceModule _basicIssuanceModule,
    IController _controller
  ) internal {
    require(_controller.isModule(address(_basicIssuanceModule)), "Module not valid");
    basicIssuanceModule = _basicIssuanceModule;
  }
}

File 2 of 20 : 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 3 of 20 : 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 4 of 20 : 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 5 of 20 : 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;
    }
}

File 6 of 20 : 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 7 of 20 : 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 8 of 20 : 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 9 of 20 : 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 10 of 20 : SafeCast.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;


/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such 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.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        require(value < 2**255, "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 11 of 20 : IDomaniDex.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.6;
pragma experimental "ABIEncoderV2";

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IDomani} from "../../interfaces/IDomani.sol";
import {IController} from "../../interfaces/IController.sol";
import {IBasicIssuanceModule} from "../../interfaces/IBasicIssuanceModule.sol";
import {IWNative} from "../interfaces/IWNative.sol";
import {IDomaniDexGeneral} from "./IDomaniDexGeneral.sol";

interface IDomaniDex is IDomaniDexGeneral {
  struct Swap {
    // Identifier of the dex to be used
    string identifier;
    // Info (like routes) to be used in a dex for the swap execution
    bytes swapData;
  }

  struct InputDexParams {
    // Address of the fund
    IDomani fund;
    // Quantity of the fund to buy/sell
    uint256 fundQuantity;
    // Address of the token to send/receive
    IERC20 swapToken;
    // Max amount to spend in a buying or min amount to receive in a selling (anti-slippage)
    uint256 maxOrMinSwapTokenAmount;
    // Info contained the choice of dex to use for single component swap
    Swap[] swaps;
    // Expiration time (in seconds)
    uint256 expiration;
    // Address receiving fund in a buying and the ERC20 in a selling
    address recipient;
  }

  event DomaniSwap(
    address indexed sender,
    address inputToken,
    uint256 inputAmount,
    address indexed recipient,
    address outputToken,
    uint256 outputAmount
  );

  function buyDomaniFund(InputDexParams calldata _inputDexParams)
    external
    payable
    returns (uint256 inputAmountUsed);

  function sellDomaniFund(InputDexParams calldata _inputDexParams)
    external
    returns (uint256 outputAmountReceived);

  function sweepToken(IERC20 token, address payable recipient) external returns (uint256);

  function controller() external view returns (IController);

  function wNative() external view returns (IWNative);

  function basicIssuanceModule() external view returns (IBasicIssuanceModule);

  function getRequiredComponents(
    IDomani _fund,
    uint256 _quantity,
    bool _isIssue
  ) external view returns (address[] memory, uint256[] memory);

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

File 12 of 20 : IDomaniDexGeneral.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.6;
pragma experimental "ABIEncoderV2";

interface IDomaniDexGeneral {
  struct ReturnValues {
    address inputToken;
    address outputToken;
    uint256 inputAmount;
    uint256 outputAmount;
  }

  struct SwapParams {
    uint256 exactAmount;
    uint256 minOutOrMaxIn;
    bytes extraData;
    bool isNative;
    uint256 expiration;
    address recipient;
  }

  struct Implementation {
    // Address of the implementation of a dex
    address dexAddr;
    // General info (like a router) to be used for the execution of the swaps
    bytes dexInfo;
  }

  event ImplementationRegistered(
    string indexed id,
    address implementationAddr,
    bytes implementationInfo
  );

  event ImplementationRemoved(string indexed id);

  function getImplementation(string calldata identifier)
    external
    view
    returns (Implementation memory);
}

File 13 of 20 : IWNative.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.6;

interface IWNative {
  function deposit() external payable;

  function withdraw(uint256 _amount) external;
}

File 14 of 20 : DelegateCall.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental "ABIEncoderV2";

library DelegateCall {
  function isContract(address account) internal view returns (bool) {
    uint256 size;
    // solhint-disable-next-line no-inline-assembly
    assembly {
      size := extcodesize(account)
    }
    return size > 0;
  }

  function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
    require(isContract(target), "Address: delegate call to non-contract");
    (bool success, bytes memory returndata) = target.delegatecall(data);
    return _verifyCallResult(success, returndata, "Address: low-level delegate call failed");
  }

  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 15 of 20 : DomaniDexConstants.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

library DomaniDexConstants {
  // Dummy address used for the identification of the native token in the swap
  address public constant NATIVE_ADDR = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;
}

File 16 of 20 : 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.7.6;

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

interface IBasicIssuanceModule {
  function getRequiredComponentUnitsForIssue(IDomani _setToken, uint256 _quantity)
    external
    returns (address[] memory, uint256[] memory);

  function issue(
    IDomani _setToken,
    uint256 _quantity,
    address _to
  ) external;

  function redeem(
    IDomani _setToken,
    uint256 _quantity,
    address _to
  ) external;
}

File 17 of 20 : 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.7.6;

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 18 of 20 : IDomani.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.7.6;
pragma experimental "ABIEncoderV2";

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

/**
 * @title IDomani
 * @author Domani Protocol
 *
 * Interface for operating with Domani tokens.
 */
interface IDomani 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 19 of 20 : ExplicitERC20.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.7.6;

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

/**
 * @title ExplicitERC20
 * @author Set Protocol
 *
 * Utility functions for ERC20 transfers that require the explicit amount to be transferred.
 */
library ExplicitERC20 {
  using SafeMath for uint256;

  /**
   * When given allowance, transfers a token from the "_from" to the "_to" of quantity "_quantity".
   * Ensures that the recipient has received the correct quantity (ie no fees taken on transfer)
   *
   * @param _token           ERC20 token to approve
   * @param _from            The account to transfer tokens from
   * @param _to              The account to transfer tokens to
   * @param _quantity        The quantity to transfer
   */
  function transferFrom(
    IERC20 _token,
    address _from,
    address _to,
    uint256 _quantity
  ) internal {
    // Call specified ERC20 contract to transfer tokens (via proxy).
    if (_quantity > 0) {
      uint256 existingBalance = _token.balanceOf(_to);

      SafeERC20.safeTransferFrom(_token, _from, _to, _quantity);

      uint256 newBalance = _token.balanceOf(_to);

      // Verify transfer quantity is reflected in balance
      require(newBalance == existingBalance.add(_quantity), "Invalid post transfer balance");
    }
  }
}

File 20 of 20 : 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.7.6;
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
 * - 4/21/21: Added approximatelyEquals function
 */
library PreciseUnitMath {
  using SafeMath for uint256;
  using SignedSafeMath for int256;

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

  // Max unsigned integer value
  uint256 internal constant MAX_UINT_256 = type(uint256).max;
  // Max and min signed integer value
  int256 internal constant MAX_INT_256 = type(int256).max;
  int256 internal constant 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;
  }

  /**
   * @dev Returns true if a =~ b within range, false otherwise.
   */
  function approximatelyEquals(
    uint256 a,
    uint256 b,
    uint256 range
  ) internal pure returns (bool) {
    return a <= b.add(range) && a >= b.sub(range);
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IController","name":"_controller","type":"address"},{"internalType":"contract IBasicIssuanceModule","name":"_basicIssuanceModule","type":"address"},{"internalType":"contract IWNative","name":"_wNative","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"outputAmount","type":"uint256"}],"name":"DomaniSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"id","type":"string"},{"indexed":false,"internalType":"address","name":"implementationAddr","type":"address"},{"indexed":false,"internalType":"bytes","name":"implementationInfo","type":"bytes"}],"name":"ImplementationRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"id","type":"string"}],"name":"ImplementationRemoved","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":"basicIssuanceModule","outputs":[{"internalType":"contract IBasicIssuanceModule","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IDomani","name":"fund","type":"address"},{"internalType":"uint256","name":"fundQuantity","type":"uint256"},{"internalType":"contract IERC20","name":"swapToken","type":"address"},{"internalType":"uint256","name":"maxOrMinSwapTokenAmount","type":"uint256"},{"components":[{"internalType":"string","name":"identifier","type":"string"},{"internalType":"bytes","name":"swapData","type":"bytes"}],"internalType":"struct IDomaniDex.Swap[]","name":"swaps","type":"tuple[]"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IDomaniDex.InputDexParams","name":"_inputDexParams","type":"tuple"}],"name":"buyDomaniFund","outputs":[{"internalType":"uint256","name":"inputAmountUsed","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_identifier","type":"string"}],"name":"getImplementation","outputs":[{"components":[{"internalType":"address","name":"dexAddr","type":"address"},{"internalType":"bytes","name":"dexInfo","type":"bytes"}],"internalType":"struct IDomaniDexGeneral.Implementation","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDomani","name":"_fund","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bool","name":"_isIssue","type":"bool"}],"name":"getRequiredComponents","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_identifier","type":"string"},{"internalType":"address","name":"_dexAddr","type":"address"},{"internalType":"bytes","name":"_dexInfo","type":"bytes"}],"name":"registerImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_identifier","type":"string"}],"name":"removeImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IDomani","name":"fund","type":"address"},{"internalType":"uint256","name":"fundQuantity","type":"uint256"},{"internalType":"contract IERC20","name":"swapToken","type":"address"},{"internalType":"uint256","name":"maxOrMinSwapTokenAmount","type":"uint256"},{"components":[{"internalType":"string","name":"identifier","type":"string"},{"internalType":"bytes","name":"swapData","type":"bytes"}],"internalType":"struct IDomaniDex.Swap[]","name":"swaps","type":"tuple[]"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct IDomaniDex.InputDexParams","name":"_inputDexParams","type":"tuple"}],"name":"sellDomaniFund","outputs":[{"internalType":"uint256","name":"outputAmountReceived","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBasicIssuanceModule","name":"_basicIssuanceModule","type":"address"}],"name":"setBasicIssuanceModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address payable","name":"_recipient","type":"address"}],"name":"sweepToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wNative","outputs":[{"internalType":"contract IWNative","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c06040523480156200001157600080fd5b50604051620037bf380380620037bf8339810160408190526200003491620002ba565b600062000040620000c2565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350916000805160206200379f833981519152908290a350600180556001600160601b0319606085901b166080526200009b8385620000c6565b6001600160601b0319606083901b1660a052620000b88162000193565b5050505062000378565b3390565b6040516342f6e38960e01b81526001600160a01b038216906342f6e38990620000f490859060040162000321565b60206040518083038186803b1580156200010d57600080fd5b505afa15801562000122573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000148919062000291565b620001705760405162461bcd60e51b8152600401620001679062000335565b60405180910390fd5b50600280546001600160a01b0319166001600160a01b0392909216919091179055565b6200019d620000c2565b6000546001600160a01b0390811691161462000200576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116620002475760405162461bcd60e51b8152600401808060200182810382526026815260200180620037796026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216916000805160206200379f83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060208284031215620002a3578081fd5b81518015158114620002b3578182fd5b9392505050565b60008060008060808587031215620002d0578283fd5b8451620002dd816200035f565b6020860151909450620002f0816200035f565b604086015190935062000303816200035f565b606086015190925062000316816200035f565b939692955090935050565b6001600160a01b0391909116815260200190565b60208082526010908201526f135bd91d5b19481b9bdd081d985b1a5960821b604082015260600190565b6001600160a01b03811681146200037557600080fd5b50565b60805160601c60a05160601c6133af620003ca6000398061067c528061094c528061099a52806116e0528061172e5250806102ce5280610733528061129052806113b1528061144e52506133af6000f3fe6080604052600436106100eb5760003560e01c8063715018a61161008a578063e830ec1611610059578063e830ec1614610253578063f2fde38b14610273578063f77c479114610293578063f92a5bf8146102a8576100f2565b8063715018a6146101e75780638da5cb5b146101fe578063c263726714610213578063d49c7be114610233576100f2565b80634d0047ee116100c65780634d0047ee1461017d57806350e2c07f1461019257806360440668146101a75780636b683896146101ba576100f2565b8062ef5c68146100f7578063258836fe1461012e5780632d68efc91461015b576100f2565b366100f257005b600080fd5b34801561010357600080fd5b506101176101123660046128a4565b6102c8565b604051610125929190612bdf565b60405180910390f35b34801561013a57600080fd5b5061014e6101493660046128e5565b61053f565b604051610125919061301d565b34801561016757600080fd5b5061017061067a565b6040516101259190612b7c565b34801561018957600080fd5b5061017061069e565b34801561019e57600080fd5b506101706106a9565b61014e6101b53660046129f7565b6106b8565b3480156101c657600080fd5b506101da6101d5366004612935565b610e18565b6040516101259190612ff0565b3480156101f357600080fd5b506101fc610f15565b005b34801561020a57600080fd5b50610170610fb7565b34801561021f57600080fd5b506101fc61022e366004612975565b610fc6565b34801561023f57600080fd5b506101fc61024e366004612935565b611107565b34801561025f57600080fd5b506101fc61026e3660046127bf565b611232565b34801561027f57600080fd5b506101fc61028e3660046127bf565b6112b7565b34801561029f57600080fd5b506101706113af565b3480156102b457600080fd5b5061014e6102c33660046129f7565b6113d3565b606080847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166374ebe3ec826040518263ffffffff1660e01b81526004016103189190612b7c565b60206040518083038186803b15801561033057600080fd5b505afa158015610344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103689190612888565b61038d5760405162461bcd60e51b815260040161038490612fb9565b60405180910390fd5b6000866001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b1580156103c857600080fd5b505afa1580156103dc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261040491908101906127db565b90506000815167ffffffffffffffff8111801561042057600080fd5b5060405190808252806020026020018201604052801561044a578160200160208202803683370190505b5090506000805b8351811015610530576104f18a6001600160a01b03166366cb8d2f86848151811061047857fe5b60200260200101516040518263ffffffff1660e01b815260040161049c9190612b7c565b60206040518083038186803b1580156104b457600080fd5b505afa1580156104c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec919061291d565b611ae4565b91508761050757610502828a611b3f565b610511565b610511828a611b64565b83828151811061051d57fe5b6020908102919091010152600101610451565b50919890975095505050505050565b600060026001541415610599576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556001600160a01b0383811614600081610632576040516370a0823160e01b81526001600160a01b038616906370a08231906105dd903090600401612b7c565b60206040518083038186803b1580156105f557600080fd5b505afa158015610609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d919061291d565b610634565b475b9050801561066e57811561065a576106556001600160a01b03851682611ba9565b61066e565b61066e6001600160a01b0386168583611c93565b60018055949350505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b0390565b6002546001600160a01b031681565b600060026001541415610712576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155604051631d3af8fb60e21b81526001600160a01b0383358116917f0000000000000000000000000000000000000000000000000000000000000000909116906374ebe3ec9061076a908490600401612b7c565b60206040518083038186803b15801561078257600080fd5b505afa158015610796573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ba9190612888565b6107d65760405162461bcd60e51b815260040161038490612fb9565b8260a001354211156107fa5760405162461bcd60e51b815260040161038490612dbd565b60006001600160a01b0361081460608601604087016127bf565b6001600160a01b0316149050806108625734156108435760405162461bcd60e51b815260040161038490612eb5565b61086261085660608601604087016127bf565b33308760600135611ce5565b600081610873578460600135610875565b345b90508060008061089761088b60208a018a6127bf565b896020013560016102c8565b815191935091506108ab60808a018a613026565b905081146108cb5760405162461bcd60e51b815260040161038490612f82565b60005b81811015610cb8578381815181106108e257fe5b60200260200101516001600160a01b03168a604001602081019061090691906127bf565b6001600160a01b031614156109425761093b83828151811061092457fe5b602002602001015186611e5790919063ffffffff16565b9450610c5d565b86801561099357507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031684828151811061098057fe5b60200260200101516001600160a01b0316145b15610a2e577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db08483815181106109d357fe5b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a0657600080fd5b505af1158015610a1a573d6000803e3d6000fd5b505050505061093b83828151811061092457fe5b6000610a3d60808c018c613026565b83818110610a4757fe5b9050602002810190610a59919061306d565b610a62906130b2565b90506000600360008360000151604051602001610a7f9190612d36565b60408051601f1981840301815291815281516020928301208352908201929092520160002080549091506001600160a01b031680610acf5760405162461bcd60e51b815260040161038490612dea565b60006040518060c00160405280888781518110610ae857fe5b602002602001015181526020018a8152602001856020015181526020018c151581526020018f60a001358152602001306001600160a01b031681525090506000610baf6040518060800160405280604381526020016131a7604391398560010184604051602401610b5a929190612c62565b60408051601f198184030181529082905291610b7591612b50565b6040519081900390206020820180516001600160e01b03166001600160e01b03199092169190911790526001600160a01b03851690611e99565b9050600081806020019051810190610bc79190612a2f565b90508f6040016020810190610bdc91906127bf565b6001600160a01b031681600001516001600160a01b0316148015610c285750898781518110610c0757fe5b60200260200101516001600160a01b031681602001516001600160a01b0316145b610c445760405162461bcd60e51b815260040161038490612e21565b6040810151610c54908c90611e57565b9a505050505050505b6002548351610cb0916001600160a01b031690859084908110610c7c57fe5b6020026020010151868481518110610c9057fe5b60200260200101516001600160a01b0316611f4c9092919063ffffffff16565b6001016108ce565b508315610cf9578515610cd457610ccf3385611ba9565b610cf9565b610cf93385610ce960608d0160408e016127bf565b6001600160a01b03169190611c93565b6002546001600160a01b0316636d78f47a610d1760208c018c6127bf565b60208c0135610d2c60e08e0160c08f016127bf565b6040518463ffffffff1660e01b8152600401610d4a93929190612cff565b600060405180830381600087803b158015610d6457600080fd5b505af1158015610d78573d6000803e3d6000fd5b50505050610d8f8486611e5790919063ffffffff16565b9750610da160e08a0160c08b016127bf565b6001600160a01b0316337fdc8841de0eade935015873b4eaf3c632cfecc42a7adb48b5de3fcbc44bcc9417610ddc60608d0160408e016127bf565b8b610dea60208f018f6127bf565b8e60200135604051610dff9493929190612bb5565b60405180910390a3505060018055509395945050505050565b610e20612631565b600360008484604051602001610e37929190612d22565b60408051808303601f1901815291815281516020928301208352828201939093529082016000208251808401845281546001600160a01b03168152600180830180548651600261010094831615949094026000190190911692909204601f8101869004860283018601909652858252919492938581019391929190830182828015610f035780601f10610ed857610100808354040283529160200191610f03565b820191906000526020600020905b815481529060010190602001808311610ee657829003601f168201915b50505050508152505090505b92915050565b610f1d61205f565b6000546001600160a01b03908116911614610f6d576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b610fce61205f565b6000546001600160a01b0390811691161461101e576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b6001600160a01b0383166110445760405162461bcd60e51b815260040161038490612d73565b600060036000878760405160200161105d929190612d22565b60408051808303601f1901815291815281516020928301208352908201929092520160002080546001600160a01b0319166001600160a01b03861617815590506110ab600182018484612649565b5085856040516110bc929190612b6c565b60405180910390207fea483761b50e3215a739ab19fb4a764f89f8aed2815840753f8164f8c77e63df8585856040516110f793929190612b90565b60405180910390a2505050505050565b61110f61205f565b6000546001600160a01b0390811691161461115f576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b60008282604051602001611174929190612d22565b60408051601f198184030181529181528151602092830120600081815260039093529120549091506001600160a01b03166111c15760405162461bcd60e51b815260040161038490612e68565b600081815260036020526040812080546001600160a01b0319168155906111eb60018301826126d1565b505082826040516111fd929190612b6c565b604051908190038120907fbf2bf649b148a9950248de19b09933211003bf3b8c1d9764815bdef9bcdece7990600090a2505050565b61123a61205f565b6000546001600160a01b0390811691161461128a576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b6112b4817f0000000000000000000000000000000000000000000000000000000000000000612063565b50565b6112bf61205f565b6000546001600160a01b0390811691161461130f576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b6001600160a01b0381166113545760405162461bcd60e51b81526004018080602001828103825260268152602001806131ea6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006002600154141561142d576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155604051631d3af8fb60e21b81526001600160a01b0383358116917f0000000000000000000000000000000000000000000000000000000000000000909116906374ebe3ec90611485908490600401612b7c565b60206040518083038186803b15801561149d57600080fd5b505afa1580156114b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d59190612888565b6114f15760405162461bcd60e51b815260040161038490612fb9565b8260a001354211156115155760405162461bcd60e51b815260040161038490612dbd565b61153161152560208501856127bf565b33308660200135611ce5565b60008061155061154460208701876127bf565b866020013560006102c8565b815191935091506115646080870187613026565b905081146115845760405162461bcd60e51b815260040161038490612f82565b6002546001600160a01b0316635c833bfd6115a260208901896127bf565b8860200135306040518463ffffffff1660e01b81526004016115c693929190612cff565b600060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b50600092506001600160a01b03915061161590506060890160408a016127bf565b6001600160a01b03161490506000606060005b84811015611a4e5786818151811061163c57fe5b60200260200101516001600160a01b03168a604001602081019061166091906127bf565b6001600160a01b031614156116d65761169586828151811061167e57fe5b60200260200101518a61211e90919063ffffffff16565b98506116d16116aa60e08c0160c08d016127bf565b8783815181106116b657fe5b60200260200101518c6040016020810190610ce991906127bf565b611a46565b83801561172757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031687828151811061171457fe5b60200260200101516001600160a01b0316145b15611807577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d87838151811061176757fe5b60200260200101516040518263ffffffff1660e01b815260040161178b919061301d565b600060405180830381600087803b1580156117a557600080fd5b505af11580156117b9573d6000803e3d6000fd5b505050506117cc86828151811061167e57fe5b98506116d18682815181106117dd57fe5b60200260200101518b60c00160208101906117f891906127bf565b6001600160a01b031690611ba9565b600061181660808c018c613026565b8381811061182057fe5b9050602002810190611832919061306d565b61183b906130b2565b905060006003600083600001516040516020016118589190612d36565b60408051601f1981840301815291815281516020928301208352908201929092520160002080546001600160a01b031695509050846118a95760405162461bcd60e51b815260040161038490612dea565b60006040518060c001604052808a86815181106118c257fe5b60200260200101518152602001600081526020018460200151815260200188151581526020018e60a0013581526020018e60c001602081019061190591906127bf565b6001600160a01b0316815250905061199a604051806080016040528060428152602001613270604291398360010183604051602401611945929190612c62565b60408051601f19818403018152908290529161196091612b50565b6040519081900390206020820180516001600160e01b03166001600160e01b03199092169190911790526001600160a01b03881690611e99565b94506000858060200190518101906119b29190612a2f565b90508a85815181106119c057fe5b60200260200101516001600160a01b031681600001516001600160a01b0316148015611a1357508d60400160208101906119fa91906127bf565b6001600160a01b031681602001516001600160a01b0316145b611a2f5760405162461bcd60e51b815260040161038490612e21565b6060810151611a3f908e9061211e565b9c50505050505b600101611628565b508860600135881015611a735760405162461bcd60e51b815260040161038490612f41565b611a8360e08a0160c08b016127bf565b6001600160a01b0316337fdc8841de0eade935015873b4eaf3c632cfecc42a7adb48b5de3fcbc44bcc9417611abb60208d018d6127bf565b8c602001358d6040016020810190611ad391906127bf565b8d604051610dff9493929190612bb5565b600080821215611b3b576040805162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f736974697665604482015290519081900360640190fd5b5090565b6000611b5d670de0b6b3a7640000611b578585612178565b906121d1565b9392505050565b6000821580611b71575081155b15611b7e57506000610f0f565b611b5d6001611ba3670de0b6b3a7640000611b5783611b9d8989612178565b90611e57565b9061211e565b80471015611bfe576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114611c49576040519150601f19603f3d011682016040523d82523d6000602084013e611c4e565b606091505b5050905080611c8e5760405162461bcd60e51b815260040180806020018281038252603a815260200180613210603a913960400191505060405180910390fd5b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611c8e908490612213565b8015611e51576000846001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611d3a57600080fd5b505afa158015611d4e573d6000803e3d6000fd5b505050506040513d6020811015611d6457600080fd5b50519050611d74858585856122c4565b6000856001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611dc357600080fd5b505afa158015611dd7573d6000803e3d6000fd5b505050506040513d6020811015611ded57600080fd5b50519050611dfb828461211e565b8114611e4e576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420706f7374207472616e736665722062616c616e6365000000604482015290519081900360640190fd5b50505b50505050565b6000611b5d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061231e565b6060611ea4836123b5565b611ec05760405162461bcd60e51b815260040161038490612efb565b600080846001600160a01b031684604051611edb9190612b50565b600060405180830381855af49150503d8060008114611f16576040519150601f19603f3d011682016040523d82523d6000602084013e611f1b565b606091505b5091509150611f4382826040518060600160405280602781526020016132f3602791396123bb565b95945050505050565b801580611fd2575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015611fa457600080fd5b505afa158015611fb8573d6000803e3d6000fd5b505050506040513d6020811015611fce57600080fd5b5051155b61200d5760405162461bcd60e51b81526004018080602001828103825260368152602001806133446036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611c8e908490612213565b3390565b6040516342f6e38960e01b81526001600160a01b038216906342f6e3899061208f908590600401612b7c565b60206040518083038186803b1580156120a757600080fd5b505afa1580156120bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120df9190612888565b6120fb5760405162461bcd60e51b815260040161038490612d49565b50600280546001600160a01b0319166001600160a01b0392909216919091179055565b600082820183811015611b5d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261218757506000610f0f565b8282028284828161219457fe5b0414611b5d5760405162461bcd60e51b81526004018080602001828103825260218152602001806132b26021913960400191505060405180910390fd5b6000611b5d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123f4565b6000612268826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124599092919063ffffffff16565b805190915015611c8e5780806020019051602081101561228757600080fd5b5051611c8e5760405162461bcd60e51b815260040180806020018281038252602a81526020018061331a602a913960400191505060405180910390fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611e51908590612213565b600081848411156123ad5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237257818101518382015260200161235a565b50505050905090810190601f16801561239f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b3b151590565b606083156123ca575081611b5d565b8251156123da5782518084602001fd5b8160405162461bcd60e51b81526004016103849190612d36565b600081836124435760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561237257818101518382015260200161235a565b50600083858161244f57fe5b0495945050505050565b60606124688484600085612470565b949350505050565b6060824710156124b15760405162461bcd60e51b815260040180806020018281038252602681526020018061324a6026913960400191505060405180910390fd5b6124ba856123b5565b61250b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106125495780518252601f19909201916020918201910161252a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146125ab576040519150601f19603f3d011682016040523d82523d6000602084013e6125b0565b606091505b50915091506125c08282866125cb565b979650505050505050565b606083156125da575081611b5d565b8251156125ea5782518084602001fd5b60405162461bcd60e51b815260206004820181815284516024840152845185939192839260440191908501908083836000831561237257818101518382015260200161235a565b60408051808201909152600081526060602082015290565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261267f57600085556126c5565b82601f106126985782800160ff198235161785556126c5565b828001600101855582156126c5579182015b828111156126c55782358255916020019190600101906126aa565b50611b3b929150612711565b50805460018160011615610100020316600290046000825580601f106126f757506112b4565b601f0160209004906000526020600020908101906112b491905b5b80821115611b3b5760008155600101612712565b600067ffffffffffffffff83111561273a57fe5b61274d601f8401601f1916602001613082565b905082815283838301111561276157600080fd5b828260208301376000602084830101529392505050565b60008083601f840112612789578182fd5b50813567ffffffffffffffff8111156127a0578182fd5b6020830191508360208285010111156127b857600080fd5b9250929050565b6000602082840312156127d0578081fd5b8135611b5d81613183565b600060208083850312156127ed578182fd5b825167ffffffffffffffff80821115612804578384fd5b818501915085601f830112612817578384fd5b81518181111561282357fe5b8381029150612833848301613082565b8181528481019084860184860187018a101561284d578788fd5b8795505b8386101561287b578051945061286685613183565b84835260019590950194918601918601612851565b5098975050505050505050565b600060208284031215612899578081fd5b8151611b5d81613198565b6000806000606084860312156128b8578182fd5b83356128c381613183565b92506020840135915060408401356128da81613198565b809150509250925092565b600080604083850312156128f7578182fd5b823561290281613183565b9150602083013561291281613183565b809150509250929050565b60006020828403121561292e578081fd5b5051919050565b60008060208385031215612947578182fd5b823567ffffffffffffffff81111561295d578283fd5b61296985828601612778565b90969095509350505050565b60008060008060006060868803121561298c578283fd5b853567ffffffffffffffff808211156129a3578485fd5b6129af89838a01612778565b9097509550602088013591506129c482613183565b909350604087013590808211156129d9578283fd5b506129e688828901612778565b969995985093965092949392505050565b600060208284031215612a08578081fd5b813567ffffffffffffffff811115612a1e578182fd5b820160e08185031215611b5d578182fd5b600060808284031215612a40578081fd5b6040516080810181811067ffffffffffffffff82111715612a5d57fe5b6040528251612a6b81613183565b81526020830151612a7b81613183565b6020820152604083810151908201526060928301519281019290925250919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452612adf816020860160208601613157565b601f01601f19169290920160200192915050565b60008151835260208201516020840152604082015160c06040850152612b1c60c0850182612ac7565b6060848101511515908601526080808501519086015260a0938401516001600160a01b031693909401929092525090919050565b60008251612b62818460208701613157565b9190910192915050565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b6001600160a01b0384168152604060208201819052600090611f439083018486612a9d565b6001600160a01b039485168152602081019390935292166040820152606081019190915260800190565b604080825283519082018190526000906020906060840190828701845b82811015612c215781516001600160a01b031684529284019290840190600101612bfc565b50505083810382850152845180825285830191830190845b81811015612c5557835183529284019291840191600101612c39565b5090979650505050505050565b60006040820160408352818554600180821660008114612c895760018114612ca757612ce0565b60028304607f16855260ff1983166060880152608087019350612ce0565b60028304808652612cb78a6130a6565b875b82811015612cd65781548a82016060015290840190602001612cb9565b8901606001955050505b5050508381036020850152612cf58186612af3565b9695505050505050565b6001600160a01b0393841681526020810192909252909116604082015260600190565b600060208252612468602083018486612a9d565b600060208252611b5d6020830184612ac7565b60208082526010908201526f135bd91d5b19481b9bdd081d985b1a5960821b604082015260600190565b6020808252602a908201527f496d706c656d656e746174696f6e20616464726573732063616e206e6f7420626040820152690652074686520307830360b41b606082015260800190565b602080825260139082015272151c985b9cd858dd1a5bdb88195e1c1a5c9959606a1b604082015260600190565b6020808252601c908201527f496d706c656d656e746174696f6e206e6f7420737570706f7274656400000000604082015260600190565b60208082526027908201527f57726f6e6720696e707574206f72206f757470757420746f6b656e20696e20746040820152660686520737761760cc1b606082015260800190565b6020808252602d908201527f496d706c656d656e746174696f6e20776974682074686973206964206973206e60408201526c1bdd081c9959da5cdd195c9959609a1b606082015260800190565b60208082526026908201527f455448206e6f7420726571756972656420666f7220616e20455243323020747260408201526530b739b332b960d11b606082015260800190565b60208082526026908201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6040820152651b9d1c9858dd60d21b606082015260800190565b60208082526021908201527f416d6f756e74207265636569766564206c657373207468616e206d696e696d756040820152606d60f81b606082015260800190565b6020808252601b908201527f57726f6e67206e756d626572206f6620696e7075742073776170730000000000604082015260600190565b6020808252601b908201527f4d75737420626520612076616c696420446f6d616e692066756e640000000000604082015260600190565b602080825282516001600160a01b0316828201528201516040808301526000906124686060840182612ac7565b90815260200190565b6000808335601e1984360301811261303c578283fd5b83018035915067ffffffffffffffff821115613056578283fd5b60209081019250810236038213156127b857600080fd5b60008235603e19833603018112612b62578182fd5b60405181810167ffffffffffffffff8111828210171561309e57fe5b604052919050565b60009081526020902090565b6000604082360312156130c3578081fd5b6040516040810167ffffffffffffffff82821081831117156130e157fe5b8160405284359150808211156130f5578384fd5b9084019036601f830112613107578384fd5b61311636833560208501612726565b8352602085013591508082111561312b578384fd5b50830136601f82011261313c578283fd5b61314b36823560208401612726565b60208301525092915050565b60005b8381101561317257818101518382015260200161315a565b83811115611e515750506000910152565b6001600160a01b03811681146112b457600080fd5b80151581146112b457600080fdfe7377617045786163744f75747075742862797465732c2875696e743235362c75696e743235362c62797465732c626f6f6c2c75696e743235362c6164647265737329294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c737761704578616374496e7075742862797465732c2875696e743235362c75696e743235362c62797465732c626f6f6c2c75696e743235362c616464726573732929536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220b93bd042664ec855fcf939d180135cd5efe854be498cf75b07cdfbee36563da764736f6c634300070600334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d8000000000000000000000000ba1030459e75f6041f938c5470f4e0f6468d5253000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000007a3dd714e35f1e19ccc911f11d9564d158f8fd73

Deployed Bytecode

0x6080604052600436106100eb5760003560e01c8063715018a61161008a578063e830ec1611610059578063e830ec1614610253578063f2fde38b14610273578063f77c479114610293578063f92a5bf8146102a8576100f2565b8063715018a6146101e75780638da5cb5b146101fe578063c263726714610213578063d49c7be114610233576100f2565b80634d0047ee116100c65780634d0047ee1461017d57806350e2c07f1461019257806360440668146101a75780636b683896146101ba576100f2565b8062ef5c68146100f7578063258836fe1461012e5780632d68efc91461015b576100f2565b366100f257005b600080fd5b34801561010357600080fd5b506101176101123660046128a4565b6102c8565b604051610125929190612bdf565b60405180910390f35b34801561013a57600080fd5b5061014e6101493660046128e5565b61053f565b604051610125919061301d565b34801561016757600080fd5b5061017061067a565b6040516101259190612b7c565b34801561018957600080fd5b5061017061069e565b34801561019e57600080fd5b506101706106a9565b61014e6101b53660046129f7565b6106b8565b3480156101c657600080fd5b506101da6101d5366004612935565b610e18565b6040516101259190612ff0565b3480156101f357600080fd5b506101fc610f15565b005b34801561020a57600080fd5b50610170610fb7565b34801561021f57600080fd5b506101fc61022e366004612975565b610fc6565b34801561023f57600080fd5b506101fc61024e366004612935565b611107565b34801561025f57600080fd5b506101fc61026e3660046127bf565b611232565b34801561027f57600080fd5b506101fc61028e3660046127bf565b6112b7565b34801561029f57600080fd5b506101706113af565b3480156102b457600080fd5b5061014e6102c33660046129f7565b6113d3565b606080847f000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d86001600160a01b03166374ebe3ec826040518263ffffffff1660e01b81526004016103189190612b7c565b60206040518083038186803b15801561033057600080fd5b505afa158015610344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103689190612888565b61038d5760405162461bcd60e51b815260040161038490612fb9565b60405180910390fd5b6000866001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b1580156103c857600080fd5b505afa1580156103dc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261040491908101906127db565b90506000815167ffffffffffffffff8111801561042057600080fd5b5060405190808252806020026020018201604052801561044a578160200160208202803683370190505b5090506000805b8351811015610530576104f18a6001600160a01b03166366cb8d2f86848151811061047857fe5b60200260200101516040518263ffffffff1660e01b815260040161049c9190612b7c565b60206040518083038186803b1580156104b457600080fd5b505afa1580156104c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec919061291d565b611ae4565b91508761050757610502828a611b3f565b610511565b610511828a611b64565b83828151811061051d57fe5b6020908102919091010152600101610451565b50919890975095505050505050565b600060026001541415610599576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556001600160a01b0383811614600081610632576040516370a0823160e01b81526001600160a01b038616906370a08231906105dd903090600401612b7c565b60206040518083038186803b1580156105f557600080fd5b505afa158015610609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d919061291d565b610634565b475b9050801561066e57811561065a576106556001600160a01b03851682611ba9565b61066e565b61066e6001600160a01b0386168583611c93565b60018055949350505050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6001600160a01b0390565b6002546001600160a01b031681565b600060026001541415610712576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155604051631d3af8fb60e21b81526001600160a01b0383358116917f000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d8909116906374ebe3ec9061076a908490600401612b7c565b60206040518083038186803b15801561078257600080fd5b505afa158015610796573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ba9190612888565b6107d65760405162461bcd60e51b815260040161038490612fb9565b8260a001354211156107fa5760405162461bcd60e51b815260040161038490612dbd565b60006001600160a01b0361081460608601604087016127bf565b6001600160a01b0316149050806108625734156108435760405162461bcd60e51b815260040161038490612eb5565b61086261085660608601604087016127bf565b33308760600135611ce5565b600081610873578460600135610875565b345b90508060008061089761088b60208a018a6127bf565b896020013560016102c8565b815191935091506108ab60808a018a613026565b905081146108cb5760405162461bcd60e51b815260040161038490612f82565b60005b81811015610cb8578381815181106108e257fe5b60200260200101516001600160a01b03168a604001602081019061090691906127bf565b6001600160a01b031614156109425761093b83828151811061092457fe5b602002602001015186611e5790919063ffffffff16565b9450610c5d565b86801561099357507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031684828151811061098057fe5b60200260200101516001600160a01b0316145b15610a2e577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08483815181106109d357fe5b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a0657600080fd5b505af1158015610a1a573d6000803e3d6000fd5b505050505061093b83828151811061092457fe5b6000610a3d60808c018c613026565b83818110610a4757fe5b9050602002810190610a59919061306d565b610a62906130b2565b90506000600360008360000151604051602001610a7f9190612d36565b60408051601f1981840301815291815281516020928301208352908201929092520160002080549091506001600160a01b031680610acf5760405162461bcd60e51b815260040161038490612dea565b60006040518060c00160405280888781518110610ae857fe5b602002602001015181526020018a8152602001856020015181526020018c151581526020018f60a001358152602001306001600160a01b031681525090506000610baf6040518060800160405280604381526020016131a7604391398560010184604051602401610b5a929190612c62565b60408051601f198184030181529082905291610b7591612b50565b6040519081900390206020820180516001600160e01b03166001600160e01b03199092169190911790526001600160a01b03851690611e99565b9050600081806020019051810190610bc79190612a2f565b90508f6040016020810190610bdc91906127bf565b6001600160a01b031681600001516001600160a01b0316148015610c285750898781518110610c0757fe5b60200260200101516001600160a01b031681602001516001600160a01b0316145b610c445760405162461bcd60e51b815260040161038490612e21565b6040810151610c54908c90611e57565b9a505050505050505b6002548351610cb0916001600160a01b031690859084908110610c7c57fe5b6020026020010151868481518110610c9057fe5b60200260200101516001600160a01b0316611f4c9092919063ffffffff16565b6001016108ce565b508315610cf9578515610cd457610ccf3385611ba9565b610cf9565b610cf93385610ce960608d0160408e016127bf565b6001600160a01b03169190611c93565b6002546001600160a01b0316636d78f47a610d1760208c018c6127bf565b60208c0135610d2c60e08e0160c08f016127bf565b6040518463ffffffff1660e01b8152600401610d4a93929190612cff565b600060405180830381600087803b158015610d6457600080fd5b505af1158015610d78573d6000803e3d6000fd5b50505050610d8f8486611e5790919063ffffffff16565b9750610da160e08a0160c08b016127bf565b6001600160a01b0316337fdc8841de0eade935015873b4eaf3c632cfecc42a7adb48b5de3fcbc44bcc9417610ddc60608d0160408e016127bf565b8b610dea60208f018f6127bf565b8e60200135604051610dff9493929190612bb5565b60405180910390a3505060018055509395945050505050565b610e20612631565b600360008484604051602001610e37929190612d22565b60408051808303601f1901815291815281516020928301208352828201939093529082016000208251808401845281546001600160a01b03168152600180830180548651600261010094831615949094026000190190911692909204601f8101869004860283018601909652858252919492938581019391929190830182828015610f035780601f10610ed857610100808354040283529160200191610f03565b820191906000526020600020905b815481529060010190602001808311610ee657829003601f168201915b50505050508152505090505b92915050565b610f1d61205f565b6000546001600160a01b03908116911614610f6d576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b610fce61205f565b6000546001600160a01b0390811691161461101e576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b6001600160a01b0383166110445760405162461bcd60e51b815260040161038490612d73565b600060036000878760405160200161105d929190612d22565b60408051808303601f1901815291815281516020928301208352908201929092520160002080546001600160a01b0319166001600160a01b03861617815590506110ab600182018484612649565b5085856040516110bc929190612b6c565b60405180910390207fea483761b50e3215a739ab19fb4a764f89f8aed2815840753f8164f8c77e63df8585856040516110f793929190612b90565b60405180910390a2505050505050565b61110f61205f565b6000546001600160a01b0390811691161461115f576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b60008282604051602001611174929190612d22565b60408051601f198184030181529181528151602092830120600081815260039093529120549091506001600160a01b03166111c15760405162461bcd60e51b815260040161038490612e68565b600081815260036020526040812080546001600160a01b0319168155906111eb60018301826126d1565b505082826040516111fd929190612b6c565b604051908190038120907fbf2bf649b148a9950248de19b09933211003bf3b8c1d9764815bdef9bcdece7990600090a2505050565b61123a61205f565b6000546001600160a01b0390811691161461128a576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b6112b4817f000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d8612063565b50565b6112bf61205f565b6000546001600160a01b0390811691161461130f576040805162461bcd60e51b815260206004820181905260248201526000805160206132d3833981519152604482015290519081900360640190fd5b6001600160a01b0381166113545760405162461bcd60e51b81526004018080602001828103825260268152602001806131ea6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b7f000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d881565b60006002600154141561142d576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155604051631d3af8fb60e21b81526001600160a01b0383358116917f000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d8909116906374ebe3ec90611485908490600401612b7c565b60206040518083038186803b15801561149d57600080fd5b505afa1580156114b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d59190612888565b6114f15760405162461bcd60e51b815260040161038490612fb9565b8260a001354211156115155760405162461bcd60e51b815260040161038490612dbd565b61153161152560208501856127bf565b33308660200135611ce5565b60008061155061154460208701876127bf565b866020013560006102c8565b815191935091506115646080870187613026565b905081146115845760405162461bcd60e51b815260040161038490612f82565b6002546001600160a01b0316635c833bfd6115a260208901896127bf565b8860200135306040518463ffffffff1660e01b81526004016115c693929190612cff565b600060405180830381600087803b1580156115e057600080fd5b505af11580156115f4573d6000803e3d6000fd5b50600092506001600160a01b03915061161590506060890160408a016127bf565b6001600160a01b03161490506000606060005b84811015611a4e5786818151811061163c57fe5b60200260200101516001600160a01b03168a604001602081019061166091906127bf565b6001600160a01b031614156116d65761169586828151811061167e57fe5b60200260200101518a61211e90919063ffffffff16565b98506116d16116aa60e08c0160c08d016127bf565b8783815181106116b657fe5b60200260200101518c6040016020810190610ce991906127bf565b611a46565b83801561172757507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031687828151811061171457fe5b60200260200101516001600160a01b0316145b15611807577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d87838151811061176757fe5b60200260200101516040518263ffffffff1660e01b815260040161178b919061301d565b600060405180830381600087803b1580156117a557600080fd5b505af11580156117b9573d6000803e3d6000fd5b505050506117cc86828151811061167e57fe5b98506116d18682815181106117dd57fe5b60200260200101518b60c00160208101906117f891906127bf565b6001600160a01b031690611ba9565b600061181660808c018c613026565b8381811061182057fe5b9050602002810190611832919061306d565b61183b906130b2565b905060006003600083600001516040516020016118589190612d36565b60408051601f1981840301815291815281516020928301208352908201929092520160002080546001600160a01b031695509050846118a95760405162461bcd60e51b815260040161038490612dea565b60006040518060c001604052808a86815181106118c257fe5b60200260200101518152602001600081526020018460200151815260200188151581526020018e60a0013581526020018e60c001602081019061190591906127bf565b6001600160a01b0316815250905061199a604051806080016040528060428152602001613270604291398360010183604051602401611945929190612c62565b60408051601f19818403018152908290529161196091612b50565b6040519081900390206020820180516001600160e01b03166001600160e01b03199092169190911790526001600160a01b03881690611e99565b94506000858060200190518101906119b29190612a2f565b90508a85815181106119c057fe5b60200260200101516001600160a01b031681600001516001600160a01b0316148015611a1357508d60400160208101906119fa91906127bf565b6001600160a01b031681602001516001600160a01b0316145b611a2f5760405162461bcd60e51b815260040161038490612e21565b6060810151611a3f908e9061211e565b9c50505050505b600101611628565b508860600135881015611a735760405162461bcd60e51b815260040161038490612f41565b611a8360e08a0160c08b016127bf565b6001600160a01b0316337fdc8841de0eade935015873b4eaf3c632cfecc42a7adb48b5de3fcbc44bcc9417611abb60208d018d6127bf565b8c602001358d6040016020810190611ad391906127bf565b8d604051610dff9493929190612bb5565b600080821215611b3b576040805162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f736974697665604482015290519081900360640190fd5b5090565b6000611b5d670de0b6b3a7640000611b578585612178565b906121d1565b9392505050565b6000821580611b71575081155b15611b7e57506000610f0f565b611b5d6001611ba3670de0b6b3a7640000611b5783611b9d8989612178565b90611e57565b9061211e565b80471015611bfe576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114611c49576040519150601f19603f3d011682016040523d82523d6000602084013e611c4e565b606091505b5050905080611c8e5760405162461bcd60e51b815260040180806020018281038252603a815260200180613210603a913960400191505060405180910390fd5b505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611c8e908490612213565b8015611e51576000846001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611d3a57600080fd5b505afa158015611d4e573d6000803e3d6000fd5b505050506040513d6020811015611d6457600080fd5b50519050611d74858585856122c4565b6000856001600160a01b03166370a08231856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611dc357600080fd5b505afa158015611dd7573d6000803e3d6000fd5b505050506040513d6020811015611ded57600080fd5b50519050611dfb828461211e565b8114611e4e576040805162461bcd60e51b815260206004820152601d60248201527f496e76616c696420706f7374207472616e736665722062616c616e6365000000604482015290519081900360640190fd5b50505b50505050565b6000611b5d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061231e565b6060611ea4836123b5565b611ec05760405162461bcd60e51b815260040161038490612efb565b600080846001600160a01b031684604051611edb9190612b50565b600060405180830381855af49150503d8060008114611f16576040519150601f19603f3d011682016040523d82523d6000602084013e611f1b565b606091505b5091509150611f4382826040518060600160405280602781526020016132f3602791396123bb565b95945050505050565b801580611fd2575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015611fa457600080fd5b505afa158015611fb8573d6000803e3d6000fd5b505050506040513d6020811015611fce57600080fd5b5051155b61200d5760405162461bcd60e51b81526004018080602001828103825260368152602001806133446036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611c8e908490612213565b3390565b6040516342f6e38960e01b81526001600160a01b038216906342f6e3899061208f908590600401612b7c565b60206040518083038186803b1580156120a757600080fd5b505afa1580156120bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120df9190612888565b6120fb5760405162461bcd60e51b815260040161038490612d49565b50600280546001600160a01b0319166001600160a01b0392909216919091179055565b600082820183811015611b5d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261218757506000610f0f565b8282028284828161219457fe5b0414611b5d5760405162461bcd60e51b81526004018080602001828103825260218152602001806132b26021913960400191505060405180910390fd5b6000611b5d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123f4565b6000612268826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124599092919063ffffffff16565b805190915015611c8e5780806020019051602081101561228757600080fd5b5051611c8e5760405162461bcd60e51b815260040180806020018281038252602a81526020018061331a602a913960400191505060405180910390fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611e51908590612213565b600081848411156123ad5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237257818101518382015260200161235a565b50505050905090810190601f16801561239f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b3b151590565b606083156123ca575081611b5d565b8251156123da5782518084602001fd5b8160405162461bcd60e51b81526004016103849190612d36565b600081836124435760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561237257818101518382015260200161235a565b50600083858161244f57fe5b0495945050505050565b60606124688484600085612470565b949350505050565b6060824710156124b15760405162461bcd60e51b815260040180806020018281038252602681526020018061324a6026913960400191505060405180910390fd5b6124ba856123b5565b61250b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106125495780518252601f19909201916020918201910161252a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146125ab576040519150601f19603f3d011682016040523d82523d6000602084013e6125b0565b606091505b50915091506125c08282866125cb565b979650505050505050565b606083156125da575081611b5d565b8251156125ea5782518084602001fd5b60405162461bcd60e51b815260206004820181815284516024840152845185939192839260440191908501908083836000831561237257818101518382015260200161235a565b60408051808201909152600081526060602082015290565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261267f57600085556126c5565b82601f106126985782800160ff198235161785556126c5565b828001600101855582156126c5579182015b828111156126c55782358255916020019190600101906126aa565b50611b3b929150612711565b50805460018160011615610100020316600290046000825580601f106126f757506112b4565b601f0160209004906000526020600020908101906112b491905b5b80821115611b3b5760008155600101612712565b600067ffffffffffffffff83111561273a57fe5b61274d601f8401601f1916602001613082565b905082815283838301111561276157600080fd5b828260208301376000602084830101529392505050565b60008083601f840112612789578182fd5b50813567ffffffffffffffff8111156127a0578182fd5b6020830191508360208285010111156127b857600080fd5b9250929050565b6000602082840312156127d0578081fd5b8135611b5d81613183565b600060208083850312156127ed578182fd5b825167ffffffffffffffff80821115612804578384fd5b818501915085601f830112612817578384fd5b81518181111561282357fe5b8381029150612833848301613082565b8181528481019084860184860187018a101561284d578788fd5b8795505b8386101561287b578051945061286685613183565b84835260019590950194918601918601612851565b5098975050505050505050565b600060208284031215612899578081fd5b8151611b5d81613198565b6000806000606084860312156128b8578182fd5b83356128c381613183565b92506020840135915060408401356128da81613198565b809150509250925092565b600080604083850312156128f7578182fd5b823561290281613183565b9150602083013561291281613183565b809150509250929050565b60006020828403121561292e578081fd5b5051919050565b60008060208385031215612947578182fd5b823567ffffffffffffffff81111561295d578283fd5b61296985828601612778565b90969095509350505050565b60008060008060006060868803121561298c578283fd5b853567ffffffffffffffff808211156129a3578485fd5b6129af89838a01612778565b9097509550602088013591506129c482613183565b909350604087013590808211156129d9578283fd5b506129e688828901612778565b969995985093965092949392505050565b600060208284031215612a08578081fd5b813567ffffffffffffffff811115612a1e578182fd5b820160e08185031215611b5d578182fd5b600060808284031215612a40578081fd5b6040516080810181811067ffffffffffffffff82111715612a5d57fe5b6040528251612a6b81613183565b81526020830151612a7b81613183565b6020820152604083810151908201526060928301519281019290925250919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452612adf816020860160208601613157565b601f01601f19169290920160200192915050565b60008151835260208201516020840152604082015160c06040850152612b1c60c0850182612ac7565b6060848101511515908601526080808501519086015260a0938401516001600160a01b031693909401929092525090919050565b60008251612b62818460208701613157565b9190910192915050565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b6001600160a01b0384168152604060208201819052600090611f439083018486612a9d565b6001600160a01b039485168152602081019390935292166040820152606081019190915260800190565b604080825283519082018190526000906020906060840190828701845b82811015612c215781516001600160a01b031684529284019290840190600101612bfc565b50505083810382850152845180825285830191830190845b81811015612c5557835183529284019291840191600101612c39565b5090979650505050505050565b60006040820160408352818554600180821660008114612c895760018114612ca757612ce0565b60028304607f16855260ff1983166060880152608087019350612ce0565b60028304808652612cb78a6130a6565b875b82811015612cd65781548a82016060015290840190602001612cb9565b8901606001955050505b5050508381036020850152612cf58186612af3565b9695505050505050565b6001600160a01b0393841681526020810192909252909116604082015260600190565b600060208252612468602083018486612a9d565b600060208252611b5d6020830184612ac7565b60208082526010908201526f135bd91d5b19481b9bdd081d985b1a5960821b604082015260600190565b6020808252602a908201527f496d706c656d656e746174696f6e20616464726573732063616e206e6f7420626040820152690652074686520307830360b41b606082015260800190565b602080825260139082015272151c985b9cd858dd1a5bdb88195e1c1a5c9959606a1b604082015260600190565b6020808252601c908201527f496d706c656d656e746174696f6e206e6f7420737570706f7274656400000000604082015260600190565b60208082526027908201527f57726f6e6720696e707574206f72206f757470757420746f6b656e20696e20746040820152660686520737761760cc1b606082015260800190565b6020808252602d908201527f496d706c656d656e746174696f6e20776974682074686973206964206973206e60408201526c1bdd081c9959da5cdd195c9959609a1b606082015260800190565b60208082526026908201527f455448206e6f7420726571756972656420666f7220616e20455243323020747260408201526530b739b332b960d11b606082015260800190565b60208082526026908201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6040820152651b9d1c9858dd60d21b606082015260800190565b60208082526021908201527f416d6f756e74207265636569766564206c657373207468616e206d696e696d756040820152606d60f81b606082015260800190565b6020808252601b908201527f57726f6e67206e756d626572206f6620696e7075742073776170730000000000604082015260600190565b6020808252601b908201527f4d75737420626520612076616c696420446f6d616e692066756e640000000000604082015260600190565b602080825282516001600160a01b0316828201528201516040808301526000906124686060840182612ac7565b90815260200190565b6000808335601e1984360301811261303c578283fd5b83018035915067ffffffffffffffff821115613056578283fd5b60209081019250810236038213156127b857600080fd5b60008235603e19833603018112612b62578182fd5b60405181810167ffffffffffffffff8111828210171561309e57fe5b604052919050565b60009081526020902090565b6000604082360312156130c3578081fd5b6040516040810167ffffffffffffffff82821081831117156130e157fe5b8160405284359150808211156130f5578384fd5b9084019036601f830112613107578384fd5b61311636833560208501612726565b8352602085013591508082111561312b578384fd5b50830136601f82011261313c578283fd5b61314b36823560208401612726565b60208301525092915050565b60005b8381101561317257818101518382015260200161315a565b83811115611e515750506000910152565b6001600160a01b03811681146112b457600080fd5b80151581146112b457600080fdfe7377617045786163744f75747075742862797465732c2875696e743235362c75696e743235362c62797465732c626f6f6c2c75696e743235362c6164647265737329294f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c737761704578616374496e7075742862797465732c2875696e743235362c75696e743235362c62797465732c626f6f6c2c75696e743235362c616464726573732929536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220b93bd042664ec855fcf939d180135cd5efe854be498cf75b07cdfbee36563da764736f6c63430007060033

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

000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d8000000000000000000000000ba1030459e75f6041f938c5470f4e0f6468d5253000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000007a3dd714e35f1e19ccc911f11d9564d158f8fd73

-----Decoded View---------------
Arg [0] : _controller (address): 0xE0CF093Ce6649Ef94fe46726745346AFc25214D8
Arg [1] : _basicIssuanceModule (address): 0xBa1030459e75f6041F938c5470F4E0f6468d5253
Arg [2] : _wNative (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [3] : _owner (address): 0x7a3Dd714E35F1e19Ccc911F11D9564D158f8Fd73

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000e0cf093ce6649ef94fe46726745346afc25214d8
Arg [1] : 000000000000000000000000ba1030459e75f6041f938c5470f4e0f6468d5253
Arg [2] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [3] : 0000000000000000000000007a3dd714e35f1e19ccc911f11d9564d158f8fd73


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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