Contract 0x8Ff3148CE574B8e135130065B188960bA93799c6

 
 
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0xccc363127ad90f6ea3a71032eb2d808b4f04724c786b84938612175cae6577adMulticall312438872022-07-28 17:10:39245 days 4 hrs ago0x07883ebd6f178420f24969279bd425ab0b99f10b IN  0x8ff3148ce574b8e135130065b188960ba93799c60 MATIC0.289839504181 55.188676359
0x7c37833f5abd3e755fc597bf7d6393467e2081c98e964cec31b76be144eb339e0x60806040312437242022-07-28 17:05:05245 days 4 hrs ago0x07883ebd6f178420f24969279bd425ab0b99f10b IN  Contract Creation0 MATIC0.164648770246 58.648091811
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

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

Contract Name:
ProtocolGovernance

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
File 1 of 20 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 2 of 20 : AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }
}

File 3 of 20 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 20 : IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 5 of 20 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^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;
        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");

        (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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 6 of 20 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 7 of 20 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "./Address.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
abstract contract Multicall {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
        return results;
    }
}

File 8 of 20 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 9 of 20 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 10 of 20 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 11 of 20 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 12 of 20 : ProtocolGovernance.sol
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.9;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "./interfaces/IProtocolGovernance.sol";
import "./libraries/ExceptionsLibrary.sol";
import "./UnitPricesGovernance.sol";
import "./utils/ContractMeta.sol";

