Contract 0xe34031E7F4D8Ba4eFab190ce5f4D8451eD1B6A82

Contract Overview

Balance:
0 Ether
Txn Hash Method
Block
From
To
Value
0xbb59b0dc84f76997d5847099976ec3cfd6284aa628536434d9ddb28998a9f8a2Issue245114802021-04-28 0:53:4820 days 18 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.000249471
0x6461696eb598ad6da534cb5f117b594c82c7845870d6997cfb0e974dcf859d50Issue245114562021-04-28 0:52:1220 days 18 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.000170021
0x973f725504f4db32051f01577c221d351ea11c2e4b04ed9060a6315bdee081f8Issue245114482021-04-28 0:51:4020 days 18 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0001622611
0x07a4881b15d5b4f8f863ef0912a65ad5bdc6c1a437ccd302f5191350d199b338Initialize245087142021-04-27 21:45:3220 days 21 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0001898111
0xd7703ffdc7c718289d358bfa7ee4b5b71ae8e7ee147dddb83a8cabd331256388Redeem238258032021-03-08 22:20:1270 days 21 hrs ago0x25d9d2d38fa590ccfeb3c59d12daa30297380666 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0058582693210.015659341
0x2218160420fee707788ff0db567405d1612700b60913be0998820235b4c33df9Issue238257942021-03-08 22:19:2470 days 21 hrs ago0x25d9d2d38fa590ccfeb3c59d12daa30297380666 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.00592985452410.185585796
0xac31f965f488a08d1565f2784107678cf0f2be368c5caf1b80c31782a9b7b843Issue238097372021-03-07 22:18:3671 days 21 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0011264522
0x36423cd093903004f962f0f37b3d644ae6c4e1c95f2361b230990a1ad980452bRedeem238084992021-03-07 20:28:1271 days 23 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.006689920
0xd04946273c1b5222d215c1d650d2c9cb549d35eb93495f13bb4d29ebab31e1e9Redeem238084332021-03-07 20:22:2071 days 23 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.006689920
0x2ba078343a947380072d0f0e6bdbd7f8b0c97783dfd35fff3da5506604b5f037Issue238078672021-03-07 19:31:4072 days 3 mins ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.005876420
0xbda2dfcdbe1f35cb2abb6ce3ee4dd2f1f0ecffe12a57f8f5493582a65726f95aRedeem238078292021-03-07 19:28:1672 days 6 mins ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.011959120
0x1baa52e75bbed143da2904fadd9e7aefc9216caa325b89706b21d5e8b823f061Issue237827952021-03-06 6:05:3673 days 13 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0212526665
0x10688fa217a8d427194dd18056b2c5fe0f6aa5df06d845e55c7f3a2e68d8337aInitialize237813302021-03-06 3:54:3673 days 15 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.01366552872
0xf87f2f2477c468fd493ee20bb42fe879b12c1f37f0045c90007628ab0522ae06Issue237783962021-03-05 23:31:2873 days 20 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0062056610
0x423cf25286708fcb0bb0c8abe4d90f1dc2d6c66c722cae7f8f4783743dc726afIssue237781182021-03-05 23:06:3673 days 20 hrs ago0x25d9d2d38fa590ccfeb3c59d12daa30297380666 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0060135710
0x360bf616872e06cab8cbd0d43e4b099e2e7572555ff4955e0747d579e5db05d5Redeem237610562021-03-04 21:27:4474 days 22 hrs ago0x25d9d2d38fa590ccfeb3c59d12daa30297380666 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.00610024295710.729380548
0x8c192c09a7fe4f1f9d56c12327505d000f5911a112eeaeea99d82b380409a829Issue237332372021-03-03 3:37:3276 days 15 hrs ago0x25d9d2d38fa590ccfeb3c59d12daa30297380666 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.00590154367510.06476204
0x3f7ef2e89c51563028cecf7381bdfd686d07dcceb6b10a4fe718fc513bd38facRedeem237315522021-03-03 1:06:5276 days 18 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0016728055
0x7716aed2fd578cb8fa76f0b848b57f8b3c32c1c7a75ac194f38ccd7201723693Issue237315402021-03-03 1:05:4876 days 18 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.001544435
0xcd4a9fe1fedcd52b5dfab1a9be43e5fa6d79a9aae843c3c08ab8edb05b054340Issue237315312021-03-03 1:05:0076 days 18 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.001634995
0x8dbf16cf014cad1ad44a4db2c00d545181fb46e43e185e4e39b2b9da119a25a1Initialize237311782021-03-03 0:33:1676 days 19 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0005694333
0x8165fb21524414adf327ed1aac6268dfc2d9b8684f5bf654df4b3b9ecf00219fInitialize237311322021-03-03 0:29:0476 days 19 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.0003796222
0x287d21b6332cfbe70119158e5bcb0530401c1bab5c34ad2638a796d563c513c4Redeem237278822021-03-02 19:36:4876 days 23 hrs ago0x25d9d2d38fa590ccfeb3c59d12daa30297380666 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.00642637196710.638156371
0x9cc1d3f119fe84505c13c6fe9fce057a407b711cad8f21e2953a595904765829Redeem236681512021-02-27 2:42:0480 days 16 hrs ago0x25d9d2d38fa590ccfeb3c59d12daa30297380666 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.00662428379810.588248887
0x975309a9467287a975ddf10ce6314ce1f1443a7fa892cea70854a45618b1a92bRedeem236675062021-02-27 1:44:3280 days 17 hrs ago0x69bdb276a17dd90f9d3a545944ccb20e593ae8e3 IN  0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether0.01489217525
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0xca1458e55d6be75ad771115d7b2fc1cb753bc5c90 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0xca1458e55d6be75ad771115d7b2fc1cb753bc5c90 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x676c7b527c706801e64ad2108aa1f0ddc83807d00 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x15758350decea0e5a96cfe9024e3f352d039905a0 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x15758350decea0e5a96cfe9024e3f352d039905a0 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x15758350decea0e5a96cfe9024e3f352d039905a0 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x9048278ca7e874f9338e4898c436ab07aa4547010 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x676c7b527c706801e64ad2108aa1f0ddc83807d00 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x9048278ca7e874f9338e4898c436ab07aa4547010 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0x51fae51fac96a8288e638a5218d89eac943d1a27 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a820 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
0x7c018eaf834b3ee0bf9cdfb5c42c501b84c5369a74ef6d91103836ee027a9202246974212021-05-06 19:26:3212 days 8 mins ago 0xe34031e7f4d8ba4efab190ce5f4d8451ed1b6a82 0x7edc8917dfb6f2c696a41579356dfc6ecd360aa10 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DebtIssuanceModule

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 2021-02-23
*/

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



// pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}


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


// pragma solidity >=0.6.0 <0.8.0;

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

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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


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


// pragma solidity >=0.6.0 <0.8.0;


/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {

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

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

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

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

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

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

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

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

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

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

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

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


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


// pragma solidity >=0.6.0 <0.8.0;

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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


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


// pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

        return c;
    }

    /**
     * @dev Returns the integer division of two signed integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(int256 a, int256 b) internal pure returns (int256) {
        require(b != 0, "SignedSafeMath: division by zero");
        require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow");

        int256 c = a / b;

        return c;
    }

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

        return c;
    }

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

        return c;
    }
}


// Dependency file: contracts/lib/AddressArrayUtils.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 AddressArrayUtils
 * @author Set Protocol
 *
 * Utility functions to handle Address Arrays
 */
library AddressArrayUtils {

    /**
     * Finds the index of the first occurrence of the given element.
     * @param A The input array to search
     * @param a The value to find
     * @return Returns (index and isIn) for the first occurrence starting from index 0
     */
    function indexOf(address[] memory A, address a) internal pure returns (uint256, bool) {
        uint256 length = A.length;
        for (uint256 i = 0; i < length; i++) {
            if (A[i] == a) {
                return (i, true);
            }
        }
        return (uint256(-1), false);
    }

    /**
    * Returns true if the value is present in the list. Uses indexOf internally.
    * @param A The input array to search
    * @param a The value to find
    * @return Returns isIn for the first occurrence starting from index 0
    */
    function contains(address[] memory A, address a) internal pure returns (bool) {
        (, bool isIn) = indexOf(A, a);
        return isIn;
    }

    /**
    * Returns true if there are 2 elements that are the same in an array
    * @param A The input array to search
    * @return Returns boolean for the first occurrence of a duplicate
    */
    function hasDuplicate(address[] memory A) internal pure returns(bool) {
        require(A.length > 0, "A is empty");

        for (uint256 i = 0; i < A.length - 1; i++) {
            address current = A[i];
            for (uint256 j = i + 1; j < A.length; j++) {
                if (current == A[j]) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * @param A The input array to search
     * @param a The address to remove     
     * @return Returns the array with the object removed.
     */
    function remove(address[] memory A, address a)
        internal
        pure
        returns (address[] memory)
    {
        (uint256 index, bool isIn) = indexOf(A, a);
        if (!isIn) {
            revert("Address not in array.");
        } else {
            (address[] memory _A,) = pop(A, index);
            return _A;
        }
    }

    /**
     * @param A The input array to search
     * @param a The address to remove
     */
    function removeStorage(address[] storage A, address a)
        internal
    {
        (uint256 index, bool isIn) = indexOf(A, a);
        if (!isIn) {
            revert("Address not in array.");
        } else {
            uint256 lastIndex = A.length - 1; // If the array would be empty, the previous line would throw, so no underflow here
            if (index != lastIndex) { A[index] = A[lastIndex]; }
            A.pop();
        }
    }

    /**
    * Removes specified index from array
    * @param A The input array to search
    * @param index The index to remove
    * @return Returns the new array and the removed entry
    */
    function pop(address[] memory A, uint256 index)
        internal
        pure
        returns (address[] memory, address)
    {
        uint256 length = A.length;
        require(index < A.length, "Index must be < A length");
        address[] memory newAddresses = new address[](length - 1);
        for (uint256 i = 0; i < index; i++) {
            newAddresses[i] = A[i];
        }
        for (uint256 j = index + 1; j < length; j++) {
            newAddresses[j - 1] = A[j];
        }
        return (newAddresses, A[index]);
    }

    /**
     * Returns the combination of the two arrays
     * @param A The first array
     * @param B The second array
     * @return Returns A extended by B
     */
    function extend(address[] memory A, address[] memory B) internal pure returns (address[] memory) {
        uint256 aLength = A.length;
        uint256 bLength = B.length;
        address[] memory newAddresses = new address[](aLength + bLength);
        for (uint256 i = 0; i < aLength; i++) {
            newAddresses[i] = A[i];
        }
        for (uint256 j = 0; j < bLength; j++) {
            newAddresses[aLength + j] = B[j];
        }
        return newAddresses;
    }
}

// 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 feeRecipient() external view returns(address);
    function getModuleFee(address _module, uint256 _feeType) external view returns(uint256);
    function isModule(address _module) external view returns(bool);
    function isSet(address _setToken) external view returns(bool);
    function isSystemContract(address _contractAddress) external view returns (bool);
    function resourceId(uint256 _id) external view returns(address);
}

// 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;


// 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/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 "contracts/interfaces/ISetToken.sol";

interface IManagerIssuanceHook {
    function invokePreIssueHook(ISetToken _setToken, uint256 _issueQuantity, address _sender, address _to) external;
    function invokePreRedeemHook(ISetToken _setToken, uint256 _redeemQuantity, address _sender, address _to) external;
}

// Dependency file: contracts/interfaces/IModuleIssuanceHook.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 { ISetToken } from "contracts/interfaces/ISetToken.sol";


/**
 * CHANGELOG:
 *      - Added a module level issue hook that can be used to set state ahead of component level
 *        issue hooks
 */
interface IModuleIssuanceHook {

    function moduleIssueHook(ISetToken _setToken, uint256 _setTokenQuantity) external;
    function moduleRedeemHook(ISetToken _setToken, uint256 _setTokenQuantity) external;
    
    function componentIssueHook(
        ISetToken _setToken,
        uint256 _setTokenQuantity,
        IERC20 _component,
        bool _isEquity
    ) external;

    function componentRedeemHook(
        ISetToken _setToken,
        uint256 _setTokenQuantity,
        IERC20 _component,
        bool _isEquity
    ) external;
}

// 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 "contracts/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: @openzeppelin/contracts/utils/Address.sol


// pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [// importANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * // importANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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


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


// pragma solidity >=0.6.0 <0.8.0;

// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/math/SafeMath.sol";
// import "@openzeppelin/contracts/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: 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/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/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.
 *
 * CHANGELOG:
 * - 9/21/20: Added safePower function
 */
library PreciseUnitMath {
    using SafeMath for uint256;
    using SignedSafeMath for int256;

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

        return result;
    }

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

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

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

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

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

        return result;
    }
}

// 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;


// import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// 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 "contracts/interfaces/ISetToken.sol";
// import { PreciseUnitMath } from "contracts/lib/PreciseUnitMath.sol";


/**
 * @title Position
 * @author Set Protocol
 *
 * Collection of helper functions for handling and updating SetToken Positions
 *
 * CHANGELOG:
 *  - Updated editExternalPosition to work when no external position is associated with module
 */
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 and data
     * 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 (_newUnit != 0) {
            if (!_setToken.isComponent(_component)) {
                _setToken.addComponent(_component);
                _setToken.addExternalPositionModule(_component, _module);
            } else if (!_setToken.isExternalPositionModule(_component, _module)) {
                _setToken.addExternalPositionModule(_component, _module);
            }
            _setToken.editExternalPositionUnit(_component, _module, _newUnit);
            _setToken.editExternalPositionData(_component, _module, _data);
        } else {
            require(_data.length == 0, "Passed data must be null");
            // If no default or external position remaining then remove component from components array
            if (_setToken.getExternalPositionRealUnit(_component, _module) != 0) {
                address[] memory positionModules = _setToken.getExternalPositionModules(_component);
                if (_setToken.getDefaultPositionRealUnit(_component) == 0 && positionModules.length == 1) {
                    require(positionModules[0] == _module, "External positions must be 0 to remove component");
                    _setToken.removeComponent(_component);
                }
                _setToken.removeExternalPositionModule(_component, _module);
            }
        }
    }

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

    /**
     * Get the total tracked balance - total supply * position unit
     *
     * @param _setToken           Address of the SetToken
     * @param _component          Address of the component
     * @return                    Notional tracked balance
     */
    function getDefaultTrackedBalance(ISetToken _setToken, address _component) internal view returns(uint256) {
        int256 positionUnit = _setToken.getDefaultPositionRealUnit(_component); 
        return _setToken.totalSupply().preciseMul(positionUnit.toUint256());
    }

    /**
     * Calculates the new default position unit and performs the edit with the new unit
     *
     * @param _setToken                 Address of the SetToken
     * @param _component                Address of the component
     * @param _setTotalSupply           Current SetToken supply
     * @param _componentPreviousBalance Pre-action component balance
     * @return                          Current component balance
     * @return                          Previous position unit
     * @return                          New position unit
     */
    function calculateAndEditDefaultPosition(
        ISetToken _setToken,
        address _component,
        uint256 _setTotalSupply,
        uint256 _componentPreviousBalance
    )
        internal
        returns(uint256, uint256, uint256)
    {
        uint256 currentBalance = IERC20(_component).balanceOf(address(_setToken));
        uint256 positionUnit = _setToken.getDefaultPositionRealUnit(_component).toUint256();

        uint256 newTokenUnit;
        if (currentBalance > 0) {
            newTokenUnit = calculateDefaultEditPositionUnit(
                _setTotalSupply,
                _componentPreviousBalance,
                currentBalance,
                positionUnit
            );
        } else {
            newTokenUnit = 0;
        }

        editDefaultPosition(_setToken, _component, newTokenUnit);

        return (currentBalance, positionUnit, newTokenUnit);
    }

    /**
     * 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
        uint256 airdroppedAmount = _preTotalNotional.sub(_prePositionUnit.preciseMul(_setTokenSupply));
        return _postTotalNotional.sub(airdroppedAmount).preciseDiv(_setTokenSupply);
    }
}


// Dependency file: contracts/interfaces/IIntegrationRegistry.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 IIntegrationRegistry {
    function addIntegration(address _module, string memory _id, address _wrapper) external;
    function getIntegrationAdapter(address _module, string memory _id) external view returns(address);
    function getIntegrationAdapterWithHash(address _module, bytes32 _id) external view returns(address);
    function isValidIntegration(address _module, string memory _id) external view returns(bool);
}

// Dependency file: contracts/interfaces/IPriceOracle.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 IPriceOracle
 * @author Set Protocol
 *
 * Interface for interacting with PriceOracle
 */
