Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xcEDA8318522D348f1d1aca48B24629b8FbF09020
Balance 0 ETH
Nonce 1
Code Size 8483 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

8483 bytes
0x6080604052600436106100955760003560e060020a90048063a05cb7551161005d578063a05cb755146101b3578063da89a7b1146101c8578063f2f4eb2614610209578063f7b00c9e1461021e578063fbfa77cf1461025f57610095565b80631cc0bd61146100e35780633ba30551146101245780633fc8cef31461015857806363dc4f95146101895780636e667db31461019e575b600654600160a060020a031633146100e15760405160e560020a62461bcd028152600401808060200182810382526059815260200180611f0b6059913960600191505060405180910390fd5b005b3480156100ef57600080fd5b506100e16004803603606081101561010657600080fd5b50600160a060020a0381351690602081013590604001351515610274565b6100e16004803603606081101561013a57600080fd5b50600160a060020a038135169060208101359060400135151561035e565b34801561016457600080fd5b5061016d610476565b60408051600160a060020a039092168252519081900360200190f35b34801561019557600080fd5b5061016d610485565b3480156101aa57600080fd5b5061016d610494565b3480156101bf57600080fd5b5061016d6104a3565b3480156101d457600080fd5b506100e1600480360360608110156101eb57600080fd5b50600160a060020a03813516906020810135906040013515156104b2565b34801561021557600080fd5b5061016d61074f565b34801561022a57600080fd5b506100e16004803603606081101561024157600080fd5b50600160a060020a038135169060208101359060400135151561075e565b34801561026b57600080fd5b5061016d6109c3565b600480546001019081905560008061028c86866109d2565b600254604080517f7c68561f000000000000000000000000000000000000000000000000000000008152336004820152306024820152600160a060020a0380861660448301526064820185905291519496509294501691637c68561f9160848082019260009290919082900301818387803b15801561030a57600080fd5b505af115801561031e573d6000803e3d6000fd5b505060055461033c92508491503090600160a060020a031684610a64565b61034886838787610a94565b5050600454811461035857600080fd5b50505050565b600480546001019081905560008061037686866109d2565b6006549193509150610392908390600160a060020a0316610b7e565b61039c8282610c45565b600254604080517fa57de4cf000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a57de4cf91604480830192600092919082900301818387803b15801561040a57600080fd5b505af115801561041e573d6000803e3d6000fd5b5050505061042e86838787610a94565b3031801561046557604051339082156108fc029083906000818181858888f19350505050158015610463573d6000803e3d6000fd5b505b505050600454811461035857600080fd5b600654600160a060020a031681565b600354600160a060020a031681565b600554600160a060020a031681565b600254600160a060020a031681565b60048054600101908190556104c78484611043565b600254604080517f5990ca08000000000000000000000000000000000000000000000000000000008152336004820152306024820152600160a060020a0387811660448301526064820187905291519190921691635990ca0891608480830192600092919082900301818387803b15801561054157600080fd5b505af1158015610555573d6000803e3d6000fd5b50505050600084600160a060020a03166330b866276040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561059757600080fd5b505afa1580156105ab573d6000803e3d6000fd5b505050506040513d60208110156105c157600080fd5b5051905060006105d0826111ca565b600254604080517ff3fef3a3000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015260248201859052915193945091169163f3fef3a39160448082019260009290919082900301818387803b15801561064057600080fd5b505af1158015610654573d6000803e3d6000fd5b5050600254604080517f1c2a0e40000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015233602483015260448201879052600060648301819052925193169450631c2a0e4093506084808201939182900301818387803b1580156106cf57600080fd5b505af11580156106e3573d6000803e3d6000fd5b50506005546106ff9250849150600160a060020a0316866112fd565b6040805186815290513391600160a060020a038916917f412d6167082ef33d0eb78858a5ca2bc234ae9f96ea4757e6c0e2a66a152c0f629181900360200190a35050600454811461035857600080fd5b600054600160a060020a031681565b60048054600101908190556107738484611043565b600084600160a060020a03166330b866276040518163ffffffff1660e060020a02815260040160206040518083038186803b1580156107b157600080fd5b505afa1580156107c5573d6000803e3d6000fd5b505050506040513d60208110156107db57600080fd5b50516006549091506107f7908290600160a060020a0316610b7e565b600254604080517f5990ca08000000000000000000000000000000000000000000000000000000008152336004820152306024820152600160a060020a0388811660448301526064820188905291519190921691635990ca0891608480830192600092919082900301818387803b15801561087157600080fd5b505af1158015610885573d6000803e3d6000fd5b505050506000610894826111ca565b600254604080517ff3fef3a3000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015260248201859052915193945091169163f3fef3a39160448082019260009290919082900301818387803b15801561090457600080fd5b505af1158015610918573d6000803e3d6000fd5b5050600254604080517f1e9a6950000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152602482018790529151919092169350631e9a69509250604480830192600092919082900301818387803b15801561098a57600080fd5b505af115801561099e573d6000803e3d6000fd5b505050506109ab82611317565b6005546106ff908390600160a060020a0316866112fd565b600154600160a060020a031681565b6000806109df8484611043565b600084600160a060020a03166330b866276040518163ffffffff1660e060020a02815260040160206040518083038186803b158015610a1d57600080fd5b505afa158015610a31573d6000803e3d6000fd5b505050506040513d6020811015610a4757600080fd5b505190506000610a5786866116a1565b9196919550909350505050565b6000610a718585856118fa565b905081811015610a8d57610a8d8584610a8861199a565b6119a0565b5050505050565b600254604080517f73088bf7000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a03878116602483015260448201869052915191909216916373088bf791606480830192600092919082900301818387803b158015610b0857600080fd5b505af1158015610b1c573d6000803e3d6000fd5b5050600554610b389250859150600160a060020a0316836112fd565b6040805183815290513391600160a060020a038716917f2d3ead46fb20943d335e2ff48b43b66d146fa01aaed75d497fa33a86092446129181900360200190a350505050565b81600160a060020a03166318c53aca826040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a0316815260200191505060206040518083038186803b158015610bd757600080fd5b505afa158015610beb573d6000803e3d6000fd5b505050506040513d6020811015610c0157600080fd5b5051610c415760405160e560020a62461bcd0281526004018080602001828103825260528152602001806120a66052913960600191505060405180910390fd5b5050565b6000829050606081600160a060020a03166399d50d5d6040518163ffffffff1660e060020a02815260040160006040518083038186803b158015610c8857600080fd5b505afa158015610c9c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610cc557600080fd5b810190808051640100000000811115610cdd57600080fd5b82016020810184811115610cf057600080fd5b8151856020820283011164010000000082111715610d0d57600080fd5b50509291905050509050606082600160a060020a031663027aa9f56040518163ffffffff1660e060020a02815260040160006040518083038186803b158015610d5557600080fd5b505afa158015610d69573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610d9257600080fd5b810190808051640100000000811115610daa57600080fd5b82016020810184811115610dbd57600080fd5b8151856020820283011164010000000082111715610dda57600080fd5b50509291905050509050600083600160a060020a03166342a7cfd56040518163ffffffff1660e060020a02815260040160206040518083038186803b158015610e2257600080fd5b505afa158015610e36573d6000803e3d6000fd5b505050506040513d6020811015610e4c57600080fd5b5051905060005b835181101561103a576000848281518110610e6a57fe5b602002602001015190506000848381518110610e8257fe5b602002602001015190506000610eb182610ea5878c611a7690919063ffffffff16565b9063ffffffff611a9816565b600654909150600160a060020a0384811691161415610f9c5780341015610f0c5760405160e560020a62461bcd028152600401808060200182810382526067815260200180611f8a6067913960800191505060405180910390fd5b600660009054906101000a9004600160a060020a0316600160a060020a031663d0e30db0826040518263ffffffff1660e060020a0281526004016000604051808303818588803b158015610f5f57600080fd5b505af1158015610f73573d6000803e3d6000fd5b5050600654600554610f979450600160a060020a0391821693503092501684610a64565b61102f565b600254604080517fde30f6ee000000000000000000000000000000000000000000000000000000008152336004820152306024820152600160a060020a038681166044830152606482018590529151919092169163de30f6ee91608480830192600092919082900301818387803b15801561101657600080fd5b505af115801561102a573d6000803e3d6000fd5b505050505b505050600101610e53565b50505050505050565b600254604080517ffef3ee73000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301529151919092169163fef3ee73916024808301926020929190829003018186803b1580156110a957600080fd5b505afa1580156110bd573d6000803e3d6000fd5b505050506040513d60208110156110d357600080fd5b50516111135760405160e560020a62461bcd02815260040180806020018281038252605881526020018061204e6058913960600191505060405180910390fd5b61118b82600160a060020a03166342a7cfd56040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561115257600080fd5b505afa158015611166573d6000803e3d6000fd5b505050506040513d602081101561117c57600080fd5b5051829063ffffffff611ac616565b15610c415760405160e560020a62461bcd02815260040180806020018281038252605d815260200180611ff1605d913960600191505060405180910390fd5b60008082600160a060020a03166342a7cfd56040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561120957600080fd5b505afa15801561121d573d6000803e3d6000fd5b505050506040513d602081101561123357600080fd5b5051600354604080517f1f98ade3000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015230602483015291519394506000939190921691631f98ade3916044808301926020929190829003018186803b1580156112a757600080fd5b505afa1580156112bb573d6000803e3d6000fd5b505050506040513d60208110156112d157600080fd5b505190506112f56112e8828463ffffffff611ac616565b829063ffffffff611ae316565b949350505050565b611308838383611af8565b6113128382611cf5565b505050565b606081600160a060020a03166399d50d5d6040518163ffffffff1660e060020a02815260040160006040518083038186803b15801561135557600080fd5b505afa158015611369573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561139257600080fd5b8101908080516401000000008111156113aa57600080fd5b820160208101848111156113bd57600080fd5b81518560208202830111640100000000821117156113da57600080fd5b50909450600093505050505b81518110156113125760008282815181106113fd57fe5b602090810291909101810151600354604080517f1f98ade3000000000000000000000000000000000000000000000000000000008152600160a060020a03808516600483015230602483015291519395506000949190921692631f98ade3926044808201939291829003018186803b15801561147857600080fd5b505afa15801561148c573d6000803e3d6000fd5b505050506040513d60208110156114a257600080fd5b5051600654909150600160a060020a038381169116141561160457600254600654604080517f0e1fd33400000000000000000000000000000000000000000000000000000000815230600482018190526024820152600160a060020a0392831660448201526064810185905290519190921691630e1fd33491608480830192600092919082900301818387803b15801561153b57600080fd5b505af115801561154f573d6000803e3d6000fd5b5050600654604080517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018690529051600160a060020a039092169350632e1a7d4d925060248082019260009290919082900301818387803b1580156115b957600080fd5b505af11580156115cd573d6000803e3d6000fd5b505060405133925083156108fc02915083906000818181858888f193505050501580156115fe573d6000803e3d6000fd5b50611697565b600254604080517f0e1fd334000000000000000000000000000000000000000000000000000000008152306004820152336024820152600160a060020a0385811660448301526064820185905291519190921691630e1fd33491608480830192600092919082900301818387803b15801561167e57600080fd5b505af1158015611692573d6000803e3d6000fd5b505050505b50506001016113e6565b600080839050600081600160a060020a0316630193aea26040518163ffffffff1660e060020a02815260040160206040518083038186803b1580156116e557600080fd5b505afa1580156116f9573d6000803e3d6000fd5b505050506040513d602081101561170f57600080fd5b5051604080517f42a7cfd50000000000000000000000000000000000000000000000000000000081529051919250600091600160a060020a038516916342a7cfd5916004808301926020929190829003018186803b15801561177057600080fd5b505afa158015611784573d6000803e3d6000fd5b505050506040513d602081101561179a57600080fd5b5051905060006117b483610ea5888563ffffffff611a7616565b9050600084600160a060020a03166330b866276040518163ffffffff1660e060020a02815260040160206040518083038186803b1580156117f457600080fd5b505afa158015611808573d6000803e3d6000fd5b505050506040513d602081101561181e57600080fd5b5051604080517f42a7cfd50000000000000000000000000000000000000000000000000000000081529051919250600091600160a060020a038416916342a7cfd5916004808301926020929190829003018186803b15801561187f57600080fd5b505afa158015611893573d6000803e3d6000fd5b505050506040513d60208110156118a957600080fd5b5051905060006118bf848363ffffffff611ac616565b905080156118ea576118e7826118db868463ffffffff611ae316565b9063ffffffff611ec316565b93505b5091955050505050505b92915050565b604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301528381166024830152915160009286169163dd62ed3e916044808301926020929190829003018186803b15801561196657600080fd5b505afa15801561197a573d6000803e3d6000fd5b505050506040513d602081101561199057600080fd5b5051949350505050565b60001990565b82600160a060020a031663095ea7b383836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015611a0357600080fd5b505af1158015611a17573d6000803e3d6000fd5b505050506040513d6020811015611a2d57600080fd5b50611a389050611ed5565b6113125760405160e560020a62461bcd028152600401808060200182810382526026815260200180611f646026913960400191505060405180910390fd5b6000808211611a8457600080fd5b6000828481611a8f57fe5b04949350505050565b600082611aa7575060006118f4565b82820282848281611ab457fe5b0414611abf57600080fd5b9392505050565b600081611ad257600080fd5b818381611adb57fe5b069392505050565b600082821115611af257600080fd5b50900390565b604080517ff7888aec000000000000000000000000000000000000000000000000000000008152600160a060020a0385166004820152306024820152905160009173eadada7c6943c223c0d4bea475a6dacc7368f8d69163f7888aec91604480820192602092909190829003018186803b158015611b7557600080fd5b505af4158015611b89573d6000803e3d6000fd5b505050506040513d6020811015611b9f57600080fd5b5051905080611bae5750611312565b8115611c5757611bc084308584610a64565b600254604080517fde30f6ee000000000000000000000000000000000000000000000000000000008152306004820152336024820152600160a060020a038781166044830152606482018590529151919092169163de30f6ee91608480830192600092919082900301818387803b158015611c3a57600080fd5b505af1158015611c4e573d6000803e3d6000fd5b50505050610358565b604080517fbeabacc8000000000000000000000000000000000000000000000000000000008152600160a060020a038616600482015233602482015260448101839052905173eadada7c6943c223c0d4bea475a6dacc7368f8d69163beabacc8916064808301926000929190829003018186803b158015611cd757600080fd5b505af4158015611ceb573d6000803e3d6000fd5b5050505050505050565b600354604080517f1f98ade3000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015230602483015291516000939290921691631f98ade391604480820192602092909190829003018186803b158015611d6557600080fd5b505afa158015611d79573d6000803e3d6000fd5b505050506040513d6020811015611d8f57600080fd5b5051905080611d9e5750610c41565b8115611e3557600254604080517f59e026f7000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015233602483015260448201859052915191909216916359e026f791606480830192600092919082900301818387803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b50505050611312565b600254604080517f0e1fd334000000000000000000000000000000000000000000000000000000008152306004820152336024820152600160a060020a0386811660448301526064820185905291519190921691630e1fd33491608480830192600092919082900301818387803b158015611eaf57600080fd5b505af115801561103a573d6000803e3d6000fd5b600082820183811015611abf57600080fd5b6000803d8015611eec5760208114611ef557611f01565b60019150611f01565b60206000803e60005191505b5060011490509056fe526562616c616e63696e6753657449737375616e63654d6f64756c652e66616c6c6261636b3a2043616e6e6f74207265636569766520455448206469726563746c7920756e6c65737320756e7772617070696e6720574554484552433230577261707065722e617070726f76653a204261642072657475726e2076616c7565526562616c616e63696e6753657449737375616e63654d6f64756c652e6465706f736974436f6d706f6e656e7473416e6448616e646c654574683a204e6f7420656e6f75676820657468657220696e636c7564656420666f72206261736520536574546f6b656e526562616c616e63696e6753657449737375616e63652e76616c6964617465526562616c616e63696e6749737375616e63653a205175616e74697479206d757374206265206d756c7469706c65206f66206e61747572616c20756e6974526562616c616e63696e6753657449737375616e63652e76616c6964617465526562616c616e63696e6749737375616e63653a20496e76616c6964206f722064697361626c656420536574546f6b656e2061646472657373526562616c616e63696e6753657449737375616e63652e76616c696461746557455448497341436f6d706f6e656e744f665365743a20436f6d706f6e656e7473206d75737420636f6e7461696e2077657468a165627a7a7230582068c911ceb08f00fb2e1bad9e01d72f353022fd55f0c42c4a8212dbfbe1744cd40029

