creation_sourcecode: {{
    "language": "Solidity",
    "settings": {
      "evmVersion": "istanbul",
      "libraries": {},
      "metadata": {
        "bytecodeHash": "ipfs",
        "useLiteralContent": true
      },
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "remappings": [],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    },
    "sources": {
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
      },
      "contracts/adapters/AirdropExtension.sol": {
        "content": "/*\n    Copyright 2021 Index Cooperative.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n    SPDX-License-Identifier: Apache License, Version 2.0\n*/\n\npragma solidity 0.6.10;\npragma experimental \"ABIEncoderV2\";\n\nimport { BaseExtension } from \"../lib/BaseExtension.sol\";\nimport { IAirdropModule } from \"../interfaces/IAirdropModule.sol\";\nimport { IBaseManager } from \"../interfaces/IBaseManager.sol\";\nimport { ISetToken } from \"../interfaces/ISetToken.sol\";\n\n/**\n * @title AirdropExtension\n * @author Index Coop\n *\n * Manager extension for interacting with AirdropModule\n */\ncontract AirdropExtension is BaseExtension {\n\n    /* ========== State Variables ========= */\n\n    // Address of AirdropModule\n    IAirdropModule public immutable airdropModule;\n\n    // Address of Set Token\n    ISetToken public immutable setToken;\n\n    /* ============ Constructor ============ */\n\n    /**\n     * Sets state variables\n     *\n     * @param _manager          Manager contract\n     * @param _airdropModule    Set Protocol AirdropModule\n     */\n    constructor(IBaseManager _manager, IAirdropModule _airdropModule) public BaseExtension(_manager) {\n        airdropModule = _airdropModule;\n        setToken = manager.setToken();\n    }\n\n    /* ========== External Functions ========== */\n\n    /**\n     * OPERATOR ONLY: initializes the AirdropModule. The recipient is always set to the manager and the fee to 0.\n     *\n     * @param _airdropSettings  Settings to initially the AirdropModule with\n     */\n    function initializeAirdropModule(IAirdropModule.AirdropSettings memory _airdropSettings) external onlyOperator {\n        invokeManager(\n            address(airdropModule),\n            abi.encodeWithSignature(\"initialize(address,(address[],address,uint256,bool))\", setToken, _airdropSettings)\n        );\n    }\n\n    /**\n     * OPERATOR ONLY: absorbs airdropped tokens\n     *\n     * @param _token    Airdropped token to absorb\n     */\n    function absorb(address _token) external onlyAllowedCaller(msg.sender) {\n        invokeManager(\n            address(airdropModule),\n            abi.encodeWithSignature(\"absorb(address,address)\", setToken, _token)\n        );\n    }\n\n    /**\n     * OPERATOR ONLY: batch absorbs airdropped tokens\n     *\n     * @param _tokens   List of airdropped tokens to absorb\n     */\n    function batchAbsorb(address[] memory _tokens) external onlyAllowedCaller(msg.sender) {\n        invokeManager(\n            address(airdropModule),\n            abi.encodeWithSignature(\"batchAbsorb(address,address[])\", setToken, _tokens)\n        );\n    }\n\n    /**\n     * OPERATOR ONLY: adds a new airdrop token\n     *\n     * @param _token    Airdropped token to add\n     */\n    function addAirdrop(address _token) external onlyOperator {\n        invokeManager(\n            address(airdropModule),\n            abi.encodeWithSignature(\"addAirdrop(address,address)\", setToken, _token)\n        );\n    }\n\n    /**\n     * OPERATOR ONLY: removes a new airdrop token\n     *\n     * @param _token    Airdropped token to remove\n     */\n    function removeAirdrop(address _token) external onlyOperator {\n        invokeManager(\n            address(airdropModule),\n            abi.encodeWithSignature(\"removeAirdrop(address,address)\", setToken, _token)\n        );\n    }\n\n    /**\n     * OPERATOR ONLY: updates the anyoneAbsorb setting\n     *\n     * @param _anyoneAbsorb     new anyoneAbsorb setting value\n     */\n    function updateAnyoneAbsorb(bool _anyoneAbsorb) external onlyOperator {\n        invokeManager(\n            address(airdropModule),\n            abi.encodeWithSignature(\"updateAnyoneAbsorb(address,bool)\", setToken, _anyoneAbsorb)\n        );\n    }\n}"
      },
      "contracts/interfaces/IAirdropModule.sol": {
        "content": "/*\n    Copyright 2021 Index Cooperative.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n*/\n\npragma solidity 0.6.10;\npragma experimental \"ABIEncoderV2\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport { AddressArrayUtils } from \"../lib/AddressArrayUtils.sol\";\nimport { ISetToken } from \"./ISetToken.sol\";\n\ninterface IAirdropModule {\n    using AddressArrayUtils for address[];\n\n    struct AirdropSettings {\n        address[] airdrops;                     // Array of tokens manager is allowing to be absorbed\n        address feeRecipient;                   // Address airdrop fees are sent to\n        uint256 airdropFee;                     // Percentage in preciseUnits of airdrop sent to feeRecipient (1e16 = 1%)\n        bool anyoneAbsorb;                      // Boolean indicating if any address can call absorb or just the manager\n    }\n\n    struct AirdropReturnSettings {\n        address feeRecipient;\n        uint256 airdropFee;\n        bool anyoneAbsorb;\n    }\n\n    function initialize(ISetToken _setToken, AirdropSettings memory _airdropSettings) external;\n\n    function airdropSettings(ISetToken _setToken) external view returns(AirdropReturnSettings memory);\n    function batchAbsorb(ISetToken _setToken, address[] memory _tokens) external;\n    function absorb(ISetToken _setToken, IERC20 _token) external;\n    function addAirdrop(ISetToken _setToken, IERC20 _airdrop) external;\n    function removeAirdrop(ISetToken _setToken, IERC20 _airdrop) external;\n    function updateAnyoneAbsorb(ISetToken _setToken, bool _anyoneAbsorb) external;\n    function updateFeeRecipient(ISetToken _setToken, address _newFeeRecipient) external;\n    function updateAirdropFee(ISetToken _setToken, uint256 _newFee) external;\n    function removeModule() external;\n    function getAirdrops(ISetToken _setToken) external returns(address[] memory);\n    function isAirdropToken(ISetToken _setToken, IERC20 _token) external returns(bool);\n}\n"
      },
      "contracts/interfaces/IBaseManager.sol": {
        "content": "/*\n    Copyright 2021 Set Labs Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n    SPDX-License-Identifier: Apache License, Version 2.0\n*/\n\npragma solidity 0.6.10;\npragma experimental \"ABIEncoderV2\";\n\nimport { ISetToken } from \"./ISetToken.sol\";\n\ninterface IBaseManager {\n    function setToken() external returns(ISetToken);\n\n    function methodologist() external returns(address);\n\n    function operator() external returns(address);\n\n    function interactManager(address _module, bytes calldata _encoded) external;\n\n    function transferTokens(address _token, address _destination, uint256 _amount) external;\n}"
      },
      "contracts/interfaces/ISetToken.sol": {
        "content": "// SPDX-License-Identifier: Apache License, Version 2.0\npragma solidity 0.6.10;\npragma experimental \"ABIEncoderV2\";\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title ISetToken\n * @author Set Protocol\n *\n * Interface for operating with SetTokens.\n */\ninterface ISetToken is IERC20 {\n\n    /* ============ Enums ============ */\n\n    enum ModuleState {\n        NONE,\n        PENDING,\n        INITIALIZED\n    }\n\n    /* ============ Structs ============ */\n    /**\n     * The base definition of a SetToken Position\n     *\n     * @param component           Address of token in the Position\n     * @param module              If not in default state, the address of associated module\n     * @param unit                Each unit is the # of components per 10^18 of a SetToken\n     * @param positionState       Position ENUM. Default is 0; External is 1\n     * @param data                Arbitrary data\n     */\n    struct Position {\n        address component;\n        address module;\n        int256 unit;\n        uint8 positionState;\n        bytes data;\n    }\n\n    /**\n     * A struct that stores a component's cash position details and external positions\n     * This data structure allows O(1) access to a component's cash position units and\n     * virtual units.\n     *\n     * @param virtualUnit               Virtual value of a component's DEFAULT position. Stored as virtual for efficiency\n     *                                  updating all units at once via the position multiplier. Virtual units are achieved\n     *                                  by dividing a \"real\" value by the \"positionMultiplier\"\n     * @param componentIndex\n     * @param externalPositionModules   List of external modules attached to each external position. Each module\n     *                                  maps to an external position\n     * @param externalPositions         Mapping of module => ExternalPosition struct for a given component\n     */\n    struct ComponentPosition {\n      int256 virtualUnit;\n      address[] externalPositionModules;\n      mapping(address => ExternalPosition) externalPositions;\n    }\n\n    /**\n     * A struct that stores a component's external position details including virtual unit and any\n     * auxiliary data.\n     *\n     * @param virtualUnit       Virtual value of a component's EXTERNAL position.\n     * @param data              Arbitrary data\n     */\n    struct ExternalPosition {\n      int256 virtualUnit;\n      bytes data;\n    }\n\n\n    /* ============ Functions ============ */\n\n    function addComponent(address _component) external;\n    function removeComponent(address _component) external;\n    function editDefaultPositionUnit(address _component, int256 _realUnit) external;\n    function addExternalPositionModule(address _component, address _positionModule) external;\n    function removeExternalPositionModule(address _component, address _positionModule) external;\n    function editExternalPositionUnit(address _component, address _positionModule, int256 _realUnit) external;\n    function editExternalPositionData(address _component, address _positionModule, bytes calldata _data) external;\n\n    function invoke(address _target, uint256 _value, bytes calldata _data) external returns(bytes memory);\n\n    function editPositionMultiplier(int256 _newMultiplier) external;\n\n    function mint(address _account, uint256 _quantity) external;\n    function burn(address _account, uint256 _quantity) external;\n\n    function lock() external;\n    function unlock() external;\n\n    function addModule(address _module) external;\n    function removeModule(address _module) external;\n    function initializeModule() external;\n\n    function setManager(address _manager) external;\n\n    function manager() external view returns (address);\n    function moduleStates(address _module) external view returns (ModuleState);\n    function getModules() external view returns (address[] memory);\n\n    function getDefaultPositionRealUnit(address _component) external view returns(int256);\n    function getExternalPositionRealUnit(address _component, address _positionModule) external view returns(int256);\n    function getComponents() external view returns(address[] memory);\n    function getExternalPositionModules(address _component) external view returns(address[] memory);\n    function getExternalPositionData(address _component, address _positionModule) external view returns(bytes memory);\n    function isExternalPositionModule(address _component, address _module) external view returns(bool);\n    function isComponent(address _component) external view returns(bool);\n\n    function positionMultiplier() external view returns (int256);\n    function getPositions() external view returns (Position[] memory);\n    function getTotalComponentRealUnits(address _component) external view returns(int256);\n\n    function isInitializedModule(address _module) external view returns(bool);\n    function isPendingModule(address _module) external view returns(bool);\n    function isLocked() external view returns (bool);\n}"
      },
      "contracts/lib/AddressArrayUtils.sol": {
        "content": "/*\n    Copyright 2020 Set Labs Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n    SPDX-License-Identifier: Apache License, Version 2.0\n*/\n\npragma solidity 0.6.10;\n\n/**\n * @title AddressArrayUtils\n * @author Set Protocol\n *\n * Utility functions to handle Address Arrays\n *\n * CHANGELOG:\n * - 4/27/21: Added validatePairsWithArray methods\n */\nlibrary AddressArrayUtils {\n\n    /**\n     * Finds the index of the first occurrence of the given element.\n     * @param A The input array to search\n     * @param a The value to find\n     * @return Returns (index and isIn) for the first occurrence starting from index 0\n     */\n    function indexOf(address[] memory A, address a) internal pure returns (uint256, bool) {\n        uint256 length = A.length;\n        for (uint256 i = 0; i < length; i++) {\n            if (A[i] == a) {\n                return (i, true);\n            }\n        }\n        return (uint256(-1), false);\n    }\n\n    /**\n    * Returns true if the value is present in the list. Uses indexOf internally.\n    * @param A The input array to search\n    * @param a The value to find\n    * @return Returns isIn for the first occurrence starting from index 0\n    */\n    function contains(address[] memory A, address a) internal pure returns (bool) {\n        (, bool isIn) = indexOf(A, a);\n        return isIn;\n    }\n\n    /**\n    * Returns true if there are 2 elements that are the same in an array\n    * @param A The input array to search\n    * @return Returns boolean for the first occurrence of a duplicate\n    */\n    function hasDuplicate(address[] memory A) internal pure returns(bool) {\n        require(A.length > 0, \"A is empty\");\n\n        for (uint256 i = 0; i < A.length - 1; i++) {\n            address current = A[i];\n            for (uint256 j = i + 1; j < A.length; j++) {\n                if (current == A[j]) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    /**\n     * @param A The input array to search\n     * @param a The address to remove\n     * @return Returns the array with the object removed.\n     */\n    function remove(address[] memory A, address a)\n        internal\n        pure\n        returns (address[] memory)\n    {\n        (uint256 index, bool isIn) = indexOf(A, a);\n        if (!isIn) {\n            revert(\"Address not in array.\");\n        } else {\n            (address[] memory _A,) = pop(A, index);\n            return _A;\n        }\n    }\n\n    /**\n     * @param A The input array to search\n     * @param a The address to remove\n     */\n    function removeStorage(address[] storage A, address a)\n        internal\n    {\n        (uint256 index, bool isIn) = indexOf(A, a);\n        if (!isIn) {\n            revert(\"Address not in array.\");\n        } else {\n            uint256 lastIndex = A.length - 1; // If the array would be empty, the previous line would throw, so no underflow here\n            if (index != lastIndex) { A[index] = A[lastIndex]; }\n            A.pop();\n        }\n    }\n\n    /**\n    * Removes specified index from array\n    * @param A The input array to search\n    * @param index The index to remove\n    * @return Returns the new array and the removed entry\n    */\n    function pop(address[] memory A, uint256 index)\n        internal\n        pure\n        returns (address[] memory, address)\n    {\n        uint256 length = A.length;\n        require(index < A.length, \"Index must be < A length\");\n        address[] memory newAddresses = new address[](length - 1);\n        for (uint256 i = 0; i < index; i++) {\n            newAddresses[i] = A[i];\n        }\n        for (uint256 j = index + 1; j < length; j++) {\n            newAddresses[j - 1] = A[j];\n        }\n        return (newAddresses, A[index]);\n    }\n\n    /**\n     * Returns the combination of the two arrays\n     * @param A The first array\n     * @param B The second array\n     * @return Returns A extended by B\n     */\n    function extend(address[] memory A, address[] memory B) internal pure returns (address[] memory) {\n        uint256 aLength = A.length;\n        uint256 bLength = B.length;\n        address[] memory newAddresses = new address[](aLength + bLength);\n        for (uint256 i = 0; i < aLength; i++) {\n            newAddresses[i] = A[i];\n        }\n        for (uint256 j = 0; j < bLength; j++) {\n            newAddresses[aLength + j] = B[j];\n        }\n        return newAddresses;\n    }\n\n    /**\n     * Validate that address and uint array lengths match. Validate address array is not empty\n     * and contains no duplicate elements.\n     *\n     * @param A         Array of addresses\n     * @param B         Array of uint\n     */\n    function validatePairsWithArray(address[] memory A, uint[] memory B) internal pure {\n        require(A.length == B.length, \"Array length mismatch\");\n        _validateLengthAndUniqueness(A);\n    }\n\n    /**\n     * Validate that address and bool array lengths match. Validate address array is not empty\n     * and contains no duplicate elements.\n     *\n     * @param A         Array of addresses\n     * @param B         Array of bool\n     */\n    function validatePairsWithArray(address[] memory A, bool[] memory B) internal pure {\n        require(A.length == B.length, \"Array length mismatch\");\n        _validateLengthAndUniqueness(A);\n    }\n\n    /**\n     * Validate that address and string array lengths match. Validate address array is not empty\n     * and contains no duplicate elements.\n     *\n     * @param A         Array of addresses\n     * @param B         Array of strings\n     */\n    function validatePairsWithArray(address[] memory A, string[] memory B) internal pure {\n        require(A.length == B.length, \"Array length mismatch\");\n        _validateLengthAndUniqueness(A);\n    }\n\n    /**\n     * Validate that address array lengths match, and calling address array are not empty\n     * and contain no duplicate elements.\n     *\n     * @param A         Array of addresses\n     * @param B         Array of addresses\n     */\n    function validatePairsWithArray(address[] memory A, address[] memory B) internal pure {\n        require(A.length == B.length, \"Array length mismatch\");\n        _validateLengthAndUniqueness(A);\n    }\n\n    /**\n     * Validate that address and bytes array lengths match. Validate address array is not empty\n     * and contains no duplicate elements.\n     *\n     * @param A         Array of addresses\n     * @param B         Array of bytes\n     */\n    function validatePairsWithArray(address[] memory A, bytes[] memory B) internal pure {\n        require(A.length == B.length, \"Array length mismatch\");\n        _validateLengthAndUniqueness(A);\n    }\n\n    /**\n     * Validate address array is not empty and contains no duplicate elements.\n     *\n     * @param A          Array of addresses\n     */\n    function _validateLengthAndUniqueness(address[] memory A) internal pure {\n        require(A.length > 0, \"Array length must be > 0\");\n        require(!hasDuplicate(A), \"Cannot duplicate addresses\");\n    }\n}\n"
      },
      "contracts/lib/BaseExtension.sol": {
        "content": "/*\n    Copyright 2021 Set Labs Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n    SPDX-License-Identifier: Apache License, Version 2.0\n*/\n\npragma solidity 0.6.10;\n\nimport { AddressArrayUtils } from \"../lib/AddressArrayUtils.sol\";\nimport { IBaseManager } from \"../interfaces/IBaseManager.sol\";\n\n/**\n * @title BaseExtension\n * @author Set Protocol\n *\n * Abstract class that houses common extension-related state and functions.\n */\nabstract contract BaseExtension {\n    using AddressArrayUtils for address[];\n\n    /* ============ Events ============ */\n\n    event CallerStatusUpdated(address indexed _caller, bool _status);\n    event AnyoneCallableUpdated(bool indexed _status);\n\n    /* ============ Modifiers ============ */\n\n    /**\n     * Throws if the sender is not the SetToken operator\n     */\n    modifier onlyOperator() {\n        require(msg.sender == manager.operator(), \"Must be operator\");\n        _;\n    }\n\n    /**\n     * Throws if the sender is not the SetToken methodologist\n     */\n    modifier onlyMethodologist() {\n        require(msg.sender == manager.methodologist(), \"Must be methodologist\");\n        _;\n    }\n\n    /**\n     * Throws if caller is a contract, can be used to stop flash loan and sandwich attacks\n     */\n    modifier onlyEOA() {\n        require(msg.sender == tx.origin, \"Caller must be EOA Address\");\n        _;\n    }\n\n    /**\n     * Throws if not allowed caller\n     */\n    modifier onlyAllowedCaller(address _caller) {\n        require(isAllowedCaller(_caller), \"Address not permitted to call\");\n        _;\n    }\n\n    /* ============ State Variables ============ */\n\n    // Instance of manager contract\n    IBaseManager public manager;\n\n    // Boolean indicating if anyone can call function\n    bool public anyoneCallable;\n\n    // Mapping of addresses allowed to call function\n    mapping(address => bool) public callAllowList;\n\n    /* ============ Constructor ============ */\n\n    constructor(IBaseManager _manager) public { manager = _manager; }\n\n    /* ============ External Functions ============ */\n\n    /**\n     * OPERATOR ONLY: Toggle ability for passed addresses to call only allowed caller functions\n     *\n     * @param _callers           Array of caller addresses to toggle status\n     * @param _statuses          Array of statuses for each caller\n     */\n    function updateCallerStatus(address[] calldata _callers, bool[] calldata _statuses) external onlyOperator {\n        require(_callers.length == _statuses.length, \"Array length mismatch\");\n        require(_callers.length > 0, \"Array length must be > 0\");\n        require(!_callers.hasDuplicate(), \"Cannot duplicate callers\");\n\n        for (uint256 i = 0; i < _callers.length; i++) {\n            address caller = _callers[i];\n            bool status = _statuses[i];\n            callAllowList[caller] = status;\n            emit CallerStatusUpdated(caller, status);\n        }\n    }\n\n    /**\n     * OPERATOR ONLY: Toggle whether anyone can call function, bypassing the callAllowlist\n     *\n     * @param _status           Boolean indicating whether to allow anyone call\n     */\n    function updateAnyoneCallable(bool _status) external onlyOperator {\n        anyoneCallable = _status;\n        emit AnyoneCallableUpdated(_status);\n    }\n\n    /* ============ Internal Functions ============ */\n\n    /**\n     * Invoke manager to transfer tokens from manager to other contract.\n     *\n     * @param _token           Token being transferred from manager contract\n     * @param _amount          Amount of token being transferred\n     */\n    function invokeManagerTransfer(address _token, address _destination, uint256 _amount) internal {\n        manager.transferTokens(_token, _destination, _amount);\n    }\n\n    /**\n     * Invoke call from manager\n     *\n     * @param _module           Module to interact with\n     * @param _encoded          Encoded byte data\n     */\n    function invokeManager(address _module, bytes memory _encoded) internal {\n        manager.interactManager(_module, _encoded);\n    }\n\n    /**\n     * Determine if passed address is allowed to call function. If anyoneCallable set to true anyone can call otherwise needs to be approved.\n     *\n     * return bool              Boolean indicating if allowed caller\n     */\n    function isAllowedCaller(address _caller) internal view virtual returns (bool) {\n        return anyoneCallable || callAllowList[_caller];\n    }\n}"
      }
    }
  }}