interface IPriceOracle {

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

    function getPrice(address _assetOne, address _assetTwo) external view returns (uint256);
    function masterQuoteAsset() external view returns (address);
}

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

interface ISetValuer {
    function calculateSetTokenValuation(ISetToken _setToken, address _quoteAsset) external view returns (uint256);
}

// Dependency file: contracts/protocol/lib/ResourceIdentifier.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 { IController } from "contracts/interfaces/IController.sol";
// import { IIntegrationRegistry } from "contracts/interfaces/IIntegrationRegistry.sol";
// import { IPriceOracle } from "contracts/interfaces/IPriceOracle.sol";
// import { ISetValuer } from "contracts/interfaces/ISetValuer.sol";

/**
 * @title ResourceIdentifier
 * @author Set Protocol
 *
 * A collection of utility functions to fetch information related to Resource contracts in the system
 */
library ResourceIdentifier {

    // IntegrationRegistry will always be resource ID 0 in the system
    uint256 constant internal INTEGRATION_REGISTRY_RESOURCE_ID = 0;
    // PriceOracle will always be resource ID 1 in the system
    uint256 constant internal PRICE_ORACLE_RESOURCE_ID = 1;
    // SetValuer resource will always be resource ID 2 in the system
    uint256 constant internal SET_VALUER_RESOURCE_ID = 2;

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

    /**
     * Gets the instance of integration registry stored on Controller. Note: IntegrationRegistry is stored as index 0 on
     * the Controller
     */
    function getIntegrationRegistry(IController _controller) internal view returns (IIntegrationRegistry) {
        return IIntegrationRegistry(_controller.resourceId(INTEGRATION_REGISTRY_RESOURCE_ID));
    }

    /**
     * Gets instance of price oracle on Controller. Note: PriceOracle is stored as index 1 on the Controller
     */
    function getPriceOracle(IController _controller) internal view returns (IPriceOracle) {
        return IPriceOracle(_controller.resourceId(PRICE_ORACLE_RESOURCE_ID));
    }

    /**
     * Gets the instance of Set valuer on Controller. Note: SetValuer is stored as index 2 on the Controller
     */
    function getSetValuer(IController _controller) internal view returns (ISetValuer) {
        return ISetValuer(_controller.resourceId(SET_VALUER_RESOURCE_ID));
    }
}

// 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 { AddressArrayUtils } from "contracts/lib/AddressArrayUtils.sol";
// import { ExplicitERC20 } from "contracts/lib/ExplicitERC20.sol";
// import { IController } from "contracts/interfaces/IController.sol";
// import { IModule } from "contracts/interfaces/IModule.sol";
// import { ISetToken } from "contracts/interfaces/ISetToken.sol";
// import { Invoke } from "contracts/protocol/lib/Invoke.sol";
// import { Position } from "contracts/protocol/lib/Position.sol";
// import { PreciseUnitMath } from "contracts/lib/PreciseUnitMath.sol";
// import { ResourceIdentifier } from "contracts/protocol/lib/ResourceIdentifier.sol";
// import { SafeCast } from "@openzeppelin/contracts/utils/SafeCast.sol";
// import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
// import { SignedSafeMath } from "@openzeppelin/contracts/math/SignedSafeMath.sol";

/**
 * @title ModuleBase
 * @author Set Protocol
 *
 * Abstract class that houses common Module-related state and functions.
 */
abstract contract ModuleBase is IModule {
    using AddressArrayUtils for address[];
    using Invoke for ISetToken;
    using Position for ISetToken;
    using PreciseUnitMath for uint256;
    using ResourceIdentifier for IController;
    using SafeCast for int256;
    using SafeCast for uint256;
    using SafeMath for uint256;
    using SignedSafeMath for int256;

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

    // Address of the controller
    IController public controller;

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

    modifier onlyManagerAndValidSet(ISetToken _setToken) { 
        require(isSetManager(_setToken, msg.sender), "Must be the SetToken manager");
        require(isSetValidAndInitialized(_setToken), "Must be a valid and initialized SetToken");
        _;
    }

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

    /**
     * Gets the integration for the module with the passed in name. Validates that the address is not empty
     */
    function getAndValidateAdapter(string memory _integrationName) internal view returns(address) { 
        bytes32 integrationHash = getNameHash(_integrationName);
        return getAndValidateAdapterWithHash(integrationHash);
    }

    /**
     * Gets the integration for the module with the passed in hash. Validates that the address is not empty
     */
    function getAndValidateAdapterWithHash(bytes32 _integrationHash) internal view returns(address) { 
        address adapter = controller.getIntegrationRegistry().getIntegrationAdapterWithHash(
            address(this),
            _integrationHash
        );

        require(adapter != address(0), "Must be valid adapter"); 
        return adapter;
    }

    /**
     * Gets the total fee for this module of the passed in index (fee % * quantity)
     */
    function getModuleFee(uint256 _feeIndex, uint256 _quantity) internal view returns(uint256) {
        uint256 feePercentage = controller.getModuleFee(address(this), _feeIndex);
        return _quantity.preciseMul(feePercentage);
    }

    /**
     * Pays the _feeQuantity from the _setToken denominated in _token to the protocol fee recipient
     */
    function payProtocolFeeFromSetToken(ISetToken _setToken, address _token, uint256 _feeQuantity) internal {
        if (_feeQuantity > 0) {
            _setToken.strictInvokeTransfer(_token, controller.feeRecipient(), _feeQuantity); 
        }
    }

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

    /**
     * Hashes the string and returns a bytes32 value
     */
    function getNameHash(string memory _name) internal pure returns(bytes32) {
        return keccak256(bytes(_name));
    }
}

// Root file: contracts/protocol/modules/DebtIssuanceModule.sol

/*
    Copyright 2021 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 { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
// 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 { AddressArrayUtils } from "contracts/lib/AddressArrayUtils.sol";
// import { IController } from "contracts/interfaces/IController.sol";
// import { IManagerIssuanceHook } from "contracts/interfaces/IManagerIssuanceHook.sol";
// import { IModuleIssuanceHook } from "contracts/interfaces/IModuleIssuanceHook.sol";
// import { Invoke } from "contracts/protocol/lib/Invoke.sol";
// import { ISetToken } from "contracts/interfaces/ISetToken.sol";
// import { ModuleBase } from "contracts/protocol/lib/ModuleBase.sol";
// import { Position } from "contracts/protocol/lib/Position.sol";
// import { PreciseUnitMath } from "contracts/lib/PreciseUnitMath.sol";


/**
 * @title DebtIssuanceModule
 * @author Set Protocol
 *
 * The DebtIssuanceModule is a module that enables users to issue and redeem SetTokens that contain default and all
 * external positions, including debt positions. Module hooks are added to allow for syncing of positions, and component
 * level hooks are added to ensure positions are replicated correctly. The manager can define arbitrary issuance logic
 * in the manager hook, as well as specify issue and redeem fees.
 */
