Contract 0x2622c4bb67992356b3826b5034bb2c7e949ab12b 1

 

Contract Overview

Balance:
0 MATIC

MATIC Value:
$0.00

Token:
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xd86c1a94940ab24cdce21b5bf0a9f62e3ab9b808da259620eb00e25cd1249d12Set Operator222535162021-12-07 20:52:32163 days 16 hrs agoIndex Coop: Deployer IN  0x2622c4bb67992356b3826b5034bb2c7e949ab12b0 MATIC0.0008557530.000000001
0x0b05ee241bf51419628dd60008efed59f419b2344cc341e4017e897c64d4d5b2Authorize Initia...222532792021-12-07 20:42:14163 days 16 hrs ago0x3059aea6011d83bfdf2da7b4299da5d00d0f1237 IN  0x2622c4bb67992356b3826b5034bb2c7e949ab12b0 MATIC0.0013692930
0x9e33a5ac2b9c6eb9e1bf0e040a31760c646b207911831941c0cea60d6f58a4cdProtect Module222179362021-12-06 23:08:20164 days 14 hrs agoIndex Coop: Deployer IN  0x2622c4bb67992356b3826b5034bb2c7e949ab12b0 MATIC0.0048477330
0x9390794a63b2bb03c983cafc5e09a768e800568decb5088991b2839a5a3c17f8Protect Module222178732021-12-06 23:03:06164 days 14 hrs agoIndex Coop: Deployer IN  0x2622c4bb67992356b3826b5034bb2c7e949ab12b0 MATIC0.0068211930
0x34c2814c52adaa955229535f0b333b5c0f06a9c0a615fdb431d87b94fe4c0174Add Extension222178322021-12-06 23:00:28164 days 14 hrs agoIndex Coop: Deployer IN  0x2622c4bb67992356b3826b5034bb2c7e949ab12b0 MATIC0.0029848230
0xd50842fb4fe1f8773e57c55b4a7cda520d7397ec6c42f825e3646babaf247cd80x60806040222177332021-12-06 22:57:06164 days 14 hrs agoIndex Coop: Deployer IN  Contract Creation0 MATIC0.0758474730
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x28d1b4F13Ba91D0E8510ef291838B9046A8645Fc

Contract Name:
BaseManagerV2

Compiler Version
v0.6.10+commit.00c0fcaf

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 10 : BaseManagerV2.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.

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

pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;

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

import { AddressArrayUtils } from "../lib/AddressArrayUtils.sol";
import { IExtension } from "../interfaces/IExtension.sol";
import { ISetToken } from "../interfaces/ISetToken.sol";
import { MutualUpgrade } from "../lib/MutualUpgrade.sol";


/**
 * @title BaseManagerV2
 * @author Set Protocol
 *
 * Smart contract manager that contains permissions and admin functionality. Implements IIP-64, supporting
 * a registry of protected modules that can only be upgraded with methodologist consent.
 */