Verified Source Code Partial Match

Compiler: v0.5.7+commit.6da8b019 EVM: byzantium Optimization: Yes (200 runs)
RebalancingSetIssuanceModule.sol 2803 lines
// File: openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol

pragma solidity ^0.5.2;

/**
 * @title Helps contracts guard against reentrancy attacks.
 * @author Remco Bloemen <remco@2π.com>, Eenae <[email protected]>
 * @dev If you mark a function `nonReentrant`, you should also
 * mark it `external`.
 */
contract ReentrancyGuard {
    /// @dev counter to allow mutex lock with only one SSTORE operation
    uint256 private _guardCounter;

    constructor () internal {
        // The counter starts at one to prevent changing it from zero to a non-zero
        // value, which is a more expensive operation.
        _guardCounter = 1;
    }

    /**
     * @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() {
        _guardCounter += 1;
        uint256 localCounter = _guardCounter;
        _;
        require(localCounter == _guardCounter);
    }
}

// File: openzeppelin-solidity/contracts/math/SafeMath.sol

pragma solidity ^0.5.2;

/**
 * @title SafeMath
 * @dev Unsigned math operations with safety checks that revert on error
 */
library SafeMath {
    /**
     * @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b);

        return c;
    }

    /**
     * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Adds two unsigned integers, reverts on overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a);

        return c;
    }

    /**
     * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
     * reverts when dividing by zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0);
        return a % b;
    }
}

// File: contracts/core/lib/RebalancingLibraryV2.sol

/*
    Copyright 2018 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.5.7;



/**
 * @title RebalancingLibrary
 * @author Set Protocol
 *
 * The RebalancingLibrary contains functions for facilitating the rebalancing process for
 * Rebalancing Set Tokens. Removes the old calculation functions
 *
 */
library RebalancingLibraryV2 {
    using SafeMath for uint256;

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

    enum State { Default, Proposal, Rebalance, Drawdown }

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

    struct AuctionPriceParameters {
        uint256 auctionStartTime;
        uint256 auctionTimeToPivot;
        uint256 auctionStartPrice;
        uint256 auctionPivotPrice;
    }

    struct BiddingParameters {
        uint256 minimumBid;
        uint256 remainingCurrentSets;
        uint256[] combinedCurrentUnits;
        uint256[] combinedNextSetUnits;
        address[] combinedTokenArray;
    }
}

// File: contracts/core/interfaces/IRebalancingSetTokenV2.sol

/*
    Copyright 2018 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.5.7;


/**
 * @title IRebalancingSetTokenV2
 * @author Set Protocol
 *
 * The IRebalancingSetToken interface provides a light-weight, structured way to interact with the
 * RebalancingSetToken contract from another contract.
 */

interface IRebalancingSetTokenV2 {

    /*
     * Get totalSupply of Rebalancing Set
     *
     * @return  totalSupply
     */
    function totalSupply()
        external
        view
        returns (uint256);

    /*
     * Get lastRebalanceTimestamp of Rebalancing Set
     *
     * @return  lastRebalanceTimestamp
     */
    function lastRebalanceTimestamp()
        external
        view
        returns (uint256);

    /*
     * Get rebalanceInterval of Rebalancing Set
     *
     * @return  rebalanceInterval
     */
    function rebalanceInterval()
        external
        view
        returns (uint256);

    /*
     * Get rebalanceState of Rebalancing Set
     *
     * @return  rebalanceState
     */
    function rebalanceState()
        external
        view
        returns (RebalancingLibraryV2.State);

    /**
     * Gets the balance of the specified address.
     *
     * @param owner      The address to query the balance of.
     * @return           A uint256 representing the amount owned by the passed address.
     */
    function balanceOf(
        address owner
    )
        external
        view
        returns (uint256);

    /**
     * Function used to set the terms of the next rebalance and start the proposal period
     *
     * @param _nextSet                      The Set to rebalance into
     * @param _auctionLibrary               The library used to calculate the Dutch Auction price
     * @param _auctionTimeToPivot           The amount of time for the auction to go ffrom start to pivot price
     * @param _auctionStartPrice            The price to start the auction at
     * @param _auctionPivotPrice            The price at which the price curve switches from linear to exponential
     */
    function propose(
        address _nextSet,
        address _auctionLibrary,
        uint256 _auctionTimeToPivot,
        uint256 _auctionStartPrice,
        uint256 _auctionPivotPrice
    )
        external;

    /*
     * Get natural unit of Set
     *
     * @return  uint256       Natural unit of Set
     */
    function naturalUnit()
        external
        view
        returns (uint256);

    /**
     * Returns the address of the current Base Set
     *
     * @return           A address representing the base Set Token
     */
    function currentSet()
        external
        view
        returns (address);

    /*
     * Get the unit shares of the rebalancing Set
     *
     * @return  unitShares       Unit Shares of the base Set
     */
    function unitShares()
        external
        view
        returns (uint256);

    /*
     * Burn set token for given address.
     * Can only be called by authorized contracts.
     *
     * @param  _from        The address of the redeeming account
     * @param  _quantity    The number of sets to burn from redeemer
     */
    function burn(
        address _from,
        uint256 _quantity
    )
        external;

    /*
     * Place bid during rebalance auction. Can only be called by Core.
     *
     * @param _quantity                 The amount of currentSet to be rebalanced
     * @return combinedTokenArray       Array of token addresses invovled in rebalancing
     * @return inflowUnitArray          Array of amount of tokens inserted into system in bid
     * @return outflowUnitArray         Array of amount of tokens taken out of system in bid
     */
    function placeBid(
        uint256 _quantity
    )
        external
        returns (address[] memory, uint256[] memory, uint256[] memory);

    /*
     * Get combinedTokenArray of Rebalancing Set
     *
     * @return  combinedTokenArray
     */
    function getCombinedTokenArrayLength()
        external
        view
        returns (uint256);

    /*
     * Get combinedTokenArray of Rebalancing Set
     *
     * @return  combinedTokenArray
     */
    function getCombinedTokenArray()
        external
        view
        returns (address[] memory);

    /*
     * Get failedAuctionWithdrawComponents of Rebalancing Set
     *
     * @return  failedAuctionWithdrawComponents
     */
    function getFailedAuctionWithdrawComponents()
        external
        view
        returns (address[] memory);

    /*
     * Get biddingParameters for current auction
     *
     * @return  biddingParameters
     */
    function getBiddingParameters()
        external
        view
        returns (uint256[] memory);

}

// File: contracts/core/interfaces/ISetToken.sol

/*
    Copyright 2018 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.5.7;

/**
 * @title ISetToken
 * @author Set Protocol
 *
 * The ISetToken interface provides a light-weight, structured way to interact with the
 * SetToken contract from another contract.
 */
interface ISetToken {

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

    /*
     * Get natural unit of Set
     *
     * @return  uint256       Natural unit of Set
     */
    function naturalUnit()
        external
        view
        returns (uint256);

    /*
     * Get addresses of all components in the Set
     *
     * @return  componentAddresses       Array of component tokens
     */
    function getComponents()
        external
        view
        returns (address[] memory);

    /*
     * Get units of all tokens in Set
     *
     * @return  units       Array of component units
     */
    function getUnits()
        external
        view
        returns (uint256[] memory);

    /*
     * Checks to make sure token is component of Set
     *
     * @param  _tokenAddress     Address of token being checked
     * @return  bool             True if token is component of Set
     */
    function tokenIsComponent(
        address _tokenAddress
    )
        external
        view
        returns (bool);

    /*
     * Mint set token for given address.
     * Can only be called by authorized contracts.
     *
     * @param  _issuer      The address of the issuing account
     * @param  _quantity    The number of sets to attribute to issuer
     */
    function mint(
        address _issuer,
        uint256 _quantity
    )
        external;

    /*
     * Burn set token for given address
     * Can only be called by authorized contracts
     *
     * @param  _from        The address of the redeeming account
     * @param  _quantity    The number of sets to burn from redeemer
     */
    function burn(
        address _from,
        uint256 _quantity
    )
        external;

    /**
    * Transfer token for a specified address
    *
    * @param to The address to transfer to.
    * @param value The amount to be transferred.
    */
    function transfer(
        address to,
        uint256 value
    )
        external;
}

// File: contracts/lib/IWETH.sol

/*
    Copyright 2018 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.5.7;


/**
 * @title IWETH
 * @author Set Protocol
 *
 * Interface for Wrapped Ether. This interface allows for interaction for wrapped ether's deposit and withdrawal
 * functionality.
 */
interface IWETH {
    function deposit()
        external
        payable;

    function withdraw(
        uint256 wad
    )
        external;
}

// File: contracts/lib/CommonMath.sol

/*
    Copyright 2018 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.5.7;



library CommonMath {
    using SafeMath for uint256;

    /**
     * Calculates and returns the maximum value for a uint256
     *
     * @return  The maximum value for uint256
     */
    function maxUInt256()
        internal
        pure
        returns (uint256)
    {
        return 2 ** 256 - 1;
    }

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

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

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

        return result;
    }

    /**
     * Checks for rounding errors and returns value of potential partial amounts of a principal
     *
     * @param  _principal       Number fractional amount is derived from
     * @param  _numerator       Numerator of fraction
     * @param  _denominator     Denominator of fraction
     * @return uint256          Fractional amount of principal calculated
     */
    function getPartialAmount(
        uint256 _principal,
        uint256 _numerator,
        uint256 _denominator
    )
        internal
        pure
        returns (uint256)
    {
        // Get remainder of partial amount (if 0 not a partial amount)
        uint256 remainder = mulmod(_principal, _numerator, _denominator);

        // Return if not a partial amount
        if (remainder == 0) {
            return _principal.mul(_numerator).div(_denominator);
        }

        // Calculate error percentage
        uint256 errPercentageTimes1000000 = remainder.mul(1000000).div(_numerator.mul(_principal));

        // Require error percentage is less than 0.1%.
        require(
            errPercentageTimes1000000 < 1000,
            "CommonMath.getPartialAmount: Rounding error exceeds bounds"
        );

        return _principal.mul(_numerator).div(_denominator);
    }

}