contract DebtIssuanceModule is ModuleBase, ReentrancyGuard {

    /* ============ Structs ============ */

    // NOTE: moduleIssuanceHooks uses address[] for compatibility with AddressArrayUtils library
    struct IssuanceSettings {
        uint256 maxManagerFee;                          // Max issue/redeem fee defined on instantiation
        uint256 managerIssueFee;                        // Current manager issuance fees in precise units (10^16 = 1%)
        uint256 managerRedeemFee;                       // Current manager redeem fees in precise units (10^16 = 1%)
        address feeRecipient;                           // Address that receives all manager issue and redeem fees
        IManagerIssuanceHook managerIssuanceHook;       // Instance of manager defined hook, can hold arbitrary logic
        address[] moduleIssuanceHooks;                  // Array of modules that are registered with this module
        mapping(address => bool) isModuleHook;          // Mapping of modules to if they've registered a hook
    }

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

    event SetTokenIssued(
        ISetToken indexed _setToken,
        address indexed _issuer,
        address indexed _to,
        address _hookContract,
        uint256 _quantity,
        uint256 _managerFee,
        uint256 _protocolFee
    );
    event SetTokenRedeemed(
        ISetToken indexed _setToken,
        address indexed _redeemer,
        address indexed _to,
        uint256 _quantity,
        uint256 _managerFee,
        uint256 _protocolFee
    );
    event FeeRecipientUpdated(ISetToken indexed _setToken, address _newFeeRecipient);
    event IssueFeeUpdated(ISetToken indexed _setToken, uint256 _newIssueFee);
    event RedeemFeeUpdated(ISetToken indexed _setToken, uint256 _newRedeemFee);

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

    uint256 private constant ISSUANCE_MODULE_PROTOCOL_FEE_SPLIT_INDEX = 0;

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

    mapping(ISetToken => IssuanceSettings) public issuanceSettings;

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

    constructor(IController _controller) public ModuleBase(_controller) {}

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

    /**
     * Deposits components to the SetToken, replicates any external module component positions and mints 
     * the SetToken. If the token has a debt position all collateral will be transferred in first then debt
     * will be returned to the minting address. If specified, a fee will be charged on issuance.
     *
     * @param _setToken         Instance of the SetToken to issue
     * @param _quantity         Quantity of SetToken to issue
     * @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 = _callManagerPreIssueHooks(_setToken, _quantity, msg.sender, _to);

        _callModulePreIssueHooks(_setToken, _quantity);

        (
            uint256 quantityWithFees,
            uint256 managerFee,
            uint256 protocolFee
        ) = calculateTotalFees(_setToken, _quantity, true);

        (
            address[] memory components,
            uint256[] memory equityUnits,
            uint256[] memory debtUnits
        ) = _calculateRequiredComponentIssuanceUnits(_setToken, quantityWithFees, true);

        _resolveEquityPositions(_setToken, quantityWithFees, _to, true, components, equityUnits);
        _resolveDebtPositions(_setToken, quantityWithFees, true, components, debtUnits);
        _resolveFees(_setToken, managerFee, protocolFee);

        _setToken.mint(_to, _quantity);

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

    /**
     * Returns components from the SetToken, unwinds any external module component positions and burns 
     * the SetToken. If the token has a debt position all debt will be paid down first then equity positions
     * will be returned to the minting address. If specified, a fee will be charged on redeem.
     *
     * @param _setToken         Instance of the SetToken to redeem
     * @param _quantity         Quantity of SetToken to redeem
     * @param _to               Address to send collateral to
     */
    function redeem(
        ISetToken _setToken,
        uint256 _quantity,
        address _to
    )
        external
        nonReentrant
        onlyValidAndInitializedSet(_setToken)
    {
        require(_quantity > 0, "Redeem quantity must be > 0");

        _callModulePreRedeemHooks(_setToken, _quantity);

        // Place burn after pre-redeem hooks because burning tokens may lead to false accounting of synced positions
        _setToken.burn(msg.sender, _quantity);

        (
            uint256 quantityNetFees,
            uint256 managerFee,
            uint256 protocolFee
        ) = calculateTotalFees(_setToken, _quantity, false);

        (
            address[] memory components,
            uint256[] memory equityUnits,
            uint256[] memory debtUnits
        ) = _calculateRequiredComponentIssuanceUnits(_setToken, quantityNetFees, false);

        _resolveDebtPositions(_setToken, quantityNetFees, false, components, debtUnits);
        _resolveEquityPositions(_setToken, quantityNetFees, _to, false, components, equityUnits);
        _resolveFees(_setToken, managerFee, protocolFee);

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

    /**
     * MANAGER ONLY: Updates address receiving issue/redeem fees for a given SetToken.
     *
     * @param _setToken             Instance of the SetToken to update fee recipient
     * @param _newFeeRecipient      New fee recipient address
     */
    function updateFeeRecipient(
        ISetToken _setToken,
        address _newFeeRecipient
    )
        external
        onlyManagerAndValidSet(_setToken)
    {
        require(_newFeeRecipient != address(0), "Fee Recipient must be non-zero address.");
        require(_newFeeRecipient != issuanceSettings[_setToken].feeRecipient, "Same fee recipient passed");

        issuanceSettings[_setToken].feeRecipient = _newFeeRecipient;

        emit FeeRecipientUpdated(_setToken, _newFeeRecipient);
    }

    /**
     * MANAGER ONLY: Updates issue fee for passed SetToken
     *
     * @param _setToken             Instance of the SetToken to update issue fee
     * @param _newIssueFee          New fee amount in preciseUnits (1% = 10^16)
     */
    function updateIssueFee(
        ISetToken _setToken,
        uint256 _newIssueFee
    )
        external
        onlyManagerAndValidSet(_setToken)
    {
        require(_newIssueFee <= issuanceSettings[_setToken].maxManagerFee, "Issue fee can't exceed maximum");
        require(_newIssueFee != issuanceSettings[_setToken].managerIssueFee, "Same issue fee passed");

        issuanceSettings[_setToken].managerIssueFee = _newIssueFee;

        emit IssueFeeUpdated(_setToken, _newIssueFee);
    }

    /**
     * MANAGER ONLY: Updates redeem fee for passed SetToken
     *
     * @param _setToken             Instance of the SetToken to update redeem fee
     * @param _newRedeemFee         New fee amount in preciseUnits (1% = 10^16)
     */
    function updateRedeemFee(
        ISetToken _setToken,
        uint256 _newRedeemFee
    )
        external
        onlyManagerAndValidSet(_setToken)
    {
        require(_newRedeemFee <= issuanceSettings[_setToken].maxManagerFee, "Redeem fee can't exceed maximum");
        require(_newRedeemFee != issuanceSettings[_setToken].managerRedeemFee, "Same redeem fee passed");

        issuanceSettings[_setToken].managerRedeemFee = _newRedeemFee;

        emit RedeemFeeUpdated(_setToken, _newRedeemFee);
    }

    /**
     * MODULE ONLY: Adds calling module to array of modules that require they be called before component hooks are
     * called. Can be used to sync debt positions before issuance.
     *
     * @param _setToken             Instance of the SetToken to issue
     */
    function registerToIssuanceModule(ISetToken _setToken) external onlyModule(_setToken) onlyValidAndInitializedSet(_setToken) {
        require(!issuanceSettings[_setToken].isModuleHook[msg.sender], "Module already registered.");
        issuanceSettings[_setToken].moduleIssuanceHooks.push(msg.sender);
        issuanceSettings[_setToken].isModuleHook[msg.sender] = true;
    }

    /**
     * MODULE ONLY: Removes calling module from array of modules that require they be called before component hooks are
     * called.
     *
     * @param _setToken             Instance of the SetToken to issue
     */
    function unregisterFromIssuanceModule(ISetToken _setToken) external onlyModule(_setToken) onlyValidAndInitializedSet(_setToken) {
        require(issuanceSettings[_setToken].isModuleHook[msg.sender], "Module not registered.");
        issuanceSettings[_setToken].moduleIssuanceHooks.removeStorage(msg.sender);
        issuanceSettings[_setToken].isModuleHook[msg.sender] = false;
    }

    /**
     * MANAGER ONLY: Initializes this module to the SetToken with issuance-related hooks and fee information. 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 _maxManagerFee                Maximum fee that can be charged on issue and redeem
     * @param _managerIssueFee              Fee to charge on issuance
     * @param _managerRedeemFee             Fee to charge on redemption
     * @param _feeRecipient                 Address to send fees to
     * @param _managerIssuanceHook          Instance of the Manager Contract with the Pre-Issuance Hook function
     */
    function initialize(
        ISetToken _setToken,
        uint256 _maxManagerFee,
        uint256 _managerIssueFee,
        uint256 _managerRedeemFee,
        address _feeRecipient,
        IManagerIssuanceHook _managerIssuanceHook
    )
        external
        onlySetManager(_setToken, msg.sender)
        onlyValidAndPendingSet(_setToken)
    {
        require(_managerIssueFee <= _maxManagerFee, "Issue fee can't exceed maximum fee");
        require(_managerRedeemFee <= _maxManagerFee, "Redeem fee can't exceed maximum fee");

        issuanceSettings[_setToken] = IssuanceSettings({
            maxManagerFee: _maxManagerFee,
            managerIssueFee: _managerIssueFee,
            managerRedeemFee: _managerRedeemFee,
            feeRecipient: _feeRecipient,
            managerIssuanceHook: _managerIssuanceHook,
            moduleIssuanceHooks: new address[](0)
        });

        _setToken.initializeModule();
    }

    /**
     * SET TOKEN ONLY: Allows removal of module (and deletion of state) if no other modules are registered.
     */
    function removeModule() external override {
        require(issuanceSettings[ISetToken(msg.sender)].moduleIssuanceHooks.length == 0, "Registered modules must be removed.");
        delete issuanceSettings[ISetToken(msg.sender)];
    }

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

    /**
     * Calculates the manager fee, protocol fee and resulting totalQuantity to use when calculating unit amounts. If fees are charged they
     * are added to the total issue quantity, for example 1% fee on 100 Sets means 101 Sets are minted by caller, the _to address receives
     * 100 and the feeRecipient receives 1. Conversely, on redemption the redeemer will only receive the collateral that collateralizes 99
     * Sets, while the additional Set is given to the feeRecipient.
     *
     * @param _setToken                 Instance of the SetToken to issue
     * @param _quantity                 Amount of SetToken issuer wants to receive/redeem
     * @param _isIssue                  If issuing or redeeming
     *
     * @return totalQuantity           Total amount of Sets to be issued/redeemed with fee adjustment
     * @return managerFee              Sets minted to the manager
     * @return protocolFee             Sets minted to the protocol
     */
    function calculateTotalFees(
        ISetToken _setToken,
        uint256 _quantity,
        bool _isIssue
    )
        public
        view
        returns (uint256 totalQuantity, uint256 managerFee, uint256 protocolFee)
    {
        IssuanceSettings memory setIssuanceSettings = issuanceSettings[_setToken];
        uint256 protocolFeeSplit = controller.getModuleFee(address(this), ISSUANCE_MODULE_PROTOCOL_FEE_SPLIT_INDEX);
        uint256 totalFeeRate = _isIssue ? setIssuanceSettings.managerIssueFee : setIssuanceSettings.managerRedeemFee;
        
        uint256 totalFee = totalFeeRate.preciseMul(_quantity);
        protocolFee = totalFee.preciseMul(protocolFeeSplit);
        managerFee = totalFee.sub(protocolFee);

        totalQuantity = _isIssue ? _quantity.add(totalFee) : _quantity.sub(totalFee);
    }

    /**
     * Calculates the amount of each component needed to collateralize passed issue quantity plus fees of Sets as well as amount of debt
     * that will be returned to caller. Values DO NOT take into account any updates from pre action manager or module hooks.
     *
     * @param _setToken         Instance of the SetToken to issue
     * @param _quantity         Amount of Sets to be issued
     *
     * @return address[]        Array of component addresses making up the Set
     * @return uint256[]        Array of equity notional amounts of each component, respectively, represented as uint256
     * @return uint256[]        Array of debt notional amounts of each component, respectively, represented as uint256
     */
    function getRequiredComponentIssuanceUnits(
        ISetToken _setToken,
        uint256 _quantity
    )
        external
        view
        returns (address[] memory, uint256[] memory, uint256[] memory)
    {
        (
            uint256 totalQuantity,,
        ) = calculateTotalFees(_setToken, _quantity, true);

        return _calculateRequiredComponentIssuanceUnits(_setToken, totalQuantity, true);
    }

    /**
     * Calculates the amount of each component will be returned on redemption net of fees as well as how much debt needs to be paid down to.
     * redeem. Values DO NOT take into account any updates from pre action manager or module hooks.
     *
     * @param _setToken         Instance of the SetToken to issue
     * @param _quantity         Amount of Sets to be redeemed
     *
     * @return address[]        Array of component addresses making up the Set
     * @return uint256[]        Array of equity notional amounts of each component, respectively, represented as uint256
     * @return uint256[]        Array of debt notional amounts of each component, respectively, represented as uint256
     */
    function getRequiredComponentRedemptionUnits(
        ISetToken _setToken,
        uint256 _quantity
    )
        external
        view
        returns (address[] memory, uint256[] memory, uint256[] memory)
    {
        (
            uint256 totalQuantity,,
        ) = calculateTotalFees(_setToken, _quantity, false);

        return _calculateRequiredComponentIssuanceUnits(_setToken, totalQuantity, false);
    }

    function getModuleIssuanceHooks(ISetToken _setToken) external view returns(address[] memory) {
        return issuanceSettings[_setToken].moduleIssuanceHooks;
    }

    function isModuleIssuanceHook(ISetToken _setToken, address _hook) external view returns(bool) {
        return issuanceSettings[_setToken].isModuleHook[_hook];
    }

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

    /**
     * Calculates the amount of each component needed to collateralize passed issue quantity of Sets as well as amount of debt that will
     * be returned to caller. Can also be used to determine how much collateral will be returned on redemption as well as how much debt
     * needs to be paid down to redeem.
     *
     * @param _setToken         Instance of the SetToken to issue
     * @param _quantity         Amount of Sets to be issued/redeemed
     * @param _isIssue          Whether Sets are being issued or redeemed
     *
     * @return address[]        Array of component addresses making up the Set
     * @return uint256[]        Array of equity notional amounts of each component, respectively, represented as uint256
     * @return uint256[]        Array of debt notional amounts of each component, respectively, represented as uint256
     */
    function _calculateRequiredComponentIssuanceUnits(
        ISetToken _setToken,
        uint256 _quantity,
        bool _isIssue
    )
        internal
        view
        returns (address[] memory, uint256[] memory, uint256[] memory)
    {
        (
            address[] memory components,
            uint256[] memory equityUnits,
            uint256[] memory debtUnits
        ) = _getTotalIssuanceUnits(_setToken);

        uint256 componentsLength = components.length;
        uint256[] memory totalEquityUnits = new uint256[](componentsLength);
        uint256[] memory totalDebtUnits = new uint256[](componentsLength);
        for (uint256 i = 0; i < components.length; i++) {
            // Use preciseMulCeil to round up to ensure overcollateration when small issue quantities are provided
            // and preciseMul to round down to ensure overcollateration when small redeem quantities are provided
            totalEquityUnits[i] = _isIssue ?
                equityUnits[i].preciseMulCeil(_quantity) :
                equityUnits[i].preciseMul(_quantity);

            totalDebtUnits[i] = _isIssue ?
                debtUnits[i].preciseMul(_quantity) :
                debtUnits[i].preciseMulCeil(_quantity);
        }

        return (components, totalEquityUnits, totalDebtUnits);
    }

    /**
     * Sums total debt and equity units for each component, taking into account default and external positions.
     *
     * @param _setToken         Instance of the SetToken to issue
     *
     * @return address[]        Array of component addresses making up the Set
     * @return uint256[]        Array of equity unit amounts of each component, respectively, represented as uint256
     * @return uint256[]        Array of debt unit amounts of each component, respectively, represented as uint256
     */
    function _getTotalIssuanceUnits(
        ISetToken _setToken
    )
        internal
        view
        returns (address[] memory, uint256[] memory, uint256[] memory)
    {
        address[] memory components = _setToken.getComponents();
        uint256 componentsLength = components.length;

        uint256[] memory equityUnits = new uint256[](componentsLength);
        uint256[] memory debtUnits = new uint256[](componentsLength);

        for (uint256 i = 0; i < components.length; i++) {
            address component = components[i];
            int256 cumulativeEquity = _setToken.getDefaultPositionRealUnit(component);
            int256 cumulativeDebt = 0;
            address[] memory externalPositions = _setToken.getExternalPositionModules(component);

            if (externalPositions.length > 0) {
                for (uint256 j = 0; j < externalPositions.length; j++) { 
                    int256 externalPositionUnit = _setToken.getExternalPositionRealUnit(component, externalPositions[j]);

                    // If positionUnit <= 0 it will be "added" to debt position
                    if (externalPositionUnit > 0) {
                        cumulativeEquity = cumulativeEquity.add(externalPositionUnit);
                    } else {
                        cumulativeDebt = cumulativeDebt.add(externalPositionUnit);
                    }
                }
            }

            equityUnits[i] = cumulativeEquity.toUint256();
            debtUnits[i] = cumulativeDebt.mul(-1).toUint256();
        }

        return (components, equityUnits, debtUnits);
    }

    /**
     * Resolve equity positions associated with SetToken. On issuance, the total equity position for an asset (including default and external
     * positions) is transferred in. Then any external position hooks are called to transfer the external positions to their necessary place.
     * On redemption all external positions are recalled by the external position hook, then those position plus any default position are
     * transferred back to the _to address.
     */
    function _resolveEquityPositions(
        ISetToken _setToken,
        uint256 _quantity,
        address _to,
        bool _isIssue,
        address[] memory _components,
        uint256[] memory _componentEquityQuantities
    )
        internal
    {
        for (uint256 i = 0; i < _components.length; i++) {
            address component = _components[i];
            uint256 componentQuantity = _componentEquityQuantities[i];
            if (componentQuantity > 0) {
                if (_isIssue) {
                    transferFrom(
                        IERC20(component),
                        msg.sender,
                        address(_setToken),
                        componentQuantity
                    );

                    _executeExternalPositionHooks(_setToken, _quantity, IERC20(component), true, true);
                } else {
                    _executeExternalPositionHooks(_setToken, _quantity, IERC20(component), false, true);

                    _setToken.strictInvokeTransfer(
                        component,
                        _to,
                        componentQuantity
                    );
                }
            }
        }
    }

    /**
     * Resolve debt positions associated with SetToken. On issuance, debt positions are entered into by calling the external position hook. The
     * resulting debt is then returned to the calling address. On redemption, the module transfers in the required debt amount from the caller
     * and uses those funds to repay the debt on behalf of the SetToken.
     */
    function _resolveDebtPositions(
        ISetToken _setToken,
        uint256 _quantity,
        bool _isIssue,
        address[] memory _components,
        uint256[] memory _componentDebtQuantities
    )
        internal
    {
        for (uint256 i = 0; i < _components.length; i++) {
            address component = _components[i];
            uint256 componentQuantity = _componentDebtQuantities[i];
            if (componentQuantity > 0) {
                if (_isIssue) {
                    _executeExternalPositionHooks(_setToken, _quantity, IERC20(component), true, false);
                    _setToken.strictInvokeTransfer(
                        component,
                        msg.sender,
                        componentQuantity
                    );
                } else {
                    transferFrom(
                        IERC20(component),
                        msg.sender,
                        address(_setToken),
                        componentQuantity
                    );
                    _executeExternalPositionHooks(_setToken, _quantity, IERC20(component), false, false);
                }
            }
        }
    }

    /**
     * If any manager fees mints Sets to the defined feeRecipient. If protocol fee is enabled mints Sets to protocol
     * feeRecipient. 
     */
    function _resolveFees(ISetToken _setToken, uint256 managerFee, uint256 protocolFee) internal {
        if (managerFee > 0) {
            _setToken.mint(issuanceSettings[_setToken].feeRecipient, managerFee);

            // Protocol fee check is inside manager fee check because protocol fees are only collected on manager fees
            if (protocolFee > 0) {
                _setToken.mint(controller.feeRecipient(), protocolFee);
            }
        }
    }

    /**
     * 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 _callManagerPreIssueHooks(
        ISetToken _setToken,
        uint256 _quantity,
        address _caller,
        address _to
    )
        internal
        returns(address)
    {
        IManagerIssuanceHook preIssueHook = issuanceSettings[_setToken].managerIssuanceHook;
        if (address(preIssueHook) != address(0)) {
            preIssueHook.invokePreIssueHook(_setToken, _quantity, _caller, _to);
            return address(preIssueHook);
        }

        return address(0);
    }
    
    /**
     * Calls all modules that have registered with the DebtIssuanceModule that have a moduleIssueHook.
     */
    function _callModulePreIssueHooks(ISetToken _setToken, uint256 _quantity) internal {
        address[] memory issuanceHooks = issuanceSettings[_setToken].moduleIssuanceHooks;
        for (uint256 i = 0; i < issuanceHooks.length; i++) {
            IModuleIssuanceHook(issuanceHooks[i]).moduleIssueHook(_setToken, _quantity);
        }
    }

    /**
     * Calls all modules that have registered with the DebtIssuanceModule that have a moduleRedeemHook.
     */
    function _callModulePreRedeemHooks(ISetToken _setToken, uint256 _quantity) internal {
        address[] memory issuanceHooks = issuanceSettings[_setToken].moduleIssuanceHooks;
        for (uint256 i = 0; i < issuanceHooks.length; i++) {
            IModuleIssuanceHook(issuanceHooks[i]).moduleRedeemHook(_setToken, _quantity);
        }
    }

    /**
     * For each component's external module positions, calculate the total notional quantity, and 
     * call the module's issue hook or redeem hook.
     * Note: It is possible that these hooks can cause the states of other modules to change.
     * It can be problematic if the hook called an external function that called back into a module, resulting in state inconsistencies.
     */
    function _executeExternalPositionHooks(
        ISetToken _setToken,
        uint256 _setTokenQuantity,
        IERC20 _component,
        bool _isIssue,
        bool _isEquity
    )
        internal
    {
        address[] memory externalPositionModules = _setToken.getExternalPositionModules(address(_component));
        uint256 modulesLength = externalPositionModules.length;
        if (_isIssue) {
            for (uint256 i = 0; i < modulesLength; i++) {
                IModuleIssuanceHook(externalPositionModules[i]).componentIssueHook(_setToken, _setTokenQuantity, _component, _isEquity);
            }
        } else {
            for (uint256 i = 0; i < modulesLength; i++) {
                IModuleIssuanceHook(externalPositionModules[i]).componentRedeemHook(_setToken, _setTokenQuantity, _component, _isEquity);
            }
        }
    }
}

Contract ABI

[{"inputs":[{"internalType":"contract IController","name":"_controller","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"indexed":false,"internalType":"address","name":"_newFeeRecipient","type":"address"}],"name":"FeeRecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_newIssueFee","type":"uint256"}],"name":"IssueFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_newRedeemFee","type":"uint256"}],"name":"RedeemFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ISetToken","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"},{"indexed":false,"internalType":"uint256","name":"_managerFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_protocolFee","type":"uint256"}],"name":"SetTokenIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ISetToken","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"},{"indexed":false,"internalType":"uint256","name":"_managerFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_protocolFee","type":"uint256"}],"name":"SetTokenRedeemed","type":"event"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bool","name":"_isIssue","type":"bool"}],"name":"calculateTotalFees","outputs":[{"internalType":"uint256","name":"totalQuantity","type":"uint256"},{"internalType":"uint256","name":"managerFee","type":"uint256"},{"internalType":"uint256","name":"protocolFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"}],"name":"getModuleIssuanceHooks","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"getRequiredComponentIssuanceUnits","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"getRequiredComponentRedemptionUnits","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_maxManagerFee","type":"uint256"},{"internalType":"uint256","name":"_managerIssueFee","type":"uint256"},{"internalType":"uint256","name":"_managerRedeemFee","type":"uint256"},{"internalType":"address","name":"_feeRecipient","type":"address"},{"internalType":"contract IManagerIssuanceHook","name":"_managerIssuanceHook","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"address","name":"_hook","type":"address"}],"name":"isModuleIssuanceHook","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"","type":"address"}],"name":"issuanceSettings","outputs":[{"internalType":"uint256","name":"maxManagerFee","type":"uint256"},{"internalType":"uint256","name":"managerIssueFee","type":"uint256"},{"internalType":"uint256","name":"managerRedeemFee","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"contract IManagerIssuanceHook","name":"managerIssuanceHook","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":"issue","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":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"}],"name":"registerToIssuanceModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"removeModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"}],"name":"unregisterFromIssuanceModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"address","name":"_newFeeRecipient","type":"address"}],"name":"updateFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_newIssueFee","type":"uint256"}],"name":"updateIssueFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"uint256","name":"_newRedeemFee","type":"uint256"}],"name":"updateRedeemFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620038de380380620038de83398101604081905262000034916200005e565b600080546001600160a01b0319166001600160a01b0392909216919091179055600180556200008e565b60006020828403121562000070578081fd5b81516001600160a01b038116811462000087578182fd5b9392505050565b613840806200009e6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c8063847ef08d11610097578063cd3c753911610066578063cd3c753914610221578063d9b1b6e014610245578063e079962014610258578063f77c47911461026b57610100565b8063847ef08d146101d15780638dda4037146101d9578063bf9fe138146101fb578063cb38b2231461020e57610100565b806363082446116100d357806363082446146101785780636b8e53b6146101985780636d78f47a146101ab5780636dd86aa9146101be57610100565b806308bc0e1114610105578063131e26b91461012e5780635c833bfd146101505780635d98c37314610165575b600080fd5b610118610113366004612ccc565b610280565b6040516101259190612fda565b60405180910390f35b61014161013c366004612d20565b6102f9565b60405161012593929190612fed565b61016361015e366004612d4b565b61032a565b005b610163610173366004612ce8565b6104ca565b61018b610186366004612ce8565b6105ec565b6040516101259190613024565b6101416101a6366004612d20565b610620565b6101636101b9366004612d4b565b610643565b6101636101cc366004612d20565b6107ed565b6101636108fb565b6101ec6101e7366004612d8c565b61097e565b6040516101259392919061374f565b610163610209366004612dc2565b610b54565b61016361021c366004612d20565b610daa565b61023461022f366004612ccc565b610eb7565b604051610125959493929190613765565b610163610253366004612ccc565b610ef3565b610163610266366004612ccc565b611100565b61027361130b565b6040516101259190612f19565b6001600160a01b0381166000908152600260209081526040918290206005018054835181840281018401909452808452606093928301828280156102ed57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116102cf575b50505050509050919050565b6060806060600061030c8686600161097e565b5050905061031c8682600161131a565b935093509350509250925092565b600260015414156103565760405162461bcd60e51b815260040161034d906136cc565b60405180910390fd5b60026001558261036581611499565b6103815760405162461bcd60e51b815260040161034d9061312d565b600083116103a15760405162461bcd60e51b815260040161034d906131a5565b6103ab848461159d565b604051632770a7eb60e21b81526001600160a01b03851690639dc29fac906103d99033908790600401612f2d565b600060405180830381600087803b1580156103f357600080fd5b505af1158015610407573d6000803e3d6000fd5b50505050600080600061041c8787600061097e565b92509250925060608060606104338a87600061131a565b9250925092506104478a87600086856116a4565b6104568a878a6000878761174a565b6104618a86866117f1565b876001600160a01b0316336001600160a01b03168b6001600160a01b03167f54f4ed50e49638053e1655b45ee7ece434edd150e6771ac0aaedb8355be13a338c89896040516104b29392919061374f565b60405180910390a45050600180555050505050505050565b816104d5813361195c565b6104f15760405162461bcd60e51b815260040161034d90613608565b6104fa81611499565b6105165760405162461bcd60e51b815260040161034d9061312d565b6001600160a01b03821661053c5760405162461bcd60e51b815260040161034d906134cc565b6001600160a01b038084166000908152600260205260409020600301548382169116141561057c5760405162461bcd60e51b815260040161034d90613495565b6001600160a01b038381166000818152600260205260409081902060030180546001600160a01b0319169386169390931790925590517faaebcf1bfa00580e41d966056b48521fa9f202645c86d4ddf28113e617c1b1d3906105df908590612f19565b60405180910390a2505050565b6001600160a01b038083166000908152600260209081526040808320938516835260069093019052205460ff165b92915050565b606080606060006106338686600061097e565b5050905061031c8682600061131a565b600260015414156106665760405162461bcd60e51b815260040161034d906136cc565b60026001558261067581611499565b6106915760405162461bcd60e51b815260040161034d9061312d565b600083116106b15760405162461bcd60e51b815260040161034d90613281565b60006106bf858533866119ea565b90506106cb8585611a8b565b60008060006106dc8888600161097e565b92509250925060608060606106f38b87600161131a565b9250925092506107088b878b6001878761174a565b6107168b87600186856116a4565b6107218b86866117f1565b6040516340c10f1960e01b81526001600160a01b038c16906340c10f199061074f908c908e90600401612f2d565b600060405180830381600087803b15801561076957600080fd5b505af115801561077d573d6000803e3d6000fd5b50505050886001600160a01b0316336001600160a01b03168c6001600160a01b03167f1abc43bc3dd8b6c8bb9bcf1a14a84f83981bf5335700ef07758efefcb03a8c758a8e8a8a6040516107d49493929190612fb4565b60405180910390a4505060018055505050505050505050565b816107f8813361195c565b6108145760405162461bcd60e51b815260040161034d90613608565b61081d81611499565b6108395760405162461bcd60e51b815260040161034d9061312d565b6001600160a01b0383166000908152600260205260409020548211156108715760405162461bcd60e51b815260040161034d906130c6565b6001600160a01b038316600090815260026020819052604090912001548214156108ad5760405162461bcd60e51b815260040161034d906130fd565b6001600160a01b03831660008181526002602081905260409182902001849055517f676eda176d6aa20e9aa09b9ee131487c90646cd2b951176f75bd6fccdc026177906105df908590613746565b336000908152600260205260409020600501541561092b5760405162461bcd60e51b815260040161034d90613689565b3360009081526002602081905260408220828155600181018390559081018290556003810180546001600160a01b031990811690915560048201805490911690559061097a6005830182612a47565b5050565b600080600061098b612a68565b6001600160a01b03808816600090815260026020818152604092839020835160c0810185528154815260018201548184015292810154838501526003810154851660608401526004810154909416608083015260058401805484518184028101840190955280855292949360a08601939092830182828015610a3657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a18575b5050509190925250506000805460405163792aa04f60e01b815293945090926001600160a01b03909116915063792aa04f90610a789030908590600401612f2d565b60206040518083038186803b158015610a9057600080fd5b505afa158015610aa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac89190612e47565b9050600086610adb578260400151610ae1565b82602001515b90506000610af5828a63ffffffff611b8c16565b9050610b07818463ffffffff611b8c16565b9450610b19818663ffffffff611bbd16565b955087610b3557610b30898263ffffffff611bbd16565b610b45565b610b45898263ffffffff611bff16565b96505050505093509350939050565b8533610b60828261195c565b610b7c5760405162461bcd60e51b815260040161034d90613608565b600054604051631d3af8fb60e21b815289916001600160a01b0316906374ebe3ec90610bac908490600401612f19565b60206040518083038186803b158015610bc457600080fd5b505afa158015610bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfc9190612c24565b610c185760405162461bcd60e51b815260040161034d906135c5565b610c2181611c24565b610c3d5760405162461bcd60e51b815260040161034d90613213565b87871115610c5d5760405162461bcd60e51b815260040161034d9061341c565b87861115610c7d5760405162461bcd60e51b815260040161034d90613703565b6040805160c08101825289815260208082018a90528183018990526001600160a01b0388811660608401528716608083015282516000808252918101909352909160a08301915090526001600160a01b03808b1660009081526002602081815260409283902085518155858201516001820155928501519183019190915560608401516003830180549185166001600160a01b031992831617905560808501516004840180549190951691161790925560a083015180519192610d4892600585019290910190612ab0565b50905050886001600160a01b0316630ffe0f1e6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d8757600080fd5b505af1158015610d9b573d6000803e3d6000fd5b50505050505050505050505050565b81610db5813361195c565b610dd15760405162461bcd60e51b815260040161034d90613608565b610dda81611499565b610df65760405162461bcd60e51b815260040161034d9061312d565b6001600160a01b038316600090815260026020526040902054821115610e2e5760405162461bcd60e51b815260040161034d9061324a565b6001600160a01b038316600090815260026020526040902060010154821415610e695760405162461bcd60e51b815260040161034d906133a6565b6001600160a01b03831660008181526002602052604090819020600101849055517fd1de57b1db6a29967f337d6f744b7811624dabf2be924c65708336a81678d077906105df908590613746565b60026020819052600091825260409091208054600182015492820154600383015460049093015491939290916001600160a01b03918216911685565b806002604051631ade272960e11b81526001600160a01b038316906335bc4e5290610f22903390600401612f19565b60206040518083038186803b158015610f3a57600080fd5b505afa158015610f4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f729190612e28565b6002811115610f7d57fe5b14610f9a5760405162461bcd60e51b815260040161034d9061332e565b6000546040516342f6e38960e01b81526001600160a01b03909116906342f6e38990610fca903390600401612f19565b60206040518083038186803b158015610fe257600080fd5b505afa158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190612c24565b6110365760405162461bcd60e51b815260040161034d90613581565b8161104081611499565b61105c5760405162461bcd60e51b815260040161034d9061312d565b6001600160a01b038316600090815260026020908152604080832033845260060190915290205460ff16156110a35760405162461bcd60e51b815260040161034d9061354a565b50506001600160a01b03166000908152600260209081526040808320600581018054600181810183559186528486200180546001600160a01b0319163390811790915585526006909101909252909120805460ff19169091179055565b806002604051631ade272960e11b81526001600160a01b038316906335bc4e529061112f903390600401612f19565b60206040518083038186803b15801561114757600080fd5b505afa15801561115b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117f9190612e28565b600281111561118a57fe5b146111a75760405162461bcd60e51b815260040161034d9061332e565b6000546040516342f6e38960e01b81526001600160a01b03909116906342f6e389906111d7903390600401612f19565b60206040518083038186803b1580156111ef57600080fd5b505afa158015611203573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112279190612c24565b6112435760405162461bcd60e51b815260040161034d90613581565b8161124d81611499565b6112695760405162461bcd60e51b815260040161034d9061312d565b6001600160a01b038316600090815260026020908152604080832033845260060190915290205460ff166112af5760405162461bcd60e51b815260040161034d90613175565b6001600160a01b03831660009081526002602052604090206112da906005013363ffffffff611c5316565b50506001600160a01b031660009081526002602090815260408083203384526006019091529020805460ff19169055565b6000546001600160a01b031681565b60608060608060608061132c89611d7f565b8251929550909350915060608167ffffffffffffffff8111801561134f57600080fd5b50604051908082528060200260200182016040528015611379578160200160208202803683370190505b50905060608267ffffffffffffffff8111801561139557600080fd5b506040519080825280602002602001820160405280156113bf578160200160208202803683370190505b50905060005b8651811015611485578a6113fe576113f98c8783815181106113e357fe5b6020026020010151611b8c90919063ffffffff16565b611424565b6114248c87838151811061140e57fe5b602002602001015161211090919063ffffffff16565b83828151811061143057fe5b6020026020010181815250508a611456576114518c86838151811061140e57fe5b611466565b6114668c8683815181106113e357fe5b82828151811061147257fe5b60209081029190910101526001016113c5565b50949b909a50939850929650505050505050565b60008054604051631d3af8fb60e21b81526001600160a01b03909116906374ebe3ec906114ca908590600401612f19565b60206040518083038186803b1580156114e257600080fd5b505afa1580156114f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151a9190612c24565b801561061a57506040516335fc6c9f60e21b81526001600160a01b0383169063d7f1b27c9061154d903090600401612f19565b60206040518083038186803b15801561156557600080fd5b505afa158015611579573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061a9190612c24565b6001600160a01b03821660009081526002602090815260409182902060050180548351818402810184019094528084526060939283018282801561160a57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115ec575b50939450600093505050505b815181101561169e5781818151811061162b57fe5b60200260200101516001600160a01b0316633fe6106b85856040518363ffffffff1660e01b8152600401611660929190612f2d565b600060405180830381600087803b15801561167a57600080fd5b505af115801561168e573d6000803e3d6000fd5b5050600190920191506116169050565b50505050565b60005b82518110156117425760008382815181106116be57fe5b6020026020010151905060008383815181106116d657fe5b60200260200101519050600081111561173857851561171e576116fe88888460016000612167565b6117196001600160a01b03891683338463ffffffff61232116565b611738565b61172a82338a84612463565b611738888884600080612167565b50506001016116a7565b505050505050565b60005b82518110156117e857600083828151811061176457fe5b60200260200101519050600083838151811061177c57fe5b6020026020010151905060008111156117de5785156117b4576117a182338b84612463565b6117af898984600180612167565b6117de565b6117c389898460006001612167565b6117de6001600160a01b038a1683898463ffffffff61232116565b505060010161174d565b50505050505050565b8115611957576001600160a01b03808416600081815260026020526040908190206003015490516340c10f1960e01b815291926340c10f199261183c92909116908690600401612f2d565b600060405180830381600087803b15801561185657600080fd5b505af115801561186a573d6000803e3d6000fd5b50505050600081111561195757826001600160a01b03166340c10f196000809054906101000a90046001600160a01b03166001600160a01b031663469048406040518163ffffffff1660e01b815260040160206040518083038186803b1580156118d357600080fd5b505afa1580156118e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190b9190612b5d565b836040518363ffffffff1660e01b8152600401611929929190612f2d565b600060405180830381600087803b15801561194357600080fd5b505af11580156117e8573d6000803e3d6000fd5b505050565b6000816001600160a01b0316836001600160a01b031663481c6a756040518163ffffffff1660e01b815260040160206040518083038186803b1580156119a157600080fd5b505afa1580156119b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d99190612b5d565b6001600160a01b0316149392505050565b6001600160a01b038085166000908152600260205260408120600401549091168015611a7d5760405163a045808360e01b81526001600160a01b0382169063a045808390611a4290899089908990899060040161302f565b600060405180830381600087803b158015611a5c57600080fd5b505af1158015611a70573d6000803e3d6000fd5b5050505080915050611a83565b60009150505b949350505050565b6001600160a01b038216600090815260026020908152604091829020600501805483518184028101840190945280845260609392830182828015611af857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611ada575b50939450600093505050505b815181101561169e57818181518110611b1957fe5b60200260200101516001600160a01b031663c153dd0785856040518363ffffffff1660e01b8152600401611b4e929190612f2d565b600060405180830381600087803b158015611b6857600080fd5b505af1158015611b7c573d6000803e3d6000fd5b505060019092019150611b049050565b6000611bb6670de0b6b3a7640000611baa858563ffffffff61246f16565b9063ffffffff6124a916565b9392505050565b6000611bb683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124eb565b600082820183811015611bb65760405162461bcd60e51b815260040161034d906131dc565b6040516353bae5f760e01b81526000906001600160a01b038316906353bae5f79061154d903090600401612f19565b600080611cb984805480602002602001604051908101604052809291908181526020018280548015611cae57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611c90575b505050505084612517565b9150915080611cda5760405162461bcd60e51b815260040161034d90613097565b835460001901828114611d4c57848181548110611cf357fe5b9060005260206000200160009054906101000a90046001600160a01b0316858481548110611d1d57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b84805480611d5657fe5b600082815260209020810160001990810180546001600160a01b03191690550190555050505050565b606080606080846001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b158015611dbe57600080fd5b505afa158015611dd2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611dfa9190810190612b79565b805190915060608167ffffffffffffffff81118015611e1857600080fd5b50604051908082528060200260200182016040528015611e42578160200160208202803683370190505b50905060608267ffffffffffffffff81118015611e5e57600080fd5b50604051908082528060200260200182016040528015611e88578160200160208202803683370190505b50905060005b8451811015612100576000858281518110611ea557fe5b6020026020010151905060008a6001600160a01b03166366cb8d2f836040518263ffffffff1660e01b8152600401611edd9190612f19565b60206040518083038186803b158015611ef557600080fd5b505afa158015611f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2d9190612e47565b60405163a7bdad0360e01b81529091506000906060906001600160a01b038e169063a7bdad0390611f62908790600401612f19565b60006040518083038186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611fb69190810190612b79565b80519091501561209f5760005b815181101561209d5760008e6001600160a01b03166322ebeba487858581518110611fea57fe5b60200260200101516040518363ffffffff1660e01b815260040161200f929190612f46565b60206040518083038186803b15801561202757600080fd5b505afa15801561203b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205f9190612e47565b905060008113156120815761207a858263ffffffff61257d16565b9450612094565b612091848263ffffffff61257d16565b93505b50600101611fc3565b505b6120a8836125c3565b8786815181106120b457fe5b60209081029190910101526120d96120d48360001963ffffffff6125e916565b6125c3565b8686815181106120e557fe5b6020908102919091010152505060019092019150611e8e9050565b5092979096509194509092505050565b600082158061211d575081155b1561212a5750600061061a565b611bb6600161215b670de0b6b3a7640000611baa8361214f898963ffffffff61246f16565b9063ffffffff611bbd16565b9063ffffffff611bff16565b60405163a7bdad0360e01b81526060906001600160a01b0387169063a7bdad0390612196908790600401612f19565b60006040518083038186803b1580156121ae57600080fd5b505afa1580156121c2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121ea9190810190612b79565b805190915083156122895760005b818110156122835782818151811061220c57fe5b60200260200101516001600160a01b0316630fb96b21898989886040518563ffffffff1660e01b8152600401612245949392919061305a565b600060405180830381600087803b15801561225f57600080fd5b505af1158015612273573d6000803e3d6000fd5b5050600190920191506121f89050565b506117e8565b60005b81811015612317578281815181106122a057fe5b60200260200101516001600160a01b031663c137f4d7898989886040518563ffffffff1660e01b81526004016122d9949392919061305a565b600060405180830381600087803b1580156122f357600080fd5b505af1158015612307573d6000803e3d6000fd5b50506001909201915061228c9050565b5050505050505050565b801561169e576040516370a0823160e01b81526000906001600160a01b038516906370a0823190612356908890600401612f19565b60206040518083038186803b15801561236e57600080fd5b505afa158015612382573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123a69190612e47565b90506123b485858585612654565b6040516370a0823160e01b81526000906001600160a01b038616906370a08231906123e3908990600401612f19565b60206040518083038186803b1580156123fb57600080fd5b505afa15801561240f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124339190612e47565b9050612445828463ffffffff611bbd16565b81146117425760405162461bcd60e51b815260040161034d9061345e565b61169e84848484612721565b60008261247e5750600061061a565b8282028284828161248b57fe5b0414611bb65760405162461bcd60e51b815260040161034d90613365565b6000611bb683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612845565b6000818484111561250f5760405162461bcd60e51b815260040161034d9190613084565b505050900390565b81516000908190815b8181101561256a57846001600160a01b031686828151811061253e57fe5b60200260200101516001600160a01b03161415612562579250600191506125769050565b600101612520565b50600019600092509250505b9250929050565b60008282018183128015906125925750838112155b806125a757506000831280156125a757508381125b611bb65760405162461bcd60e51b815260040161034d906132b8565b6000808212156125e55760405162461bcd60e51b815260040161034d906132f9565b5090565b6000826125f85750600061061a565b8260001914801561260c5750600160ff1b82145b156126295760405162461bcd60e51b815260040161034d906133d5565b8282028284828161263657fe5b0514611bb65760405162461bcd60e51b815260040161034d906133d5565b801561169e576060828260405160240161266f929190612f2d565b60408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b179052516347b7819960e11b81529091506001600160a01b03861690638f6f0332906126cb9087906000908690600401612f84565b600060405180830381600087803b1580156126e557600080fd5b505af11580156126f9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117429190810190612c40565b801561169e576040516370a0823160e01b81526000906001600160a01b038616906370a0823190612756908690600401612f19565b60206040518083038186803b15801561276e57600080fd5b505afa158015612782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a69190612e47565b90506127b48585858561287c565b6040516370a0823160e01b81526000906001600160a01b038716906370a08231906127e3908790600401612f19565b60206040518083038186803b1580156127fb57600080fd5b505afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128339190612e47565b9050612445828463ffffffff611bff16565b600081836128665760405162461bcd60e51b815260040161034d9190613084565b50600083858161287257fe5b0495945050505050565b61169e846323b872dd60e01b85858560405160240161289d93929190612f60565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526060612924826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661295e9092919063ffffffff16565b80519091501561195757808060200190518101906129429190612c24565b6119575760405162461bcd60e51b815260040161034d9061363f565b6060611a8384846000858561297285612a08565b61298e5760405162461bcd60e51b815260040161034d90613513565b60006060866001600160a01b031685876040516129ab9190612efd565b60006040518083038185875af1925050503d80600081146129e8576040519150601f19603f3d011682016040523d82523d6000602084013e6129ed565b606091505b50915091506129fd828286612a0e565b979650505050505050565b3b151590565b60608315612a1d575081611bb6565b825115612a2d5782518084602001fd5b8160405162461bcd60e51b815260040161034d9190613084565b5080546000825590600052602060002090810190612a659190612b11565b50565b6040518060c0016040528060008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001606081525090565b828054828255906000526020600020908101928215612b05579160200282015b82811115612b0557825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612ad0565b506125e5929150612b2e565b612b2b91905b808211156125e55760008155600101612b17565b90565b612b2b91905b808211156125e55780546001600160a01b0319168155600101612b34565b805161061a816137e7565b600060208284031215612b6e578081fd5b8151611bb6816137e7565b60006020808385031215612b8b578182fd5b825167ffffffffffffffff80821115612ba2578384fd5b81850186601f820112612bb3578485fd5b8051925081831115612bc3578485fd5b8383029150612bd3848301613794565b8381528481019082860184840187018a1015612bed578788fd5b8794505b85851015612c1757612c038a82612b52565b835260019490940193918601918601612bf1565b5098975050505050505050565b600060208284031215612c35578081fd5b8151611bb6816137fc565b600060208284031215612c51578081fd5b815167ffffffffffffffff80821115612c68578283fd5b81840185601f820112612c79578384fd5b8051925081831115612c89578384fd5b612c9c601f8401601f1916602001613794565b9150828252856020848301011115612cb2578384fd5b612cc38360208401602084016137bb565b50949350505050565b600060208284031215612cdd578081fd5b8135611bb6816137e7565b60008060408385031215612cfa578081fd5b8235612d05816137e7565b91506020830135612d15816137e7565b809150509250929050565b60008060408385031215612d32578182fd5b8235612d3d816137e7565b946020939093013593505050565b600080600060608486031215612d5f578081fd5b8335612d6a816137e7565b9250602084013591506040840135612d81816137e7565b809150509250925092565b600080600060608486031215612da0578283fd5b8335612dab816137e7565b9250602084013591506040840135612d81816137fc565b60008060008060008060c08789031215612dda578182fd5b8635612de5816137e7565b95506020870135945060408701359350606087013592506080870135612e0a816137e7565b915060a0870135612e1a816137e7565b809150509295509295509295565b600060208284031215612e39578081fd5b815160038110611bb6578182fd5b600060208284031215612e58578081fd5b5051919050565b6000815180845260208085019450808401835b83811015612e975781516001600160a01b031687529582019590820190600101612e72565b509495945050505050565b6000815180845260208085019450808401835b83811015612e9757815187529582019590820190600101612eb5565b60008151808452612ee98160208601602086016137bb565b601f01601f19169290920160200192915050565b60008251612f0f8184602087016137bb565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060018060a01b038516825283602083015260606040830152612fab6060830184612ed1565b95945050505050565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b600060208252611bb66020830184612e5f565b6000606082526130006060830186612e5f565b82810360208401526130128186612ea2565b83810360408501526129fd8186612ea2565b901515815260200190565b6001600160a01b03948516815260208101939093529083166040830152909116606082015260800190565b6001600160a01b039485168152602081019390935292166040820152901515606082015260800190565b600060208252611bb66020830184612ed1565b60208082526015908201527420b2323932b9b9903737ba1034b71030b93930bc9760591b604082015260600190565b6020808252601f908201527f52656465656d206665652063616e277420657863656564206d6178696d756d00604082015260600190565b60208082526016908201527514d85b59481c995919595b48199959481c185cdcd95960521b604082015260600190565b60208082526028908201527f4d75737420626520612076616c696420616e6420696e697469616c697a65642060408201526729b2ba2a37b5b2b760c11b606082015260800190565b60208082526016908201527526b7b23ab632903737ba103932b3b4b9ba32b932b21760511b604082015260600190565b6020808252601b908201527f52656465656d207175616e74697479206d757374206265203e20300000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f4d7573742062652070656e64696e6720696e697469616c697a6174696f6e0000604082015260600190565b6020808252601e908201527f4973737565206665652063616e277420657863656564206d6178696d756d0000604082015260600190565b6020808252601a908201527f4973737565207175616e74697479206d757374206265203e2030000000000000604082015260600190565b60208082526021908201527f5369676e6564536166654d6174683a206164646974696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f53616665436173743a2076616c7565206d75737420626520706f736974697665604082015260600190565b60208082526018908201527f4f6e6c7920746865206d6f64756c652063616e2063616c6c0000000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526015908201527414d85b59481a5cdcdd5948199959481c185cdcd959605a1b604082015260600190565b60208082526027908201527f5369676e6564536166654d6174683a206d756c7469706c69636174696f6e206f604082015266766572666c6f7760c81b606082015260800190565b60208082526022908201527f4973737565206665652063616e277420657863656564206d6178696d756d2066604082015261656560f01b606082015260800190565b6020808252601d908201527f496e76616c696420706f7374207472616e736665722062616c616e6365000000604082015260600190565b60208082526019908201527f53616d652066656520726563697069656e742070617373656400000000000000604082015260600190565b60208082526027908201527f46656520526563697069656e74206d757374206265206e6f6e2d7a65726f206160408201526632323932b9b99760c91b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601a908201527f4d6f64756c6520616c726561647920726567697374657265642e000000000000604082015260600190565b60208082526024908201527f4d6f64756c65206d75737420626520656e61626c6564206f6e20636f6e74726f604082015263363632b960e11b606082015260800190565b60208082526023908201527f4d75737420626520636f6e74726f6c6c65722d656e61626c656420536574546f60408201526235b2b760e91b606082015260800190565b6020808252601c908201527f4d7573742062652074686520536574546f6b656e206d616e6167657200000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526023908201527f52656769737465726564206d6f64756c6573206d7573742062652072656d6f7660408201526232b21760e91b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526023908201527f52656465656d206665652063616e277420657863656564206d6178696d756d2060408201526266656560e81b606082015260800190565b90815260200190565b9283526020830191909152604082015260600190565b948552602085019390935260408401919091526001600160a01b03908116606084015216608082015260a00190565b60405181810167ffffffffffffffff811182821017156137b357600080fd5b604052919050565b60005b838110156137d65781810151838201526020016137be565b8381111561169e5750506000910152565b6001600160a01b0381168114612a6557600080fd5b8015158114612a6557600080fdfea2646970667358221220aa334002508aaca4c7f98ec7096740df91c2c08246bef101a6c3101f8c7f79c564736f6c634300060a00330000000000000000000000009048278ca7e874f9338e4898c436ab07aa454701

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