contract BaseManagerV2 is MutualUpgrade {
    using Address for address;
    using AddressArrayUtils for address[];
    using SafeERC20 for IERC20;

    /* ============ Struct ========== */

    struct ProtectedModule {
        bool isProtected;                               // Flag set to true if module is protected
        address[] authorizedExtensionsList;             // List of Extensions authorized to call module
        mapping(address => bool) authorizedExtensions;  // Map of extensions authorized to call module
    }

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

    event ExtensionAdded(
        address _extension
    );

    event ExtensionRemoved(
        address _extension
    );

    event MethodologistChanged(
        address _oldMethodologist,
        address _newMethodologist
    );

    event OperatorChanged(
        address _oldOperator,
        address _newOperator
    );

    event ExtensionAuthorized(
        address _module,
        address _extension
    );

    event ExtensionAuthorizationRevoked(
        address _module,
        address _extension
    );

    event ModuleProtected(
        address _module,
        address[] _extensions
    );

    event ModuleUnprotected(
        address _module
    );

    event ReplacedProtectedModule(
        address _oldModule,
        address _newModule,
        address[] _newExtensions
    );

    event EmergencyReplacedProtectedModule(
        address _module,
        address[] _extensions
    );

    event EmergencyRemovedProtectedModule(
        address _module
    );

    event EmergencyResolved();

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

    /**
     * Throws if the sender is not the SetToken operator
     */
    modifier onlyOperator() {
        require(msg.sender == operator, "Must be operator");
        _;
    }

    /**
     * Throws if the sender is not the SetToken methodologist
     */
    modifier onlyMethodologist() {
        require(msg.sender == methodologist, "Must be methodologist");
        _;
    }

    /**
     * Throws if the sender is not a listed extension
     */
    modifier onlyExtension() {
        require(isExtension[msg.sender], "Must be extension");
        _;
    }

    /**
     * Throws if contract is in an emergency state following a unilateral operator removal of a
     * protected module.
     */
    modifier upgradesPermitted() {
        require(emergencies == 0, "Upgrades paused by emergency");
        _;
    }

    /**
     * Throws if contract is *not* in an emergency state. Emergency replacement and resolution
     * can only happen in an emergency
     */
    modifier onlyEmergency() {
        require(emergencies > 0, "Not in emergency");
        _;
    }

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

    // Instance of SetToken
    ISetToken public setToken;

    // Array of listed extensions
    address[] internal extensions;

    // Mapping to check if extension is added
    mapping(address => bool) public isExtension;

    // Address of operator which typically executes manager only functions on Set Protocol modules
    address public operator;

    // Address of methodologist which serves as providing methodology for the index
    address public methodologist;

    // Counter incremented when the operator "emergency removes" a protected module. Decremented
    // when methodologist executes an "emergency replacement". Operator can only add modules and
    // extensions when `emergencies` is zero. Emergencies can only be declared "over" by mutual agreement
    // between operator and methodologist or by the methodologist alone via `resolveEmergency`
    uint256 public emergencies;

    // Mapping of protected modules. These cannot be called or removed except by mutual upgrade.
    mapping(address => ProtectedModule) public protectedModules;

    // List of protected modules, for iteration. Used when checking that an extension removal
    // can happen without methodologist approval
    address[] public protectedModulesList;

    // Boolean set when methodologist authorizes initialization after contract deployment.
    // Must be true to call via `interactManager`.
    bool public initialized;

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

    constructor(
        ISetToken _setToken,
        address _operator,
        address _methodologist
    )
        public
    {
        setToken = _setToken;
        operator = _operator;
        methodologist = _methodologist;
    }

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

    /**
     * ONLY METHODOLOGIST : Called by the methodologist to enable contract. All `interactManager`
     * calls revert until this is invoked. Lets methodologist review and authorize initial protected
     * module settings.
     */
    function authorizeInitialization() external onlyMethodologist {
        require(!initialized, "Initialization authorized");
        initialized = true;
    }

    /**
     * MUTUAL UPGRADE: Update the SetToken manager address. Operator and Methodologist must each call
     * this function to execute the update.
     *
     * @param _newManager           New manager address
     */
    function setManager(address _newManager) external mutualUpgrade(operator, methodologist) {
        require(_newManager != address(0), "Zero address not valid");
        setToken.setManager(_newManager);
    }

    /**
     * OPERATOR ONLY: Add a new extension that the BaseManager can call.
     *
     * @param _extension           New extension to add
     */
    function addExtension(address _extension) external upgradesPermitted onlyOperator {
        require(!isExtension[_extension], "Extension already exists");
        require(address(IExtension(_extension).manager()) == address(this), "Extension manager invalid");

        _addExtension(_extension);
    }

    /**
     * OPERATOR ONLY: Remove an existing extension tracked by the BaseManager.
     *
     * @param _extension           Old extension to remove
     */
    function removeExtension(address _extension) external onlyOperator {
        require(isExtension[_extension], "Extension does not exist");
        require(!_isAuthorizedExtension(_extension), "Extension used by protected module");

        extensions.removeStorage(_extension);

        isExtension[_extension] = false;

        emit ExtensionRemoved(_extension);
    }

    /**
     * MUTUAL UPGRADE: Authorizes an extension for a protected module. Operator and Methodologist must
     * each call this function to execute the update. Adds extension to manager if not already present.
     *
     * @param _module           Module to authorize extension for
     * @param _extension          Extension to authorize for module
     */
    function authorizeExtension(address _module, address _extension)
        external
        mutualUpgrade(operator, methodologist)
    {
        require(protectedModules[_module].isProtected, "Module not protected");
        require(!protectedModules[_module].authorizedExtensions[_extension], "Extension already authorized");

        _authorizeExtension(_module, _extension);

        emit ExtensionAuthorized(_module, _extension);
    }

    /**
     * MUTUAL UPGRADE: Revokes extension authorization for a protected module. Operator and Methodologist
     * must each call this function to execute the update. In order to remove the extension completely
     * from the contract removeExtension must be called by the operator.
     *
     * @param _module           Module to revoke extension authorization for
     * @param _extension          Extension to revoke authorization of
     */
    function revokeExtensionAuthorization(address _module, address _extension)
        external
        mutualUpgrade(operator, methodologist)
    {
        require(protectedModules[_module].isProtected, "Module not protected");
        require(isExtension[_extension], "Extension does not exist");
        require(protectedModules[_module].authorizedExtensions[_extension], "Extension not authorized");

        protectedModules[_module].authorizedExtensions[_extension] = false;
        protectedModules[_module].authorizedExtensionsList.removeStorage(_extension);

        emit ExtensionAuthorizationRevoked(_module, _extension);
    }

    /**
     * ADAPTER ONLY: Interact with a module registered on the SetToken. Manager initialization must
     * have been authorized by methodologist. Extension making this call must be authorized
     * to call module if module is protected.
     *
     * @param _module           Module to interact with
     * @param _data             Byte data of function to call in module
     */
    function interactManager(address _module, bytes memory _data) external onlyExtension {
        require(initialized, "Manager not initialized");
        require(_module != address(setToken), "Extensions cannot call SetToken");
        require(_senderAuthorizedForModule(_module, msg.sender), "Extension not authorized for module");

        // Invoke call to module, assume value will always be 0
        _module.functionCallWithValue(_data, 0);
    }

    /**
     * OPERATOR ONLY: Transfers _tokens held by the manager to _destination. Can be used to
     * recover anything sent here accidentally. In BaseManagerV2, extensions should
     * be the only contracts designated as `feeRecipient` in fee modules.
     *
     * @param _token           ERC20 token to send
     * @param _destination     Address receiving the tokens
     * @param _amount          Quantity of tokens to send
     */
    function transferTokens(address _token, address _destination, uint256 _amount) external onlyExtension {
        IERC20(_token).safeTransfer(_destination, _amount);
    }

    /**
     * OPERATOR ONLY: Add a new module to the SetToken.
     *
     * @param _module           New module to add
     */
    function addModule(address _module) external upgradesPermitted onlyOperator {
        setToken.addModule(_module);
    }

    /**
     * OPERATOR ONLY: Remove a new module from the SetToken. Any extensions associated with this
     * module need to be removed in separate transactions via removeExtension.
     *
     * @param _module           Module to remove
     */
    function removeModule(address _module) external onlyOperator {
        require(!protectedModules[_module].isProtected, "Module protected");
        setToken.removeModule(_module);
    }

    /**
     * OPERATOR ONLY: Marks a currently protected module as unprotected and deletes its authorized
     * extension registries. Removes module from the SetToken. Increments the `emergencies` counter,
     * prohibiting any operator-only module or extension additions until `emergencyReplaceProtectedModule`
     * is executed or `resolveEmergency` is called by the methodologist.
     *
     * Called by operator when a module must be removed immediately for security reasons and it's unsafe
     * to wait for a `mutualUpgrade` process to play out.
     *
     * NOTE: If removing a fee module, you can ensure all fees are distributed by calling distribute
     * on the module's de-authorized fee extension after this call.
     *
     * @param _module           Module to remove
     */
    function emergencyRemoveProtectedModule(address _module) external onlyOperator {
        _unProtectModule(_module);
        setToken.removeModule(_module);
        emergencies += 1;

        emit EmergencyRemovedProtectedModule(_module);
    }

    /**
     * OPERATOR ONLY: Marks an existing module as protected and authorizes extensions for
     * it, adding them if necessary. Adds module to the protected modules list
     *
     * The operator uses this when they're adding new features and want to assure the methodologist
     * they won't be unilaterally changed in the future. Cannot be called during an emergency because
     * methodologist needs to explicitly approve protection arrangements under those conditions.
     *
     * NOTE: If adding a fee extension while protecting a fee module, it's important to set the
     * module `feeRecipient` to the new extension's address (ideally before this call).
     *
     * @param  _module          Module to protect
     * @param  _extensions        Array of extensions to authorize for protected module
     */
    function protectModule(address _module, address[] memory _extensions)
        external
        upgradesPermitted
        onlyOperator
    {
        require(setToken.getModules().contains(_module), "Module not added yet");
        _protectModule(_module, _extensions);

        emit ModuleProtected(_module, _extensions);
    }

    /**
     * METHODOLOGIST ONLY: Marks a currently protected module as unprotected and deletes its authorized
     * extension registries. Removes old module from the protected modules list.
     *
     * Called by the methodologist when they want to cede control over a protected module without triggering
     * an emergency (for example, to remove it because its dead).
     *
     * @param  _module          Module to revoke protections for
     */
    function unProtectModule(address _module) external onlyMethodologist {
        _unProtectModule(_module);

        emit ModuleUnprotected(_module);
    }

    /**
     * MUTUAL UPGRADE: Replaces a protected module. Operator and Methodologist must each call this
     * function to execute the update.
     *
     * > Marks a currently protected module as unprotected
     * > Deletes its authorized extension registries.
     * > Removes old module from SetToken.
     * > Adds new module to SetToken.
     * > Marks `_newModule` as protected and authorizes new extensions for it.
     *
     * Used when methodologists wants to guarantee that an existing protection arrangement is replaced
     * with a suitable substitute (ex: upgrading a StreamingFeeSplitExtension).
     *
     * NOTE: If replacing a fee module, it's necessary to set the module `feeRecipient` to be
     * the new fee extension address after this call. Any fees remaining in the old module's
     * de-authorized extensions can be distributed by calling `distribute()` on the old extension.
     *
     * @param _oldModule        Module to remove
     * @param _newModule        Module to add in place of removed module
     * @param _newExtensions      Extensions to authorize for new module
     */
    function replaceProtectedModule(address _oldModule, address _newModule, address[] memory _newExtensions)
        external
        mutualUpgrade(operator, methodologist)
    {
        _unProtectModule(_oldModule);

        setToken.removeModule(_oldModule);
        setToken.addModule(_newModule);

        _protectModule(_newModule, _newExtensions);

        emit ReplacedProtectedModule(_oldModule, _newModule, _newExtensions);
    }

    /**
     * MUTUAL UPGRADE & EMERGENCY ONLY: Replaces a module the operator has removed with
     * `emergencyRemoveProtectedModule`. Operator and Methodologist must each call this function to
     *  execute the update.
     *
     * > Adds new module to SetToken.
     * > Marks `_newModule` as protected and authorizes new extensions for it.
     * > Adds `_newModule` to protectedModules list.
     * > Decrements the emergencies counter,
     *
     * Used when methodologist wants to guarantee that a protection arrangement which was
     * removed in an emergency is replaced with a suitable substitute. Operator's ability to add modules
     * or extensions is restored after invoking this method (if this is the only emergency.)
     *
     * NOTE: If replacing a fee module, it's necessary to set the module `feeRecipient` to be
     * the new fee extension address after this call. Any fees remaining in the old module's
     * de-authorized extensions can be distributed by calling `accrueFeesAndDistribute` on the old extension.
     *
     * @param _module          Module to add in place of removed module
     * @param _extensions      Array of extensions to authorize for replacement module
     */
    function emergencyReplaceProtectedModule(
        address _module,
        address[] memory _extensions
    )
        external
        mutualUpgrade(operator, methodologist)
        onlyEmergency
    {
        setToken.addModule(_module);
        _protectModule(_module, _extensions);

        emergencies -= 1;

        emit EmergencyReplacedProtectedModule(_module, _extensions);
    }

    /**
     * METHODOLOGIST ONLY & EMERGENCY ONLY: Decrements the emergencies counter.
     *
     * Allows a methodologist to exit a state of emergency without replacing a protected module that
     * was removed. This could happen if the module has no viable substitute or operator and methodologist
     * agree that restoring normal operations is the best way forward.
     */
    function resolveEmergency() external onlyMethodologist onlyEmergency {
        emergencies -= 1;

        emit EmergencyResolved();
    }

    /**
     * METHODOLOGIST ONLY: Update the methodologist address
     *
     * @param _newMethodologist           New methodologist address
     */
    function setMethodologist(address _newMethodologist) external onlyMethodologist {
        emit MethodologistChanged(methodologist, _newMethodologist);

        methodologist = _newMethodologist;
    }

    /**
     * OPERATOR ONLY: Update the operator address
     *
     * @param _newOperator           New operator address
     */
    function setOperator(address _newOperator) external onlyOperator {
        emit OperatorChanged(operator, _newOperator);

        operator = _newOperator;
    }

    /* ============ External Getters ============ */

    function getExtensions() external view returns(address[] memory) {
        return extensions;
    }

    function getAuthorizedExtensions(address _module) external view returns (address[] memory) {
        return protectedModules[_module].authorizedExtensionsList;
    }

    function isAuthorizedExtension(address _module, address _extension) external view returns (bool) {
        return protectedModules[_module].authorizedExtensions[_extension];
    }

    function getProtectedModules() external view returns (address[] memory) {
        return protectedModulesList;
    }

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


    /**
     * Add a new extension that the BaseManager can call.
     */
    function _addExtension(address _extension) internal {
        extensions.push(_extension);

        isExtension[_extension] = true;

        emit ExtensionAdded(_extension);
    }

    /**
     * Marks a currently protected module as unprotected and deletes it from authorized extension
     * registries. Removes module from the SetToken.
     */
    function _unProtectModule(address _module) internal {
        require(protectedModules[_module].isProtected, "Module not protected");

        // Clear mapping and array entries in struct before deleting mapping entry
        for (uint256 i = 0; i < protectedModules[_module].authorizedExtensionsList.length; i++) {
            address extension = protectedModules[_module].authorizedExtensionsList[i];
            protectedModules[_module].authorizedExtensions[extension] = false;
        }

        delete protectedModules[_module];

        protectedModulesList.removeStorage(_module);
    }

    /**
     * Adds new module to SetToken. Marks `_newModule` as protected and authorizes
     * new extensions for it. Adds `_newModule` module to protectedModules list.
     */
    function _protectModule(address _module, address[] memory _extensions) internal {
        require(!protectedModules[_module].isProtected, "Module already protected");

        protectedModules[_module].isProtected = true;
        protectedModulesList.push(_module);

        for (uint i = 0; i < _extensions.length; i++) {
            _authorizeExtension(_module, _extensions[i]);
        }
    }

    /**
     * Adds extension if not already added and marks extension as authorized for module
     */
    function _authorizeExtension(address _module, address _extension) internal {
        if (!isExtension[_extension]) {
            _addExtension(_extension);
        }

        protectedModules[_module].authorizedExtensions[_extension] = true;
        protectedModules[_module].authorizedExtensionsList.push(_extension);
    }

    /**
     * Searches the extension mappings of each protected modules to determine if an extension
     * is authorized by any of them. Authorized extensions cannot be unilaterally removed by
     * the operator.
     */
    function _isAuthorizedExtension(address _extension) internal view returns (bool) {
        for (uint256 i = 0; i < protectedModulesList.length; i++) {
            if (protectedModules[protectedModulesList[i]].authorizedExtensions[_extension]) {
                return true;
            }
        }

        return false;
    }

    /**
     * Checks if `_sender` (an extension) is allowed to call a module (which may be protected)
     */
    function _senderAuthorizedForModule(address _module, address _sender) internal view returns (bool) {
        if (protectedModules[_module].isProtected) {
            return protectedModules[_module].authorizedExtensions[_sender];
        }

        return true;
    }
}

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

pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 4 of 10 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 5 of 10 : 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.

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

pragma solidity 0.6.10;

/**
 * @title AddressArrayUtils
 * @author Set Protocol
 *
 * Utility functions to handle Address Arrays
 *
 * CHANGELOG:
 * - 4/27/21: Added validatePairsWithArray methods
 */
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;
    }

    /**
     * Validate that address and uint array lengths match. Validate address array is not empty
     * and contains no duplicate elements.
     *
     * @param A         Array of addresses
     * @param B         Array of uint
     */
    function validatePairsWithArray(address[] memory A, uint[] memory B) internal pure {
        require(A.length == B.length, "Array length mismatch");
        _validateLengthAndUniqueness(A);
    }

    /**
     * Validate that address and bool array lengths match. Validate address array is not empty
     * and contains no duplicate elements.
     *
     * @param A         Array of addresses
     * @param B         Array of bool
     */
    function validatePairsWithArray(address[] memory A, bool[] memory B) internal pure {
        require(A.length == B.length, "Array length mismatch");
        _validateLengthAndUniqueness(A);
    }

    /**
     * Validate that address and string array lengths match. Validate address array is not empty
     * and contains no duplicate elements.
     *
     * @param A         Array of addresses
     * @param B         Array of strings
     */
    function validatePairsWithArray(address[] memory A, string[] memory B) internal pure {
        require(A.length == B.length, "Array length mismatch");
        _validateLengthAndUniqueness(A);
    }

    /**
     * Validate that address array lengths match, and calling address array are not empty
     * and contain no duplicate elements.
     *
     * @param A         Array of addresses
     * @param B         Array of addresses
     */
    function validatePairsWithArray(address[] memory A, address[] memory B) internal pure {
        require(A.length == B.length, "Array length mismatch");
        _validateLengthAndUniqueness(A);
    }

    /**
     * Validate that address and bytes array lengths match. Validate address array is not empty
     * and contains no duplicate elements.
     *
     * @param A         Array of addresses
     * @param B         Array of bytes
     */
    function validatePairsWithArray(address[] memory A, bytes[] memory B) internal pure {
        require(A.length == B.length, "Array length mismatch");
        _validateLengthAndUniqueness(A);
    }

    /**
     * Validate address array is not empty and contains no duplicate elements.
     *
     * @param A          Array of addresses
     */
    function _validateLengthAndUniqueness(address[] memory A) internal pure {
        require(A.length > 0, "Array length must be > 0");
        require(!hasDuplicate(A), "Cannot duplicate addresses");
    }
}