// File: contracts/lib/IERC20.sol

/*
    Copyright 2018 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.5.7;


/**
 * @title IERC20
 * @author Set Protocol
 *
 * Interface for using ERC20 Tokens. This interface is needed to interact with tokens that are not
 * fully ERC20 compliant and return something other than true on successful transfers.
 */
interface IERC20 {
    function balanceOf(
        address _owner
    )
        external
        view
        returns (uint256);

    function allowance(
        address _owner,
        address _spender
    )
        external
        view
        returns (uint256);

    function transfer(
        address _to,
        uint256 _quantity
    )
        external;

    function transferFrom(
        address _from,
        address _to,
        uint256 _quantity
    )
        external;

    function approve(
        address _spender,
        uint256 _quantity
    )
        external
        returns (bool);
}

// File: contracts/lib/ERC20Wrapper.sol

/*
    Copyright 2018 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.5.7;




/**
 * @title ERC20Wrapper
 * @author Set Protocol
 *
 * This library contains functions for interacting wtih ERC20 tokens, even those not fully compliant.
 * For all functions we will only accept tokens that return a null or true value, any other values will
 * cause the operation to revert.
 */
library ERC20Wrapper {

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

    /**
     * Check balance owner's balance of ERC20 token
     *
     * @param  _token          The address of the ERC20 token
     * @param  _owner          The owner who's balance is being checked
     * @return  uint256        The _owner's amount of tokens
     */
    function balanceOf(
        address _token,
        address _owner
    )
        external
        view
        returns (uint256)
    {
        return IERC20(_token).balanceOf(_owner);
    }

    /**
     * Checks spender's allowance to use token's on owner's behalf.
     *
     * @param  _token          The address of the ERC20 token
     * @param  _owner          The token owner address
     * @param  _spender        The address the allowance is being checked on
     * @return  uint256        The spender's allowance on behalf of owner
     */
    function allowance(
        address _token,
        address _owner,
        address _spender
    )
        internal
        view
        returns (uint256)
    {
        return IERC20(_token).allowance(_owner, _spender);
    }

    /**
     * Transfers tokens from an address. Handle's tokens that return true or null.
     * If other value returned, reverts.
     *
     * @param  _token          The address of the ERC20 token
     * @param  _to             The address to transfer to
     * @param  _quantity       The amount of tokens to transfer
     */
    function transfer(
        address _token,
        address _to,
        uint256 _quantity
    )
        external
    {
        IERC20(_token).transfer(_to, _quantity);

        // Check that transfer returns true or null
        require(
            checkSuccess(),
            "ERC20Wrapper.transfer: Bad return value"
        );
    }

    /**
     * Transfers tokens from an address (that has set allowance on the proxy).
     * Handle's tokens that return true or null. If other value returned, reverts.
     *
     * @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(
        address _token,
        address _from,
        address _to,
        uint256 _quantity
    )
        external
    {
        IERC20(_token).transferFrom(_from, _to, _quantity);

        // Check that transferFrom returns true or null
        require(
            checkSuccess(),
            "ERC20Wrapper.transferFrom: Bad return value"
        );
    }

    /**
     * Grants spender ability to spend on owner's behalf.
     * Handle's tokens that return true or null. If other value returned, reverts.
     *
     * @param  _token          The address of the ERC20 token
     * @param  _spender        The address to approve for transfer
     * @param  _quantity       The amount of tokens to approve spender for
     */
    function approve(
        address _token,
        address _spender,
        uint256 _quantity
    )
        internal
    {
        IERC20(_token).approve(_spender, _quantity);

        // Check that approve returns true or null
        require(
            checkSuccess(),
            "ERC20Wrapper.approve: Bad return value"
        );
    }

    /**
     * Ensure's the owner has granted enough allowance for system to
     * transfer tokens.
     *
     * @param  _token          The address of the ERC20 token
     * @param  _owner          The address of the token owner
     * @param  _spender        The address to grant/check allowance for
     * @param  _quantity       The amount to see if allowed for
     */
    function ensureAllowance(
        address _token,
        address _owner,
        address _spender,
        uint256 _quantity
    )
        internal
    {
        uint256 currentAllowance = allowance(_token, _owner, _spender);
        if (currentAllowance < _quantity) {
            approve(
                _token,
                _spender,
                CommonMath.maxUInt256()
            );
        }
    }

    // ============ Private Functions ============

    /**
     * Checks the return value of the previous function up to 32 bytes. Returns true if the previous
     * function returned 0 bytes or 1.
     */
    function checkSuccess(
    )
        private
        pure
        returns (bool)
    {
        // default to failure
        uint256 returnValue = 0;

        assembly {
            // check number of bytes returned from last function call
            switch returndatasize

            // no bytes returned: assume success
            case 0x0 {
                returnValue := 1
            }

            // 32 bytes returned
            case 0x20 {
                // copy 32 bytes into scratch space
                returndatacopy(0x0, 0x0, 0x20)

                // load those bytes into returnValue
                returnValue := mload(0x0)
            }

            // not sure what was returned: dont mark as success
            default { }
        }

        // check if returned value is one or nothing
        return returnValue == 1;
    }
}