87674:27727:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;103677:166;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;102076:426;;;;;;;;;:::i;:::-;;;;;;;;;;92349:1339;;;;;;;;;:::i;:::-;;93959:514;;;;;;;;;:::i;103851:167::-;;;;;;;;;:::i;:::-;;;;;;;;103239:430;;;;;;;;;:::i;90473:1336::-;;;;;;;;;:::i;95499:521::-;;;;;;;;;:::i;99183:237::-;;;:::i;100483:837::-;;;;;;;;;:::i;:::-;;;;;;;;;;98091:957;;;;;;;;;:::i;94730:510::-;;;;;;;;;:::i;89684:62::-;;;;;;;;;:::i;:::-;;;;;;;;;;;;96309:380;;;;;;;;;:::i;96931:389::-;;;;;;;;;:::i;80267:29::-;;;:::i;:::-;;;;;;;;103677:166;-1:-1:-1;;;;;103788:27:0;;;;;;:16;:27;;;;;;;;;:47;;103781:54;;;;;;;;;;;;;;;;;103752:16;;103781:54;;;103788:47;103781:54;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;103781:54:0;;;;;;;;;;;;;;;;;;;;;;;103677:166;;;:::o;102076:426::-;102234:16;102252;102270;102319:21;102356:46;102375:9;102386;102397:4;102356:18;:46::i;:::-;102304:98;;;;102422:72;102463:9;102474:13;102489:4;102422:40;:72::i;:::-;102415:79;;;;;;;102076:426;;;;;:::o;92349:1339::-;4594:1;5200:7;;:19;;5192:63;;;;-1:-1:-1;;;5192:63:0;;;;;;;;;;;;;;;;;4594:1;5333:7;:18;92528:9;80872:35:::1;92528:9:::0;80872:24:::1;:35::i;:::-;80864:88;;;;-1:-1:-1::0;;;80864:88:0::1;;;;;;;;;92575:1:::2;92563:9;:13;92555:53;;;;-1:-1:-1::0;;;92555:53:0::2;;;;;;;;;92621:47;92647:9;92658;92621:25;:47::i;:::-;92799:37;::::0;-1:-1:-1;;;92799:37:0;;-1:-1:-1;;;;;92799:14:0;::::2;::::0;::::2;::::0;:37:::2;::::0;92814:10:::2;::::0;92826:9;;92799:37:::2;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;92864:23;92902:18:::0;92935:19:::2;92968:47;92987:9;92998;93009:5;92968:18;:47::i;:::-;92849:166;;;;;;93043:27;93085:28:::0;93128:26:::2;93168:75;93209:9;93220:15;93237:5;93168:40;:75::i;:::-;93028:215;;;;;;93256:79;93278:9;93289:15;93306:5;93313:10;93325:9;93256:21;:79::i;:::-;93346:88;93370:9;93381:15;93398:3;93403:5;93410:10;93422:11;93346:23;:88::i;:::-;93445:48;93458:9;93469:10;93481:11;93445:12;:48::i;:::-;93591:3;-1:-1:-1::0;;;;;93511:169:0::2;93566:10;-1:-1:-1::0;;;;;93511:169:0::2;93542:9;-1:-1:-1::0;;;;;93511:169:0::2;;93609:9;93633:10;93658:11;93511:169;;;;;;;;;;;;;;;;;-1:-1:-1::0;;4550:1:0;5512:22;;-1:-1:-1;;;;;;;;92349:1339:0:o;93959:514::-;94109:9;80427:35;80440:9;80451:10;80427:12;:35::i;:::-;80419:76;;;;-1:-1:-1;;;80419:76:0;;;;;;;;;80514:35;80539:9;80514:24;:35::i;:::-;80506:88;;;;-1:-1:-1;;;80506:88:0;;;;;;;;;-1:-1:-1;;;;;94144:30:0;::::1;94136:82;;;;-1:-1:-1::0;;;94136:82:0::1;;;;;;;;;-1:-1:-1::0;;;;;94257:27:0;;::::1;;::::0;;;:16:::1;:27;::::0;;;;:40:::1;;::::0;94237:60;;::::1;94257:40:::0;::::1;94237:60;;94229:98;;;;-1:-1:-1::0;;;94229:98:0::1;;;;;;;;;-1:-1:-1::0;;;;;94340:27:0;;::::1;;::::0;;;:16:::1;:27;::::0;;;;;;:40:::1;;:59:::0;;-1:-1:-1;;;;;;94340:59:0::1;::::0;;::::1;::::0;;;::::1;::::0;;;94417:48;;::::1;::::0;::::1;::::0;94340:59;;94417:48:::1;;;;;;;;;;93959:514:::0;;;:::o;103851:167::-;-1:-1:-1;;;;;103963:27:0;;;103939:4;103963:27;;;:16;:27;;;;;;;;:47;;;;;:40;;;;:47;;;;;;103851:167;;;;;:::o;103239:430::-;103399:16;103417;103435;103484:21;103521:47;103540:9;103551;103562:5;103521:18;:47::i;:::-;103469:99;;;;103588:73;103629:9;103640:13;103655:5;103588:40;:73::i;90473:1336::-;4594:1;5200:7;;:19;;5192:63;;;;-1:-1:-1;;;5192:63:0;;;;;;;;;4594:1;5333:7;:18;90651:9;80872:35:::1;90651:9:::0;80872:24:::1;:35::i;:::-;80864:88;;;;-1:-1:-1::0;;;80864:88:0::1;;;;;;;;;90698:1:::2;90686:9;:13;90678:52;;;;-1:-1:-1::0;;;90678:52:0::2;;;;;;;;;90743:20;90766:64;90792:9;90803;90814:10;90826:3;90766:25;:64::i;:::-;90743:87;;90843:46;90868:9;90879;90843:24;:46::i;:::-;90917:24;90956:18:::0;90989:19:::2;91022:46;91041:9;91052;91063:4;91022:18;:46::i;:::-;90902:166;;;;;;91096:27;91138:28:::0;91181:26:::2;91221:75;91262:9;91273:16;91291:4;91221:40;:75::i;:::-;91081:215;;;;;;91309:88;91333:9;91344:16;91362:3;91367:4;91373:10;91385:11;91309:23;:88::i;:::-;91408:79;91430:9;91441:16;91459:4;91465:10;91477:9;91408:21;:79::i;:::-;91498:48;91511:9;91522:10;91534:11;91498:12;:48::i;:::-;91559:30;::::0;-1:-1:-1;;;91559:30:0;;-1:-1:-1;;;;;91559:14:0;::::2;::::0;::::2;::::0;:30:::2;::::0;91574:3;;91579:9;;91559:30:::2;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;91685:3;-1:-1:-1::0;;;;;91607:194:0::2;91660:10;-1:-1:-1::0;;;;;91607:194:0::2;91636:9;-1:-1:-1::0;;;;;91607:194:0::2;;91703:12;91730:9;91754:10;91779:11;91607:194;;;;;;;;;;;;;;;;;;-1:-1:-1::0;;4550:1:0;5512:22;;-1:-1:-1;;;;;;;;;90473:1336:0:o;95499:521::-;95643:9;80427:35;80440:9;80451:10;80427:12;:35::i;:::-;80419:76;;;;-1:-1:-1;;;80419:76:0;;;;;;;;;80514:35;80539:9;80514:24;:35::i;:::-;80506:88;;;;-1:-1:-1;;;80506:88:0;;;;;;;;;-1:-1:-1;;;;;95695:27:0;::::1;;::::0;;;:16:::1;:27;::::0;;;;:41;95678:58;::::1;;95670:102;;;;-1:-1:-1::0;;;95670:102:0::1;;;;;;;;;-1:-1:-1::0;;;;;95808:27:0;::::1;;::::0;;;:16:::1;:27;::::0;;;;;;;:44:::1;::::0;95791:61;::::1;;95783:96;;;;-1:-1:-1::0;;;95783:96:0::1;;;;;;;;;-1:-1:-1::0;;;;;95892:27:0;::::1;;::::0;;;:16:::1;:27;::::0;;;;;;;;:44:::1;:60:::0;;;95970:42;::::1;::::0;::::1;::::0;95939:13;;95970:42:::1;;99183:237:::0;99271:10;99244:39;;;;:16;:39;;;;;:59;;:66;:71;99236:119;;;;-1:-1:-1;;;99236:119:0;;;;;;;;;99400:10;99373:39;;;;:16;:39;;;;;;;99366:46;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;99366:46:0;;;;;;;;;;;;;;;;99373:39;99366:46;;;;99373:39;99366:46;:::i;:::-;;;99183:237::o;100483:837::-;100648:21;100671:18;100691:19;100728:43;;:::i;:::-;-1:-1:-1;;;;;100774:27:0;;;;;;;:16;:27;;;;;;;;;100728:73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100774:27;100728:73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;100728:73:0;;;;;;;;;;;;;;;;-1:-1:-1;;;100728:73:0;;;;-1:-1:-1;;100812:24:0;100839:10;;:80;;-1:-1:-1;;;100839:80:0;;100728:73;;-1:-1:-1;100812:24:0;;-1:-1:-1;;;;;100839:10:0;;;;-1:-1:-1;100839:23:0;;:80;;100871:4;;100812:24;;100839:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100812:107;;100930:20;100953:8;:85;;101002:19;:36;;;100953:85;;;100964:19;:35;;;100953:85;100930:108;-1:-1:-1;101059:16:0;101078:34;100930:108;101102:9;101078:34;:23;:34;:::i;:::-;101059:53;-1:-1:-1;101137:37:0;101059:53;101157:16;101137:37;:19;:37;:::i;:::-;101123:51;-1:-1:-1;101198:25:0;:8;101123:51;101198:25;:12;:25;:::i;:::-;101185:38;;101252:8;:60;;101289:23;:9;101303:8;101289:23;:13;:23;:::i;:::-;101252:60;;;101263:23;:9;101277:8;101263:23;:13;:23;:::i;:::-;101236:76;;100483:837;;;;;;;;;;;:::o;98091:957::-;98378:9;98389:10;80703:32;80716:9;80727:7;80703:12;:32::i;:::-;80695:73;;;;-1:-1:-1;;;80695:73:0;;;;;;;;;81652:10:::1;::::0;:36:::1;::::0;-1:-1:-1;;;81652:36:0;;98433:9;;-1:-1:-1;;;;;81652:10:0::1;::::0;:16:::1;::::0;:36:::1;::::0;98433:9;;81652:36:::1;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;81644:84;;;;-1:-1:-1::0;;;81644:84:0::1;;;;;;;;;81747:37;81774:9;81747:26;:37::i;:::-;81739:80;;;;-1:-1:-1::0;;;81739:80:0::1;;;;;;;;;98488:14:::2;98468:16;:34;;98460:81;;;;-1:-1:-1::0;;;98460:81:0::2;;;;;;;;;98581:14;98560:17;:35;;98552:83;;;;-1:-1:-1::0;;;98552:83:0::2;;;;;;;;;98678:321;::::0;;::::2;::::0;::::2;::::0;;;;;::::2;::::0;;::::2;::::0;;;;;;;;;-1:-1:-1;;;;;98678:321:0;;::::2;::::0;;;;;::::2;::::0;;;;98971:16;;-1:-1:-1;98971:16:0;;;;;::::2;::::0;;;98678:321;;;;;;-1:-1:-1;98678:321:0;;-1:-1:-1;;;;;98648:27:0;;::::2;;::::0;;;:16:::2;:27;::::0;;;;;;;;:351;;;;;;::::2;::::0;::::2;::::0;::::2;::::0;;;::::2;::::0;;;::::2;::::0;;;;::::2;::::0;::::2;::::0;::::2;::::0;::::2;::::0;;;;::::2;-1:-1:-1::0;;;;;;98648:351:0;;::::2;;::::0;;::::2;::::0;::::2;::::0;::::2;::::0;::::2;::::0;;;;;::::2;::::0;::::2;;::::0;;;::::2;::::0;::::2;::::0;;;:27;;:351:::2;::::0;::::2;::::0;::::2;::::0;;;::::2;::::0;::::2;:::i;:::-;;;;;99012:9;-1:-1:-1::0;;;;;99012:26:0::2;;:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;80779:1:::1;98091:957:::0;;;;;;;;:::o;94730:510::-;94872:9;80427:35;80440:9;80451:10;80427:12;:35::i;:::-;80419:76;;;;-1:-1:-1;;;80419:76:0;;;;;;;;;80514:35;80539:9;80514:24;:35::i;:::-;80506:88;;;;-1:-1:-1;;;80506:88:0;;;;;;;;;-1:-1:-1;;;;;94923:27:0;::::1;;::::0;;;:16:::1;:27;::::0;;;;:41;94907:57;::::1;;94899:100;;;;-1:-1:-1::0;;;94899:100:0::1;;;;;;;;;-1:-1:-1::0;;;;;95034:27:0;::::1;;::::0;;;:16:::1;:27;::::0;;;;:43:::1;;::::0;95018:59;::::1;;95010:93;;;;-1:-1:-1::0;;;95010:93:0::1;;;;;;;;;-1:-1:-1::0;;;;;95116:27:0;::::1;;::::0;;;:16:::1;:27;::::0;;;;;;:43:::1;;:58:::0;;;95192:40;::::1;::::0;::::1;::::0;95162:12;;95192:40:::1;;89684:62:::0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;89684:62:0;;;;;;:::o;96309:380::-;96384:9;81188:33;81150:34;;-1:-1:-1;;;81150:34:0;;-1:-1:-1;;;;;81150:22:0;;;;;:34;;81173:10;;81150:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:71;;;;;;;;;81128:145;;;;-1:-1:-1;;;81128:145:0;;;;;;;;;81308:10;;:31;;-1:-1:-1;;;81308:31:0;;-1:-1:-1;;;;;81308:10:0;;;;:19;;:31;;81328:10;;81308:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;81286:117;;;;-1:-1:-1;;;81286:117:0;;;;;;;;;96422:9:::1;80872:35;80897:9;80872:24;:35::i;:::-;80864:88;;;;-1:-1:-1::0;;;80864:88:0::1;;;;;;;;;-1:-1:-1::0;;;;;96453:27:0;::::2;;::::0;;;:16:::2;:27;::::0;;;;;;;96494:10:::2;96453:52:::0;;:40:::2;;:52:::0;;;;;;::::2;;96452:53;96444:92;;;;-1:-1:-1::0;;;96444:92:0::2;;;;;;;;;-1:-1:-1::0;;;;;;;96547:27:0::2;;::::0;;;:16:::2;:27;::::0;;;;;;;:47:::2;::::0;::::2;:64:::0;;::::2;::::0;;::::2;::::0;;;;;;;;::::2;::::0;;-1:-1:-1;;;;;;96547:64:0::2;96600:10;96547:64:::0;;::::2;::::0;;;96622:52;;:40:::2;::::0;;::::2;:52:::0;;;;;;:59;;-1:-1:-1;;96622:59:0::2;::::0;;::::2;::::0;;96309:380::o;96931:389::-;97010:9;81188:33;81150:34;;-1:-1:-1;;;81150:34:0;;-1:-1:-1;;;;;81150:22:0;;;;;:34;;81173:10;;81150:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:71;;;;;;;;;81128:145;;;;-1:-1:-1;;;81128:145:0;;;;;;;;;81308:10;;:31;;-1:-1:-1;;;81308:31:0;;-1:-1:-1;;;;;81308:10:0;;;;:19;;:31;;81328:10;;81308:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;81286:117;;;;-1:-1:-1;;;81286:117:0;;;;;;;;;97048:9:::1;80872:35;80897:9;80872:24;:35::i;:::-;80864:88;;;;-1:-1:-1::0;;;80864:88:0::1;;;;;;;;;-1:-1:-1::0;;;;;97078:27:0;::::2;;::::0;;;:16:::2;:27;::::0;;;;;;;97119:10:::2;97078:52:::0;;:40:::2;;:52:::0;;;;;;::::2;;97070:87;;;;-1:-1:-1::0;;;97070:87:0::2;;;;;;;;;-1:-1:-1::0;;;;;97168:27:0;::::2;;::::0;;;:16:::2;:27;::::0;;;;:73:::2;::::0;:47:::2;;97230:10;97168:73;:61;:73;:::i;:::-;-1:-1:-1::0;;;;;;;97252:27:0::2;97307:5;97252:27:::0;;;:16:::2;:27;::::0;;;;;;;97293:10:::2;97252:52:::0;;:40:::2;;:52:::0;;;;;:60;;-1:-1:-1;;97252:60:0::2;::::0;;96931:389::o;80267:29::-;;;-1:-1:-1;;;;;80267:29:0;;:::o;104968:1336::-;105157:16;105175;105193;105242:27;105284:28;105327:26;105367:33;105390:9;105367:22;:33::i;:::-;105440:17;;105227:173;;-1:-1:-1;105227:173:0;;-1:-1:-1;105227:173:0;-1:-1:-1;105468:33:0;105440:17;105504:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;105504:31:0;;105468:67;;105546:31;105594:16;105580:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;105580:31:0;-1:-1:-1;105546:65:0;-1:-1:-1;105627:9:0;105622:609;105646:10;:17;105642:1;:21;105622:609;;;105938:8;:124;;106026:36;106052:9;106026:11;106038:1;106026:14;;;;;;;;;;;;;;:25;;:36;;;;:::i;:::-;105938:124;;;105966:40;105996:9;105966:11;105978:1;105966:14;;;;;;;;;;;;;;:29;;:40;;;;:::i;:::-;105916:16;105933:1;105916:19;;;;;;;;;;;;;:146;;;;;106099:8;:120;;106181:38;106209:9;106181;106191:1;106181:12;;;;;;;:38;106099:120;;;106127:34;106151:9;106127;106137:1;106127:12;;;;;;;:34;106079:14;106094:1;106079:17;;;;;;;;;;;;;;;;;:140;105665:3;;105622:609;;;-1:-1:-1;106251:10:0;;106263:16;;-1:-1:-1;106251:10:0;;-1:-1:-1;104968:1336:0;;-1:-1:-1;;;;;;;104968:1336:0:o;84972:206::-;85049:4;85073:10;;:36;;-1:-1:-1;;;85073:36:0;;-1:-1:-1;;;;;85073:10:0;;;;:16;;:36;;85098:9;;85073:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:97;;;;-1:-1:-1;85126:44:0;;-1:-1:-1;;;85126:44:0;;-1:-1:-1;;;;;85126:29:0;;;;;:44;;85164:4;;85126:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;113764:347;-1:-1:-1;;;;;113892:27:0;;;;;;:16;:27;;;;;;;;;:47;;113859:80;;;;;;;;;;;;;;;;;:30;;:80;;;113892:47;113859:80;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;113859:80:0;;;;;;;;;;;;;;;;-1:-1:-1;113859:80:0;;-1:-1:-1;113955:9:0;;-1:-1:-1;;;;113950:154:0;113974:13;:20;113970:1;:24;113950:154;;;114036:13;114050:1;114036:16;;;;;;;;;;;;;;-1:-1:-1;;;;;114016:54:0;;114071:9;114082;114016:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;113996:3:0;;;;;-1:-1:-1;113950:154:0;;-1:-1:-1;113950:154:0;;;113764:347;;;:::o;110575:1201::-;110825:9;110820:949;110844:11;:18;110840:1;:22;110820:949;;;110884:17;110904:11;110916:1;110904:14;;;;;;;;;;;;;;110884:34;;110933:25;110961:24;110986:1;110961:27;;;;;;;;;;;;;;110933:55;;111027:1;111007:17;:21;111003:755;;;111053:8;111049:694;;;111086:83;111116:9;111127;111145;111157:4;111163:5;111086:29;:83::i;:::-;111192:170;-1:-1:-1;;;;;111192:30:0;;111249:9;111285:10;111322:17;111192:170;:30;:170;:::i;:::-;111049:694;;;111411:205;111457:9;111494:10;111539:9;111576:17;111411:12;:205::i;:::-;111639:84;111669:9;111680;111698;111710:5;111717;111639:29;:84::i;:::-;-1:-1:-1;;110864:3:0;;110820:949;;;;110575:1201;;;;;:::o;108962:1224::-;109238:9;109233:946;109257:11;:18;109253:1;:22;109233:946;;;109297:17;109317:11;109329:1;109317:14;;;;;;;;;;;;;;109297:34;;109346:25;109374:26;109401:1;109374:29;;;;;;;;;;;;;;109346:57;;109442:1;109422:17;:21;109418:750;;;109468:8;109464:689;;;109501:205;109547:9;109584:10;109629:9;109666:17;109501:12;:205::i;:::-;109731:82;109761:9;109772;109790;109802:4;109808;109731:29;:82::i;:::-;109464:689;;;109862:83;109892:9;109903;109921;109933:5;109940:4;109862:29;:83::i;:::-;109970:163;-1:-1:-1;;;;;109970:30:0;;110027:9;110063:3;110093:17;109970:163;:30;:163;:::i;:::-;-1:-1:-1;;109277:3:0;;109233:946;;;;108962:1224;;;;;;:::o;111943:472::-;112051:14;;112047:361;;-1:-1:-1;;;;;112082:14:0;;;112097:27;;;;:16;:27;;;;;;;:40;;;112082:68;;-1:-1:-1;;;112082:68:0;;:14;;;;:68;;112097:40;;;;112139:10;;112082:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;112305:1;112291:11;:15;112287:110;;;112327:9;-1:-1:-1;;;;;112327:14:0;;112342:10;;;;;;;;;-1:-1:-1;;;;;112342:10:0;-1:-1:-1;;;;;112342:23:0;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;112369:11;112327:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;112287:110;111943:472;;;:::o;84683:146::-;84766:4;84813:8;-1:-1:-1;;;;;84790:31:0;:9;-1:-1:-1;;;;;84790:17:0;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;84790:31:0;;;84683:146;-1:-1:-1;;;84683:146:0:o;112637:517::-;-1:-1:-1;;;;;112881:27:0;;;112820:7;112881:27;;;:16;:27;;;;;:47;;;112820:7;;112881:47;112943:35;;112939:178;;112995:67;;-1:-1:-1;;;112995:67:0;;-1:-1:-1;;;;;112995:31:0;;;;;:67;;113027:9;;113038;;113049:7;;113058:3;;112995:67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;113092:12;113077:28;;;;;112939:178;113144:1;113129:17;;;112637:517;;;;;;;:::o;113288:345::-;-1:-1:-1;;;;;113415:27:0;;;;;;:16;:27;;;;;;;;;:47;;113382:80;;;;;;;;;;;;;;;;;:30;;:80;;;113415:47;113382:80;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;113382:80:0;;;;;;;;;;;;;;;;-1:-1:-1;113382:80:0;;-1:-1:-1;113478:9:0;;-1:-1:-1;;;;113473:153:0;113497:13;:20;113493:1;:24;113473:153;;;113559:13;113573:1;113559:16;;;;;;;;;;;;;;-1:-1:-1;;;;;113539:53:0;;113593:9;113604;113539:75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;113519:3:0;;;;;-1:-1:-1;113473:153:0;;-1:-1:-1;113473:153:0;57325:126;57390:7;57417:26;55786:8;57417;:1;57423;57417:8;:5;:8;:::i;:::-;:12;:26;:12;:26;:::i;:::-;57410:33;57325:126;-1:-1:-1;;;57325:126:0:o;13754:136::-;13812:7;13839:43;13843:1;13846;13839:43;;;;;;;;;;;;;;;;;:3;:43::i;13290:181::-;13348:7;13380:5;;;13404:6;;;;13396:46;;;;-1:-1:-1;;;13396:46:0;;;;;;;;84444:151;84547:40;;-1:-1:-1;;;84547:40:0;;84523:4;;-1:-1:-1;;;;;84547:25:0;;;;;:40;;84581:4;;84547:40;;;;23643:455;23733:13;23748:9;23761:13;23769:1;23761:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;23761:13:0;;;;;;;;;;;;;;;;;;;;;23772:1;23761:7;:13::i;:::-;23732:42;;;;23790:4;23785:306;;23811:31;;-1:-1:-1;;;23811:31:0;;;;;;;;23785:306;23895:8;;-1:-1:-1;;23895:12:0;24010:18;;;24006:52;;24043:1;24045:9;24043:12;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;24043:12:0;24032:1;24034:5;24032:8;;;;;;;;;;;;;;;;:23;;;;;-1:-1:-1;;;;;24032:23:0;;;;;-1:-1:-1;;;;;24032:23:0;;;;;;24006:52;24072:1;:7;;;;;;;;;;;;;;;;-1:-1:-1;;24072:7:0;;;;;-1:-1:-1;;;;;;24072:7:0;;;;;;-1:-1:-1;23643:455:0;;;;:::o;106840:1626::-;106959:16;106977;106995;107029:27;107059:9;-1:-1:-1;;;;;107059:23:0;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;107059:25:0;;;;;;;;;;;;;;107122:17;;107029:55;;-1:-1:-1;107152:28:0;107122:17;107183:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;107183:31:0;;107152:62;;107225:26;107268:16;107254:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;107254:31:0;-1:-1:-1;107225:60:0;-1:-1:-1;107303:9:0;107298:1105;107322:10;:17;107318:1;:21;107298:1105;;;107361:17;107381:10;107392:1;107381:13;;;;;;;;;;;;;;107361:33;;107409:23;107435:9;-1:-1:-1;;;;;107435:36:0;;107472:9;107435:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;107574;;-1:-1:-1;;;107574:47:0;;107409:73;;-1:-1:-1;107497:21:0;;107537:34;;-1:-1:-1;;;;;107574:36:0;;;;;:47;;107611:9;;107574:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;107574:47:0;;;;;;;;;;;;;;107642:24;;107537:84;;-1:-1:-1;107642:28:0;107638:628;;107696:9;107691:560;107715:17;:24;107711:1;:28;107691:560;;;107770:27;107800:9;-1:-1:-1;;;;;107800:37:0;;107838:9;107849:17;107867:1;107849:20;;;;;;;;;;;;;;107800:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;107770:100;;108003:1;107980:20;:24;107976:256;;;108052:42;:16;108073:20;108052:42;:20;:42;:::i;:::-;108033:61;;107976:256;;;108168:40;:14;108187:20;108168:40;:18;:40;:::i;:::-;108151:57;;107976:256;-1:-1:-1;107741:3:0;;107691:560;;;;107638:628;108299:28;:16;:26;:28::i;:::-;108282:11;108294:1;108282:14;;;;;;;;;;;;;;;;;:45;108357:34;:22;:14;-1:-1:-1;;108357:22:0;:18;:22;:::i;:::-;:32;:34::i;:::-;108342:9;108352:1;108342:12;;;;;;;;;;;;;;;;;:49;-1:-1:-1;;107341:3:0;;;;;-1:-1:-1;107298:1105:0;;-1:-1:-1;107298:1105:0;;-1:-1:-1;108423:10:0;;108435:11;;-1:-1:-1;108423:10:0;;-1:-1:-1;106840:1626:0;;-1:-1:-1;;;106840:1626:0:o;57968:211::-;58037:7;58061:6;;;:16;;-1:-1:-1;58071:6:0;;58061:16;58057:57;;;-1:-1:-1;58101:1:0;58094:8;;58057:57;58131:40;58169:1;58131:33;55786:8;58131:15;58169:1;58131:8;:1;58137;58131:8;:5;:8;:::i;:::-;:12;:15;:12;:15;:::i;:33::-;:37;:40;:37;:40;:::i;114523:875::-;114789:57;;-1:-1:-1;;;114789:57:0;;114746:40;;-1:-1:-1;;;;;114789:36:0;;;;;:57;;114834:10;;114789:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;114789:57:0;;;;;;;;;;;;;;114881:30;;114746:100;;-1:-1:-1;114922:469:0;;;;114956:9;114951:198;114975:13;114971:1;:17;114951:198;;;115034:23;115058:1;115034:26;;;;;;;;;;;;;;-1:-1:-1;;;;;115014:66:0;;115081:9;115092:17;115111:10;115123:9;115014:119;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;114990:3:0;;;;;-1:-1:-1;114951:198:0;;-1:-1:-1;114951:198:0;;;114922:469;;;115186:9;115181:199;115205:13;115201:1;:17;115181:199;;;115264:23;115288:1;115264:26;;;;;;;;;;;;;;-1:-1:-1;;;;;115244:67:0;;115312:9;115323:17;115342:10;115354:9;115244:120;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;115220:3:0;;;;;-1:-1:-1;115181:199:0;;-1:-1:-1;115181:199:0;;;114523:875;;;;;;;:::o;38203:803::-;38383:13;;38379:620;;38506:44;;-1:-1:-1;;;38506:44:0;;38480:23;;-1:-1:-1;;;;;38506:24:0;;;;;:44;;38539:9;;38506:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;38480:70;;38567:56;38589:9;38600:6;38608:3;38613:9;38567:21;:56::i;:::-;38727:44;;-1:-1:-1;;;38727:44:0;;38706:18;;-1:-1:-1;;;;;38727:24:0;;;;;:44;;38760:9;;38727:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;38706:65;-1:-1:-1;38892:30:0;:15;38912:9;38892:30;:19;:30;:::i;:::-;38878:10;:44;38852:135;;;;-1:-1:-1;;;38852:135:0;;;;;;;;82575:169;82679:57;82706:6;82714:5;82721:3;82726:9;82679:26;:57::i;14644:471::-;14702:7;14947:6;14943:47;;-1:-1:-1;14977:1:0;14970:8;;14943:47;15014:5;;;15018:1;15014;:5;:1;15038:5;;;;;:10;15030:56;;;;-1:-1:-1;;;15030:56:0;;;;;;;;15591:132;15649:7;15676:39;15680:1;15683;15676:39;;;;;;;;;;;;;;;;;:3;:39::i;14193:192::-;14279:7;14315:12;14307:6;;;;14299:29;;;;-1:-1:-1;;;14299:29:0;;;;;;;;;;-1:-1:-1;;;14351:5:0;;;14193:192::o;21666:307::-;21780:8;;21737:7;;;;;21799:129;21823:6;21819:1;:10;21799:129;;;21863:1;-1:-1:-1;;;;;21855:9:0;:1;21857;21855:4;;;;;;;;;;;;;;-1:-1:-1;;;;;21855:9:0;;21851:66;;;21893:1;-1:-1:-1;21896:4:0;;-1:-1:-1;21885:16:0;;-1:-1:-1;21885:16:0;21851:66;21831:3;;21799:129;;;;-1:-1:-1;;21959:5:0;21938:27;;;;;21666:307;;;;;;:::o;20332:215::-;20388:6;20418:5;;;20443:6;;;;;;:16;;;20458:1;20453;:6;;20443:16;20442:38;;;;20469:1;20465;:5;:14;;;;;20478:1;20474;:5;20465:14;20434:84;;;;-1:-1:-1;;;20434:84:0;;;;;;;;8973:171;9029:7;9066:1;9057:5;:10;;9049:55;;;;-1:-1:-1;;;9049:55:0;;;;;;;;;-1:-1:-1;9130:5:0;8973:171::o;18305:568::-;18361:6;18605;18601:47;;-1:-1:-1;18635:1:0;18628:8;;18601:47;18670:1;-1:-1:-1;;18670:7:0;:27;;;;;-1:-1:-1;;;18681:1:0;:16;18670:27;18668:30;18660:82;;;;-1:-1:-1;;;18660:82:0;;;;;;;;;18766:5;;;18770:1;18766;:5;:1;18790:5;;;;;:10;18782:62;;;;-1:-1:-1;;;18782:62:0;;;;;;;;37405:367;37579:13;;37575:190;;37609:21;37686:3;37691:9;37633:68;;;;;;;;;;;;;;-1:-1:-1;;37633:68:0;;;;;;;;;;;;;;-1:-1:-1;;;;;37633:68:0;-1:-1:-1;;;37633:68:0;;;37716:37;-1:-1:-1;;;37716:37:0;;37633:68;;-1:-1:-1;;;;;;37716:16:0;;;;;:37;;37733:6;;-1:-1:-1;;37633:68:0;;37716:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;37716:37:0;;;;;;;;;;;;;52599:768;52838:13;;52834:526;;52894:21;;-1:-1:-1;;;52894:21:0;;52868:23;;-1:-1:-1;;;;;52894:16:0;;;;;:21;;52911:3;;52894:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52868:47;;52932:140;52977:6;53002:5;53026:3;53048:9;52932:26;:140::i;:::-;53110:21;;-1:-1:-1;;;53110:21:0;;53089:18;;-1:-1:-1;;;;;53110:16:0;;;;;:21;;53127:3;;53110:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;53089:42;-1:-1:-1;53253:30:0;:15;53273:9;53253:30;:19;:30;:::i;16219:278::-;16305:7;16340:12;16333:5;16325:28;;;;-1:-1:-1;;;16325:28:0;;;;;;;;;;;16364:9;16380:1;16376;:5;;;;;;;16219:278;-1:-1:-1;;;;;16219:278:0:o;48074:205::-;48175:96;48195:5;48225:27;;;48254:4;48260:2;48264:5;48202:68;;;;;;;;;;;;;;;-1:-1:-1;;48202:68:0;;;;;;;;;;;;;;-1:-1:-1;;;;;48202:68:0;-1:-1:-1;;;;;;48202:68:0;;;;;;;;;;50618:23;50644:69;50672:4;50644:69;;;;;;;;;;;;;;;;;50652:5;-1:-1:-1;;;;;50644:27:0;;;:69;;;;;:::i;:::-;50728:17;;50618:95;;-1:-1:-1;50728:21:0;50724:224;;50870:10;50859:30;;;;;;;;;;;;;;50851:85;;;;-1:-1:-1;;;50851:85:0;;;;;;;;43703:195;43806:12;43838:52;43860:6;43868:4;43874:1;43877:12;43806;45007:18;45018:6;45007:10;:18::i;:::-;44999:60;;;;-1:-1:-1;;;44999:60:0;;;;;;;;;45133:12;45147:23;45174:6;-1:-1:-1;;;;;45174:11:0;45194:5;45202:4;45174:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;45132:75;;;;45225:52;45243:7;45252:10;45264:12;45225:17;:52::i;:::-;45218:59;44755:530;-1:-1:-1;;;;;;;44755:530:0:o;40782:422::-;41149:20;41188:8;;;40782:422::o;46291:742::-;46406:12;46435:7;46431:595;;;-1:-1:-1;46466:10:0;46459:17;;46431:595;46580:17;;:21;46576:439;;46843:10;46837:17;46904:15;46891:10;46887:2;46883:19;46876:44;46791:148;46986:12;46979:20;;-1:-1:-1;;;46979:20:0;;;;;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;142:134;220:13;;238:33;220:13;238:33;;2706:263;;2821:2;2809:9;2800:7;2796:23;2792:32;2789:2;;;-1:-1;;2827:12;2789:2;226:6;220:13;238:33;265:5;238:33;;2976:392;;3116:2;;3104:9;3095:7;3091:23;3087:32;3084:2;;;-1:-1;;3122:12;3084:2;3173:17;3167:24;3211:18;;3203:6;3200:30;3197:2;;;-1:-1;;3233:12;3197:2;3335:6;3324:9;3320: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;;3211:18;44597:6;44594:30;44591:2;;;-1:-1;;44627:12;44591:2;3116;44664:6;44660:17;;;499:80;3116:2;44660:17;44725: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;3253:99;3078:290;-1:-1;;;;;;;;3078:290;3375:257;;3487:2;3475:9;3466:7;3462:23;3458:32;3455:2;;;-1:-1;;3493:12;3455:2;1243:6;1237:13;1255:30;1279:5;1255:30;;3639:360;;3763:2;3751:9;3742:7;3738:23;3734:32;3731:2;;;-1:-1;;3769:12;3731:2;3820:17;3814:24;3858:18;;3850:6;3847:30;3844:2;;;-1:-1;;3880:12;3844:2;3966:6;3955:9;3951:22;1410:3;1403:4;1395:6;1391:17;1387:27;1377:2;;-1:-1;;1418:12;1377:2;1458:6;1452:13;1438:27;;3858:18;44892:6;44889:30;44886:2;;;-1:-1;;44922:12;44886:2;1480:64;44995:9;44976:17;;-1:-1;;44972:33;3763:2;45053:15;1480:64;;;1471:73;;1564:6;1557:5;1550:21;1668:3;3763:2;1659:6;1592;1650:16;;1647:25;1644:2;;;-1:-1;;1675:12;1644:2;1695:39;1727:6;3763:2;1626:5;1622:16;3763:2;1592:6;1588:17;1695:39;;;-1:-1;3900:83;3725:274;-1:-1;;;;3725:274;4006:277;;4128:2;4116:9;4107:7;4103:23;4099:32;4096:2;;;-1:-1;;4134:12;4096:2;2041:6;2028:20;2053:51;2098:5;2053:51;;4290:402;;;4429:2;4417:9;4408:7;4404:23;4400:32;4397:2;;;-1:-1;;4435:12;4397:2;2041:6;2028:20;2053:51;2098:5;2053:51;;;4487:81;-1:-1;4605:2;4644:22;;72:20;97:33;72:20;97:33;;;4613:63;;;;4391:301;;;;;;4699:402;;;4838:2;4826:9;4817:7;4813:23;4809:32;4806:2;;;-1:-1;;4844:12;4806:2;2041:6;2028:20;2053:51;2098:5;2053:51;;;4896:81;5014:2;5053:22;;;;2495:20;;-1:-1;;;4800:301;5108:527;;;;5264:2;5252:9;5243:7;5239:23;5235:32;5232:2;;;-1:-1;;5270:12;5232:2;2041:6;2028:20;2053:51;2098:5;2053:51;;;5322:81;-1:-1;5440:2;5479:22;;2495:20;;-1:-1;5548:2;5587:22;;72:20;97:33;72:20;97:33;;;5556:63;;;;5226:409;;;;;;5642:521;;;;5795:2;5783:9;5774:7;5770:23;5766:32;5763:2;;;-1:-1;;5801:12;5763:2;2041:6;2028:20;2053:51;2098:5;2053:51;;;5853:81;-1:-1;5971:2;6010:22;;2495:20;;-1:-1;6079:2;6115:22;;1095:20;1120:30;1095:20;1120:30;;6170:963;;;;;;;6406:3;6394:9;6385:7;6381:23;6377:33;6374:2;;;-1:-1;;6413:12;6374:2;2041:6;2028:20;2053:51;2098:5;2053:51;;;6465:81;-1:-1;6583:2;6622:22;;2495:20;;-1:-1;6691:2;6730:22;;2495:20;;-1:-1;6799:2;6838:22;;2495:20;;-1:-1;6907:3;6947:22;;72:20;97:33;72:20;97:33;;;6916:63;-1:-1;7016:3;7085:22;;1844:20;1869:62;1844:20;1869:62;;;7025:92;;;;6368:765;;;;;;;;;7140:295;;7271:2;7259:9;7250:7;7246:23;7242:32;7239:2;;;-1:-1;;7277:12;7239:2;2216:6;2210:13;50529:1;50522:5;50519:12;50509:2;;-1:-1;;50535:12;7442:261;;7556:2;7544:9;7535:7;7531:23;7527:32;7524:2;;;-1:-1;;7562:12;7524:2;-1:-1;2366:13;;7518:185;-1:-1;7518:185;8754:690;;8947:5;45504:12;46307:6;46302:3;46295:19;46344:4;;46339:3;46335:14;8959:93;;46344:4;9123:5;45200:14;-1:-1;9162:260;9187:6;9184:1;9181:13;9162:260;;;9248:13;;-1:-1;;;;;47619:54;8554:37;;8134:14;;;;46035;;;;3211:18;9202:9;9162:260;;;-1:-1;9428:10;;8878:566;-1:-1;;;;;8878:566;9483:690;;9676:5;45504:12;46307:6;46302:3;46295:19;46344:4;;46339:3;46335:14;9688:93;;46344:4;9852:5;45200:14;-1:-1;9891:260;9916:6;9913:1;9910:13;9891:260;;;9977:13;;22895:37;;8316:14;;;;46035;;;;9938:1;9931:9;9891:260;;10292:343;;10434:5;45504:12;46307:6;46302:3;46295:19;10527:52;10572:6;46344:4;46339:3;46335:14;46344:4;10553:5;10549:16;10527:52;;;44995:9;49823:14;-1:-1;;49819:28;10591:39;;;;46344:4;10591:39;;10382:253;-1:-1;;10382:253;23064:271;;10802:5;45504:12;10913:52;10958:6;10953:3;10946:4;10939:5;10935:16;10913:52;;;10977:16;;;;;23198:137;-1:-1;;23198:137;23342:222;-1:-1;;;;;47619:54;;;;8554:37;;23469:2;23454:18;;23440:124;23816:349;-1:-1;;;;;47619:54;;;;8423:58;;24151:2;24136:18;;22895:37;23979:2;23964:18;;23950:215;24172:333;-1:-1;;;;;47619:54;;;8554:37;;47619:54;;24491:2;24476:18;;8554:37;24327:2;24312:18;;24298:207;24512:444;-1:-1;;;;;47619:54;;;8554:37;;47619:54;;;;24859:2;24844:18;;8554:37;24942:2;24927:18;;22895:37;;;;24695:2;24680:18;;24666:290;24963:544;;3211:18;;47630:42;;;47126:5;47619:54;8561:3;8554:37;49199:24;25344:2;25333:9;25329:18;11776:58;25172:2;25381;25370:9;25366:18;25359:48;25421:76;25172:2;25161:9;25157:18;25483:6;25421:76;;;25413:84;25143:364;-1:-1;;;;;25143:364;25854:556;-1:-1;;;;;47619:54;;;;8554:37;;26230:2;26215:18;;22895:37;;;;26313:2;26298:18;;22895:37;26396:2;26381:18;;22895:37;26065:3;26050:19;;26036:374;26417:370;;26594:2;26615:17;26608:47;26669:108;26594:2;26583:9;26579:18;26763:6;26669:108;;26794:888;;27127:2;27148:17;27141:47;27202:108;27127:2;27116:9;27112:18;27296:6;27202:108;;;27358:9;27352:4;27348:20;27343:2;27332:9;27328:18;27321:48;27383:108;27486:4;27477:6;27383:108;;;27539:9;27533:4;27529:20;27524:2;27513:9;27509:18;27502:48;27564:108;27667:4;27658:6;27564:108;;27689:210;47210:13;;47203:21;10246:34;;27810:2;27795:18;;27781:118;28551:592;-1:-1;;;;;47619:54;;;11096:70;;28963:2;28948:18;;22895:37;;;;47619:54;;;29046:2;29031:18;;8554:37;47619:54;;;29129:2;29114:18;;8554:37;28780:3;28765:19;;28751:392;29150:606;-1:-1;;;;;47619:54;;;11096:70;;29569:2;29554:18;;22895:37;;;;47619:54;;29665:2;29650:18;;11096:70;47210:13;;47203:21;29742:2;29727:18;;10246:34;29386:3;29371:19;;29357:399;29763:310;;29910:2;29931:17;29924:47;29985:78;29910:2;29899:9;29895:18;30049:6;29985:78;;30080:416;30280:2;30294:47;;;12425:2;30265:18;;;46295:19;-1:-1;;;46335:14;;;12441:44;12504:12;;;30251:245;30503:416;30703:2;30717:47;;;12755:2;30688:18;;;46295:19;12791:33;46335:14;;;12771:54;12844:12;;;30674:245;30926:416;31126:2;31140:47;;;13095:2;31111:18;;;46295:19;-1:-1;;;46335:14;;;13111:45;13175:12;;;31097:245;31349:416;31549:2;31563:47;;;13426:2;31534:18;;;46295:19;13462:34;46335:14;;;13442:55;-1:-1;;;13517:12;;;13510:32;13561:12;;;31520:245;31772:416;31972:2;31986:47;;;13812:2;31957:18;;;46295:19;-1:-1;;;46335:14;;;13828:45;13892:12;;;31943:245;32195:416;32395:2;32409:47;;;14143:2;32380:18;;;46295:19;14179:29;46335:14;;;14159:50;14228:12;;;32366:245;32618:416;32818:2;32832:47;;;14479:2;32803:18;;;46295:19;14515:29;46335:14;;;14495:50;14564:12;;;32789:245;33041:416;33241:2;33255:47;;;14815:2;33226:18;;;46295:19;14851:32;46335:14;;;14831:53;14903:12;;;33212:245;33464:416;33664:2;33678:47;;;15154:2;33649:18;;;46295:19;15190:32;46335:14;;;15170:53;15242:12;;;33635:245;33887:416;34087:2;34101:47;;;15493:2;34072:18;;;46295:19;15529:28;46335:14;;;15509:49;15577:12;;;34058:245;34310:416;34510:2;34524:47;;;15828:2;34495:18;;;46295:19;15864:34;46335:14;;;15844:55;-1:-1;;;15919:12;;;15912:25;15956:12;;;34481:245;35156:416;35356:2;35370:47;;;35341:18;;;46295:19;16627:34;46335:14;;;16607:55;16681:12;;;35327:245;35579:416;35779:2;35793:47;;;16932:2;35764:18;;;46295:19;16968:26;46335:14;;;16948:47;17014:12;;;35750:245;36002:416;36202:2;36216:47;;;17265:2;36187:18;;;46295:19;17301:34;46335:14;;;17281:55;-1:-1;;;17356:12;;;17349:25;17393:12;;;36173:245;36425:416;36625:2;36639:47;;;17644:2;36610:18;;;46295:19;-1:-1;;;46335:14;;;17660:44;17723:12;;;36596:245;36848:416;37048:2;37062:47;;;17974:2;37033:18;;;46295:19;18010:34;46335:14;;;17990:55;-1:-1;;;18065:12;;;18058:31;18108:12;;;37019:245;37271:416;37471:2;37485:47;;;18359:2;37456:18;;;46295:19;18395:34;46335:14;;;18375:55;-1:-1;;;18450:12;;;18443:26;18488:12;;;37442:245;37694:416;37894:2;37908:47;;;18739:2;37879:18;;;46295:19;18775:31;46335:14;;;18755:52;18826:12;;;37865:245;38117:416;38317:2;38331:47;;;19077:2;38302:18;;;46295:19;19113:27;46335:14;;;19093:48;19160:12;;;38288:245;38540:416;38740:2;38754:47;;;19411:2;38725:18;;;46295:19;19447:34;46335:14;;;19427:55;-1:-1;;;19502:12;;;19495:31;19545:12;;;38711:245;38963:416;39163:2;39177:47;;;19796:2;39148:18;;;46295:19;19832:31;46335:14;;;19812:52;19883:12;;;39134:245;39386:416;39586:2;39600:47;;;20134:2;39571:18;;;46295:19;20170:28;46335:14;;;20150:49;20218:12;;;39557:245;39809:416;40009:2;40023:47;;;20469:2;39994:18;;;46295:19;20505:34;46335:14;;;20485:55;-1:-1;;;20560:12;;;20553:28;20600:12;;;39980:245;40232:416;40432:2;40446:47;;;20851:2;40417:18;;;46295:19;20887:34;46335:14;;;20867:55;-1:-1;;;20942:12;;;20935:27;20981:12;;;40403:245;40655:416;40855:2;40869:47;;;21232:2;40840:18;;;46295:19;21268:30;46335:14;;;21248:51;21318:12;;;40826:245;41078:416;41278:2;41292:47;;;21569:2;41263:18;;;46295:19;21605:34;46335:14;;;21585:55;-1:-1;;;21660:12;;;21653:34;21706:12;;;41249:245;41501:416;41701:2;41715:47;;;21957:2;41686:18;;;46295:19;21993:34;46335:14;;;21973:55;-1:-1;;;22048:12;;;22041:27;22087:12;;;41672:245;41924:416;42124:2;42138:47;;;22338:2;42109:18;;;46295:19;22374:33;46335:14;;;22354:54;22427:12;;;42095:245;42347:416;42547:2;42561:47;;;22678:2;42532:18;;;46295:19;22714:34;46335:14;;;22694:55;-1:-1;;;22769:12;;;22762:27;22808:12;;;42518:245;42770:222;22895:37;;;42897:2;42882:18;;42868:124;42999:444;22895:37;;;43346:2;43331:18;;22895:37;;;;43429:2;43414:18;;22895:37;43182:2;43167:18;;43153:290;43450:726;22895:37;;;43883:2;43868:18;;22895:37;;;;43966:2;43951:18;;22895:37;;;;-1:-1;;;;;47619:54;;;44049:2;44034:18;;8554:37;47619:54;44161:3;44146:19;;11096:70;43718:3;43703:19;;43689:487;44183:256;44245:2;44239:9;44271:17;;;44346:18;44331:34;;44367:22;;;44328:62;44325:2;;;44403:1;;44393:12;44325:2;44245;44412:22;44223:216;;-1:-1;44223:216;49479:268;49544:1;49551:101;49565:6;49562:1;49559:13;49551:101;;;49632:11;;;49626:18;49613:11;;;49606:39;49587:2;49580:10;49551:101;;;49667:6;49664:1;49661:13;49658:2;;;-1:-1;;49544:1;49714:16;;49707:27;49528:219;49860:117;-1:-1;;;;;47619:54;;49919:35;;49909:2;;49968:1;;49958:12;49984:111;50065:5;47210:13;47203:21;50043:5;50040:32;50030:2;;50086:1;;50076:12

Swarm Source

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