File 6 of 10 : IExtension.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.

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

pragma solidity 0.6.10;
pragma experimental "ABIEncoderV2";

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

interface IExtension {
    function manager() external view returns (IBaseManager);
}

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

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

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

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

    enum ModuleState {
        NONE,
        PENDING,
        INITIALIZED
    }

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

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

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


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

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

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

    function editPositionMultiplier(int256 _newMultiplier) external;

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

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

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

    function setManager(address _manager) external;

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

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

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

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

File 8 of 10 : MutualUpgrade.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.

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

pragma solidity 0.6.10;

/**
 * @title MutualUpgrade
 * @author Set Protocol
 *
 * The MutualUpgrade contract contains a modifier for handling mutual upgrades between two parties
 */
contract MutualUpgrade {
    /* ============ State Variables ============ */

    // Mapping of upgradable units and if upgrade has been initialized by other party
    mapping(bytes32 => bool) public mutualUpgrades;

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

    event MutualUpgradeRegistered(
        bytes32 _upgradeHash
    );

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

    modifier mutualUpgrade(address _signerOne, address _signerTwo) {
        require(
            msg.sender == _signerOne || msg.sender == _signerTwo,
            "Must be authorized address"
        );

        address nonCaller = _getNonCaller(_signerOne, _signerTwo);

        // The upgrade hash is defined by the hash of the transaction call data and sender of msg,
        // which uniquely identifies the function, arguments, and sender.
        bytes32 expectedHash = keccak256(abi.encodePacked(msg.data, nonCaller));

        if (!mutualUpgrades[expectedHash]) {
            bytes32 newHash = keccak256(abi.encodePacked(msg.data, msg.sender));

            mutualUpgrades[newHash] = true;

            emit MutualUpgradeRegistered(newHash);

            return;
        }

        delete mutualUpgrades[expectedHash];

        // Run the rest of the upgrades
        _;
    }

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

    function _getNonCaller(address _signerOne, address _signerTwo) internal view returns(address) {
        return msg.sender == _signerOne ? _signerTwo : _signerOne;
    }
}

File 9 of 10 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @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) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @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) {
        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, reverting 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) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting 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) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * 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);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 10 of 10 : IBaseManager.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.

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

pragma solidity 0.6.10;
pragma experimental "ABIEncoderV2";

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

interface IBaseManager {
    function setToken() external returns(ISetToken);

    function methodologist() external returns(address);

    function operator() external returns(address);

    function interactManager(address _module, bytes calldata _encoded) external;