// File: contracts/core/interfaces/ICore.sol

/*
    Copyright 2018 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.5.7;


/**
 * @title ICore
 * @author Set Protocol
 *
 * The ICore Contract defines all the functions exposed in the Core through its
 * various extensions and is a light weight way to interact with the contract.
 */
interface ICore {
    /**
     * Return transferProxy address.
     *
     * @return address       transferProxy address
     */
    function transferProxy()
        external
        view
        returns (address);

    /**
     * Return vault address.
     *
     * @return address       vault address
     */
    function vault()
        external
        view
        returns (address);

    /**
     * Return address belonging to given exchangeId.
     *
     * @param  _exchangeId       ExchangeId number
     * @return address           Address belonging to given exchangeId
     */
    function exchangeIds(
        uint8 _exchangeId
    )
        external
        view
        returns (address);

    /*
     * Returns if valid set
     *
     * @return  bool      Returns true if Set created through Core and isn't disabled
     */
    function validSets(address)
        external
        view
        returns (bool);

    /*
     * Returns if valid module
     *
     * @return  bool      Returns true if valid module
     */
    function validModules(address)
        external
        view
        returns (bool);

    /**
     * Return boolean indicating if address is a valid Rebalancing Price Library.
     *
     * @param  _priceLibrary    Price library address
     * @return bool             Boolean indicating if valid Price Library
     */
    function validPriceLibraries(
        address _priceLibrary
    )
        external
        view
        returns (bool);

