Contract 0x8a070235a4B9b477655Bf4Eb65a1dB81051B3cC1

Contract Overview

Balance:
0 Ether
Txn Hash Method
Block
From
To
Value
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfcIssue247140742021-05-07 14:41:2411 days 5 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0004666293
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84aIssue247139262021-05-07 14:31:3211 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0004669173
0x02183d4b5b9168178332020c1637e8c9a81d272ad872b695b1bed2e335237099Issue247134552021-05-07 13:59:4011 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0004669533
0xb56b5b7305c14bd5e508646418d36dba7549ffbc0e58a5271167d0d9fe9fc440Issue247134312021-05-07 13:58:0411 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0004669173
0xc82f6163231ee418a32f8e21f7f23b1f369e91f8f4bec75b0e99059e8af241beIssue247134052021-05-07 13:56:2011 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0004667733
0x4d9a4fda73fe9c607ca67caf217e2a63e87efd8723a6c5541366c540f5df7954Issue247133902021-05-07 13:55:2011 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0006467373
0xdc755d2035498c1c7fcb4e5055aad8ff91d3f187060b8712c246b9db67b3a179Issue247133412021-05-07 13:52:0011 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.000235413
0xd0168dc93a3b593622e568dd454b904fdd7ff8539fde8738b184d8c171ebb3a8Issue247133342021-05-07 13:51:3211 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.000235413
0xa4878daf7f9acdb0b4b7b6830c25e6048e26f628caf5932060e78dd38287554eIssue247133242021-05-07 13:50:5211 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.000235413
0xa3327f5e00ee40727a817dcd51172c1ac2723feaf8b19086cb685ea868d804d6Issue247133072021-05-07 13:49:3611 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.000235413
0xa3136b4f1b1482a1fe3c6a9b4e5dc6f09ba552c9c25ef9210400eaddb33d9efcIssue247132952021-05-07 13:48:4811 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.000235413
0x623210cb9558c29132d722fc3abc9672fedbeddae01353df2b30b2f96cd3e56fIssue247132432021-05-07 13:45:2011 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.000235413
0xf81f3cdabe135cf8da7ae45972d3d0d10f3f1ece60b7019ce2690049d790cb88Initialize247131382021-05-07 13:38:1611 days 6 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0002581653
0x9c16e0cf3e4b5d90fe8fa9e60a66602ff78e913b13324e873b013b482a365066Issue247125552021-05-07 12:58:1611 days 7 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0002484633
0xd0ff8f8b6d2f43eac23f84278c2f06e0442fea70d461b7d20ef040a5de801c9aInitialize247121002021-05-07 12:27:2011 days 8 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0002581293
0x6e70ca739dff4d222824c1d0db4046597ad7ce8bcbf2ce063a3a8c675caab60dIssue247086702021-05-07 8:35:2811 days 12 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0003116223
0x5b700f4ac44bb5acf0057998af56babe240193505a495efd840a1a5b74ad272fInitialize247085772021-05-07 8:29:1611 days 12 hrs ago0xf4e2bc18464670a684bb8ce2f5663c543db402c3 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0002131653
0xa77711f636d04a1e7230d8b3e1139976a17947a7591bad23311309cfcf69e986Initialize244745462021-04-26 7:09:2422 days 13 hrs ago0xef516493863fe3a4ff18ae07cee2bdbf16deaee6 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.000172112
0x54e6a0a5c6d064eecbcbaf0d4b87fd3c39edcb0fe09b7a603c6a1ef698d80885Issue243599862021-04-20 21:38:3627 days 22 hrs ago0xc3f8e4bc305dcaabd410b220e0734d4dea7c0bc9 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0002138891
0xdba7fe340564d15f6c33be06fbeca6fb6056fc008b1f7f28b2ebde638728e99cInitialize243592782021-04-20 20:50:4427 days 23 hrs ago0xc3f8e4bc305dcaabd410b220e0734d4dea7c0bc9 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0004302755
0xd47422659adaef304d76c51379b0f574d16e03a3c13ff45e9d93de9270b515cfInitialize243553202021-04-20 16:23:0428 days 4 hrs ago0xc3f8e4bc305dcaabd410b220e0734d4dea7c0bc9 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0004302755
0xaa15c5a880f66c2a2e06a37eee2af2646525f6420897a51169d0871868bf523bIssue243178102021-04-18 18:58:2030 days 1 hr ago0x66c638677287d761e77deaec3ad7902c60d08eb7 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0032876130
0x0a1b2e30863d05a85554051641398650532b0dce4ef6b8fb38ddcb6085d400caIssue241483652021-04-03 23:47:4044 days 20 hrs ago0x66c638677287d761e77deaec3ad7902c60d08eb7 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0045106530
0xa79c5b156ddcbf39960bc5b4cd0962b4bfc149df20cce82c99a47cd655ead441Issue241483372021-04-03 23:43:5644 days 20 hrs ago0x9ab45dec9eee6adcebc271e06ddd93903f251564 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0045106530
0x1e8e9de08bba70418be4a7adb1ff9bd50d2023d1595908fafbb58f2c532b52cbIssue241483102021-04-03 23:40:2044 days 20 hrs ago0x66c638677287d761e77deaec3ad7902c60d08eb7 IN  0x8a070235a4b9b477655bf4eb65a1db81051b3cc10 Ether0.0049606530
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x9048278ca7e874f9338e4898c436ab07aa4547010 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0xff7419d8ee4c205645915dbac25866cc940f433e1ad364bc8c8b4cc2b6fe1bfc247140742021-05-07 14:41:2411 days 5 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x9048278ca7e874f9338e4898c436ab07aa4547010 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xd0a1e359811322d97991e03f863a0c30c2cf029c0 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa0 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
0x2bffb200d3f6bd8014f68f270a4348fdeb5d620e4ac8ae4d802abd062f3dd84a247139262021-05-07 14:31:3211 days 6 hrs ago 0x8a070235a4b9b477655bf4eb65a1db81051b3cc1 0xed1fe1994c6c50c19811ea0534e923c91b8c16320 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BasicIssuanceModule

Compiler Version
v0.6.10+commit.00c0fcaf

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Apache-2.0 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-09-08
*/

// Dependency file: @openzeppelin/contracts/utils/Address.sol



// pragma solidity ^0.6.2;

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

    /**
     * @dev 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");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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);
            }
        }
    }
}

// Dependency file: @openzeppelin/contracts/token/ERC20/SafeERC20.sol



// pragma solidity ^0.6.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");
        }
    }
}

// Dependency file: @openzeppelin/contracts/math/SignedSafeMath.sol



// pragma solidity ^0.6.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;
    }
}

// Dependency file: contracts/interfaces/IModule.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.


*/
// pragma solidity 0.6.10;


/**
 * @title IModule
 * @author Set Protocol
 *
 * Interface for interacting with Modules.
 */
interface IModule {
    /**
     * Called by a SetToken to notify that this module was removed from the Set token. Any logic can be included
     * in case checks need to be made or state needs to be cleared.
     */
    function removeModule() external;
}
// Dependency file: contracts/lib/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.


*/

// pragma solidity 0.6.10;

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

// Dependency file: contracts/lib/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.


*/

// pragma solidity 0.6.10;
// pragma experimental ABIEncoderV2;

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


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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

        int256 result = a.div(b);
        if (a ^ b < 0 && a % b != 0) {
            result = result.sub(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);
    }
}
// Dependency file: contracts/protocol/lib/Position.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.


*/

// pragma solidity 0.6.10;
// pragma experimental "ABIEncoderV2";

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

// import { ISetToken } from "../../interfaces/ISetToken.sol";
// import { PreciseUnitMath } from "../../lib/PreciseUnitMath.sol";

/**
 * @title Position
 * @author Set Protocol
 *
 * Collection of helper functions for handling and updating SetToken Positions
 */