/// @notice Governance that manages all params common for Mellow Permissionless Vaults protocol.
contract ProtocolGovernance is ContractMeta, IProtocolGovernance, ERC165, UnitPricesGovernance, Multicall {
    using EnumerableSet for EnumerableSet.AddressSet;

    uint256 public constant MAX_GOVERNANCE_DELAY = 7 days;
    uint256 public constant MIN_WITHDRAW_LIMIT = 200_000;

    /// @inheritdoc IProtocolGovernance
    mapping(address => uint256) public stagedPermissionGrantsTimestamps;
    /// @inheritdoc IProtocolGovernance
    mapping(address => uint256) public stagedPermissionGrantsMasks;
    /// @inheritdoc IProtocolGovernance
    mapping(address => uint256) public permissionMasks;

    /// @inheritdoc IProtocolGovernance
    mapping(address => uint256) public stagedValidatorsTimestamps;
    /// @inheritdoc IProtocolGovernance
    mapping(address => address) public stagedValidators;
    /// @inheritdoc IProtocolGovernance
    mapping(address => address) public validators;

    /// @inheritdoc IProtocolGovernance
    uint256 public stagedParamsTimestamp;

    EnumerableSet.AddressSet private _stagedPermissionGrantsAddresses;
    EnumerableSet.AddressSet private _permissionAddresses;
    EnumerableSet.AddressSet private _validatorsAddresses;
    EnumerableSet.AddressSet private _stagedValidatorsAddresses;

    Params private _stagedParams;
    Params private _params;

    /// @notice Creates a new contract
    /// @param admin Initial admin of the contract
    constructor(address admin) UnitPricesGovernance(admin) {}

    // -------------------  EXTERNAL, VIEW  -------------------

    /// @inheritdoc IProtocolGovernance
    function stagedParams() public view returns (Params memory) {
        return _stagedParams;
    }

    /// @inheritdoc IProtocolGovernance
    function params() public view returns (Params memory) {
        return _params;
    }

    function stagedValidatorsAddresses() external view returns (address[] memory) {
        return _stagedValidatorsAddresses.values();
    }

    /// @inheritdoc IProtocolGovernance
    function validatorsAddresses() external view returns (address[] memory) {
        return _validatorsAddresses.values();
    }

    /// @inheritdoc IProtocolGovernance
    function validatorsAddress(uint256 i) external view returns (address) {
        return _validatorsAddresses.at(i);
    }

    /// @inheritdoc IProtocolGovernance
    function permissionAddresses() external view returns (address[] memory) {
        return _permissionAddresses.values();
    }

    /// @inheritdoc IProtocolGovernance
    function stagedPermissionGrantsAddresses() external view returns (address[] memory) {
        return _stagedPermissionGrantsAddresses.values();
    }

    /// @inheritdoc IProtocolGovernance
    function addressesByPermission(uint8 permissionId) external view returns (address[] memory addresses) {
        uint256 length = _permissionAddresses.length();
        addresses = new address[](length);
        uint256 addressesLength = 0;
        uint256 mask = 1 << permissionId;
        for (uint256 i = 0; i < length; i++) {
            address addr = _permissionAddresses.at(i);
            if (permissionMasks[addr] & mask != 0) {
                addresses[addressesLength] = addr;
                addressesLength++;
            }
        }
        // shrink to fit
        assembly {
            mstore(addresses, addressesLength)
        }
    }

    /// @inheritdoc IProtocolGovernance
    function hasPermission(address target, uint8 permissionId) external view returns (bool) {
        return ((permissionMasks[target] | _params.forceAllowMask) & (1 << (permissionId))) != 0;
    }

    /// @inheritdoc IProtocolGovernance
    function hasAllPermissions(address target, uint8[] calldata permissionIds) external view returns (bool) {
        uint256 submask = _permissionIdsToMask(permissionIds);
        uint256 mask = permissionMasks[target] | _params.forceAllowMask;
        return mask & submask == submask;
    }

    /// @inheritdoc IProtocolGovernance
    function maxTokensPerVault() external view returns (uint256) {
        return _params.maxTokensPerVault;
    }

    /// @inheritdoc IProtocolGovernance
    function governanceDelay() external view returns (uint256) {
        return _params.governanceDelay;
    }

    /// @inheritdoc IProtocolGovernance
    function protocolTreasury() external view returns (address) {
        return _params.protocolTreasury;
    }

    /// @inheritdoc IProtocolGovernance
    function forceAllowMask() external view returns (uint256) {
        return _params.forceAllowMask;
    }

    /// @inheritdoc IProtocolGovernance
    function withdrawLimit(address token) external view returns (uint256) {
        return _params.withdrawLimit * unitPrices[token];
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(UnitPricesGovernance, IERC165, ERC165)
        returns (bool)
    {
        return (interfaceId == type(IProtocolGovernance).interfaceId) || super.supportsInterface(interfaceId);
    }

    // -------------------  EXTERNAL, MUTATING  -------------------

    /// @inheritdoc IProtocolGovernance
    function stageValidator(address target, address validator) external {
        _requireAdmin();
        require(
            target != address(0) &&
            validator != address(0), 
            ExceptionsLibrary.ADDRESS_ZERO
        );
        _stagedValidatorsAddresses.add(target);
        stagedValidators[target] = validator;
        uint256 at = block.timestamp + _params.governanceDelay;
        stagedValidatorsTimestamps[target] = at;
        emit ValidatorStaged(tx.origin, msg.sender, target, validator, at);
    }

    /// @inheritdoc IProtocolGovernance
    function rollbackStagedValidators() external {
        _requireAdmin();
        uint256 length = _stagedValidatorsAddresses.length();
        for (uint256 i; i != length; ++i) {
            address target = _stagedValidatorsAddresses.at(0);
            delete stagedValidators[target];
            delete stagedValidatorsTimestamps[target];
            _stagedValidatorsAddresses.remove(target);
        }
        emit AllStagedValidatorsRolledBack(tx.origin, msg.sender);
    }

    /// @inheritdoc IProtocolGovernance
    function commitValidator(address stagedAddress) external {
        _requireAdmin();
        uint256 stagedToCommitAt = stagedValidatorsTimestamps[stagedAddress];
        require(block.timestamp >= stagedToCommitAt, ExceptionsLibrary.TIMESTAMP);
        require(stagedToCommitAt != 0, ExceptionsLibrary.NULL);
        validators[stagedAddress] = stagedValidators[stagedAddress];
        _validatorsAddresses.add(stagedAddress);
        delete stagedValidators[stagedAddress];
        delete stagedValidatorsTimestamps[stagedAddress];
        _stagedValidatorsAddresses.remove(stagedAddress);
        emit ValidatorCommitted(tx.origin, msg.sender, stagedAddress);
    }

    /// @inheritdoc IProtocolGovernance
    function commitAllValidatorsSurpassedDelay() external returns (address[] memory addressesCommitted) {
        _requireAdmin();
        uint256 length = _stagedValidatorsAddresses.length();
        addressesCommitted = new address[](length);
        uint256 addressesCommittedLength;
        for (uint256 i; i != length;) {
            address stagedAddress = _stagedValidatorsAddresses.at(i);
            if (block.timestamp >= stagedValidatorsTimestamps[stagedAddress]) {
                validators[stagedAddress] = stagedValidators[stagedAddress];
                _validatorsAddresses.add(stagedAddress);
                delete stagedValidators[stagedAddress];
                delete stagedValidatorsTimestamps[stagedAddress];
                _stagedValidatorsAddresses.remove(stagedAddress);
                addressesCommitted[addressesCommittedLength] = stagedAddress;
                ++addressesCommittedLength;
                --length;
                emit ValidatorCommitted(tx.origin, msg.sender, stagedAddress);
            } else {
                ++i;
            }
        }
        assembly {
            mstore(addressesCommitted, addressesCommittedLength)
        }
    }

    /// @inheritdoc IProtocolGovernance
    function revokeValidator(address target) external {
        _requireAdmin();
        require(target != address(0), ExceptionsLibrary.NULL);
        delete validators[target];
        _validatorsAddresses.remove(target);
        emit ValidatorRevoked(tx.origin, msg.sender, target);
    }

    /// @inheritdoc IProtocolGovernance
    function rollbackStagedPermissionGrants() external {
        _requireAdmin();
        uint256 length = _stagedPermissionGrantsAddresses.length();
        for (uint256 i; i != length; ++i) {
            address target = _stagedPermissionGrantsAddresses.at(0);
            delete stagedPermissionGrantsMasks[target];
            delete stagedPermissionGrantsTimestamps[target];
            _stagedPermissionGrantsAddresses.remove(target);
        }
        emit AllStagedPermissionGrantsRolledBack(tx.origin, msg.sender);
    }

    /// @inheritdoc IProtocolGovernance
    function commitPermissionGrants(address stagedAddress) external {
        _requireAdmin();
        uint256 stagedToCommitAt = stagedPermissionGrantsTimestamps[stagedAddress];
        require(block.timestamp >= stagedToCommitAt, ExceptionsLibrary.TIMESTAMP);
        require(stagedToCommitAt != 0, ExceptionsLibrary.NULL);
        permissionMasks[stagedAddress] |= stagedPermissionGrantsMasks[stagedAddress];
        _permissionAddresses.add(stagedAddress);
        delete stagedPermissionGrantsMasks[stagedAddress];
        delete stagedPermissionGrantsTimestamps[stagedAddress];
        _stagedPermissionGrantsAddresses.remove(stagedAddress);
        emit PermissionGrantsCommitted(tx.origin, msg.sender, stagedAddress);
    }

    /// @inheritdoc IProtocolGovernance
    function commitAllPermissionGrantsSurpassedDelay() external returns (address[] memory addresses) {
        _requireAdmin();
        uint256 length = _stagedPermissionGrantsAddresses.length();
        uint256 addressesLeft = length;
        addresses = new address[](length);
        for (uint256 i; i != addressesLeft;) {
            address stagedAddress = _stagedPermissionGrantsAddresses.at(i);
            if (block.timestamp >= stagedPermissionGrantsTimestamps[stagedAddress]) {
                permissionMasks[stagedAddress] |= stagedPermissionGrantsMasks[stagedAddress];
                _permissionAddresses.add(stagedAddress);
                delete stagedPermissionGrantsMasks[stagedAddress];
                delete stagedPermissionGrantsTimestamps[stagedAddress];
                _stagedPermissionGrantsAddresses.remove(stagedAddress);
                addresses[length - addressesLeft] = stagedAddress;
                --addressesLeft;
                emit PermissionGrantsCommitted(tx.origin, msg.sender, stagedAddress);
            } else {
                ++i;
            }
        }
        length -= addressesLeft;
        assembly {
            mstore(addresses, length)
        }
    }

    /// @inheritdoc IProtocolGovernance
    function revokePermissions(address target, uint8[] calldata permissionIds) external {
        _requireAdmin();
        require(target != address(0), ExceptionsLibrary.NULL);
        uint256 diff = _permissionIdsToMask(permissionIds);
        uint256 currentMask = permissionMasks[target];
        uint256 newMask = currentMask & (~diff);
        permissionMasks[target] = newMask;
        if (newMask == 0) {
            _permissionAddresses.remove(target);
        }
        emit PermissionsRevoked(tx.origin, msg.sender, target, permissionIds);
    }

    /// @inheritdoc IProtocolGovernance
    function commitParams() external {
        _requireAdmin();
        require(stagedParamsTimestamp != 0, ExceptionsLibrary.NULL);
        require(
            block.timestamp >= stagedParamsTimestamp,
            ExceptionsLibrary.TIMESTAMP
        );
        _params = _stagedParams;
        delete _stagedParams;
        delete stagedParamsTimestamp;
        emit ParamsCommitted(tx.origin, msg.sender, _params);
    }

    /// @inheritdoc IProtocolGovernance
    function stagePermissionGrants(address target, uint8[] calldata permissionIds) external {
        _requireAdmin();
        require(target != address(0), ExceptionsLibrary.NULL);
        _stagedPermissionGrantsAddresses.add(target);
        stagedPermissionGrantsMasks[target] = _permissionIdsToMask(permissionIds);
        uint256 stagedToCommitAt = block.timestamp + _params.governanceDelay;
        stagedPermissionGrantsTimestamps[target] = stagedToCommitAt;
        emit PermissionGrantsStaged(tx.origin, msg.sender, target, permissionIds, stagedToCommitAt);
    }

    /// @inheritdoc IProtocolGovernance
    function stageParams(IProtocolGovernance.Params calldata newParams) external {
        _requireAdmin();
        _validateGovernanceParams(newParams);
        _stagedParams = newParams;
        stagedParamsTimestamp = block.timestamp + _params.governanceDelay;
        emit ParamsStaged(tx.origin, msg.sender, stagedParamsTimestamp, _stagedParams);
    }

    // -------------------------  INTERNAL, VIEW  ------------------------------

    function _contractName() internal pure override returns (bytes32) {
        return bytes32("ProtocolGovernance");
    }

    function _contractVersion() internal pure override returns (bytes32) {
        return bytes32("1.0.0");
    }

    function _validateGovernanceParams(IProtocolGovernance.Params calldata newParams) private pure {
        require(newParams.maxTokensPerVault != 0 && newParams.governanceDelay != 0, ExceptionsLibrary.NULL);
        require(newParams.governanceDelay <= MAX_GOVERNANCE_DELAY, ExceptionsLibrary.LIMIT_OVERFLOW);
        require(newParams.withdrawLimit >= MIN_WITHDRAW_LIMIT, ExceptionsLibrary.LIMIT_OVERFLOW);
    }

    function _permissionIdsToMask(uint8[] calldata permissionIds) private pure returns (uint256 mask) {
        for (uint256 i = 0; i < permissionIds.length; ++i) {
            mask |= 1 << permissionIds[i];
        }
    }

    // --------------------------  EVENTS  --------------------------

    /// @notice Emitted when validators are staged to be granted for specific address.
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param target Target address
    /// @param validator Staged validator
    /// @param at Timestamp when the staged permissions could be committed
    event ValidatorStaged(
        address indexed origin,
        address indexed sender,
        address indexed target,
        address validator,
        uint256 at
    );

    /// @notice Validator revoked
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param target Target address
    event ValidatorRevoked(address indexed origin, address indexed sender, address indexed target);

    /// @notice Emitted when staged validators are rolled back
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    event AllStagedValidatorsRolledBack(address indexed origin, address indexed sender);

    /// @notice Emitted when staged validators are comitted for specific address
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param target Target address
    event ValidatorCommitted(address indexed origin, address indexed sender, address indexed target);

    /// @notice Emitted when new permissions are staged to be granted for specific address.
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param target Target address
    /// @param permissionIds Permission IDs to be granted
    /// @param at Timestamp when the staged permissions could be committed
    event PermissionGrantsStaged(
        address indexed origin,
        address indexed sender,
        address indexed target,
        uint8[] permissionIds,
        uint256 at
    );

    /// @notice Emitted when permissions are revoked
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param target Target address
    /// @param permissionIds Permission IDs to be revoked
    event PermissionsRevoked(
        address indexed origin,
        address indexed sender,
        address indexed target,
        uint8[] permissionIds
    );

    /// @notice Emitted when staged permissions are rolled back
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    event AllStagedPermissionGrantsRolledBack(address indexed origin, address indexed sender);

    /// @notice Emitted when staged permissions are comitted for specific address
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param target Target address
    event PermissionGrantsCommitted(address indexed origin, address indexed sender, address indexed target);

    /// @notice Emitted when pending parameters are set
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param at Timestamp when the pending parameters could be committed
    /// @param params Pending parameters
    event ParamsStaged(address indexed origin, address indexed sender, uint256 at, Params params);

    /// @notice Emitted when pending parameters are committed
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param params Committed parameters
    event ParamsCommitted(address indexed origin, address indexed sender, Params params);
}

File 13 of 20 : UnitPricesGovernance.sol
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.9;

import "./interfaces/IUnitPricesGovernance.sol";
import "./libraries/ExceptionsLibrary.sol";
import "./utils/DefaultAccessControl.sol";

contract UnitPricesGovernance is IUnitPricesGovernance, DefaultAccessControl {
    uint256 public constant DELAY = 14 days;
    /// @inheritdoc IUnitPricesGovernance
    mapping(address => uint256) public unitPrices;
    /// @inheritdoc IUnitPricesGovernance
    mapping(address => uint256) public stagedUnitPrices;
    /// @inheritdoc IUnitPricesGovernance
    mapping(address => uint256) public stagedUnitPricesTimestamps;

    constructor(address admin) DefaultAccessControl(admin) {}

    // -------------------  EXTERNAL, VIEW  -------------------

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(IERC165, AccessControlEnumerable)
        returns (bool)
    {
        return (interfaceId == type(IUnitPricesGovernance).interfaceId) || super.supportsInterface(interfaceId);
    }

    // -------------------  EXTERNAL, MUTATING  -------------------

    /// @inheritdoc IUnitPricesGovernance
    function stageUnitPrice(address token, uint256 value) external {
        require(token != address(0), ExceptionsLibrary.ADDRESS_ZERO);
        _requireAdmin();
        stagedUnitPrices[token] = value;
        stagedUnitPricesTimestamps[token] = unitPrices[token] == 0 ? block.timestamp : block.timestamp + DELAY;
        emit UnitPriceStaged(tx.origin, msg.sender, token, value);
    }

    /// @inheritdoc IUnitPricesGovernance
    function rollbackUnitPrice(address token) external {
        _requireAdmin();
        delete stagedUnitPrices[token];
        delete stagedUnitPricesTimestamps[token];
        emit UnitPriceRolledBack(tx.origin, msg.sender, token);
    }

    /// @inheritdoc IUnitPricesGovernance
    function commitUnitPrice(address token) external {
        _requireAdmin();
        uint256 timestamp = stagedUnitPricesTimestamps[token];
        require(timestamp != 0, ExceptionsLibrary.INVALID_STATE);
        require(timestamp <= block.timestamp, ExceptionsLibrary.TIMESTAMP);

        uint256 price = stagedUnitPrices[token];
        unitPrices[token] = price;
        delete stagedUnitPrices[token];
        delete stagedUnitPricesTimestamps[token];
        emit UnitPriceCommitted(tx.origin, msg.sender, token, price);
    }

    // --------------------------  EVENTS  --------------------------

    /// @notice UnitPrice staged for commit
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param token Token address
    /// @param unitPrice Unit price
    event UnitPriceStaged(address indexed origin, address indexed sender, address token, uint256 unitPrice);

    /// @notice UnitPrice rolled back
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param token Token address
    event UnitPriceRolledBack(address indexed origin, address indexed sender, address token);

    /// @notice UnitPrice committed
    /// @param origin Origin of the transaction (tx.origin)
    /// @param sender Sender of the call (msg.sender)
    /// @param token Token address
    /// @param unitPrice Unit price
    event UnitPriceCommitted(address indexed origin, address indexed sender, address token, uint256 unitPrice);
}

File 14 of 20 : IProtocolGovernance.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "./utils/IDefaultAccessControl.sol";
import "./IUnitPricesGovernance.sol";

interface IProtocolGovernance is IDefaultAccessControl, IUnitPricesGovernance {
    /// @notice CommonLibrary protocol params.
    /// @param maxTokensPerVault Max different token addresses that could be managed by the vault
    /// @param governanceDelay The delay (in secs) that must pass before setting new pending params to commiting them
    /// @param protocolTreasury The address that collects protocolFees, if protocolFee is not zero
    /// @param forceAllowMask If a permission bit is set in this mask it forces all addresses to have this permission as true
    /// @param withdrawLimit Withdraw limit (in unit prices, i.e. usd)
    struct Params {
        uint256 maxTokensPerVault;
        uint256 governanceDelay;
        address protocolTreasury;
        uint256 forceAllowMask;
        uint256 withdrawLimit;
    }

    // -------------------  EXTERNAL, VIEW  -------------------

    /// @notice Timestamp after which staged granted permissions for the given address can be committed.
    /// @param target The given address
    /// @return Zero if there are no staged permission grants, timestamp otherwise
    function stagedPermissionGrantsTimestamps(address target) external view returns (uint256);

    /// @notice Staged granted permission bitmask for the given address.
    /// @param target The given address
    /// @return Bitmask
    function stagedPermissionGrantsMasks(address target) external view returns (uint256);

    /// @notice Permission bitmask for the given address.
    /// @param target The given address
    /// @return Bitmask
    function permissionMasks(address target) external view returns (uint256);

    /// @notice Timestamp after which staged pending protocol parameters can be committed
    /// @return Zero if there are no staged parameters, timestamp otherwise.
    function stagedParamsTimestamp() external view returns (uint256);

    /// @notice Staged pending protocol parameters.
    function stagedParams() external view returns (Params memory);

    /// @notice Current protocol parameters.
    function params() external view returns (Params memory);

    /// @notice Addresses for which non-zero permissions are set.
    function permissionAddresses() external view returns (address[] memory);

    /// @notice Permission addresses staged for commit.
    function stagedPermissionGrantsAddresses() external view returns (address[] memory);

    /// @notice Return all addresses where rawPermissionMask bit for permissionId is set to 1.
    /// @param permissionId Id of the permission to check.
    /// @return A list of dirty addresses.
    function addressesByPermission(uint8 permissionId) external view returns (address[] memory);

    /// @notice Checks if address has permission or given permission is force allowed for any address.
    /// @param addr Address to check
    /// @param permissionId Permission to check
    function hasPermission(address addr, uint8 permissionId) external view returns (bool);

    /// @notice Checks if address has all permissions.
    /// @param target Address to check
    /// @param permissionIds A list of permissions to check
    function hasAllPermissions(address target, uint8[] calldata permissionIds) external view returns (bool);

    /// @notice Max different ERC20 token addresses that could be managed by the protocol.
    function maxTokensPerVault() external view returns (uint256);

    /// @notice The delay for committing any governance params.
    function governanceDelay() external view returns (uint256);

    /// @notice The address of the protocol treasury.
    function protocolTreasury() external view returns (address);

    /// @notice Permissions mask which defines if ordinary permission should be reverted.
    /// This bitmask is xored with ordinary mask.
    function forceAllowMask() external view returns (uint256);

    /// @notice Withdraw limit per token per block.
    /// @param token Address of the token
    /// @return Withdraw limit per token per block
    function withdrawLimit(address token) external view returns (uint256);

    /// @notice Addresses that has staged validators.
    function stagedValidatorsAddresses() external view returns (address[] memory);

    /// @notice Timestamp after which staged granted permissions for the given address can be committed.
    /// @param target The given address
    /// @return Zero if there are no staged permission grants, timestamp otherwise
    function stagedValidatorsTimestamps(address target) external view returns (uint256);

    /// @notice Staged validator for the given address.
    /// @param target The given address
    /// @return Validator
    function stagedValidators(address target) external view returns (address);

    /// @notice Addresses that has validators.
    function validatorsAddresses() external view returns (address[] memory);

    /// @notice Address that has validators.
    /// @param i The number of address
    /// @return Validator address
    function validatorsAddress(uint256 i) external view returns (address);

    /// @notice Validator for the given address.
    /// @param target The given address
    /// @return Validator
    function validators(address target) external view returns (address);

    // -------------------  EXTERNAL, MUTATING, GOVERNANCE, IMMEDIATE  -------------------

    /// @notice Rollback all staged validators.
    function rollbackStagedValidators() external;

    /// @notice Revoke validator instantly from the given address.
    /// @param target The given address
    function revokeValidator(address target) external;

    /// @notice Stages a new validator for the given address
    /// @param target The given address
    /// @param validator The validator for the given address
    function stageValidator(address target, address validator) external;

    /// @notice Commits validator for the given address.
    /// @dev Reverts if governance delay has not passed yet.
    /// @param target The given address.
    function commitValidator(address target) external;

    /// @notice Commites all staged validators for which governance delay passed
    /// @return Addresses for which validators were committed
    function commitAllValidatorsSurpassedDelay() external returns (address[] memory);

    /// @notice Rollback all staged granted permission grant.
    function rollbackStagedPermissionGrants() external;

    /// @notice Commits permission grants for the given address.
    /// @dev Reverts if governance delay has not passed yet.
    /// @param target The given address.
    function commitPermissionGrants(address target) external;

    /// @notice Commites all staged permission grants for which governance delay passed.
    /// @return An array of addresses for which permission grants were committed.
    function commitAllPermissionGrantsSurpassedDelay() external returns (address[] memory);

    /// @notice Revoke permission instantly from the given address.
    /// @param target The given address.
    /// @param permissionIds A list of permission ids to revoke.
    function revokePermissions(address target, uint8[] memory permissionIds) external;

    /// @notice Commits staged protocol params.
    /// Reverts if governance delay has not passed yet.
    function commitParams() external;

    // -------------------  EXTERNAL, MUTATING, GOVERNANCE, DELAY  -------------------

    /// @notice Sets new pending params that could have been committed after governance delay expires.
    /// @param newParams New protocol parameters to set.
    function stageParams(Params memory newParams) external;

    /// @notice Stage granted permissions that could have been committed after governance delay expires.
    /// Resets commit delay and permissions if there are already staged permissions for this address.
    /// @param target Target address
    /// @param permissionIds A list of permission ids to grant
    function stagePermissionGrants(address target, uint8[] memory permissionIds) external;
}

File 15 of 20 : IUnitPricesGovernance.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "./utils/IDefaultAccessControl.sol";

interface IUnitPricesGovernance is IDefaultAccessControl, IERC165 {
    // -------------------  EXTERNAL, VIEW  -------------------

    /// @notice Estimated amount of token worth 1 USD staged for commit.
    /// @param token Address of the token
    /// @return The amount of token
    function stagedUnitPrices(address token) external view returns (uint256);

    /// @notice Timestamp after which staged unit prices for the given token can be committed.
    /// @param token Address of the token
    /// @return Timestamp
    function stagedUnitPricesTimestamps(address token) external view returns (uint256);

    /// @notice Estimated amount of token worth 1 USD.
    /// @param token Address of the token
    /// @return The amount of token
    function unitPrices(address token) external view returns (uint256);

    // -------------------  EXTERNAL, MUTATING  -------------------

    /// @notice Stage estimated amount of token worth 1 USD staged for commit.
    /// @param token Address of the token
    /// @param value The amount of token
    function stageUnitPrice(address token, uint256 value) external;

    /// @notice Reset staged value
    /// @param token Address of the token
    function rollbackUnitPrice(address token) external;

    /// @notice Commit staged unit price
    /// @param token Address of the token
    function commitUnitPrice(address token) external;
}

File 16 of 20 : IContractMeta.sol
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.9;

interface IContractMeta {
    function contractName() external view returns (string memory);
    function contractNameBytes() external view returns (bytes32);

    function contractVersion() external view returns (string memory);
    function contractVersionBytes() external view returns (bytes32);
}

File 17 of 20 : IDefaultAccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";

interface IDefaultAccessControl is IAccessControlEnumerable {
    /// @notice Checks that the address is contract admin.
    /// @param who Address to check
    /// @return `true` if who is admin, `false` otherwise
    function isAdmin(address who) external view returns (bool);

    /// @notice Checks that the address is contract admin.
    /// @param who Address to check
    /// @return `true` if who is operator, `false` otherwise
    function isOperator(address who) external view returns (bool);
}

File 18 of 20 : ExceptionsLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

/// @notice Exceptions stores project`s smart-contracts exceptions
library ExceptionsLibrary {
    string constant ADDRESS_ZERO = "AZ";
    string constant VALUE_ZERO = "VZ";
    string constant EMPTY_LIST = "EMPL";
    string constant NOT_FOUND = "NF";
    string constant INIT = "INIT";
    string constant DUPLICATE = "DUP";
    string constant NULL = "NULL";
    string constant TIMESTAMP = "TS";
    string constant FORBIDDEN = "FRB";
    string constant ALLOWLIST = "ALL";
    string constant LIMIT_OVERFLOW = "LIMO";
    string constant LIMIT_UNDERFLOW = "LIMU";
    string constant INVALID_VALUE = "INV";
    string constant INVARIANT = "INVA";
    string constant INVALID_TARGET = "INVTR";
    string constant INVALID_TOKEN = "INVTO";
    string constant INVALID_INTERFACE = "INVI";
    string constant INVALID_SELECTOR = "INVS";
    string constant INVALID_STATE = "INVST";
    string constant INVALID_LENGTH = "INVL";
    string constant LOCK = "LCKD";
    string constant DISABLED = "DIS";
}

File 19 of 20 : ContractMeta.sol
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.9;

import "../interfaces/utils/IContractMeta.sol";

abstract contract ContractMeta is IContractMeta {
    // -------------------  EXTERNAL, VIEW  -------------------

    function contractName() external pure returns (string memory) {
        return _bytes32ToString(_contractName());
    }

    function contractNameBytes() external pure returns (bytes32) {
        return _contractName();
    }

    function contractVersion() external pure returns (string memory) {
        return _bytes32ToString(_contractVersion());
    }

    function contractVersionBytes() external pure returns (bytes32) {
        return _contractVersion();
    }

    // -------------------  INTERNAL, VIEW  -------------------

    function _contractName() internal pure virtual returns (bytes32);

    function _contractVersion() internal pure virtual returns (bytes32);

    function _bytes32ToString(bytes32 b) internal pure returns (string memory s) {
        s = new string(32);
        uint256 len = 32;
        for (uint256 i = 0; i < 32; ++i) {
            if (uint8(b[i]) == 0) {
                len = i;
                break;
            }
        }
        assembly {
            mstore(s, len)
            mstore(add(s, 0x20), b)
        }
    }
}

File 20 of 20 : DefaultAccessControl.sol
// SPDX-License-Identifier: BSL-1.1
pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "../interfaces/utils/IDefaultAccessControl.sol";
import "../libraries/ExceptionsLibrary.sol";

/// @notice This is a default access control with 3 roles:
///
/// - ADMIN: allowed to do anything
/// - ADMIN_DELEGATE: allowed to do anything except assigning ADMIN and ADMIN_DELEGATE roles
/// - OPERATOR: low-privileged role, generally keeper or some other bot
contract DefaultAccessControl is IDefaultAccessControl, AccessControlEnumerable {
    bytes32 public constant OPERATOR = keccak256("operator");
    bytes32 public constant ADMIN_ROLE = keccak256("admin");
    bytes32 public constant ADMIN_DELEGATE_ROLE = keccak256("admin_delegate");

    /// @notice Creates a new contract.
    /// @param admin Admin of the contract
    constructor(address admin) {
        require(admin != address(0), ExceptionsLibrary.ADDRESS_ZERO);

        _setupRole(OPERATOR, admin);
        _setupRole(ADMIN_ROLE, admin);

        _setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
        _setRoleAdmin(ADMIN_DELEGATE_ROLE, ADMIN_ROLE);
        _setRoleAdmin(OPERATOR, ADMIN_DELEGATE_ROLE);
    }

    // -------------------------  EXTERNAL, VIEW  ------------------------------

    /// @notice Checks if the address is ADMIN or ADMIN_DELEGATE.
    /// @param sender Adddress to check
    /// @return `true` if sender is an admin, `false` otherwise
    function isAdmin(address sender) public view returns (bool) {
        return hasRole(ADMIN_ROLE, sender) || hasRole(ADMIN_DELEGATE_ROLE, sender);
    }

    /// @notice Checks if the address is OPERATOR.
    /// @param sender Adddress to check
    /// @return `true` if sender is an admin, `false` otherwise
    function isOperator(address sender) public view returns (bool) {
        return hasRole(OPERATOR, sender);
    }

    // -------------------------  INTERNAL, VIEW  ------------------------------

    function _requireAdmin() internal view {
        require(isAdmin(msg.sender), ExceptionsLibrary.FORBIDDEN);
    }

    function _requireAtLeastOperator() internal view {
        require(isAdmin(msg.sender) || isOperator(msg.sender), ExceptionsLibrary.FORBIDDEN);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AllStagedPermissionGrantsRolledBack","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AllStagedValidatorsRolledBack","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"components":[{"internalType":"uint256","name":"maxTokensPerVault","type":"uint256"},{"internalType":"uint256","name":"governanceDelay","type":"uint256"},{"internalType":"address","name":"protocolTreasury","type":"address"},{"internalType":"uint256","name":"forceAllowMask","type":"uint256"},{"internalType":"uint256","name":"withdrawLimit","type":"uint256"}],"indexed":false,"internalType":"struct IProtocolGovernance.Params","name":"params","type":"tuple"}],"name":"ParamsCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"at","type":"uint256"},{"components":[{"internalType":"uint256","name":"maxTokensPerVault","type":"uint256"},{"internalType":"uint256","name":"governanceDelay","type":"uint256"},{"internalType":"address","name":"protocolTreasury","type":"address"},{"internalType":"uint256","name":"forceAllowMask","type":"uint256"},{"internalType":"uint256","name":"withdrawLimit","type":"uint256"}],"indexed":false,"internalType":"struct IProtocolGovernance.Params","name":"params","type":"tuple"}],"name":"ParamsStaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"}],"name":"PermissionGrantsCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint8[]","name":"permissionIds","type":"uint8[]"},{"indexed":false,"internalType":"uint256","name":"at","type":"uint256"}],"name":"PermissionGrantsStaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint8[]","name":"permissionIds","type":"uint8[]"}],"name":"PermissionsRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"unitPrice","type":"uint256"}],"name":"UnitPriceCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"UnitPriceRolledBack","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"unitPrice","type":"uint256"}],"name":"UnitPriceStaged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"}],"name":"ValidatorCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"}],"name":"ValidatorRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"address","name":"validator","type":"address"},{"indexed":false,"internalType":"uint256","name":"at","type":"uint256"}],"name":"ValidatorStaged","type":"event"},{"inputs":[],"name":"ADMIN_DELEGATE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_GOVERNANCE_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_WITHDRAW_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"permissionId","type":"uint8"}],"name":"addressesByPermission","outputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commitAllPermissionGrantsSurpassedDelay","outputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"commitAllValidatorsSurpassedDelay","outputs":[{"internalType":"address[]","name":"addressesCommitted","type":"address[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"commitParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stagedAddress","type":"address"}],"name":"commitPermissionGrants","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"commitUnitPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stagedAddress","type":"address"}],"name":"commitValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractNameBytes","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractVersionBytes","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"forceAllowMask","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governanceDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint8[]","name":"permissionIds","type":"uint8[]"}],"name":"hasAllPermissions","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint8","name":"permissionId","type":"uint8"}],"name":"hasPermission","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokensPerVault","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"params","outputs":[{"components":[{"internalType":"uint256","name":"maxTokensPerVault","type":"uint256"},{"internalType":"uint256","name":"governanceDelay","type":"uint256"},{"internalType":"address","name":"protocolTreasury","type":"address"},{"internalType":"uint256","name":"forceAllowMask","type":"uint256"},{"internalType":"uint256","name":"withdrawLimit","type":"uint256"}],"internalType":"struct IProtocolGovernance.Params","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permissionAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"permissionMasks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint8[]","name":"permissionIds","type":"uint8[]"}],"name":"revokePermissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"revokeValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rollbackStagedPermissionGrants","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rollbackStagedValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"rollbackUnitPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"maxTokensPerVault","type":"uint256"},{"internalType":"uint256","name":"governanceDelay","type":"uint256"},{"internalType":"address","name":"protocolTreasury","type":"address"},{"internalType":"uint256","name":"forceAllowMask","type":"uint256"},{"internalType":"uint256","name":"withdrawLimit","type":"uint256"}],"internalType":"struct IProtocolGovernance.Params","name":"newParams","type":"tuple"}],"name":"stageParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint8[]","name":"permissionIds","type":"uint8[]"}],"name":"stagePermissionGrants","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"stageUnitPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"address","name":"validator","type":"address"}],"name":"stageValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stagedParams","outputs":[{"components":[{"internalType":"uint256","name":"maxTokensPerVault","type":"uint256"},{"internalType":"uint256","name":"governanceDelay","type":"uint256"},{"internalType":"address","name":"protocolTreasury","type":"address"},{"internalType":"uint256","name":"forceAllowMask","type":"uint256"},{"internalType":"uint256","name":"withdrawLimit","type":"uint256"}],"internalType":"struct IProtocolGovernance.Params","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stagedParamsTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stagedPermissionGrantsAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stagedPermissionGrantsMasks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stagedPermissionGrantsTimestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stagedUnitPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stagedUnitPricesTimestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stagedValidators","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stagedValidatorsAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stagedValidatorsTimestamps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"unitPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"validators","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"validatorsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validatorsAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620030c9380380620030c9833981016040819052620000349162000305565b60408051808201909152600281526120ad60f11b6020820152819081906001600160a01b038216620000845760405162461bcd60e51b81526004016200007b919062000337565b60405180910390fd5b50620000a0600080516020620030a98339815191528262000155565b620000bb600080516020620030898339815191528262000155565b620000d6600080516020620030898339815191528062000165565b620001117fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d76000805160206200308983398151915262000165565b6200014c600080516020620030a98339815191527fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d762000165565b5050506200038f565b620001618282620001b0565b5050565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b620001c78282620001f360201b62001d0b1760201c565b6000828152600160209081526040909120620001ee91839062001d8f62000293821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000161576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200024f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620002aa836001600160a01b038416620002b3565b90505b92915050565b6000818152600183016020526040812054620002fc57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620002ad565b506000620002ad565b6000602082840312156200031857600080fd5b81516001600160a01b03811681146200033057600080fd5b9392505050565b600060208083528351808285015260005b81811015620003665785810183015185820160400152820162000348565b8181111562000379576000604083870101525b50601f01601f1916929092016040019392505050565b612cea806200039f6000396000f3fe608060405234801561001057600080fd5b50600436106103ba5760003560e01c806378546fa2116101f4578063b3ff103c1161011a578063cff0ab96116100ad578063e970164c1161007c578063e970164c146108aa578063f7fcd303146108b2578063fa52c7d8146108db578063fce33f011461090457600080fd5b8063cff0ab9614610867578063d1bf2a6b1461086f578063d547741f14610877578063d65c5e6b1461088a57600080fd5b8063bd674f3a116100e9578063bd674f3a14610831578063bd7692f714610839578063c7e6ab0514610841578063ca15c8731461085457600080fd5b8063b3ff103c146107fa578063b521bf2d1461080d578063bba3293914610820578063bd66b16e1461082857600080fd5b80639348e4ec11610192578063a0a8e46011610161578063a0a8e460146107aa578063a217fddf146107b2578063ac9650d8146107ba578063ae24e14a146107da57600080fd5b80639348e4ec1461076057806395e3a12d14610773578063983d27371461077b57806399fb4234146107a257600080fd5b8063887b812d116101ce578063887b812d146107075780638e35b0281461071a5780639010d07c1461073a57806391d148541461074d57600080fd5b806378546fa2146106d2578063803db96d146106da578063806bc2f1146106ff57600080fd5b806336568abe116102e457806369b411701161027757806373680db41161024657806373680db41461066357806375b238fc1461067657806375d0c0dc1461069d578063768a1bfc146106b257600080fd5b806369b41170146105e55780636d70f7ae146105ef578063717af5ed14610602578063731c01a91461061557600080fd5b80635c1e4448116102b35780635c1e44481461056d57806363d21c751461058057806363e85d2d1461058a57806364cd39af146105c557600080fd5b806336568abe1461052c5780633837a1a31461053f57806356f46d7214610552578063577848ea1461056557600080fd5b806312c2d8741161035c578063248a9ca31161032b578063248a9ca3146104c357806324d7806c146104e65780632a4ebb41146104f95780632f2ff15d1461051957600080fd5b806312c2d874146104735780631c3a2341146104935780631c5afc46146104a65780631dd02197146104bb57600080fd5b806306a462391161039857806306a462391461040f5780630952ff54146104275780630e3e80ac1461044e5780630ea556361461046957600080fd5b80630161c241146103bf57806301ffc9a7146103d4578063047564b7146103fc575b600080fd5b6103d26103cd366004612625565b610917565b005b6103e76103e2366004612642565b610a78565b60405190151581526020015b60405180910390f35b6103d261040a366004612625565b610aa3565b640312e302e360dc1b5b6040519081526020016103f3565b6104197fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d781565b7150726f746f636f6c476f7665726e616e636560701b610419565b61041962093a8081565b610419610481366004612625565b60046020526000908152604090205481565b6103d26104a13660046126b8565b610b60565b6104ae610c4f565b6040516103f3919061270d565b6103d2610c5b565b6104196104d136600461275a565b60009081526020819052604090206001015490565b6103e76104f4366004612625565b610d0a565b610419610507366004612625565b60066020526000908152604090205481565b6103d2610527366004612773565b610d66565b6103d261053a366004612773565b610d91565b6103d261054d366004612625565b610e0f565b6103d26105603660046127a3565b610f22565b6104ae611008565b6103d261057b3660046127cf565b6111b8565b61041962030d4081565b6103e76105983660046127fd565b601c546001600160a01b03831660009081526007602052604090205417600160ff83161b16151592915050565b6104196105d3366004612625565b60076020526000908152604090205481565b6104196212750081565b6103e76105fd366004612625565b61122a565b6104ae610610366004612832565b611256565b61061d611344565b6040516103f3919081518152602080830151908201526040808301516001600160a01b031690820152606080830151908201526080918201519181019190915260a00190565b6103d2610671366004612625565b61138a565b6104197ff23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d881565b6106a56113ec565b6040516103f391906128a9565b6104196106c0366004612625565b60026020526000908152604090205481565b601954610419565b601b546001600160a01b03165b6040516001600160a01b0390911681526020016103f3565b6104ae61140c565b6103d2610715366004612625565b611418565b610419610728366004612625565b60056020526000908152604090205481565b6106e76107483660046128bc565b611558565b6103e761075b366004612773565b611577565b6103e761076e3660046126b8565b6115a0565b6104ae6115d7565b6104197f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62281565b601c54610419565b6106a56115e3565b610419600081565b6107cd6107c83660046128de565b6115f6565b6040516103f39190612920565b6104196107e8366004612625565b60036020526000908152604090205481565b6106e761080836600461275a565b6116eb565b6103d261081b366004612982565b6116f8565b601a54610419565b610419600b5481565b6103d2611806565b6103d26118aa565b6103d261084f3660046126b8565b6119c6565b61041961086236600461275a565b611ab3565b61061d611aca565b6104ae611b10565b6103d2610885366004612773565b611b1c565b610419610898366004612625565b60086020526000908152604090205481565b6104ae611b42565b6106e76108c0366004612625565b6009602052600090815260409020546001600160a01b031681565b6106e76108e9366004612625565b600a602052600090815260409020546001600160a01b031681565b610419610912366004612625565b611ce5565b61091f611da4565b6001600160a01b0381166000908152600860209081526040918290205482518084019093526002835261545360f01b9183019190915290428211156109805760405162461bcd60e51b815260040161097791906128a9565b60405180910390fd5b506040805180820190915260048152631395531360e21b6020820152816109ba5760405162461bcd60e51b815260040161097791906128a9565b506001600160a01b03808316600090815260096020908152604080832054600a90925290912080546001600160a01b031916919092161790556109fe601083611d8f565b506001600160a01b038216600090815260096020908152604080832080546001600160a01b03191690556008909152812055610a3b601283611dea565b506040516001600160a01b03831690339032907fbed845dc13e95e4cf248e05941119a9e8c8c7e79700599c07a2c86c527d9f78d90600090a45050565b60006001600160e01b0319821663ca11fe0360e01b1480610a9d5750610a9d82611dff565b92915050565b610aab611da4565b6040805180820190915260048152631395531360e21b60208201526001600160a01b038216610aed5760405162461bcd60e51b815260040161097791906128a9565b506001600160a01b0381166000908152600a6020526040902080546001600160a01b0319169055610b1f601082611dea565b506040516001600160a01b03821690339032907f847e483f8de6bf96572128142c4ca8ea6846ac59ee9b73e06a4485157d64924490600090a450565b905090565b610b68611da4565b6040805180820190915260048152631395531360e21b60208201526001600160a01b038416610baa5760405162461bcd60e51b815260040161097791906128a9565b50610bb6600c84611d8f565b50610bc18282611e24565b6001600160a01b038416600090815260066020526040812091909155601a54610bea90426129c6565b6001600160a01b038516600081815260056020526040908190208390555191925090339032907f3e6606f969b1354b7fbac9654238e69d3844c5fc3d90fa6ae9b9d474236908fe90610c4190889088908890612a1f565b60405180910390a450505050565b6060610b5b6012611e73565b610c63611da4565b6000610c6f6012611e80565b905060005b818114610cd9576000610c88601282611e8a565b6001600160a01b038116600090815260096020908152604080832080546001600160a01b031916905560089091528120559050610cc6601282611dea565b505080610cd290612a43565b9050610c74565b50604051339032907f26723c59f9cf42b0dee652fc4fb4c3fca21ccf8d77b988c733fecf8991bda69390600090a350565b6000610d367ff23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d883611577565b80610a9d5750610a9d7fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d783611577565b600082815260208190526040902060010154610d828133611e96565b610d8c8383611efa565b505050565b6001600160a01b0381163314610e015760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610977565b610e0b8282611f1c565b5050565b610e17611da4565b6001600160a01b038116600090815260046020908152604091829020548251808401909352600583526412539594d560da1b918301919091529081610e6f5760405162461bcd60e51b815260040161097791906128a9565b50604080518082019091526002815261545360f01b602082015242821115610eaa5760405162461bcd60e51b815260040161097791906128a9565b506001600160a01b038216600081815260036020908152604080832080546002845282852081905590849055600483528184209390935580519384529083018290529091339132917f99745c5bf4e5d496dd70013ac2b6bae4262c471986c2b157141d8c4d570bc039910160405180910390a3505050565b60408051808201909152600281526120ad60f11b60208201526001600160a01b038316610f625760405162461bcd60e51b815260040161097791906128a9565b50610f6b611da4565b6001600160a01b0382166000908152600360209081526040808320849055600290915290205415610fa857610fa362127500426129c6565b610faa565b425b6001600160a01b038316600081815260046020908152604091829020939093558051918252918101839052339132917fc8a6c4dcd4038ea437d00baa434c23066bf4cc6cd661a55bcb754f58d670b6e5910160405180910390a35050565b6060611012611da4565b600061101e6012611e80565b90508067ffffffffffffffff81111561103957611039612a5e565b604051908082528060200260200182016040528015611062578160200160208202803683370190505b5091506000805b8281146111b157600061107d601283611e8a565b6001600160a01b038116600090815260086020526040902054909150421061119f576001600160a01b03808216600090815260096020908152604080832054600a90925290912080546001600160a01b031916919092161790556110e2601082611d8f565b506001600160a01b038116600090815260096020908152604080832080546001600160a01b0319169055600890915281205561111f601282611dea565b508085848151811061113357611133612a74565b6001600160a01b039092166020928302919091019091015261115483612a43565b925061115f84612a8a565b6040519094506001600160a01b03821690339032907fbed845dc13e95e4cf248e05941119a9e8c8c7e79700599c07a2c86c527d9f78d90600090a46111ab565b6111a882612a43565b91505b50611069565b5082525090565b6111c0611da4565b6111c981611f3e565b8060146111d68282612aa1565b5050601a546111e590426129c6565b600b819055604051339132917f57d7abf76a9762486b1c294e2ab4c95a80cc2f6b9516cab2e39b060b3d5928b29161121f91601490612b2b565b60405180910390a350565b6000610a9d7f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62283611577565b60606000611264600e611e80565b90508067ffffffffffffffff81111561127f5761127f612a5e565b6040519080825280602002602001820160405280156112a8578160200160208202803683370190505b5091506000600160ff85161b815b8381101561133a5760006112cb600e83611e8a565b6001600160a01b038116600090815260076020526040902054909150831615611327578086858151811061130157611301612a74565b6001600160a01b03909216602092830291909101909101528361132381612a43565b9450505b508061133281612a43565b9150506112b6565b5050825250919050565b61134c6125d8565b506040805160a081018252601454815260155460208201526016546001600160a01b0316918101919091526017546060820152601854608082015290565b611392611da4565b6001600160a01b038116600081815260036020908152604080832083905560048252808320929092559051918252339132917fe157c01d7fdfb7981107455af06f96f3d8a289a8925529bb12d8a3706f2f9238910161121f565b6060610b5b7150726f746f636f6c476f7665726e616e636560701b612017565b6060610b5b600e611e73565b611420611da4565b6001600160a01b0381166000908152600560209081526040918290205482518084019093526002835261545360f01b9183019190915290428211156114785760405162461bcd60e51b815260040161097791906128a9565b506040805180820190915260048152631395531360e21b6020820152816114b25760405162461bcd60e51b815260040161097791906128a9565b506001600160a01b0382166000908152600660209081526040808320546007909252909120805490911790556114e9600e83611d8f565b506001600160a01b0382166000908152600660209081526040808320839055600590915281205561151b600c83611dea565b506040516001600160a01b03831690339032907f50df548bb5b3a2ff8dd01f8aacf26b88153fba5b749e050b9874e021a6b4a7d190600090a45050565b60008281526001602052604081206115709083611e8a565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000806115ad8484611e24565b601c546001600160a01b038716600090815260076020526040902054178116149150509392505050565b6060610b5b600c611e73565b6060610b5b640312e302e360dc1b612017565b60608167ffffffffffffffff81111561161157611611612a5e565b60405190808252806020026020018201604052801561164457816020015b606081526020019060019003908161162f5790505b50905060005b828110156116e4576116b43085858481811061166857611668612a74565b905060200281019061167a9190612b3f565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061208392505050565b8282815181106116c6576116c6612a74565b602002602001018190525080806116dc90612a43565b91505061164a565b5092915050565b6000610a9d601083611e8a565b611700611da4565b6001600160a01b0382161580159061172057506001600160a01b03811615155b6040518060400160405280600281526020016120ad60f11b815250906117595760405162461bcd60e51b815260040161097791906128a9565b50611765601283611d8f565b506001600160a01b03828116600090815260096020526040812080546001600160a01b03191692841692909217909155601a546117a290426129c6565b6001600160a01b0384811660008181526008602090815260409182902085905581519387168452830184905292935091339132917fbd765521cce68f9c3fc8945fb25cb99a6b8a6d0c03f086c1e9a7ea9a24b35d97910160405180910390a4505050565b61180e611da4565b600061181a600c611e80565b905060005b818114611879576000611833600c82611e8a565b6001600160a01b038116600090815260066020908152604080832083905560059091528120559050611866600c82611dea565b50508061187290612a43565b905061181f565b50604051339032907fe65fa0190ef93820f93988cc16cbbdd3a9615c87920a2ad4de5f6610d6e2710290600090a350565b6118b2611da4565b600b546040805180820190915260048152631395531360e21b6020820152906118ee5760405162461bcd60e51b815260040161097791906128a9565b50600b5442101560405180604001604052806002815260200161545360f01b8152509061192e5760405162461bcd60e51b815260040161097791906128a9565b5060148054601990815560158054601a5560168054601b80546001600160a01b03199081166001600160a01b0384161790915560178054601c5560188054601d55600097889055948790559116909155839055829055600b91909155604051339132917f9450ccd09ec91c0d60e02db0ad62489853f47c9d2312b4db049030912e45c82f916119bc91612b86565b60405180910390a3565b6119ce611da4565b6040805180820190915260048152631395531360e21b60208201526001600160a01b038416611a105760405162461bcd60e51b815260040161097791906128a9565b506000611a1d8383611e24565b6001600160a01b03851660009081526007602052604090208054821981169182905591925080611a5457611a52600e87611dea565b505b856001600160a01b0316336001600160a01b0316326001600160a01b03167ff9133af9d3bddecefe06913c77827dcd75c3aba24b56e67afa215ef087598c9a8888604051611aa3929190612b94565b60405180910390a4505050505050565b6000818152600160205260408120610a9d90611e80565b611ad26125d8565b506040805160a0810182526019548152601a546020820152601b546001600160a01b031691810191909152601c546060820152601d54608082015290565b6060610b5b6010611e73565b600082815260208190526040902060010154611b388133611e96565b610d8c8383611f1c565b6060611b4c611da4565b6000611b58600c611e80565b9050808067ffffffffffffffff811115611b7457611b74612a5e565b604051908082528060200260200182016040528015611b9d578160200160208202803683370190505b50925060005b818114611cd1576000611bb7600c83611e8a565b6001600160a01b0381166000908152600560205260409020549091504210611cbf576001600160a01b038116600090815260066020908152604080832054600790925290912080549091179055611c0f600e82611d8f565b506001600160a01b03811660009081526006602090815260408083208390556005909152812055611c41600c82611dea565b508085611c4e8587612bb0565b81518110611c5e57611c5e612a74565b6001600160a01b0390921660209283029190910190910152611c7f83612a8a565b6040519093506001600160a01b03821690339032907f50df548bb5b3a2ff8dd01f8aacf26b88153fba5b749e050b9874e021a6b4a7d190600090a4611ccb565b611cc882612a43565b91505b50611ba3565b50611cdc8183612bb0565b83525090919050565b6001600160a01b038116600090815260026020526040812054601d54610a9d9190612bc7565b611d158282611577565b610e0b576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611d4b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611570836001600160a01b0384166120a8565b611dad33610d0a565b6040518060400160405280600381526020016223292160e91b81525090611de75760405162461bcd60e51b815260040161097791906128a9565b50565b6000611570836001600160a01b0384166120f7565b60006001600160e01b0319821663d7c7e3a760e01b1480610a9d5750610a9d826121ea565b6000805b828110156116e457838382818110611e4257611e42612a74565b9050602002016020810190611e579190612832565b60ff166001901b8217915080611e6c90612a43565b9050611e28565b606060006115708361220f565b6000610a9d825490565b6000611570838361226b565b611ea08282611577565b610e0b57611eb8816001600160a01b03166014612295565b611ec3836020612295565b604051602001611ed4929190612be6565b60408051601f198184030181529082905262461bcd60e51b8252610977916004016128a9565b611f048282611d0b565b6000828152600160205260409020610d8c9082611d8f565b611f268282612431565b6000828152600160205260409020610d8c9082611dea565b803515801590611f515750602081013515155b604051806040016040528060048152602001631395531360e21b81525090611f8c5760405162461bcd60e51b815260040161097791906128a9565b5062093a8081602001351115604051806040016040528060048152602001634c494d4f60e01b81525090611fd35760405162461bcd60e51b815260040161097791906128a9565b506040805180820190915260048152634c494d4f60e01b602082015262030d4060808301351015610e0b5760405162461bcd60e51b815260040161097791906128a9565b604080516020808252818301909252606091602082018180368337019050509050602060005b60208110156120755783816020811061205857612058612a74565b1a61206557809150612075565b61206e81612a43565b905061203d565b508152602081019190915290565b60606115708383604051806060016040528060278152602001612c8e60279139612496565b60008181526001830160205260408120546120ef57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a9d565b506000610a9d565b600081815260018301602052604081205480156121e057600061211b600183612bb0565b855490915060009061212f90600190612bb0565b905081811461219457600086600001828154811061214f5761214f612a74565b906000526020600020015490508087600001848154811061217257612172612a74565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806121a5576121a5612c5b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a9d565b6000915050610a9d565b60006001600160e01b03198216635a05180f60e01b1480610a9d5750610a9d8261256a565b60608160000180548060200260200160405190810160405280929190818152602001828054801561225f57602002820191906000526020600020905b81548152602001906001019080831161224b575b50505050509050919050565b600082600001828154811061228257612282612a74565b9060005260206000200154905092915050565b606060006122a4836002612bc7565b6122af9060026129c6565b67ffffffffffffffff8111156122c7576122c7612a5e565b6040519080825280601f01601f1916602001820160405280156122f1576020820181803683370190505b509050600360fc1b8160008151811061230c5761230c612a74565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061233b5761233b612a74565b60200101906001600160f81b031916908160001a905350600061235f846002612bc7565b61236a9060016129c6565b90505b60018111156123e2576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061239e5761239e612a74565b1a60f81b8282815181106123b4576123b4612a74565b60200101906001600160f81b031916908160001a90535060049490941c936123db81612a8a565b905061236d565b5083156115705760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610977565b61243b8282611577565b15610e0b576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6060833b6124f55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610977565b600080856001600160a01b0316856040516125109190612c71565b600060405180830381855af49150503d806000811461254b576040519150601f19603f3d011682016040523d82523d6000602084013e612550565b606091505b509150915061256082828661259f565b9695505050505050565b60006001600160e01b03198216637965db0b60e01b1480610a9d57506301ffc9a760e01b6001600160e01b0319831614610a9d565b606083156125ae575081611570565b8251156125be5782518084602001fd5b8160405162461bcd60e51b815260040161097791906128a9565b6040518060a00160405280600081526020016000815260200160006001600160a01b0316815260200160008152602001600081525090565b6001600160a01b0381168114611de757600080fd5b60006020828403121561263757600080fd5b813561157081612610565b60006020828403121561265457600080fd5b81356001600160e01b03198116811461157057600080fd5b60008083601f84011261267e57600080fd5b50813567ffffffffffffffff81111561269657600080fd5b6020830191508360208260051b85010111156126b157600080fd5b9250929050565b6000806000604084860312156126cd57600080fd5b83356126d881612610565b9250602084013567ffffffffffffffff8111156126f457600080fd5b6127008682870161266c565b9497909650939450505050565b6020808252825182820181905260009190848201906040850190845b8181101561274e5783516001600160a01b031683529284019291840191600101612729565b50909695505050505050565b60006020828403121561276c57600080fd5b5035919050565b6000806040838503121561278657600080fd5b82359150602083013561279881612610565b809150509250929050565b600080604083850312156127b657600080fd5b82356127c181612610565b946020939093013593505050565b600060a082840312156127e157600080fd5b50919050565b803560ff811681146127f857600080fd5b919050565b6000806040838503121561281057600080fd5b823561281b81612610565b9150612829602084016127e7565b90509250929050565b60006020828403121561284457600080fd5b611570826127e7565b60005b83811015612868578181015183820152602001612850565b83811115612877576000848401525b50505050565b6000815180845261289581602086016020860161284d565b601f01601f19169290920160200192915050565b602081526000611570602083018461287d565b600080604083850312156128cf57600080fd5b50508035926020909101359150565b600080602083850312156128f157600080fd5b823567ffffffffffffffff81111561290857600080fd5b6129148582860161266c565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561297557603f1988860301845261296385835161287d565b94509285019290850190600101612947565b5092979650505050505050565b6000806040838503121561299557600080fd5b82356129a081612610565b9150602083013561279881612610565b634e487b7160e01b600052601160045260246000fd5b600082198211156129d9576129d96129b0565b500190565b8183526000602080850194508260005b85811015612a145760ff612a01836127e7565b16875295820195908201906001016129ee565b509495945050505050565b604081526000612a336040830185876129de565b9050826020830152949350505050565b6000600019821415612a5757612a576129b0565b5060010190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081612a9957612a996129b0565b506000190190565b8135815560208201356001820155600281016040830135612ac181612610565b81546001600160a01b0319166001600160a01b039190911617905560608201356003820155608090910135600490910155565b805482526001810154602083015260028101546001600160a01b031660408301526003810154606083015260040154608090910152565b82815260c081016115706020830184612af4565b6000808335601e19843603018112612b5657600080fd5b83018035915067ffffffffffffffff821115612b7157600080fd5b6020019150368190038213156126b157600080fd5b60a08101610a9d8284612af4565b602081526000612ba86020830184866129de565b949350505050565b600082821015612bc257612bc26129b0565b500390565b6000816000190483118215151615612be157612be16129b0565b500290565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612c1e81601785016020880161284d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612c4f81602884016020880161284d565b01602801949350505050565b634e487b7160e01b600052603160045260246000fd5b60008251612c8381846020870161284d565b919091019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122041a9bdf311cb8812b3b8422eae2ba116e095eb6a62860f0a0f13ff01f3b10ccc64736f6c63430008090033f23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d846a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62200000000000000000000000007883ebd6f178420f24969279bd425ab0b99f10b

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.