    /**
     * Exchanges components for Set Tokens
     *
     * @param  _set          Address of set to issue
     * @param  _quantity     Quantity of set to issue
     */
    function issue(
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Issues a specified Set for a specified quantity to the recipient
     * using the caller's components from the wallet and vault.
     *
     * @param  _recipient    Address to issue to
     * @param  _set          Address of the Set to issue
     * @param  _quantity     Number of tokens to issue
     */
    function issueTo(
        address _recipient,
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Converts user's components into Set Tokens held directly in Vault instead of user's account
     *
     * @param _set          Address of the Set
     * @param _quantity     Number of tokens to redeem
     */
    function issueInVault(
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Function to convert Set Tokens into underlying components
     *
     * @param _set          The address of the Set token
     * @param _quantity     The number of tokens to redeem. Should be multiple of natural unit.
     */
    function redeem(
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Redeem Set token and return components to specified recipient. The components
     * are left in the vault
     *
     * @param _recipient    Recipient of Set being issued
     * @param _set          Address of the Set
     * @param _quantity     Number of tokens to redeem
     */
    function redeemTo(
        address _recipient,
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Function to convert Set Tokens held in vault into underlying components
     *
     * @param _set          The address of the Set token
     * @param _quantity     The number of tokens to redeem. Should be multiple of natural unit.
     */
    function redeemInVault(
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Composite method to redeem and withdraw with a single transaction
     *
     * Normally, you should expect to be able to withdraw all of the tokens.
     * However, some have central abilities to freeze transfers (e.g. EOS). _toExclude
     * allows you to optionally specify which component tokens to exclude when
     * redeeming. They will remain in the vault under the users' addresses.
     *
     * @param _set          Address of the Set
     * @param _to           Address to withdraw or attribute tokens to
     * @param _quantity     Number of tokens to redeem
     * @param _toExclude    Mask of indexes of tokens to exclude from withdrawing
     */
    function redeemAndWithdrawTo(
        address _set,
        address _to,
        uint256 _quantity,
        uint256 _toExclude
    )
        external;

    /**
     * Deposit multiple tokens to the vault. Quantities should be in the
     * order of the addresses of the tokens being deposited.
     *
     * @param  _tokens           Array of the addresses of the ERC20 tokens
     * @param  _quantities       Array of the number of tokens to deposit
     */
    function batchDeposit(
        address[] calldata _tokens,
        uint256[] calldata _quantities
    )
        external;

    /**
     * Withdraw multiple tokens from the vault. Quantities should be in the
     * order of the addresses of the tokens being withdrawn.
     *
     * @param  _tokens            Array of the addresses of the ERC20 tokens
     * @param  _quantities        Array of the number of tokens to withdraw
     */
    function batchWithdraw(
        address[] calldata _tokens,
        uint256[] calldata _quantities
    )
        external;

    /**
     * Deposit any quantity of tokens into the vault.
     *
     * @param  _token           The address of the ERC20 token
     * @param  _quantity        The number of tokens to deposit
     */
    function deposit(
        address _token,
        uint256 _quantity
    )
        external;

    /**
     * Withdraw a quantity of tokens from the vault.
     *
     * @param  _token           The address of the ERC20 token
     * @param  _quantity        The number of tokens to withdraw
     */
    function withdraw(
        address _token,
        uint256 _quantity
    )
        external;

    /**
     * Transfer tokens associated with the sender's account in vault to another user's
     * account in vault.
     *
     * @param  _token           Address of token being transferred
     * @param  _to              Address of user receiving tokens
     * @param  _quantity        Amount of tokens being transferred
     */
    function internalTransfer(
        address _token,
        address _to,
        uint256 _quantity
    )
        external;

    /**
     * Deploys a new Set Token and adds it to the valid list of SetTokens
     *
     * @param  _factory              The address of the Factory to create from
     * @param  _components           The address of component tokens
     * @param  _units                The units of each component token
     * @param  _naturalUnit          The minimum unit to be issued or redeemed
     * @param  _name                 The bytes32 encoded name of the new Set
     * @param  _symbol               The bytes32 encoded symbol of the new Set
     * @param  _callData             Byte string containing additional call parameters
     * @return setTokenAddress       The address of the new Set
     */
    function createSet(
        address _factory,
        address[] calldata _components,
        uint256[] calldata _units,
        uint256 _naturalUnit,
        bytes32 _name,
        bytes32 _symbol,
        bytes calldata _callData
    )
        external
        returns (address);

    /**
     * Exposes internal function that deposits a quantity of tokens to the vault and attributes
     * the tokens respectively, to system modules.
     *
     * @param  _from            Address to transfer tokens from
     * @param  _to              Address to credit for deposit
     * @param  _token           Address of token being deposited
     * @param  _quantity        Amount of tokens to deposit
     */
    function depositModule(
        address _from,
        address _to,
        address _token,
        uint256 _quantity
    )
        external;

    /**
     * Exposes internal function that withdraws a quantity of tokens from the vault and
     * deattributes the tokens respectively, to system modules.
     *
     * @param  _from            Address to decredit for withdraw
     * @param  _to              Address to transfer tokens to
     * @param  _token           Address of token being withdrawn
     * @param  _quantity        Amount of tokens to withdraw
     */
    function withdrawModule(
        address _from,
        address _to,
        address _token,
        uint256 _quantity
    )
        external;

    /**
     * Exposes internal function that deposits multiple tokens to the vault, to system
     * modules. Quantities should be in the order of the addresses of the tokens being
     * deposited.
     *
     * @param  _from              Address to transfer tokens from
     * @param  _to                Address to credit for deposits
     * @param  _tokens            Array of the addresses of the tokens being deposited
     * @param  _quantities        Array of the amounts of tokens to deposit
     */
    function batchDepositModule(
        address _from,
        address _to,
        address[] calldata _tokens,
        uint256[] calldata _quantities
    )
        external;

    /**
     * Exposes internal function that withdraws multiple tokens from the vault, to system
     * modules. Quantities should be in the order of the addresses of the tokens being withdrawn.
     *
     * @param  _from              Address to decredit for withdrawals
     * @param  _to                Address to transfer tokens to
     * @param  _tokens            Array of the addresses of the tokens being withdrawn
     * @param  _quantities        Array of the amounts of tokens to withdraw
     */
    function batchWithdrawModule(
        address _from,
        address _to,
        address[] calldata _tokens,
        uint256[] calldata _quantities
    )
        external;

    /**
     * Expose internal function that exchanges components for Set tokens,
     * accepting any owner, to system modules
     *
     * @param  _owner        Address to use tokens from
     * @param  _recipient    Address to issue Set to
     * @param  _set          Address of the Set to issue
     * @param  _quantity     Number of tokens to issue
     */
    function issueModule(
        address _owner,
        address _recipient,
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Expose internal function that exchanges Set tokens for components,
     * accepting any owner, to system modules
     *
     * @param  _burnAddress         Address to burn token from
     * @param  _incrementAddress    Address to increment component tokens to
     * @param  _set                 Address of the Set to redeem
     * @param  _quantity            Number of tokens to redeem
     */
    function redeemModule(
        address _burnAddress,
        address _incrementAddress,
        address _set,
        uint256 _quantity
    )
        external;

    /**
     * Expose vault function that increments user's balance in the vault.
     * Available to system modules
     *
     * @param  _tokens          The addresses of the ERC20 tokens
     * @param  _owner           The address of the token owner
     * @param  _quantities      The numbers of tokens to attribute to owner
     */
    function batchIncrementTokenOwnerModule(
        address[] calldata _tokens,
        address _owner,
        uint256[] calldata _quantities
    )
        external;

    /**
     * Expose vault function that decrement user's balance in the vault
     * Only available to system modules.
     *
     * @param  _tokens          The addresses of the ERC20 tokens
     * @param  _owner           The address of the token owner
     * @param  _quantities      The numbers of tokens to attribute to owner
     */
    function batchDecrementTokenOwnerModule(
        address[] calldata _tokens,
        address _owner,
        uint256[] calldata _quantities
    )
        external;

    /**
     * Expose vault function that transfer vault balances between users
     * Only available to system modules.
     *
     * @param  _tokens           Addresses of tokens being transferred
     * @param  _from             Address tokens being transferred from
     * @param  _to               Address tokens being transferred to
     * @param  _quantities       Amounts of tokens being transferred
     */
    function batchTransferBalanceModule(
        address[] calldata _tokens,
        address _from,
        address _to,
        uint256[] calldata _quantities
    )
        external;

    /**
     * Transfers token from one address to another using the transfer proxy.
     * Only available to system modules.
     *
     * @param  _token          The address of the ERC20 token
     * @param  _quantity       The number of tokens to transfer
     * @param  _from           The address to transfer from
     * @param  _to             The address to transfer to
     */
    function transferModule(
        address _token,
        uint256 _quantity,
        address _from,
        address _to
    )
        external;

    /**
     * Expose transfer proxy function to transfer tokens from one address to another
     * Only available to system modules.
     *
     * @param  _tokens         The addresses of the ERC20 token
     * @param  _quantities     The numbers of tokens to transfer
     * @param  _from           The address to transfer from
     * @param  _to             The address to transfer to
     */
    function batchTransferModule(
        address[] calldata _tokens,
        uint256[] calldata _quantities,
        address _from,
        address _to
    )
        external;
}

// File: contracts/core/interfaces/ITransferProxy.sol

/*
    Copyright 2018 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.5.7;

/**
 * @title ITransferProxy
 * @author Set Protocol
 *
 * The ITransferProxy interface provides a light-weight, structured way to interact with the
 * TransferProxy contract from another contract.
 */
interface ITransferProxy {

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

    /**
     * Transfers tokens from an address (that has set allowance on the proxy).
     * Can only be called by authorized core contracts.
     *
     * @param  _token          The address of the ERC20 token
     * @param  _quantity       The number of tokens to transfer
     * @param  _from           The address to transfer from
     * @param  _to             The address to transfer to
     */
    function transfer(
        address _token,
        uint256 _quantity,
        address _from,
        address _to
    )
        external;

    /**
     * Transfers tokens from an address (that has set allowance on the proxy).
     * Can only be called by authorized core contracts.
     *
     * @param  _tokens         The addresses of the ERC20 token
     * @param  _quantities     The numbers of tokens to transfer
     * @param  _from           The address to transfer from
     * @param  _to             The address to transfer to
     */
    function batchTransfer(
        address[] calldata _tokens,
        uint256[] calldata _quantities,
        address _from,
        address _to
    )
        external;
}

// File: contracts/core/interfaces/IVault.sol

/*
    Copyright 2018 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.5.7;

/**
 * @title IVault
 * @author Set Protocol
 *
 * The IVault interface provides a light-weight, structured way to interact with the Vault
 * contract from another contract.
 */
interface IVault {

    /*
     * Withdraws user's unassociated tokens to user account. Can only be
     * called by authorized core contracts.
     *
     * @param  _token          The address of the ERC20 token
     * @param  _to             The address to transfer token to
     * @param  _quantity       The number of tokens to transfer
     */
    function withdrawTo(
        address _token,
        address _to,
        uint256 _quantity
    )
        external;

    /*
     * Increment quantity owned of a token for a given address. Can
     * only be called by authorized core contracts.
     *
     * @param  _token           The address of the ERC20 token
     * @param  _owner           The address of the token owner
     * @param  _quantity        The number of tokens to attribute to owner
     */
    function incrementTokenOwner(
        address _token,
        address _owner,
        uint256 _quantity
    )
        external;

    /*
     * Decrement quantity owned of a token for a given address. Can only
     * be called by authorized core contracts.
     *
     * @param  _token           The address of the ERC20 token
     * @param  _owner           The address of the token owner
     * @param  _quantity        The number of tokens to deattribute to owner
     */
    function decrementTokenOwner(
        address _token,
        address _owner,
        uint256 _quantity
    )
        external;

    /**
     * Transfers tokens associated with one account to another account in the vault
     *
     * @param  _token          Address of token being transferred
     * @param  _from           Address token being transferred from
     * @param  _to             Address token being transferred to
     * @param  _quantity       Amount of tokens being transferred
     */

    function transferBalance(
        address _token,
        address _from,
        address _to,
        uint256 _quantity
    )
        external;


    /*
     * Withdraws user's unassociated tokens to user account. Can only be
     * called by authorized core contracts.
     *
     * @param  _tokens          The addresses of the ERC20 tokens
     * @param  _owner           The address of the token owner
     * @param  _quantities      The numbers of tokens to attribute to owner
     */
    function batchWithdrawTo(
        address[] calldata _tokens,
        address _to,
        uint256[] calldata _quantities
    )
        external;

    /*
     * Increment quantites owned of a collection of tokens for a given address. Can
     * only be called by authorized core contracts.
     *
     * @param  _tokens          The addresses of the ERC20 tokens
     * @param  _owner           The address of the token owner
     * @param  _quantities      The numbers of tokens to attribute to owner
     */
    function batchIncrementTokenOwner(
        address[] calldata _tokens,
        address _owner,
        uint256[] calldata _quantities
    )
        external;

    /*
     * Decrements quantites owned of a collection of tokens for a given address. Can
     * only be called by authorized core contracts.
     *
     * @param  _tokens          The addresses of the ERC20 tokens
     * @param  _owner           The address of the token owner
     * @param  _quantities      The numbers of tokens to attribute to owner
     */
    function batchDecrementTokenOwner(
        address[] calldata _tokens,
        address _owner,
        uint256[] calldata _quantities
    )
        external;

   /**
     * Transfers tokens associated with one account to another account in the vault
     *
     * @param  _tokens           Addresses of tokens being transferred
     * @param  _from             Address tokens being transferred from
     * @param  _to               Address tokens being transferred to
     * @param  _quantities       Amounts of tokens being transferred
     */
    function batchTransferBalance(
        address[] calldata _tokens,
        address _from,
        address _to,
        uint256[] calldata _quantities
    )
        external;

    /*
     * Get balance of particular contract for owner.
     *
     * @param  _token    The address of the ERC20 token
     * @param  _owner    The address of the token owner
     */
    function getOwnerBalance(
        address _token,
        address _owner
    )
        external
        view
        returns (uint256);
}

// File: contracts/core/modules/lib/ModuleCoreState.sol

/*
    Copyright 2018 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.5.7;





/**
 * @title ModuleCoreState
 * @author Set Protocol
 *
 * The ModuleCoreState library maintains Core-related state for modules
 */
contract ModuleCoreState {

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

    // Address of core contract
    address public core;

    // Address of vault contract
    address public vault;

    // Instance of core contract
    ICore public coreInstance;

    // Instance of vault contract
    IVault public vaultInstance;

    /* ============ Public Getters ============ */

    /**
     * Constructor function for ModuleCoreState
     *
     * @param _core                The address of Core
     * @param _vault               The address of Vault
     */
    constructor(
        address _core,
        address _vault
    )
        public
    {
        // Commit passed address to core state variable
        core = _core;

        // Commit passed address to coreInstance state variable
        coreInstance = ICore(_core);

        // Commit passed address to vault state variable
        vault = _vault;

        // Commit passed address to vaultInstance state variable
        vaultInstance = IVault(_vault);
    }
}

// File: contracts/lib/AddressArrayUtils.sol

// Pulled in from Cryptofin Solidity package in order to control Solidity compiler version
// https://github.com/cryptofinlabs/cryptofin-solidity/blob/master/contracts/array-utils/AddressArrayUtils.sol

pragma solidity 0.5.7;


library AddressArrayUtils {

    /**
     * Finds the index of the first occurrence of the given element.
  ...

// [truncated — 90114 bytes total]

Read Contract

core 0xf2f4eb26 → address
coreInstance 0xa05cb755 → address
transferProxy 0x6e667db3 → address
vault 0xfbfa77cf → address
vaultInstance 0x63dc4f95 → address
weth 0x3fc8cef3 → address

Write Contract 4 functions

These functions modify contract state and require a wallet transaction to execute.

issueRebalancingSet 0x1cc0bd61
address _rebalancingSetAddress
uint256 _rebalancingSetQuantity
bool _keepChangeInVault
issueRebalancingSetWrappingEther 0x3ba30551
address _rebalancingSetAddress
uint256 _rebalancingSetQuantity
bool _keepChangeInVault
redeemRebalancingSet 0xda89a7b1
address _rebalancingSetAddress
uint256 _rebalancingSetQuantity
bool _keepChangeInVault
redeemRebalancingSetUnwrappingEther 0xf7b00c9e
address _rebalancingSetAddress
uint256 _rebalancingSetQuantity
bool _keepChangeInVault

Recent Transactions

No transactions found for this address