library Position {
    using SafeCast for uint256;
    using SafeMath for uint256;
    using SafeCast for int256;
    using SignedSafeMath for int256;
    using PreciseUnitMath for uint256;

    /* ============ Helper ============ */

    /**
     * Returns whether the SetToken has a default position for a given component (if the real unit is > 0)
     */
    function hasDefaultPosition(ISetToken _setToken, address _component) internal view returns(bool) {
        return _setToken.getDefaultPositionRealUnit(_component) > 0;
    }

    /**
     * Returns whether the SetToken has an external position for a given component (if # of position modules is > 0)
     */
    function hasExternalPosition(ISetToken _setToken, address _component) internal view returns(bool) {
        return _setToken.getExternalPositionModules(_component).length > 0;
    }
    
    /**
     * Returns whether the SetToken component default position real unit is greater than or equal to units passed in.
     */
    function hasSufficientDefaultUnits(ISetToken _setToken, address _component, uint256 _unit) internal view returns(bool) {
        return _setToken.getDefaultPositionRealUnit(_component) >= _unit.toInt256();
    }

    /**
     * Returns whether the SetToken component external position is greater than or equal to the real units passed in.
     */
    function hasSufficientExternalUnits(
        ISetToken _setToken,
        address _component,
        address _positionModule,
        uint256 _unit
    )
        internal
        view
        returns(bool)
    {
       return _setToken.getExternalPositionRealUnit(_component, _positionModule) >= _unit.toInt256();    
    }

    /**
     * If the position does not exist, create a new Position and add to the SetToken. If it already exists,
     * then set the position units. If the new units is 0, remove the position. Handles adding/removing of 
     * components where needed (in light of potential external positions).
     *
     * @param _setToken           Address of SetToken being modified
     * @param _component          Address of the component
     * @param _newUnit            Quantity of Position units - must be >= 0
     */
    function editDefaultPosition(ISetToken _setToken, address _component, uint256 _newUnit) internal {
        bool isPositionFound = hasDefaultPosition(_setToken, _component);
        if (!isPositionFound && _newUnit > 0) {
            // If there is no Default Position and no External Modules, then component does not exist
            if (!hasExternalPosition(_setToken, _component)) {
                _setToken.addComponent(_component);
            }
        } else if (isPositionFound && _newUnit == 0) {
            // If there is a Default Position and no external positions, remove the component
            if (!hasExternalPosition(_setToken, _component)) {
                _setToken.removeComponent(_component);
            }
        }

        _setToken.editDefaultPositionUnit(_component, _newUnit.toInt256());
    }

    /**
     * Update an external position and remove and external positions or components if necessary. The logic flows as follows:
     * 1) If component is not already added then add component and external position. 
     * 2) If component is added but no existing external position using the passed module exists then add the external position.
     * 3) If the existing position is being added to then just update the unit
     * 4) If the position is being closed and no other external positions or default positions are associated with the component
     *    then untrack the component and remove external position.
     * 5) If the position is being closed and  other existing positions still exist for the component then just remove the
     *    external position.
     *
     * @param _setToken         SetToken being updated
     * @param _component        Component position being updated
     * @param _module           Module external position is associated with
     * @param _newUnit          Position units of new external position
     * @param _data             Arbitrary data associated with the position
     */
    function editExternalPosition(
        ISetToken _setToken,
        address _component,
        address _module,
        int256 _newUnit,
        bytes memory _data
    )
        internal
    {
        if (!_setToken.isComponent(_component)) {
            _setToken.addComponent(_component);
            addExternalPosition(_setToken, _component, _module, _newUnit, _data);
        } else if (!_setToken.isExternalPositionModule(_component, _module)) {
            addExternalPosition(_setToken, _component, _module, _newUnit, _data);
        } else if (_newUnit != 0) {
            _setToken.editExternalPositionUnit(_component, _module, _newUnit);
        } else {
            // If no default or external position remaining then remove component from components array
            if (_setToken.getDefaultPositionRealUnit(_component) == 0 && _setToken.getExternalPositionModules(_component).length == 1) {
                _setToken.removeComponent(_component);
            }
            _setToken.removeExternalPositionModule(_component, _module);
        }
    }

    /**
     * Add a new external position from a previously untracked module.
     *
     * @param _setToken         SetToken being updated
     * @param _component        Component position being updated
     * @param _module           Module external position is associated with
     * @param _newUnit          Position units of new external position
     * @param _data             Arbitrary data associated with the position
     */
    function addExternalPosition(
        ISetToken _setToken,
        address _component,
        address _module,
        int256 _newUnit,
        bytes memory _data
    )
        internal
    {
        _setToken.addExternalPositionModule(_component, _module);
        _setToken.editExternalPositionUnit(_component, _module, _newUnit);
        _setToken.editExternalPositionData(_component, _module, _data);
    }

    /**
     * Get total notional amount of Default position
     *
     * @param _setTokenSupply     Supply of SetToken in precise units (10^18)
     * @param _positionUnit       Quantity of Position units
     *
     * @return                    Total notional amount of units
     */
    function getDefaultTotalNotional(uint256 _setTokenSupply, uint256 _positionUnit) internal pure returns (uint256) {
        return _setTokenSupply.preciseMul(_positionUnit);
    }

    /**
     * Get position unit from total notional amount
     *
     * @param _setTokenSupply     Supply of SetToken in precise units (10^18)
     * @param _totalNotional      Total notional amount of component prior to
     * @return                    Default position unit
     */
    function getDefaultPositionUnit(uint256 _setTokenSupply, uint256 _totalNotional) internal pure returns (uint256) {
        return _totalNotional.preciseDiv(_setTokenSupply);
    }

    /**
     * Calculate the new position unit given total notional values pre and post executing an action that changes SetToken state
     * The intention is to make updates to the units without accidentally picking up airdropped assets as well.
     *
     * @param _setTokenSupply     Supply of SetToken in precise units (10^18)
     * @param _preTotalNotional   Total notional amount of component prior to executing action
     * @param _postTotalNotional  Total notional amount of component after the executing action
     * @param _prePositionUnit    Position unit of SetToken prior to executing action
     * @return                    New position unit
     */
    function calculateDefaultEditPositionUnit(
        uint256 _setTokenSupply,
        uint256 _preTotalNotional,
        uint256 _postTotalNotional,
        uint256 _prePositionUnit
    )
        internal
        pure
        returns (uint256)
    {
        // If pre action total notional amount is greater then subtract post action total notional and calculate new position units
        if (_preTotalNotional >= _postTotalNotional) {
            uint256 unitsToSub = _preTotalNotional.sub(_postTotalNotional).preciseDivCeil(_setTokenSupply);
            return _prePositionUnit.sub(unitsToSub);
        } else {
            // Else subtract post action total notional from pre action total notional and calculate new position units
            uint256 unitsToAdd = _postTotalNotional.sub(_preTotalNotional).preciseDiv(_setTokenSupply);
            return _prePositionUnit.add(unitsToAdd);
        }
    }
}

// Dependency file: contracts/protocol/lib/ModuleBase.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.


*/

// pragma solidity 0.6.10;

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

// import { ExplicitERC20 } from "../../lib/ExplicitERC20.sol";
// import { IController } from "../../interfaces/IController.sol";
// import { IModule } from "../../interfaces/IModule.sol";
// import { ISetToken } from "../../interfaces/ISetToken.sol";

/**
 * @title ModuleBase
 * @author Set Protocol
 *
 * Abstract class that houses common Module-related state and functions.
 */
abstract contract ModuleBase is IModule {

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

    // Address of the controller
    IController public controller;

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

    modifier onlySetManager(ISetToken _setToken, address _caller) {
        require(isSetManager(_setToken, _caller), "Must be the SetToken manager");
        _;
    }

    modifier onlyValidAndInitializedSet(ISetToken _setToken) {
        require(isSetValidAndInitialized(_setToken), "Must be a valid and initialized SetToken");
        _;
    }

    /**
     * Throws if the sender is not a SetToken's module or module not enabled
     */
    modifier onlyModule(ISetToken _setToken) {
        require(
            _setToken.moduleStates(msg.sender) == ISetToken.ModuleState.INITIALIZED,
            "Only the module can call"
        );

        require(
            controller.isModule(msg.sender),
            "Module must be enabled on controller"
        );
        _;
    }

    /**
     * Utilized during module initializations to check that the module is in pending state
     * and that the SetToken is valid
     */
    modifier onlyValidAndPendingSet(ISetToken _setToken) {
        require(controller.isSet(address(_setToken)), "Must be controller-enabled SetToken");
        require(isSetPendingInitialization(_setToken), "Must be pending initialization");        
        _;
    }

    /* ============ Constructor ============ */

    /**
     * Set state variables and map asset pairs to their oracles
     *
     * @param _controller             Address of controller contract
     */
    constructor(IController _controller) public {
        controller = _controller;
    }

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

    /**
     * Transfers tokens from an address (that has set allowance on the module).
     *
     * @param  _token          The address of the ERC20 token
     * @param  _from           The address to transfer from
     * @param  _to             The address to transfer to
     * @param  _quantity       The number of tokens to transfer
     */
    function transferFrom(IERC20 _token, address _from, address _to, uint256 _quantity) internal {
        ExplicitERC20.transferFrom(_token, _from, _to, _quantity);
    }

    /**
     * Returns true if the module is in process of initialization on the SetToken
     */
    function isSetPendingInitialization(ISetToken _setToken) internal view returns(bool) {
        return _setToken.isPendingModule(address(this));
    }

    /**
     * Returns true if the address is the SetToken's manager
     */
    function isSetManager(ISetToken _setToken, address _toCheck) internal view returns(bool) {
        return _setToken.manager() == _toCheck;
    }

    /**
     * Returns true if SetToken must be enabled on the controller 
     * and module is registered on the SetToken
     */
    function isSetValidAndInitialized(ISetToken _setToken) internal view returns(bool) {
        return controller.isSet(address(_setToken)) &&
            _setToken.isInitializedModule(address(this));
    }
}
// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol



// pragma solidity ^0.6.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);
}

// Dependency file: contracts/interfaces/ISetToken.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.


*/
// pragma solidity 0.6.10;
// pragma experimental "ABIEncoderV2";

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

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

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

    enum ModuleState {
        NONE,
        PENDING,
        INITIALIZED
    }

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

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

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


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

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

    function editPositionMultiplier(int256 _newMultiplier) external;

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

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

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

    function setManager(address _manager) external;

    function manager() external view returns (address);
    function moduleStates(address _module) external view returns (ModuleState);
    function getModules() external view returns (address[] memory);
    
    function getDefaultPositionRealUnit(address _component) external view returns(int256);
    function getExternalPositionRealUnit(address _component, address _positionModule) external view returns(int256);
    function getComponents() external view returns(address[] memory);
    function getExternalPositionModules(address _component) external view returns(address[] memory);
    function getExternalPositionData(address _component, address _positionModule) external view returns(bytes memory);
    function isExternalPositionModule(address _component, address _module) external view returns(bool);
    function isComponent(address _component) external view returns(bool);
    
    function positionMultiplier() external view returns (int256);
    function getPositions() external view returns (Position[] memory);
    function getTotalComponentRealUnits(address _component) external view returns(int256);

    function isInitializedModule(address _module) external view returns(bool);
    function isPendingModule(address _module) external view returns(bool);
    function isLocked() external view returns (bool);
}
// Dependency file: contracts/protocol/lib/Invoke.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.


*/

// pragma solidity 0.6.10;

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

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


/**
 * @title Invoke
 * @author Set Protocol
 *
 * A collection of common utility functions for interacting with the SetToken's invoke function
 */
library Invoke {
    using SafeMath for uint256;

    /* ============ Internal ============ */

    /**
     * Instructs the SetToken to set approvals of the ERC20 token to a spender.
     *
     * @param _setToken        SetToken instance to invoke
     * @param _token           ERC20 token to approve
     * @param _spender         The account allowed to spend the SetToken's balance
     * @param _quantity        The quantity of allowance to allow
     */
    function invokeApprove(
        ISetToken _setToken,
        address _token,
        address _spender,
        uint256 _quantity
    )
        internal
    {
        bytes memory callData = abi.encodeWithSignature("approve(address,uint256)", _spender, _quantity);
        _setToken.invoke(_token, 0, callData);
    }

    /**
     * Instructs the SetToken to transfer the ERC20 token to a recipient.
     *
     * @param _setToken        SetToken instance to invoke
     * @param _token           ERC20 token to transfer
     * @param _to              The recipient account
     * @param _quantity        The quantity to transfer
     */
    function invokeTransfer(
        ISetToken _setToken,
        address _token,
        address _to,
        uint256 _quantity
    )
        internal
    {
        if (_quantity > 0) {
            bytes memory callData = abi.encodeWithSignature("transfer(address,uint256)", _to, _quantity);
            _setToken.invoke(_token, 0, callData);
        }
    }

    /**
     * Instructs the SetToken to transfer the ERC20 token to a recipient.
     * The new SetToken balance must equal the existing balance less the quantity transferred
     *
     * @param _setToken        SetToken instance to invoke
     * @param _token           ERC20 token to transfer
     * @param _to              The recipient account
     * @param _quantity        The quantity to transfer
     */
    function strictInvokeTransfer(
        ISetToken _setToken,
        address _token,
        address _to,
        uint256 _quantity
    )
        internal
    {
        if (_quantity > 0) {
            // Retrieve current balance of token for the SetToken
            uint256 existingBalance = IERC20(_token).balanceOf(address(_setToken));

            Invoke.invokeTransfer(_setToken, _token, _to, _quantity);

            // Get new balance of transferred token for SetToken
            uint256 newBalance = IERC20(_token).balanceOf(address(_setToken));

            // Verify only the transfer quantity is subtracted
            require(
                newBalance == existingBalance.sub(_quantity),
                "Invalid post transfer balance"
            );
        }
    }

    /**
     * Instructs the SetToken to unwrap the passed quantity of WETH
     *
     * @param _setToken        SetToken instance to invoke
     * @param _weth            WETH address
     * @param _quantity        The quantity to unwrap
     */
    function invokeUnwrapWETH(ISetToken _setToken, address _weth, uint256 _quantity) internal {
        bytes memory callData = abi.encodeWithSignature("withdraw(uint256)", _quantity);
        _setToken.invoke(_weth, 0, callData);
    }

    /**
     * Instructs the SetToken to wrap the passed quantity of ETH
     *
     * @param _setToken        SetToken instance to invoke
     * @param _weth            WETH address
     * @param _quantity        The quantity to unwrap
     */
    function invokeWrapWETH(ISetToken _setToken, address _weth, uint256 _quantity) internal {
        bytes memory callData = abi.encodeWithSignature("deposit()");
        _setToken.invoke(_weth, _quantity, callData);
    }
}
// Dependency file: contracts/interfaces/IManagerIssuanceHook.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.


*/
// pragma solidity 0.6.10;

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

interface IManagerIssuanceHook {
    function invokePreIssueHook(ISetToken _setToken, uint256 _issueQuantity, address _sender, address _to) external;
}
// Dependency file: contracts/interfaces/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.


*/
// pragma solidity 0.6.10;

interface IController {
    function addSet(address _setToken) external;
    function getModuleFee(address _module, uint256 _feeType) external view returns(uint256);
    function resourceId(uint256 _id) external view returns(address);
    function feeRecipient() external view returns(address);
    function isModule(address _module) external view returns(bool);
    function isSet(address _setToken) external view returns(bool);
    function isSystemContract(address _contractAddress) external view returns (bool);
}
// Dependency file: @openzeppelin/contracts/math/SafeMath.sol



// pragma solidity ^0.6.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;
    }
}

// Dependency file: @openzeppelin/contracts/utils/SafeCast.sol



// pragma solidity ^0.6.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);
    }
}

// Dependency file: @openzeppelin/contracts/utils/ReentrancyGuard.sol



// pragma solidity ^0.6.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].
 */
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;
    }
}


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

*/

pragma solidity 0.6.10;
pragma experimental "ABIEncoderV2";

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

// import { IController } from "../../interfaces/IController.sol";
// import { IManagerIssuanceHook } from "../../interfaces/IManagerIssuanceHook.sol";
// import { Invoke } from "../lib/Invoke.sol";
// import { ISetToken } from "../../interfaces/ISetToken.sol";
// import { ModuleBase } from "../lib/ModuleBase.sol";
// import { Position } from "../lib/Position.sol";
// import { PreciseUnitMath } from "../../lib/PreciseUnitMath.sol";

/**
 * @title BasicIssuanceModule
 * @author Set Protocol
 *
 * Module that enables issuance and redemption functionality on a SetToken. This is a module that is
 * required to bring the totalSupply of a Set above 0.
 */