    function transferTokens(address _token, address _destination, uint256 _amount) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ISetToken","name":"_setToken","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_methodologist","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_module","type":"address"}],"name":"EmergencyRemovedProtectedModule","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_module","type":"address"},{"indexed":false,"internalType":"address[]","name":"_extensions","type":"address[]"}],"name":"EmergencyReplacedProtectedModule","type":"event"},{"anonymous":false,"inputs":[],"name":"EmergencyResolved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_extension","type":"address"}],"name":"ExtensionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_module","type":"address"},{"indexed":false,"internalType":"address","name":"_extension","type":"address"}],"name":"ExtensionAuthorizationRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_module","type":"address"},{"indexed":false,"internalType":"address","name":"_extension","type":"address"}],"name":"ExtensionAuthorized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_extension","type":"address"}],"name":"ExtensionRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldMethodologist","type":"address"},{"indexed":false,"internalType":"address","name":"_newMethodologist","type":"address"}],"name":"MethodologistChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_module","type":"address"},{"indexed":false,"internalType":"address[]","name":"_extensions","type":"address[]"}],"name":"ModuleProtected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_module","type":"address"}],"name":"ModuleUnprotected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_upgradeHash","type":"bytes32"}],"name":"MutualUpgradeRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldOperator","type":"address"},{"indexed":false,"internalType":"address","name":"_newOperator","type":"address"}],"name":"OperatorChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldModule","type":"address"},{"indexed":false,"internalType":"address","name":"_newModule","type":"address"},{"indexed":false,"internalType":"address[]","name":"_newExtensions","type":"address[]"}],"name":"ReplacedProtectedModule","type":"event"},{"inputs":[{"internalType":"address","name":"_extension","type":"address"}],"name":"addExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"}],"name":"addModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"},{"internalType":"address","name":"_extension","type":"address"}],"name":"authorizeExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"authorizeInitialization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencies","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"}],"name":"emergencyRemoveProtectedModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"},{"internalType":"address[]","name":"_extensions","type":"address[]"}],"name":"emergencyReplaceProtectedModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"}],"name":"getAuthorizedExtensions","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExtensions","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtectedModules","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"interactManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"},{"internalType":"address","name":"_extension","type":"address"}],"name":"isAuthorizedExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"methodologist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"mutualUpgrades","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"},{"internalType":"address[]","name":"_extensions","type":"address[]"}],"name":"protectModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"protectedModules","outputs":[{"internalType":"bool","name":"isProtected","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"protectedModulesList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_extension","type":"address"}],"name":"removeExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"}],"name":"removeModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oldModule","type":"address"},{"internalType":"address","name":"_newModule","type":"address"},{"internalType":"address[]","name":"_newExtensions","type":"address[]"}],"name":"replaceProtectedModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resolveEmergency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"},{"internalType":"address","name":"_extension","type":"address"}],"name":"revokeExtensionAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newManager","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newMethodologist","type":"address"}],"name":"setMethodologist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOperator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setToken","outputs":[{"internalType":"contract ISetToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"}],"name":"unProtectModule","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162002c6f38038062002c6f833981016040819052620000349162000077565b600180546001600160a01b039485166001600160a01b031991821617909155600480549385169382169390931790925560058054919093169116179055620000e3565b6000806000606084860312156200008c578283fd5b83516200009981620000ca565b6020850151909350620000ac81620000ca565b6040850151909250620000bf81620000ca565b809150509250925092565b6001600160a01b0381168114620000e057600080fd5b50565b612b7c80620000f36000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80637db1b7061161010f578063a64b6e5f116100a2578063d0ebdbe711610071578063d0ebdbe7146103d2578063ed9cf58c146103e5578063f7b399db146103ed578063f847ed4814610400576101e5565b8063a64b6e5f14610386578063b3ab15fb14610399578063bb1ae080146103ac578063c93bbd6f146103bf576101e5565b8063994f3b45116100de578063994f3b451461035057806399aac253146103585780639f8e67bf1461036b578063a063246114610373576101e5565b80637db1b7061461031a57806383b7db631461032d57806386c9b5e114610335578063925b969e1461033d576101e5565b80633eb75b40116101875780635a5dea6c116101565780635a5dea6c146102cc57806363c88836146102e1578063660db484146102f457806372f2661e14610307576101e5565b80633eb75b40146102715780634cf4f63b14610291578063570ca735146102a45780635873999f146102b9576101e5565b80631bfc709d116101c35780631bfc709d146102255780631ed86f191461023857806321ee102b1461024b578063389f15321461025e576101e5565b8063158ef93e146101ea57806315c73afd14610208578063170ff3e114610212575b600080fd5b6101f2610413565b6040516101ff9190612512565b60405180910390f35b61021061041c565b005b610210610220366004612110565b6104a6565b6101f2610233366004612110565b6105d6565b610210610246366004612110565b6105eb565b610210610259366004612110565b61069a565b6101f261026c3660046123ac565b61078e565b61028461027f366004612110565b6107a3565b6040516101ff91906124ff565b61021061029f366004612252565b61081d565b6102ac6108e2565b6040516101ff9190612468565b6102106102c7366004612110565b6108f1565b6102d46109bf565b6040516101ff919061251d565b6102106102ef36600461212c565b6109c5565b610210610302366004612110565b610c39565b61021061031536600461212c565b610ccc565b610210610328366004612164565b610e4a565b610284611098565b6102846110fb565b61021061034b366004612204565b61115b565b6102106112a2565b6101f261036636600461212c565b6112fe565b6102ac611332565b610210610381366004612110565b611341565b6102106103943660046121c4565b6113d4565b6102106103a7366004612110565b61141d565b6102106103ba366004612204565b6114b0565b6102ac6103cd3660046123ac565b61163c565b6102106103e0366004612110565b611663565b6102ac611825565b6102106103fb366004612110565b611834565b6101f261040e366004612110565b611896565b60095460ff1681565b6005546001600160a01b0316331461044f5760405162461bcd60e51b81526004016104469061287d565b60405180910390fd5b6000600654116104715760405162461bcd60e51b8152600401610446906128ac565b600680546000190190556040517f80cf79aef2fa8bdb9275d6b40d6eb5c5ee0f74e14ec21e964e23e0415b7f6e2c90600090a1565b600654156104c65760405162461bcd60e51b8152600401610446906126b8565b6004546001600160a01b031633146104f05760405162461bcd60e51b8152600401610446906125bf565b6001600160a01b03811660009081526003602052604090205460ff16156105295760405162461bcd60e51b81526004016104469061276c565b306001600160a01b0316816001600160a01b031663481c6a756040518163ffffffff1660e01b815260040160206040518083038186803b15801561056c57600080fd5b505afa158015610580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a491906123c4565b6001600160a01b0316146105ca5760405162461bcd60e51b8152600401610446906126ef565b6105d3816118ab565b50565b60076020526000908152604090205460ff1681565b6006541561060b5760405162461bcd60e51b8152600401610446906126b8565b6004546001600160a01b031633146106355760405162461bcd60e51b8152600401610446906125bf565b600154604051631ed86f1960e01b81526001600160a01b0390911690631ed86f1990610665908490600401612468565b600060405180830381600087803b15801561067f57600080fd5b505af1158015610693573d6000803e3d6000fd5b5050505050565b6004546001600160a01b031633146106c45760405162461bcd60e51b8152600401610446906125bf565b6001600160a01b03811660009081526003602052604090205460ff166106fc5760405162461bcd60e51b815260040161044690612a27565b6107058161193f565b156107225760405162461bcd60e51b81526004016104469061283b565b61073360028263ffffffff6119ba16565b6001600160a01b03811660009081526003602052604090819020805460ff19169055517fa8b8029a40c8e49166ec4fec5b557819f19f8b94d2d69f5c4beb606af5850d8c90610783908390612468565b60405180910390a150565b60006020819052908152604090205460ff1681565b6001600160a01b03811660009081526007602090815260409182902060010180548351818402810184019094528084526060939283018282801561081057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107f2575b505050505090505b919050565b3360009081526003602052604090205460ff1661084c5760405162461bcd60e51b8152600401610446906128d6565b60095460ff1661086e5760405162461bcd60e51b815260040161044690612a5e565b6001546001600160a01b038381169116141561089c5760405162461bcd60e51b815260040161044690612559565b6108a68233611ae6565b6108c25760405162461bcd60e51b815260040161044690612675565b6108dd6001600160a01b03831682600063ffffffff611b4316565b505050565b6004546001600160a01b031681565b6004546001600160a01b0316331461091b5760405162461bcd60e51b8152600401610446906125bf565b61092481611b73565b60015460405163a063246160e01b81526001600160a01b039091169063a063246190610954908490600401612468565b600060405180830381600087803b15801561096e57600080fd5b505af1158015610982573d6000803e3d6000fd5b505060068054600101905550506040517fd18d4a150d1e746f04598e457ec24a3edf496efcce508524f9c74407118a605990610783908390612468565b60065481565b6004546005546001600160a01b039182169116338214806109ee5750336001600160a01b038216145b610a0a5760405162461bcd60e51b815260040161044690612938565b6000610a168383611c7e565b90506000803683604051602001610a2f93929190612423565b60408051601f19818403018152918152815160209283012060008181529283905291205490915060ff16610ae2576000803633604051602001610a7493929190612423565b60408051601f198184030181528282528051602091820120600081815291829052919020805460ff1916600117905591507f2d8be207af2fa24175b649fe62755a7b86fb6cb82c6efbd96de7447196d652ff90610ad290839061251d565b60405180910390a1505050610c33565b600081815260208181526040808320805460ff191690556001600160a01b0389168352600790915290205460ff16610b2c5760405162461bcd60e51b815260040161044690612647565b6001600160a01b03851660009081526003602052604090205460ff16610b645760405162461bcd60e51b815260040161044690612a27565b6001600160a01b038087166000908152600760209081526040808320938916835260029093019052205460ff16610bad5760405162461bcd60e51b8152600401610446906129f0565b6001600160a01b038087166000818152600760208181526040808420958b1684526002860182528320805460ff19169055929091529052610bf7906001018663ffffffff6119ba16565b7fd1547a1de21c18d521cd43c9d97b3e8585fb28d9a734ff2ca8cd4fc343a5f7bb8686604051610c2892919061247c565b60405180910390a150505b50505050565b6005546001600160a01b03163314610c635760405162461bcd60e51b81526004016104469061287d565b6005546040517fa744ece5192366887e454b5cc9ca9d970cf0ac3341003e0c91e9d30a570bae9391610ca2916001600160a01b0390911690849061247c565b60405180910390a1600580546001600160a01b0319166001600160a01b0392909216919091179055565b6004546005546001600160a01b03918216911633821480610cf55750336001600160a01b038216145b610d115760405162461bcd60e51b815260040161044690612938565b6000610d1d8383611c7e565b90506000803683604051602001610d3693929190612423565b60408051601f19818403018152918152815160209283012060008181529283905291205490915060ff16610d7b576000803633604051602001610a7493929190612423565b600081815260208181526040808320805460ff191690556001600160a01b0389168352600790915290205460ff16610dc55760405162461bcd60e51b815260040161044690612647565b6001600160a01b038087166000908152600760209081526040808320938916835260029093019052205460ff1615610e0f5760405162461bcd60e51b815260040161044690612804565b610e198686611c9c565b7f10c227733a73fbb4324bc76c8769459e70cc0d28bc1f0238002bdd8ea0cb5db68686604051610c2892919061247c565b6004546005546001600160a01b03918216911633821480610e735750336001600160a01b038216145b610e8f5760405162461bcd60e51b815260040161044690612938565b6000610e9b8383611c7e565b90506000803683604051602001610eb493929190612423565b60408051601f19818403018152918152815160209283012060008181529283905291205490915060ff16610f67576000803633604051602001610ef993929190612423565b60408051601f198184030181528282528051602091820120600081815291829052919020805460ff1916600117905591507f2d8be207af2fa24175b649fe62755a7b86fb6cb82c6efbd96de7447196d652ff90610f5790839061251d565b60405180910390a1505050610693565b6000818152602081905260409020805460ff19169055610f8687611b73565b60015460405163a063246160e01b81526001600160a01b039091169063a063246190610fb6908a90600401612468565b600060405180830381600087803b158015610fd057600080fd5b505af1158015610fe4573d6000803e3d6000fd5b5050600154604051631ed86f1960e01b81526001600160a01b039091169250631ed86f199150611018908990600401612468565b600060405180830381600087803b15801561103257600080fd5b505af1158015611046573d6000803e3d6000fd5b505050506110548686611d25565b7ff2b7eae21d5c352fa2fa2b46f6610cec3701b974bc3bde8fd23d65d88c44a41587878760405161108793929190612496565b60405180910390a150505050505050565b606060028054806020026020016040519081016040528092919081815260200182805480156110f057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110d2575b505050505090505b90565b606060088054806020026020016040519081016040528092919081815260200182805480156110f0576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116110d2575050505050905090565b6006541561117b5760405162461bcd60e51b8152600401610446906126b8565b6004546001600160a01b031633146111a55760405162461bcd60e51b8152600401610446906125bf565b61123f82600160009054906101000a90046001600160a01b03166001600160a01b031663b2494df36040518163ffffffff1660e01b815260040160006040518083038186803b1580156111f757600080fd5b505afa15801561120b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261123391908101906122f0565b9063ffffffff611df216565b61125b5760405162461bcd60e51b8152600401610446906125e9565b6112658282611d25565b7f2baf269c5c06db26e9b8585868003d5939092475d48c1dae4902d528538c375782826040516112969291906124c2565b60405180910390a15050565b6005546001600160a01b031633146112cc5760405162461bcd60e51b81526004016104469061287d565b60095460ff16156112ef5760405162461bcd60e51b8152600401610446906127a3565b6009805460ff19166001179055565b6001600160a01b038083166000908152600760209081526040808320938516835260029093019052205460ff165b92915050565b6005546001600160a01b031681565b6004546001600160a01b0316331461136b5760405162461bcd60e51b8152600401610446906125bf565b6001600160a01b03811660009081526007602052604090205460ff16156113a45760405162461bcd60e51b8152600401610446906127da565b60015460405163a063246160e01b81526001600160a01b039091169063a063246190610665908490600401612468565b3360009081526003602052604090205460ff166114035760405162461bcd60e51b8152600401610446906128d6565b6108dd6001600160a01b038416838363ffffffff611e0816565b6004546001600160a01b031633146114475760405162461bcd60e51b8152600401610446906125bf565b6004546040517fd58299b712891143e76310d5e664c4203c940a67db37cf856bdaa3c5c76a802c91611486916001600160a01b0390911690849061247c565b60405180910390a1600480546001600160a01b0319166001600160a01b0392909216919091179055565b6004546005546001600160a01b039182169116338214806114d95750336001600160a01b038216145b6114f55760405162461bcd60e51b815260040161044690612938565b60006115018383611c7e565b9050600080368360405160200161151a93929190612423565b60408051601f19818403018152918152815160209283012060008181529283905291205490915060ff1661155f576000803633604051602001610a7493929190612423565b6000818152602081905260409020805460ff191690556006546115945760405162461bcd60e51b8152600401610446906128ac565b600154604051631ed86f1960e01b81526001600160a01b0390911690631ed86f19906115c4908990600401612468565b600060405180830381600087803b1580156115de57600080fd5b505af11580156115f2573d6000803e3d6000fd5b505050506116008686611d25565b600680546000190190556040517f9dabf4dac1b959c971acf2d0cc8461591ff6773ede40a38db700d8b37c8a708490610c2890889088906124c2565b6008818154811061164957fe5b6000918252602090912001546001600160a01b0316905081565b6004546005546001600160a01b0391821691163382148061168c5750336001600160a01b038216145b6116a85760405162461bcd60e51b815260040161044690612938565b60006116b48383611c7e565b905060008036836040516020016116cd93929190612423565b60408051601f19818403018152918152815160209283012060008181529283905291205490915060ff1661178057600080363360405160200161171293929190612423565b60408051601f198184030181528282528051602091820120600081815291829052919020805460ff1916600117905591507f2d8be207af2fa24175b649fe62755a7b86fb6cb82c6efbd96de7447196d652ff9061177090839061251d565b60405180910390a15050506108dd565b6000818152602081905260409020805460ff191690556001600160a01b0385166117bc5760405162461bcd60e51b815260040161044690612617565b60015460405163d0ebdbe760e01b81526001600160a01b039091169063d0ebdbe7906117ec908890600401612468565b600060405180830381600087803b15801561180657600080fd5b505af115801561181a573d6000803e3d6000fd5b505050505050505050565b6001546001600160a01b031681565b6005546001600160a01b0316331461185e5760405162461bcd60e51b81526004016104469061287d565b61186781611b73565b7fc1cdb62e2491252e18b1bdc78395e942ed3c2335e7dc8f7842c2176a01cf466d816040516107839190612468565b60036020526000908152604090205460ff1681565b6002805460018082019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b03841690811790915560009081526003602052604090819020805460ff1916909217909155517f99c6112dbaef85e57ac8ca86dd23e3c785162b58a6e810e5d5e7455b568d66b190610783908390612468565b6000805b6008548110156119b157600760006008838154811061195e57fe5b60009182526020808320909101546001600160a01b03908116845283820194909452604092830182209387168252600290930190925290205460ff16156119a9576001915050610818565b600101611943565b50600092915050565b600080611a2084805480602002602001604051908101604052809291908181526020018280548015611a1557602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116119f7575b505050505084611e5e565b9150915080611a415760405162461bcd60e51b815260040161044690612590565b835460001901828114611ab357848181548110611a5a57fe5b9060005260206000200160009054906101000a90046001600160a01b0316858481548110611a8457fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b84805480611abd57fe5b600082815260209020810160001990810180546001600160a01b03191690550190555050505050565b6001600160a01b03821660009081526007602052604081205460ff1615611b3a57506001600160a01b038083166000908152600760209081526040808320938516835260029093019052205460ff1661132c565b50600192915050565b6060611b69848484604051806060016040528060298152602001612b1e60299139611ec4565b90505b9392505050565b6001600160a01b03811660009081526007602052604090205460ff16611bab5760405162461bcd60e51b815260040161044690612647565b60005b6001600160a01b038216600090815260076020526040902060010154811015611c3b576001600160a01b0382166000908152600760205260408120600101805483908110611bf857fe5b60009182526020808320909101546001600160a01b0386811684526007835260408085209190921684526002019091529020805460ff1916905550600101611bae565b506001600160a01b0381166000908152600760205260408120805460ff1916815590611c6a6001830182612062565b506105d3905060088263ffffffff6119ba16565b6000336001600160a01b03841614611c965782611b6c565b50919050565b6001600160a01b03811660009081526003602052604090205460ff16611cc557611cc5816118ab565b6001600160a01b03918216600090815260076020818152604080842094909516808452600285018252948320805460ff191660019081179091559181529281018054918201815582529190200180546001600160a01b0319169091179055565b6001600160a01b03821660009081526007602052604090205460ff1615611d5e5760405162461bcd60e51b8152600401610446906129b9565b6001600160a01b0382166000818152600760205260408120805460ff1916600190811790915560088054918201815582527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169092179091555b81518110156108dd57611dea83838381518110611ddd57fe5b6020026020010151611c9c565b600101611dc4565b600080611dff8484611e5e565b95945050505050565b6108dd8363a9059cbb60e01b8484604051602401611e279291906124e6565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f85565b81516000908190815b81811015611eb157846001600160a01b0316868281518110611e8557fe5b60200260200101516001600160a01b03161415611ea957925060019150611ebd9050565b600101611e67565b50600019600092509250505b9250929050565b606082471015611ee65760405162461bcd60e51b815260040161044690612726565b611eef85612014565b611f0b5760405162461bcd60e51b815260040161044690612901565b60006060866001600160a01b03168587604051611f28919061244c565b60006040518083038185875af1925050503d8060008114611f65576040519150601f19603f3d011682016040523d82523d6000602084013e611f6a565b606091505b5091509150611f7a82828661201a565b979650505050505050565b6060611fda826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120539092919063ffffffff16565b8051909150156108dd5780806020019051810190611ff8919061238c565b6108dd5760405162461bcd60e51b81526004016104469061296f565b3b151590565b60608315612029575081611b6c565b8251156120395782518084602001fd5b8160405162461bcd60e51b81526004016104469190612526565b6060611b698484600085611ec4565b50805460008255906000526020600020908101906105d391906110f891905b808211156120955760008155600101612081565b5090565b600082601f8301126120a9578081fd5b81356120bc6120b782612abc565b612a95565b8181529150602080830190848101818402860182018710156120dd57600080fd5b60005b848110156121055781356120f381612b08565b845292820192908201906001016120e0565b505050505092915050565b600060208284031215612121578081fd5b8135611b6c81612b08565b6000806040838503121561213e578081fd5b823561214981612b08565b9150602083013561215981612b08565b809150509250929050565b600080600060608486031215612178578081fd5b833561218381612b08565b9250602084013561219381612b08565b9150604084013567ffffffffffffffff8111156121ae578182fd5b6121ba86828701612099565b9150509250925092565b6000806000606084860312156121d8578283fd5b83356121e381612b08565b925060208401356121f381612b08565b929592945050506040919091013590565b60008060408385031215612216578182fd5b823561222181612b08565b9150602083013567ffffffffffffffff81111561223c578182fd5b61224885828601612099565b9150509250929050565b60008060408385031215612264578182fd5b823561226f81612b08565b915060208381013567ffffffffffffffff8082111561228c578384fd5b81860187601f82011261229d578485fd5b80359250818311156122ad578485fd5b6122bf601f8401601f19168501612a95565b915082825287848483010111156122d4578485fd5b8284820185840137509081019091019190915290939092509050565b60006020808385031215612302578182fd5b825167ffffffffffffffff811115612318578283fd5b80840185601f820112612329578384fd5b805191506123396120b783612abc565b8281528381019082850185850284018601891015612355578687fd5b8693505b8484101561238057805161236c81612b08565b835260019390930192918501918501612359565b50979650505050505050565b60006020828403121561239d578081fd5b81518015158114611b6c578182fd5b6000602082840312156123bd578081fd5b5035919050565b6000602082840312156123d5578081fd5b8151611b6c81612b08565b6000815180845260208085019450808401835b838110156124185781516001600160a01b0316875295820195908201906001016123f3565b509495945050505050565b6000838583375060609190911b6bffffffffffffffffffffffff19169101908152601401919050565b6000825161245e818460208701612adc565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03848116825283166020820152606060408201819052600090611dff908301846123e0565b6001600160a01b0383168152604060208201819052600090611b69908301846123e0565b6001600160a01b03929092168252602082015260400190565b600060208252611b6c60208301846123e0565b901515815260200190565b90815260200190565b6000602082528251806020840152612545816040850160208701612adc565b601f01601f19169190910160400192915050565b6020808252601f908201527f457874656e73696f6e732063616e6e6f742063616c6c20536574546f6b656e00604082015260600190565b60208082526015908201527420b2323932b9b9903737ba1034b71030b93930bc9760591b604082015260600190565b60208082526010908201526f26bab9ba1031329037b832b930ba37b960811b604082015260600190565b602080825260149082015273135bd91d5b19481b9bdd081859191959081e595d60621b604082015260600190565b60208082526016908201527516995c9bc81859191c995cdcc81b9bdd081d985b1a5960521b604082015260600190565b602080825260149082015273135bd91d5b19481b9bdd081c1c9bdd1958dd195960621b604082015260600190565b60208082526023908201527f457874656e73696f6e206e6f7420617574686f72697a656420666f72206d6f64604082015262756c6560e81b606082015260800190565b6020808252601c908201527f55706772616465732070617573656420627920656d657267656e637900000000604082015260600190565b60208082526019908201527f457874656e73696f6e206d616e6167657220696e76616c696400000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b60208082526018908201527f457874656e73696f6e20616c7265616479206578697374730000000000000000604082015260600190565b60208082526019908201527f496e697469616c697a6174696f6e20617574686f72697a656400000000000000604082015260600190565b60208082526010908201526f135bd91d5b19481c1c9bdd1958dd195960821b604082015260600190565b6020808252601c908201527f457874656e73696f6e20616c726561647920617574686f72697a656400000000604082015260600190565b60208082526022908201527f457874656e73696f6e20757365642062792070726f746563746564206d6f64756040820152616c6560f01b606082015260800190565b602080825260159082015274135d5cdd081899481b595d1a1bd91bdb1bd9da5cdd605a1b604082015260600190565b60208082526010908201526f4e6f7420696e20656d657267656e637960801b604082015260600190565b60208082526011908201527026bab9ba1031329032bc3a32b739b4b7b760791b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601a908201527f4d75737420626520617574686f72697a65642061646472657373000000000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526018908201527f4d6f64756c6520616c72656164792070726f7465637465640000000000000000604082015260600190565b60208082526018908201527f457874656e73696f6e206e6f7420617574686f72697a65640000000000000000604082015260600190565b60208082526018908201527f457874656e73696f6e20646f6573206e6f742065786973740000000000000000604082015260600190565b60208082526017908201527f4d616e61676572206e6f7420696e697469616c697a6564000000000000000000604082015260600190565b60405181810167ffffffffffffffff81118282101715612ab457600080fd5b604052919050565b600067ffffffffffffffff821115612ad2578081fd5b5060209081020190565b60005b83811015612af7578181015183820152602001612adf565b83811115610c335750506000910152565b6001600160a01b03811681146105d357600080fdfe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212208e10de8c25413c3dbde84090deed576a90ae95b4d14f9fde3b7f2244a16568eb64736f6c634300060a0033000000000000000000000000bef26aa15c6e24b73478917d0e4188a2370c735c00000000000000000000000037e6365d4f6ae378467b0e24c9065ce5f06d70bf00000000000000000000000037e6365d4f6ae378467b0e24c9065ce5f06d70bf

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.