contract BasicIssuanceModule is ModuleBase, ReentrancyGuard {
    using Invoke for ISetToken;
    using Position for ISetToken.Position;
    using Position for ISetToken;
    using PreciseUnitMath for uint256;
    using SafeMath for uint256;
    using SafeCast for int256;

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

    event SetTokenIssued(
        address indexed _setToken,
        address indexed _issuer,
        address indexed _to,
        address _hookContract,
        uint256 _quantity
    );
    event SetTokenRedeemed(
        address indexed _setToken,
        address indexed _redeemer,
        address indexed _to,
        uint256 _quantity
    );

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

    // Mapping of SetToken to Issuance hook configurations
    mapping(ISetToken => IManagerIssuanceHook) public managerIssuanceHook;

    /* ============ Constructor ============ */

    /**
     * Set state controller state variable
     *
     * @param _controller             Address of controller contract
     */
    constructor(IController _controller) public ModuleBase(_controller) {}

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

    /**
     * Deposits the SetToken's position components into the SetToken and mints the SetToken of the given quantity
     * to the specified _to address. This function only handles Default Positions (positionState = 0).
     *
     * @param _setToken             Instance of the SetToken contract
     * @param _quantity             Quantity of the SetToken to mint
     * @param _to                   Address to mint SetToken to
     */
    function issue(
        ISetToken _setToken,
        uint256 _quantity,
        address _to
    ) 
        external
        nonReentrant
        onlyValidAndInitializedSet(_setToken)
    {
        require(_quantity > 0, "Issue quantity must be > 0");

        address hookContract = _callPreIssueHooks(_setToken, _quantity, msg.sender, _to);

        (
            address[] memory components,
            uint256[] memory componentQuantities
        ) = getRequiredComponentUnitsForIssue(_setToken, _quantity);

        // For each position, transfer the required underlying to the SetToken
        for (uint256 i = 0; i < components.length; i++) {
            // Transfer the component to the SetToken
            transferFrom(
                IERC20(components[i]),
                msg.sender,
                address(_setToken),
                componentQuantities[i]
            );
        }

        // Mint the SetToken
        _setToken.mint(_to, _quantity);

        emit SetTokenIssued(address(_setToken), msg.sender, _to, hookContract, _quantity);
    }

    /**
     * Redeems the SetToken's positions and sends the components of the given
     * quantity to the caller. This function only handles Default Positions (positionState = 0).
     *
     * @param _setToken             Instance of the SetToken contract
     * @param _quantity             Quantity of the SetToken to redeem
     * @param _to                   Address to send component assets to
     */
    function redeem(
        ISetToken _setToken,
        uint256 _quantity,
        address _to
    )
        external
        nonReentrant
        onlyValidAndInitializedSet(_setToken)
    {
        require(_quantity > 0, "Redeem quantity must be > 0");

        // Burn the SetToken - ERC20's internal burn already checks that the user has enough balance
        _setToken.burn(msg.sender, _quantity);

        // For each position, invoke the SetToken to transfer the tokens to the user
        address[] memory components = _setToken.getComponents();
        for (uint256 i = 0; i < components.length; i++) {
            address component = components[i];
            require(!_setToken.hasExternalPosition(component), "Only default positions are supported");

            uint256 unit = _setToken.getDefaultPositionRealUnit(component).toUint256();

            // Use preciseMul to round down to ensure overcollateration when small redeem quantities are provided
            uint256 componentQuantity = _quantity.preciseMul(unit);

            // Instruct the SetToken to transfer the component to the user
            _setToken.strictInvokeTransfer(
                component,
                _to,
                componentQuantity
            );
        }

        emit SetTokenRedeemed(address(_setToken), msg.sender, _to, _quantity);
    }

    /**
     * Initializes this module to the SetToken with issuance-related hooks. Only callable by the SetToken's manager.
     * Hook addresses are optional. Address(0) means that no hook will be called
     *
     * @param _setToken             Instance of the SetToken to issue
     * @param _preIssueHook         Instance of the Manager Contract with the Pre-Issuance Hook function
     */
    function initialize(
        ISetToken _setToken,
        IManagerIssuanceHook _preIssueHook
    )
        external
        onlySetManager(_setToken, msg.sender)
        onlyValidAndPendingSet(_setToken)
    {
        managerIssuanceHook[_setToken] = _preIssueHook;

        _setToken.initializeModule();
    }

    /**
     * Reverts as this module should not be removable after added. Users should always
     * have a way to redeem their Sets
     */
    function removeModule() external override {
        revert("The BasicIssuanceModule module cannot be removed");
    }

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

    /**
     * Retrieves the addresses and units required to mint a particular quantity of SetToken.
     *
     * @param _setToken             Instance of the SetToken to issue
     * @param _quantity             Quantity of SetToken to issue
     * @return address[]            List of component addresses
     * @return uint256[]            List of component units required to issue the quantity of SetTokens
     */
    function getRequiredComponentUnitsForIssue(
        ISetToken _setToken,
        uint256 _quantity
    )
        public
        view
        onlyValidAndInitializedSet(_setToken)
        returns (address[] memory, uint256[] memory)
    {
        address[] memory components = _setToken.getComponents();

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

        for (uint256 i = 0; i < components.length; i++) {
            require(!_setToken.hasExternalPosition(components[i]), "Only default positions are supported");

            notionalUnits[i] = _setToken.getDefaultPositionRealUnit(components[i]).toUint256().preciseMulCeil(_quantity);
        }

        return (components, notionalUnits);
    }

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

    /**
     * If a pre-issue hook has been configured, call the external-protocol contract. Pre-issue hook logic
     * can contain arbitrary logic including validations, external function calls, etc.
     */
    function _callPreIssueHooks(
        ISetToken _setToken,
        uint256 _quantity,
        address _caller,
        address _to
    )
        internal
        returns(address)
    {
        IManagerIssuanceHook preIssueHook = managerIssuanceHook[_setToken];
        if (address(preIssueHook) != address(0)) {
            preIssueHook.invokePreIssueHook(_setToken, _quantity, _caller, _to);
            return address(preIssueHook);
        }

        return address(0);
    }
}

Contract ABI

[{"inputs":[{"internalType":"contract IController","name":"_controller","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_setToken","type":"address"},{"indexed":true,"internalType":"address","name":"_issuer","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"address","name":"_hookContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"SetTokenIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_setToken","type":"address"},{"indexed":true,"internalType":"address","name":"_redeemer","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"SetTokenRedeemed","type":"event"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"getRequiredComponentUnitsForIssue","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"contract IManagerIssuanceHook","name":"_preIssueHook","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"issue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"","type":"address"}],"name":"managerIssuanceHook","outputs":[{"internalType":"contract IManagerIssuanceHook","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"address","name":"_to","type":"address"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"removeModule","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50604051611bda380380611bda83398101604081905261002f91610058565b600080546001600160a01b0319166001600160a01b039290921691909117905560018055610086565b600060208284031215610069578081fd5b81516001600160a01b038116811461007f578182fd5b9392505050565b611b45806100956000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637a4ffd031161005b5780637a4ffd03146100bd578063847ef08d146100e7578063dfe75335146100ef578063f77c47911461010f5761007d565b8063485cc955146100825780635c833bfd146100975780636d78f47a146100aa575b600080fd5b61009561009036600461149e565b610117565b005b6100956100a5366004611501565b61028a565b6100956100b8366004611501565b610551565b6100d06100cb3660046114d6565b6106ec565b6040516100de929190611638565b60405180910390f35b6100956108ab565b6101026100fd366004611482565b6108c3565b6040516100de91906115b7565b6101026108de565b813361012382826108ed565b6101485760405162461bcd60e51b815260040161013f906119e3565b60405180910390fd5b600054604051631d3af8fb60e21b815285916001600160a01b0316906374ebe3ec906101789084906004016115b7565b60206040518083038186803b15801561019057600080fd5b505afa1580156101a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c891906113d6565b6101e45760405162461bcd60e51b815260040161013f906119a0565b6101ed8161097d565b6102095760405162461bcd60e51b815260040161013f9061184e565b6001600160a01b0385811660008181526002602052604080822080546001600160a01b0319169489169490941790935582516307ff078f60e11b815292519192630ffe0f1e926004808301939282900301818387803b15801561026b57600080fd5b505af115801561027f573d6000803e3d6000fd5b505050505050505050565b600260015414156102ad5760405162461bcd60e51b815260040161013f90611a64565b6002600155826102bc816109fc565b6102d85760405162461bcd60e51b815260040161013f90611704565b600083116102f85760405162461bcd60e51b815260040161013f9061174c565b604051632770a7eb60e21b81526001600160a01b03851690639dc29fac9061032690339087906004016115cb565b600060405180830381600087803b15801561034057600080fd5b505af1158015610354573d6000803e3d6000fd5b505050506060846001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561039357600080fd5b505afa1580156103a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103cf919081019061132b565b905060005b81518110156104f05760008282815181106103eb57fe5b6020026020010151905061041181886001600160a01b0316610ab090919063ffffffff16565b1561042e5760405162461bcd60e51b815260040161013f9061180a565b60006104b4886001600160a01b03166366cb8d2f846040518263ffffffff1660e01b815260040161045f91906115b7565b60206040518083038186803b15801561047757600080fd5b505afa15801561048b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104af9190611542565b610b3c565b905060006104c8888363ffffffff610b6216565b90506104e56001600160a01b038a1684898463ffffffff610b9316565b5050506001016103d4565b50826001600160a01b0316336001600160a01b0316866001600160a01b03167f05f8aaada00823525432114f0e904c6f7c0198a5b8f113ee635ff81aaf9566ad8760405161053e9190611a9b565b60405180910390a4505060018055505050565b600260015414156105745760405162461bcd60e51b815260040161013f90611a64565b600260015582610583816109fc565b61059f5760405162461bcd60e51b815260040161013f90611704565b600083116105bf5760405162461bcd60e51b815260040161013f90611885565b60006105cd85853386610cde565b90506060806105dc87876106ec565b909250905060005b82518110156106275761061f8382815181106105fc57fe5b6020026020010151338a85858151811061061257fe5b6020026020010151610d7c565b6001016105e4565b506040516340c10f1960e01b81526001600160a01b038816906340c10f19906106569088908a906004016115cb565b600060405180830381600087803b15801561067057600080fd5b505af1158015610684573d6000803e3d6000fd5b50505050846001600160a01b0316336001600160a01b0316886001600160a01b03167fc07f1e2fe31c4d90eae81f76d263d7995aac043a99d6ee6de9c0506047f541c2868a6040516106d79291906115cb565b60405180910390a45050600180555050505050565b606080836106f9816109fc565b6107155760405162461bcd60e51b815260040161013f90611704565b6060856001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561075057600080fd5b505afa158015610764573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261078c919081019061132b565b90506060815167ffffffffffffffff811180156107a857600080fd5b506040519080825280602002602001820160405280156107d2578160200160208202803683370190505b50905060005b825181101561089e576108108382815181106107f057fe5b6020026020010151896001600160a01b0316610ab090919063ffffffff16565b1561082d5760405162461bcd60e51b815260040161013f9061180a565b61087f876108738a6001600160a01b03166366cb8d2f87868151811061084f57fe5b60200260200101516040518263ffffffff1660e01b815260040161045f91906115b7565b9063ffffffff610d8816565b82828151811061088b57fe5b60209081029190910101526001016107d8565b5090969095509350505050565b60405162461bcd60e51b815260040161013f906117ba565b6002602052600090815260409020546001600160a01b031681565b6000546001600160a01b031681565b6000816001600160a01b0316836001600160a01b031663481c6a756040518163ffffffff1660e01b815260040160206040518083038186803b15801561093257600080fd5b505afa158015610946573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096a919061130f565b6001600160a01b03161490505b92915050565b6040516353bae5f760e01b81526000906001600160a01b038316906353bae5f7906109ac9030906004016115b7565b60206040518083038186803b1580156109c457600080fd5b505afa1580156109d8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097791906113d6565b60008054604051631d3af8fb60e21b81526001600160a01b03909116906374ebe3ec90610a2d9085906004016115b7565b60206040518083038186803b158015610a4557600080fd5b505afa158015610a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7d91906113d6565b801561097757506040516335fc6c9f60e21b81526001600160a01b0383169063d7f1b27c906109ac9030906004016115b7565b600080836001600160a01b031663a7bdad03846040518263ffffffff1660e01b8152600401610adf91906115b7565b60006040518083038186803b158015610af757600080fd5b505afa158015610b0b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b33919081019061132b565b51119392505050565b600080821215610b5e5760405162461bcd60e51b815260040161013f906118bc565b5090565b6000610b8c670de0b6b3a7640000610b80858563ffffffff610ddf16565b9063ffffffff610e1916565b9392505050565b8015610cd8576040516370a0823160e01b81526000906001600160a01b038516906370a0823190610bc89088906004016115b7565b60206040518083038186803b158015610be057600080fd5b505afa158015610bf4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c189190611542565b9050610c2685858585610e5b565b6040516370a0823160e01b81526000906001600160a01b038616906370a0823190610c559089906004016115b7565b60206040518083038186803b158015610c6d57600080fd5b505afa158015610c81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca59190611542565b9050610cb7828463ffffffff610f2816565b8114610cd55760405162461bcd60e51b815260040161013f90611932565b50505b50505050565b6001600160a01b038085166000908152600260205260408120549091168015610d6e5760405163a045808360e01b81526001600160a01b0382169063a045808390610d339089908990899089906004016116c6565b600060405180830381600087803b158015610d4d57600080fd5b505af1158015610d61573d6000803e3d6000fd5b5050505080915050610d74565b60009150505b949350505050565b610cd884848484610f6a565b6000821580610d95575081155b15610da257506000610977565b610b8c6001610dd3670de0b6b3a7640000610b8083610dc7898963ffffffff610ddf16565b9063ffffffff610f2816565b9063ffffffff61108e16565b600082610dee57506000610977565b82820282848281610dfb57fe5b0414610b8c5760405162461bcd60e51b815260040161013f906118f1565b6000610b8c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110b3565b8015610cd85760608282604051602401610e769291906115cb565b60408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b179052516347b7819960e11b81529091506001600160a01b03861690638f6f033290610ed29087906000908690600401611608565b600060405180830381600087803b158015610eec57600080fd5b505af1158015610f00573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cd591908101906113f6565b6000610b8c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506110ea565b8015610cd8576040516370a0823160e01b81526000906001600160a01b038616906370a0823190610f9f9086906004016115b7565b60206040518083038186803b158015610fb757600080fd5b505afa158015610fcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fef9190611542565b9050610ffd85858585611116565b6040516370a0823160e01b81526000906001600160a01b038716906370a082319061102c9087906004016115b7565b60206040518083038186803b15801561104457600080fd5b505afa158015611058573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107c9190611542565b9050610cb7828463ffffffff61108e16565b600082820183811015610b8c5760405162461bcd60e51b815260040161013f90611783565b600081836110d45760405162461bcd60e51b815260040161013f91906116f1565b5060008385816110e057fe5b0495945050505050565b6000818484111561110e5760405162461bcd60e51b815260040161013f91906116f1565b505050900390565b610cd8846323b872dd60e01b858585604051602401611137939291906115e4565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260606111be826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111fd9092919063ffffffff16565b8051909150156111f857808060200190518101906111dc91906113d6565b6111f85760405162461bcd60e51b815260040161013f90611a1a565b505050565b6060610d7484846000856060611212856112cb565b61122e5760405162461bcd60e51b815260040161013f90611969565b60006060866001600160a01b0316858760405161124b919061159b565b60006040518083038185875af1925050503d8060008114611288576040519150601f19603f3d011682016040523d82523d6000602084013e61128d565b606091505b509150915081156112a1579150610d749050565b8051156112b15780518082602001fd5b8360405162461bcd60e51b815260040161013f91906116f1565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610d74575050151592915050565b805161097781611af7565b600060208284031215611320578081fd5b8151610b8c81611af7565b6000602080838503121561133d578182fd5b825167ffffffffffffffff80821115611354578384fd5b81850186601f820112611365578485fd5b8051925081831115611375578485fd5b8383029150611385848301611aa4565b8381528481019082860184840187018a101561139f578788fd5b8794505b858510156113c9576113b58a82611304565b8352600194909401939186019186016113a3565b5098975050505050505050565b6000602082840312156113e7578081fd5b81518015158114610b8c578182fd5b600060208284031215611407578081fd5b815167ffffffffffffffff8082111561141e578283fd5b81840185601f82011261142f578384fd5b805192508183111561143f578384fd5b611452601f8401601f1916602001611aa4565b9150828252856020848301011115611468578384fd5b611479836020840160208401611acb565b50949350505050565b600060208284031215611493578081fd5b8135610b8c81611af7565b600080604083850312156114b0578081fd5b82356114bb81611af7565b915060208301356114cb81611af7565b809150509250929050565b600080604083850312156114e8578182fd5b82356114f381611af7565b946020939093013593505050565b600080600060608486031215611515578081fd5b833561152081611af7565b925060208401359150604084013561153781611af7565b809150509250925092565b600060208284031215611553578081fd5b5051919050565b815260200190565b6001600160a01b03169052565b60008151808452611587816020860160208601611acb565b601f01601f19169290920160200192915050565b600082516115ad818460208701611acb565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060018060a01b03851682528360208301526060604083015261162f606083018461156f565b95945050505050565b604080825283519082018190526000906020906060840190828701845b8281101561167857611668848351611562565b9284019290840190600101611655565b5050508381038285015280855161168f8184611a9b565b91508387019250845b818110156116b9576116ab83855161155a565b938501939250600101611698565b5090979650505050505050565b6001600160a01b03948516815260208101939093529083166040830152909116606082015260800190565b600060208252610b8c602083018461156f565b60208082526028908201527f4d75737420626520612076616c696420616e6420696e697469616c697a65642060408201526729b2ba2a37b5b2b760c11b606082015260800190565b6020808252601b908201527f52656465656d207175616e74697479206d757374206265203e20300000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526030908201527f54686520426173696349737375616e63654d6f64756c65206d6f64756c65206360408201526f185b9b9bdd081899481c995b5bdd995960821b606082015260800190565b60208082526024908201527f4f6e6c792064656661756c7420706f736974696f6e732061726520737570706f6040820152631c9d195960e21b606082015260800190565b6020808252601e908201527f4d7573742062652070656e64696e6720696e697469616c697a6174696f6e0000604082015260600190565b6020808252601a908201527f4973737565207175616e74697479206d757374206265203e2030000000000000604082015260600190565b6020808252818101527f53616665436173743a2076616c7565206d75737420626520706f736974697665604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601d908201527f496e76616c696420706f7374207472616e736665722062616c616e6365000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526023908201527f4d75737420626520636f6e74726f6c6c65722d656e61626c656420536574546f60408201526235b2b760e91b606082015260800190565b6020808252601c908201527f4d7573742062652074686520536574546f6b656e206d616e6167657200000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715611ac357600080fd5b604052919050565b60005b83811015611ae6578181015183820152602001611ace565b83811115610cd85750506000910152565b6001600160a01b0381168114611b0c57600080fd5b5056fea26469706673582212205afb30bbc76cd694b9469cdace9272085847eeeee2e2ca3ef8c11c06490e3d8664736f6c634300060a00330000000000000000000000009048278ca7e874f9338e4898c436ab07aa454701

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

0000000000000000000000009048278ca7e874f9338e4898c436ab07aa454701

-----Decoded View---------------
Arg [0] : _controller (address): 0x9048278ca7e874f9338e4898c436ab07aa454701

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009048278ca7e874f9338e4898c436ab07aa454701


Deployed ByteCode Sourcemap

68593:7599:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;73572:321;;;;;;;;;:::i;:::-;;71782:1379;;;;;;;;;:::i;70258:1097::-;;;;;;;;;:::i;74667:749::-;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;74047:119;;;:::i;69402:69::-;;;;;;;;;:::i;:::-;;;;;;;;33391:29;;;:::i;73572:321::-;73716:9;73727:10;33559:32;33572:9;33583:7;33559:12;:32::i;:::-;33551:73;;;;-1:-1:-1;;;33551:73:0;;;;;;;;;;;;;;;;;34508:10:::1;::::0;:36:::1;::::0;-1:-1:-1;;;34508:36:0;;73771:9;;-1:-1:-1;;;;;34508:10:0::1;::::0;:16:::1;::::0;:36:::1;::::0;73771:9;;34508:36:::1;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;34500:84;;;;-1:-1:-1::0;;;34500:84:0::1;;;;;;;;;34603:37;34630:9;34603:26;:37::i;:::-;34595:80;;;;-1:-1:-1::0;;;34595:80:0::1;;;;;;;;;-1:-1:-1::0;;;;;73798:30:0;;::::2;;::::0;;;:19:::2;:30;::::0;;;;;:46;;-1:-1:-1;;;;;;73798:46:0::2;::::0;;::::2;::::0;;;::::2;::::0;;;73857:28;;-1:-1:-1;;;73857:28:0;;;;73798:30;;73857:26:::2;::::0;:28:::2;::::0;;::::2;::::0;73798:30;73857:28;;;;;73798:30;;73857:28;::::2;;::::0;::::2;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;33635:1:::1;73572:321:::0;;;;:::o;71782:1379::-;65973:1;66579:7;;:19;;66571:63;;;;-1:-1:-1;;;66571:63:0;;;;;;;;;65973:1;66712:7;:18;71961:9;33728:35:::1;71961:9:::0;33728:24:::1;:35::i;:::-;33720:88;;;;-1:-1:-1::0;;;33720:88:0::1;;;;;;;;;72008:1:::2;71996:9;:13;71988:53;;;;-1:-1:-1::0;;;71988:53:0::2;;;;;;;;;72156:37;::::0;-1:-1:-1;;;72156:37:0;;-1:-1:-1;;;;;72156:14:0;::::2;::::0;::::2;::::0;:37:::2;::::0;72171:10:::2;::::0;72183:9;;72156:37:::2;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;72292:27;72322:9;-1:-1:-1::0;;;;;72322:23:0::2;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;::::0;;::::2;-1:-1:-1::0;;72322:25:0::2;::::0;::::2;;::::0;::::2;::::0;;;::::2;::::0;::::2;;;72292:55:::0;-1:-1:-1;72363:9:0::2;72358:714;72382:10;:17;72378:1;:21;72358:714;;;72421:17;72441:10;72452:1;72441:13;;;;;;;;;;;;;;72421:33;;72478:40;72508:9;72478;-1:-1:-1::0;;;;;72478:29:0::2;;;:40;;;;:::i;:::-;72477:41;72469:90;;;;-1:-1:-1::0;;;72469:90:0::2;;;;;;;;;72576:12;72591:59;:9;-1:-1:-1::0;;;;;72591:36:0::2;;72628:9;72591:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:57;:59::i;:::-;72576:74:::0;-1:-1:-1;72782:25:0::2;72810:26;:9:::0;72576:74;72810:26:::2;:20;:26;:::i;:::-;72782:54:::0;-1:-1:-1;72929:131:0::2;-1:-1:-1::0;;;;;72929:30:0;::::2;72978:9:::0;73006:3;72782:54;72929:131:::2;:30;:131;:::i;:::-;-1:-1:-1::0;;;72401:3:0::2;;72358:714;;;;73138:3;-1:-1:-1::0;;;;;73089:64:0::2;73126:10;-1:-1:-1::0;;;;;73089:64:0::2;73114:9;-1:-1:-1::0;;;;;73089:64:0::2;;73143:9;73089:64;;;;;;;;;;;;;;;-1:-1:-1::0;;65929:1:0;66891:22;;-1:-1:-1;;;71782:1379:0:o;70258:1097::-;65973:1;66579:7;;:19;;66571:63;;;;-1:-1:-1;;;66571:63:0;;;;;;;;;65973:1;66712:7;:18;70437:9;33728:35:::1;70437:9:::0;33728:24:::1;:35::i;:::-;33720:88;;;;-1:-1:-1::0;;;33720:88:0::1;;;;;;;;;70484:1:::2;70472:9;:13;70464:52;;;;-1:-1:-1::0;;;70464:52:0::2;;;;;;;;;70529:20;70552:57;70571:9;70582;70593:10;70605:3;70552:18;:57::i;:::-;70529:80;;70637:27;70679:36:::0;70729:55:::2;70763:9;70774;70729:33;:55::i;:::-;70622:162:::0;;-1:-1:-1;70622:162:0;-1:-1:-1;70882:9:0::2;70877:304;70901:10;:17;70897:1;:21;70877:304;;;70995:174;71033:10;71044:1;71033:13;;;;;;;;;;;;;;71066:10;71103:9;71132:19;71152:1;71132:22;;;;;;;;;;;;;;70995:12;:174::i;:::-;70920:3;;70877:304;;;-1:-1:-1::0;71223:30:0::2;::::0;-1:-1:-1;;;71223:30:0;;-1:-1:-1;;;;;71223:14:0;::::2;::::0;::::2;::::0;:30:::2;::::0;71238:3;;71243:9;;71223:30:::2;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;71318:3;-1:-1:-1::0;;;;;71271:76:0::2;71306:10;-1:-1:-1::0;;;;;71271:76:0::2;71294:9;-1:-1:-1::0;;;;;71271:76:0::2;;71323:12;71337:9;71271:76;;;;;;;;;;;;;;;;-1:-1:-1::0;;65929:1:0;66891:22;;-1:-1:-1;;;;;70258:1097:0:o;74667:749::-;74870:16;74888;74841:9;33728:35;33753:9;33728:24;:35::i;:::-;33720:88;;;;-1:-1:-1;;;33720:88:0;;;;;;;;;74922:27:::1;74952:9;-1:-1:-1::0;;;;;74952:23:0::1;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;::::0;;::::1;-1:-1:-1::0;;74952:25:0::1;::::0;::::1;;::::0;::::1;::::0;;;::::1;::::0;::::1;;;74922:55;;74990:30;75037:10;:17;75023:32;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;-1:-1:-1;75023:32:0::1;-1:-1:-1::0;74990:65:0;-1:-1:-1;75073:9:0::1;75068:294;75092:10;:17;75088:1;:21;75068:294;;;75140:44;75170:10;75181:1;75170:13;;;;;;;;;;;;;;75140:9;-1:-1:-1::0;;;;;75140:29:0::1;;;:44;;;;:::i;:::-;75139:45;75131:94;;;;-1:-1:-1::0;;;75131:94:0::1;;;;;;;;;75261:89;75340:9;75261:63;:9;-1:-1:-1::0;;;;;75261:36:0::1;;75298:10;75309:1;75298:13;;;;;;;;;;;;;;75261:51;;;;;;;;;;;;;;;;:63;:78:::0;:89:::1;:78;:89;:::i;:::-;75242:13;75256:1;75242:16;;;;;;;;;::::0;;::::1;::::0;;;;;:108;75111:3:::1;;75068:294;;;-1:-1:-1::0;75382:10:0;;;;-1:-1:-1;74667:749:0;-1:-1:-1;;;;74667:749:0:o;74047:119::-;74100:58;;-1:-1:-1;;;74100:58:0;;;;;;;;69402:69;;;;;;;;;;;;-1:-1:-1;;;;;69402:69:0;;:::o;33391:29::-;;;-1:-1:-1;;;;;33391:29:0;;:::o;35948:146::-;36031:4;36078:8;-1:-1:-1;;;;;36055:31:0;:9;-1:-1:-1;;;;;36055:17:0;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;36055:31:0;;36048:38;;35948:146;;;;;:::o;35709:151::-;35812:40;;-1:-1:-1;;;35812:40:0;;35788:4;;-1:-1:-1;;;;;35812:25:0;;;;;:40;;35846:4;;35812:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;36237:206;36314:4;36338:10;;:36;;-1:-1:-1;;;36338:36:0;;-1:-1:-1;;;;;36338:10:0;;;;:16;;:36;;36363:9;;36338:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:97;;;;-1:-1:-1;36391:44:0;;-1:-1:-1;;;36391:44:0;;-1:-1:-1;;;;;36391:29:0;;;;;:44;;36429:4;;36391:44;;;;23962:183;24054:4;24136:1;24078:9;-1:-1:-1;;;;;24078:36:0;;24115:10;24078:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;24078:48:0;;;;;;;;;;;;;;:55;:59;;23962:183;-1:-1:-1;;;23962:183:0:o;60854:171::-;60910:7;60947:1;60938:5;:10;;60930:55;;;;-1:-1:-1;;;60930:55:0;;;;;;;;;-1:-1:-1;61011:5:0;60854:171::o;19209:126::-;19274:7;19301:26;17670:8;19301;:1;19307;19301:8;:5;:8;:::i;:::-;:12;:26;:12;:26;:::i;:::-;19294:33;19209:126;-1:-1:-1;;;19209:126:0:o;48099:803::-;48279:13;;48275:620;;48402:44;;-1:-1:-1;;;48402:44:0;;48376:23;;-1:-1:-1;;;;;48402:24:0;;;;;:44;;48435:9;;48402:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48376:70;;48463:56;48485:9;48496:6;48504:3;48509:9;48463:21;:56::i;:::-;48623:44;;-1:-1:-1;;;48623:44:0;;48602:18;;-1:-1:-1;;;;;48623:24:0;;;;;:44;;48656:9;;48623:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48602:65;-1:-1:-1;48788:30:0;:15;48808:9;48788:30;:19;:30;:::i;:::-;48774:10;:44;48748:135;;;;-1:-1:-1;;;48748:135:0;;;;;;;;;48275:620;;;48099:803;;;;:::o;75696:493::-;-1:-1:-1;;;;;75933:30:0;;;75872:7;75933:30;;;:19;:30;;;;;;75872:7;;75933:30;75978:35;;75974:178;;76030:67;;-1:-1:-1;;;76030:67:0;;-1:-1:-1;;;;;76030:31:0;;;;;:67;;76062:9;;76073;;76084:7;;76093:3;;76030:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;76127:12;76112:28;;;;;75974:178;76179:1;76164:17;;;75696:493;;;;;;;:::o;35431:169::-;35535:57;35562:6;35570:5;35577:3;35582:9;35535:26;:57::i;19852:211::-;19921:7;19945:6;;;:16;;-1:-1:-1;19955:6:0;;19945:16;19941:57;;;-1:-1:-1;19985:1:0;19978:8;;19941:57;20015:40;20053:1;20015:33;17670:8;20015:15;20053:1;20015:8;:1;20021;20015:8;:5;:8;:::i;:::-;:12;:15;:12;:15;:::i;:33::-;:37;:40;:37;:40;:::i;54332:471::-;54390:7;54635:6;54631:47;;-1:-1:-1;54665:1:0;54658:8;;54631:47;54702:5;;;54706:1;54702;:5;:1;54726:5;;;;;:10;54718:56;;;;-1:-1:-1;;;54718:56:0;;;;;;;;55279:132;55337:7;55364:39;55368:1;55371;55364:39;;;;;;;;;;;;;;;;;:3;:39::i;47301:367::-;47475:13;;47471:190;;47505:21;47582:3;47587:9;47529:68;;;;;;;;;;;;;;-1:-1:-1;;47529:68:0;;;;;;;;;;;;;;-1:-1:-1;;;;;47529:68:0;-1:-1:-1;;;47529:68:0;;;47612:37;-1:-1:-1;;;47612:37:0;;47529:68;;-1:-1:-1;;;;;;47612:16:0;;;;;:37;;47629:6;;-1:-1:-1;;47529:68:0;;47612:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;47612:37:0;;;;;;;;;;;;;53442:136;53500:7;53527:43;53531:1;53534;53527:43;;;;;;;;;;;;;;;;;:3;:43::i;15612:768::-;15851:13;;15847:526;;15907:21;;-1:-1:-1;;;15907:21:0;;15881:23;;-1:-1:-1;;;;;15907:16:0;;;;;:21;;15924:3;;15907:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15881:47;;15945:140;15990:6;16015:5;16039:3;16061:9;15945:26;:140::i;:::-;16123:21;;-1:-1:-1;;;16123:21:0;;16102:18;;-1:-1:-1;;;;;16123:16:0;;;;;:21;;16140:3;;16123:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;16102:42;-1:-1:-1;16266:30:0;:15;16286:9;16266:30;:19;:30;:::i;52978:181::-;53036:7;53068:5;;;53092:6;;;;53084:46;;;;-1:-1:-1;;;53084:46:0;;;;;;;;55907:278;55993:7;56028:12;56021:5;56013:28;;;;-1:-1:-1;;;56013:28:0;;;;;;;;;;;56052:9;56068:1;56064;:5;;;;;;;55907:278;-1:-1:-1;;;;;55907:278:0:o;53881:192::-;53967:7;54003:12;53995:6;;;;53987:29;;;;-1:-1:-1;;;53987:29:0;;;;;;;;;;-1:-1:-1;;;54039:5:0;;;53881:192::o;7220:205::-;7321:96;7341:5;7371:27;;;7400:4;7406:2;7410:5;7348:68;;;;;;;;;;;;;;;-1:-1:-1;;7348:68:0;;;;;;;;;;;;;;-1:-1:-1;;;;;7348:68:0;-1:-1:-1;;;;;;7348:68:0;;;;;;;;;;9764:23;9790:69;9818:4;9790:69;;;;;;;;;;;;;;;;;9798:5;-1:-1:-1;;;;;9790:27:0;;;:69;;;;;:::i;:::-;9874:17;;9764:95;;-1:-1:-1;9874:21:0;9870:224;;10016:10;10005:30;;;;;;;;;;;;;;9997:85;;;;-1:-1:-1;;;9997:85:0;;;;;;;;;9340:761;;;:::o;3901:196::-;4004:12;4036:53;4059:6;4067:4;4073:1;4076:12;5408;5441:18;5452:6;5441:10;:18::i;:::-;5433:60;;;;-1:-1:-1;;;5433:60:0;;;;;;;;;5567:12;5581:23;5608:6;-1:-1:-1;;;;;5608:11:0;5628:8;5639:4;5608:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5566:78;;;;5659:7;5655:595;;;5690:10;-1:-1:-1;5683:17:0;;-1:-1:-1;5683:17:0;5655:595;5804:17;;:21;5800:439;;6067:10;6061:17;6128:15;6115:10;6111:2;6107:19;6100:44;6015:148;6210:12;6203:20;;-1:-1:-1;;;6203:20:0;;;;;;;;;783:619;843:4;1311:20;;1154:66;1351:23;;;;;;:42;;-1:-1:-1;;1378:15:0;;;1343:51;-1:-1:-1;;783:619:0:o;142:134:-1:-;220:13;;238:33;220:13;238:33;;2402:263;;2517:2;2505:9;2496:7;2492:23;2488:32;2485:2;;;-1:-1;;2523:12;2485:2;226:6;220:13;238:33;265:5;238:33;;2672:392;;2812:2;;2800:9;2791:7;2787:23;2783:32;2780:2;;;-1:-1;;2818:12;2780:2;2869:17;2863:24;2907:18;;2899:6;2896:30;2893:2;;;-1:-1;;2929:12;2893:2;3031:6;3020:9;3016:22;429:3;422:4;414:6;410:17;406:27;396:2;;-1:-1;;437:12;396:2;477:6;471:13;457:27;;2907:18;26765:6;26762:30;26759:2;;;-1:-1;;26795:12;26759:2;2812;26832:6;26828:17;;;499:80;2812:2;26828:17;26893:15;499:80;;;607:21;;;664:14;;;;639:17;;;744:27;;;;;741:36;-1:-1;738:2;;;-1:-1;;780:12;738:2;-1:-1;806:10;;800:217;825:6;822:1;819:13;800:217;;;905:48;949:3;937:10;905:48;;;893:61;;847:1;840:9;;;;;968:14;;;;996;;800:217;;;-1:-1;2949:99;2774:290;-1:-1;;;;;;;;2774:290;3071:257;;3183:2;3171:9;3162:7;3158:23;3154:32;3151:2;;;-1:-1;;3189:12;3151:2;1112:6;1106:13;31951:5;29378:13;29371:21;31929:5;31926:32;31916:2;;-1:-1;;31962:12;3335:360;;3459:2;3447:9;3438:7;3434:23;3430:32;3427:2;;;-1:-1;;3465:12;3427:2;3516:17;3510:24;3554:18;;3546:6;3543:30;3540:2;;;-1:-1;;3576:12;3540:2;3662:6;3651:9;3647:22;1279:3;1272:4;1264:6;1260:17;1256:27;1246:2;;-1:-1;;1287:12;1246:2;1327:6;1321:13;1307:27;;3554:18;27060:6;27057:30;27054:2;;;-1:-1;;27090:12;27054:2;1349:64;27163:9;27144:17;;-1:-1;;27140:33;3459:2;27221:15;1349:64;;;1340:73;;1433:6;1426:5;1419:21;1537:3;3459:2;1528:6;1461;1519:16;;1516:25;1513:2;;;-1:-1;;1544:12;1513:2;1564:39;1596:6;3459:2;1495:5;1491:16;3459:2;1461:6;1457:17;1564:39;;;-1:-1;3596:83;3421:274;-1:-1;;;;3421:274;3702:277;;3824:2;3812:9;3803:7;3799:23;3795:32;3792:2;;;-1:-1;;3830:12;3792:2;1910:6;1897:20;1922:51;1967:5;1922:51;;3986:460;;;4154:2;4142:9;4133:7;4129:23;4125:32;4122:2;;;-1:-1;;4160:12;4122:2;1910:6;1897:20;1922:51;1967:5;1922:51;;;4212:81;-1:-1;4330:2;4398:22;;1713:20;1738:62;1713:20;1738:62;;;4338:92;;;;4116:330;;;;;;4453:402;;;4592:2;4580:9;4571:7;4567:23;4563:32;4560:2;;;-1:-1;;4598:12;4560:2;1910:6;1897:20;1922:51;1967:5;1922:51;;;4650:81;4768:2;4807:22;;;;2191:20;;-1:-1;;;4554:301;4862:527;;;;5018:2;5006:9;4997:7;4993:23;4989:32;4986:2;;;-1:-1;;5024:12;4986:2;1910:6;1897:20;1922:51;1967:5;1922:51;;;5076:81;-1:-1;5194:2;5233:22;;2191:20;;-1:-1;5302:2;5341:22;;72:20;97:33;72:20;97:33;;;5310:63;;;;4980:409;;;;;;5396:261;;5510:2;5498:9;5489:7;5485:23;5481:32;5478:2;;;-1:-1;;5516:12;5478:2;-1:-1;2062:13;;5472:185;-1:-1;5472:185;6117:173;15295:37;;6279:4;6270:14;;6197:93;6447:103;-1:-1;;;;;29787:54;6508:37;;6502:48;8135:343;;8277:5;27672:12;28475:6;28470:3;28463:19;8370:52;8415:6;28512:4;28507:3;28503:14;28512:4;8396:5;8392:16;8370:52;;;27163:9;31709:14;-1:-1;;31705:28;8434:39;;;;28512:4;8434:39;;8225:253;-1:-1;;8225:253;15464:271;;8645:5;27672:12;8756:52;8801:6;8796:3;8789:4;8782:5;8778:16;8756:52;;;8820:16;;;;;15598:137;-1:-1;;15598:137;15742:222;-1:-1;;;;;29787:54;;;;6508:37;;15869:2;15854:18;;15840:124;15971:349;-1:-1;;;;;29787:54;;;;6377:58;;16306:2;16291:18;;15295:37;16134:2;16119:18;;16105:215;16327:444;-1:-1;;;;;29787:54;;;6508:37;;29787:54;;;;16674:2;16659:18;;6508:37;16757:2;16742:18;;15295:37;;;;16510:2;16495:18;;16481:290;16778:544;;2907:18;;29798:42;;;29294:5;29787:54;6515:3;6508:37;31085:24;17159:2;17148:9;17144:18;9460:58;16987:2;17196;17185:9;17181:18;17174:48;17236:76;16987:2;16976:9;16972:18;17298:6;17236:76;;;17228:84;16958:364;-1:-1;;;;;16958:364;17669:629;17924:2;17938:47;;;27672:12;;17909:18;;;28463:19;;;17669:629;;28512:4;;28503:14;;;;27368;;;17669:629;7116:260;7141:6;7138:1;7135:13;7116:260;;;6022:46;6064:3;7208:6;7202:13;6022:46;;;6088:14;;;;28203;;;;7163:1;7156:9;7116:260;;;7120:14;;;18155:9;18149:4;18145:20;28512:4;18129:9;18125:18;18118:48;18180:108;7630:5;27672:12;7649:86;7728:6;7723:3;7649:86;;;7642:93;;28512:4;7806:5;27368:14;7818:21;;-1:-1;7845:260;7870:6;7867:1;7864:13;7845:260;;;7958:63;8017:3;7937:6;7931:13;7958:63;;;28203:14;;;;7951:70;-1:-1;7163:1;7885:9;7845:260;;;-1:-1;18172:116;;17895:403;-1:-1;;;;;;;17895:403;18861:592;-1:-1;;;;;29787:54;;;8939:70;;19273:2;19258:18;;15295:37;;;;29787:54;;;19356:2;19341:18;;6508:37;29787:54;;;19439:2;19424:18;;6508:37;19090:3;19075:19;;19061:392;19460:310;;19607:2;19628:17;19621:47;19682:78;19607:2;19596:9;19592:18;19746:6;19682:78;;19777:416;19977:2;19991:47;;;10109:2;19962:18;;;28463:19;10145:34;28503:14;;;10125:55;-1:-1;;;10200:12;;;10193:32;10244:12;;;19948:245;20200:416;20400:2;20414:47;;;10495:2;20385:18;;;28463:19;10531:29;28503:14;;;10511:50;10580:12;;;20371:245;20623:416;20823:2;20837:47;;;10831:2;20808:18;;;28463:19;10867:29;28503:14;;;10847:50;10916:12;;;20794:245;21046:416;21246:2;21260:47;;;11167:2;21231:18;;;28463:19;11203:34;28503:14;;;11183:55;-1:-1;;;11258:12;;;11251:40;11310:12;;;21217:245;21469:416;21669:2;21683:47;;;11561:2;21654:18;;;28463:19;11597:34;28503:14;;;11577:55;-1:-1;;;11652:12;;;11645:28;11692:12;;;21640:245;21892:416;22092:2;22106:47;;;11943:2;22077:18;;;28463:19;11979:32;28503:14;;;11959:53;12031:12;;;22063:245;22315:416;22515:2;22529:47;;;12282:2;22500:18;;;28463:19;12318:28;28503:14;;;12298:49;12366:12;;;22486:245;22738:416;22938:2;22952:47;;;22923:18;;;28463:19;12653:34;28503:14;;;12633:55;12707:12;;;22909:245;23161:416;23361:2;23375:47;;;12958:2;23346:18;;;28463:19;12994:34;28503:14;;;12974:55;-1:-1;;;13049:12;;;13042:25;13086:12;;;23332:245;23584:416;23784:2;23798:47;;;13337:2;23769:18;;;28463:19;13373:31;28503:14;;;13353:52;13424:12;;;23755:245;24007:416;24207:2;24221:47;;;13675:2;24192:18;;;28463:19;13711:31;28503:14;;;13691:52;13762:12;;;24178:245;24430:416;24630:2;24644:47;;;14013:2;24615:18;;;28463:19;14049:34;28503:14;;;14029:55;-1:-1;;;14104:12;;;14097:27;14143:12;;;24601:245;24853:416;25053:2;25067:47;;;14394:2;25038:18;;;28463:19;14430:30;28503:14;;;14410:51;14480:12;;;25024:245;25276:416;25476:2;25490:47;;;14731:2;25461:18;;;28463:19;14767:34;28503:14;;;14747:55;-1:-1;;;14822:12;;;14815:34;14868:12;;;25447:245;25699:416;25899:2;25913:47;;;15119:2;25884:18;;;28463:19;15155:33;28503:14;;;15135:54;15208:12;;;25870:245;26122:222;15295:37;;;26249:2;26234:18;;26220:124;26351:256;26413:2;26407:9;26439:17;;;26514:18;26499:34;;26535:22;;;26496:62;26493:2;;;26571:1;;26561:12;26493:2;26413;26580:22;26391:216;;-1:-1;26391:216;31365:268;31430:1;31437:101;31451:6;31448:1;31445:13;31437:101;;;31518:11;;;31512:18;31499:11;;;31492:39;31473:2;31466:10;31437:101;;;31553:6;31550:1;31547:13;31544:2;;;-1:-1;;31430:1;31600:16;;31593:27;31414:219;31746:117;-1:-1;;;;;29787:54;;31805:35;;31795:2;;31854:1;;31844:12;31795:2;31789:74;

Swarm Source

ipfs://5afb30bbc76cd694b9469cdace9272085847eeeee2e2ca3ef8c11c06490e3d86
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading