Address Details
contract
0x58c4281C3E42Bc33d77adeD5aD6aed57cD8c793a
- Contract Name
- Authorizer
- Creator
- 0x0dc437–43c26b at 0x7425c0–15c08f
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 5 Transactions
- Transfers
- 0 Transfers
- Gas Used
- 357,409
- Last Balance Update
- 21050320
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Authorizer
- Optimization enabled
- true
- Compiler version
- v0.7.3+commit.9bfce1f6
- Optimization runs
- 1500
- EVM Version
- istanbul
- Verified at
- 2022-05-25T11:27:53.538892Z
pkg/vault/contracts/Authorizer.sol
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; import "./interfaces/IAuthorizer.sol"; import "../../solidity-utils/contracts/openzeppelin/AccessControl.sol"; import "../../solidity-utils/contracts/helpers/InputHelpers.sol"; /** * @dev Basic Authorizer implementation, based on OpenZeppelin's Access Control. * * Users are allowed to perform actions if they have the role with the same identifier. In this sense, roles are not * being truly used as such, since they each map to a single action identifier. * * This temporary implementation is expected to be replaced soon after launch by a more sophisticated one, able to * manage permissions across multiple contracts and to natively handle timelocks. */ contract Authorizer is AccessControl, IAuthorizer { constructor(address admin) { _setupRole(DEFAULT_ADMIN_ROLE, admin); } function canPerform( bytes32 actionId, address account, address where ) public view override returns (bool) { return AccessControl.hasRole(actionId, account, where); } /** * @dev Grants multiple roles to a single account for a set of contracts. */ function grantRoles( bytes32[] memory roles, address account, address[] calldata where ) external { for (uint256 i = 0; i < roles.length; i++) { grantRole(roles[i], account, where); } } /** * @dev Grants multiple roles to a single account for all contracts. */ function grantRolesGlobally(bytes32[] memory roles, address account) external { for (uint256 i = 0; i < roles.length; i++) { grantRoleGlobally(roles[i], account); } } /** * @dev Grants roles to a list of accounts for a set of contracts. */ function grantRolesToMany( bytes32[] memory roles, address[] memory accounts, address[] calldata where ) external { InputHelpers.ensureInputLengthMatch(roles.length, accounts.length); for (uint256 i = 0; i < roles.length; i++) { grantRole(roles[i], accounts[i], where); } } /** * @dev Grants roles to a list of accounts for all contracts. */ function grantRolesGloballyToMany(bytes32[] memory roles, address[] memory accounts) external { InputHelpers.ensureInputLengthMatch(roles.length, accounts.length); for (uint256 i = 0; i < roles.length; i++) { grantRoleGlobally(roles[i], accounts[i]); } } /** * @dev Revokes multiple roles from a single account for a set of contracts. */ function revokeRoles( bytes32[] memory roles, address account, address[] calldata where ) external { for (uint256 i = 0; i < roles.length; i++) { revokeRole(roles[i], account, where); } } /** * @dev Revokes multiple roles from a single account for all contracts. */ function revokeRolesGlobally(bytes32[] memory roles, address account) external { for (uint256 i = 0; i < roles.length; i++) { revokeRoleGlobally(roles[i], account); } } /** * @dev Revokes roles from a list of accounts across a set of contracts */ function revokeRolesFromMany( bytes32[] memory roles, address[] memory accounts, address[] calldata where ) external { InputHelpers.ensureInputLengthMatch(roles.length, accounts.length); for (uint256 i = 0; i < roles.length; i++) { revokeRole(roles[i], accounts[i], where); } } /** * @dev Revokes roles from a list of accounts. */ function revokeRolesGloballyFromMany(bytes32[] memory roles, address[] memory accounts) external { InputHelpers.ensureInputLengthMatch(roles.length, accounts.length); for (uint256 i = 0; i < roles.length; i++) { revokeRoleGlobally(roles[i], accounts[i]); } } }
/pkg/solidity-utils/contracts/helpers/BalancerErrors.sol
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; // solhint-disable /** * @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are * supported. */ function _require(bool condition, uint256 errorCode) pure { if (!condition) _revert(errorCode); } /** * @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported. */ function _revert(uint256 errorCode) pure { // We're going to dynamically create a revert string based on the error code, with the following format: // 'BAL#{errorCode}' // where the code is left-padded with zeroes to three digits (so they range from 000 to 999). // // We don't have revert strings embedded in the contract to save bytecode size: it takes much less space to store a // number (8 to 16 bits) than the individual string characters. // // The dynamic string creation algorithm that follows could be implemented in Solidity, but assembly allows for a // much denser implementation, again saving bytecode size. Given this function unconditionally reverts, this is a // safe place to rely on it without worrying about how its usage might affect e.g. memory contents. assembly { // First, we need to compute the ASCII representation of the error code. We assume that it is in the 0-999 // range, so we only need to convert three digits. To convert the digits to ASCII, we add 0x30, the value for // the '0' character. let units := add(mod(errorCode, 10), 0x30) errorCode := div(errorCode, 10) let tenths := add(mod(errorCode, 10), 0x30) errorCode := div(errorCode, 10) let hundreds := add(mod(errorCode, 10), 0x30) // With the individual characters, we can now construct the full string. The "BAL#" part is a known constant // (0x42414c23): we simply shift this by 24 (to provide space for the 3 bytes of the error code), and add the // characters to it, each shifted by a multiple of 8. // The revert reason is then shifted left by 200 bits (256 minus the length of the string, 7 characters * 8 bits // per character = 56) to locate it in the most significant part of the 256 slot (the beginning of a byte // array). let revertReason := shl(200, add(0x42414c23000000, add(add(units, shl(8, tenths)), shl(16, hundreds)))) // We can now encode the reason in memory, which can be safely overwritten as we're about to revert. The encoded // message will have the following layout: // [ revert reason identifier ] [ string location offset ] [ string length ] [ string contents ] // The Solidity revert reason identifier is 0x08c739a0, the function selector of the Error(string) function. We // also write zeroes to the next 28 bytes of memory, but those are about to be overwritten. mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000) // Next is the offset to the location of the string, which will be placed immediately after (20 bytes away). mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) // The string length is fixed: 7 characters. mstore(0x24, 7) // Finally, the string itself is stored. mstore(0x44, revertReason) // Even if the string is only 7 bytes long, we need to return a full 32 byte slot containing it. The length of // the encoded message is therefore 4 + 32 + 32 + 32 = 100. revert(0, 100) } } library Errors { // Math uint256 internal constant ADD_OVERFLOW = 0; uint256 internal constant SUB_OVERFLOW = 1; uint256 internal constant SUB_UNDERFLOW = 2; uint256 internal constant MUL_OVERFLOW = 3; uint256 internal constant ZERO_DIVISION = 4; uint256 internal constant DIV_INTERNAL = 5; uint256 internal constant X_OUT_OF_BOUNDS = 6; uint256 internal constant Y_OUT_OF_BOUNDS = 7; uint256 internal constant PRODUCT_OUT_OF_BOUNDS = 8; uint256 internal constant INVALID_EXPONENT = 9; // Input uint256 internal constant OUT_OF_BOUNDS = 100; uint256 internal constant UNSORTED_ARRAY = 101; uint256 internal constant UNSORTED_TOKENS = 102; uint256 internal constant INPUT_LENGTH_MISMATCH = 103; uint256 internal constant ZERO_TOKEN = 104; // Shared pools uint256 internal constant MIN_TOKENS = 200; uint256 internal constant MAX_TOKENS = 201; uint256 internal constant MAX_SWAP_FEE_PERCENTAGE = 202; uint256 internal constant MIN_SWAP_FEE_PERCENTAGE = 203; uint256 internal constant MINIMUM_BPT = 204; uint256 internal constant CALLER_NOT_VAULT = 205; uint256 internal constant UNINITIALIZED = 206; uint256 internal constant BPT_IN_MAX_AMOUNT = 207; uint256 internal constant BPT_OUT_MIN_AMOUNT = 208; uint256 internal constant EXPIRED_PERMIT = 209; uint256 internal constant NOT_TWO_TOKENS = 210; // Pools uint256 internal constant MIN_AMP = 300; uint256 internal constant MAX_AMP = 301; uint256 internal constant MIN_WEIGHT = 302; uint256 internal constant MAX_STABLE_TOKENS = 303; uint256 internal constant MAX_IN_RATIO = 304; uint256 internal constant MAX_OUT_RATIO = 305; uint256 internal constant MIN_BPT_IN_FOR_TOKEN_OUT = 306; uint256 internal constant MAX_OUT_BPT_FOR_TOKEN_IN = 307; uint256 internal constant NORMALIZED_WEIGHT_INVARIANT = 308; uint256 internal constant INVALID_TOKEN = 309; uint256 internal constant UNHANDLED_JOIN_KIND = 310; uint256 internal constant ZERO_INVARIANT = 311; uint256 internal constant ORACLE_INVALID_SECONDS_QUERY = 312; uint256 internal constant ORACLE_NOT_INITIALIZED = 313; uint256 internal constant ORACLE_QUERY_TOO_OLD = 314; uint256 internal constant ORACLE_INVALID_INDEX = 315; uint256 internal constant ORACLE_BAD_SECS = 316; uint256 internal constant AMP_END_TIME_TOO_CLOSE = 317; uint256 internal constant AMP_ONGOING_UPDATE = 318; uint256 internal constant AMP_RATE_TOO_HIGH = 319; uint256 internal constant AMP_NO_ONGOING_UPDATE = 320; uint256 internal constant STABLE_INVARIANT_DIDNT_CONVERGE = 321; uint256 internal constant STABLE_GET_BALANCE_DIDNT_CONVERGE = 322; uint256 internal constant RELAYER_NOT_CONTRACT = 323; uint256 internal constant BASE_POOL_RELAYER_NOT_CALLED = 324; uint256 internal constant REBALANCING_RELAYER_REENTERED = 325; uint256 internal constant GRADUAL_UPDATE_TIME_TRAVEL = 326; uint256 internal constant SWAPS_DISABLED = 327; uint256 internal constant CALLER_IS_NOT_LBP_OWNER = 328; uint256 internal constant PRICE_RATE_OVERFLOW = 329; uint256 internal constant INVALID_JOIN_EXIT_KIND_WHILE_SWAPS_DISABLED = 330; uint256 internal constant WEIGHT_CHANGE_TOO_FAST = 331; uint256 internal constant LOWER_GREATER_THAN_UPPER_TARGET = 332; uint256 internal constant UPPER_TARGET_TOO_HIGH = 333; uint256 internal constant UNHANDLED_BY_LINEAR_POOL = 334; uint256 internal constant OUT_OF_TARGET_RANGE = 335; uint256 internal constant UNHANDLED_EXIT_KIND = 336; uint256 internal constant UNAUTHORIZED_EXIT = 337; uint256 internal constant MAX_MANAGEMENT_SWAP_FEE_PERCENTAGE = 338; uint256 internal constant UNHANDLED_BY_MANAGED_POOL = 339; uint256 internal constant UNHANDLED_BY_PHANTOM_POOL = 340; uint256 internal constant TOKEN_DOES_NOT_HAVE_RATE_PROVIDER = 341; uint256 internal constant INVALID_INITIALIZATION = 342; uint256 internal constant OUT_OF_NEW_TARGET_RANGE = 343; uint256 internal constant UNAUTHORIZED_OPERATION = 344; uint256 internal constant UNINITIALIZED_POOL_CONTROLLER = 345; // Lib uint256 internal constant REENTRANCY = 400; uint256 internal constant SENDER_NOT_ALLOWED = 401; uint256 internal constant PAUSED = 402; uint256 internal constant PAUSE_WINDOW_EXPIRED = 403; uint256 internal constant MAX_PAUSE_WINDOW_DURATION = 404; uint256 internal constant MAX_BUFFER_PERIOD_DURATION = 405; uint256 internal constant INSUFFICIENT_BALANCE = 406; uint256 internal constant INSUFFICIENT_ALLOWANCE = 407; uint256 internal constant ERC20_TRANSFER_FROM_ZERO_ADDRESS = 408; uint256 internal constant ERC20_TRANSFER_TO_ZERO_ADDRESS = 409; uint256 internal constant ERC20_MINT_TO_ZERO_ADDRESS = 410; uint256 internal constant ERC20_BURN_FROM_ZERO_ADDRESS = 411; uint256 internal constant ERC20_APPROVE_FROM_ZERO_ADDRESS = 412; uint256 internal constant ERC20_APPROVE_TO_ZERO_ADDRESS = 413; uint256 internal constant ERC20_TRANSFER_EXCEEDS_ALLOWANCE = 414; uint256 internal constant ERC20_DECREASED_ALLOWANCE_BELOW_ZERO = 415; uint256 internal constant ERC20_TRANSFER_EXCEEDS_BALANCE = 416; uint256 internal constant ERC20_BURN_EXCEEDS_ALLOWANCE = 417; uint256 internal constant SAFE_ERC20_CALL_FAILED = 418; uint256 internal constant ADDRESS_INSUFFICIENT_BALANCE = 419; uint256 internal constant ADDRESS_CANNOT_SEND_VALUE = 420; uint256 internal constant SAFE_CAST_VALUE_CANT_FIT_INT256 = 421; uint256 internal constant GRANT_SENDER_NOT_ADMIN = 422; uint256 internal constant REVOKE_SENDER_NOT_ADMIN = 423; uint256 internal constant RENOUNCE_SENDER_NOT_ALLOWED = 424; uint256 internal constant BUFFER_PERIOD_EXPIRED = 425; uint256 internal constant CALLER_IS_NOT_OWNER = 426; uint256 internal constant NEW_OWNER_IS_ZERO = 427; uint256 internal constant CODE_DEPLOYMENT_FAILED = 428; uint256 internal constant CALL_TO_NON_CONTRACT = 429; uint256 internal constant LOW_LEVEL_CALL_FAILED = 430; uint256 internal constant NOT_PAUSED = 431; uint256 internal constant ADDRESS_ALREADY_ALLOWLISTED = 432; uint256 internal constant ADDRESS_NOT_ALLOWLISTED = 433; // Vault uint256 internal constant INVALID_POOL_ID = 500; uint256 internal constant CALLER_NOT_POOL = 501; uint256 internal constant SENDER_NOT_ASSET_MANAGER = 502; uint256 internal constant USER_DOESNT_ALLOW_RELAYER = 503; uint256 internal constant INVALID_SIGNATURE = 504; uint256 internal constant EXIT_BELOW_MIN = 505; uint256 internal constant JOIN_ABOVE_MAX = 506; uint256 internal constant SWAP_LIMIT = 507; uint256 internal constant SWAP_DEADLINE = 508; uint256 internal constant CANNOT_SWAP_SAME_TOKEN = 509; uint256 internal constant UNKNOWN_AMOUNT_IN_FIRST_SWAP = 510; uint256 internal constant MALCONSTRUCTED_MULTIHOP_SWAP = 511; uint256 internal constant INTERNAL_BALANCE_OVERFLOW = 512; uint256 internal constant INSUFFICIENT_INTERNAL_BALANCE = 513; uint256 internal constant INVALID_ETH_INTERNAL_BALANCE = 514; uint256 internal constant INVALID_POST_LOAN_BALANCE = 515; uint256 internal constant INSUFFICIENT_ETH = 516; uint256 internal constant UNALLOCATED_ETH = 517; uint256 internal constant ETH_TRANSFER = 518; uint256 internal constant CANNOT_USE_ETH_SENTINEL = 519; uint256 internal constant TOKENS_MISMATCH = 520; uint256 internal constant TOKEN_NOT_REGISTERED = 521; uint256 internal constant TOKEN_ALREADY_REGISTERED = 522; uint256 internal constant TOKENS_ALREADY_SET = 523; uint256 internal constant TOKENS_LENGTH_MUST_BE_2 = 524; uint256 internal constant NONZERO_TOKEN_BALANCE = 525; uint256 internal constant BALANCE_TOTAL_OVERFLOW = 526; uint256 internal constant POOL_NO_TOKENS = 527; uint256 internal constant INSUFFICIENT_FLASH_LOAN_BALANCE = 528; // Fees uint256 internal constant SWAP_FEE_PERCENTAGE_TOO_HIGH = 600; uint256 internal constant FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH = 601; uint256 internal constant INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT = 602; }
/pkg/solidity-utils/contracts/helpers/InputHelpers.sol
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; import "../openzeppelin/IERC20.sol"; import "./BalancerErrors.sol"; library InputHelpers { function ensureInputLengthMatch(uint256 a, uint256 b) internal pure { _require(a == b, Errors.INPUT_LENGTH_MISMATCH); } function ensureInputLengthMatch( uint256 a, uint256 b, uint256 c ) internal pure { _require(a == b && b == c, Errors.INPUT_LENGTH_MISMATCH); } function ensureArrayIsSorted(IERC20[] memory array) internal pure { address[] memory addressArray; // solhint-disable-next-line no-inline-assembly assembly { addressArray := array } ensureArrayIsSorted(addressArray); } function ensureArrayIsSorted(address[] memory array) internal pure { if (array.length < 2) { return; } address previous = array[0]; for (uint256 i = 1; i < array.length; ++i) { address current = array[i]; _require(previous < current, Errors.UNSORTED_ARRAY); previous = current; } } }
/pkg/solidity-utils/contracts/openzeppelin/AccessControl.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../helpers/BalancerErrors.sol"; import "./EnumerableSet.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * 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 { using EnumerableSet for EnumerableSet.AddressSet; struct RoleData { EnumerableSet.AddressSet globalMembers; mapping(address => EnumerableSet.AddressSet) membersByContract; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; address public constant GLOBAL_ROLE_ADMIN = address(0); /** * @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` in an specific contract `where`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender, address where); /** * @dev Emitted when `account` is granted `role` across all contracts. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGrantedGlobally(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role` in an specific contract `where`. * * `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, address where); /** * @dev Emitted when `account` is revoked `role` across all contracts. * * `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 RoleRevokedGlobally(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role` either globally * or in specific `where` */ function hasRole(bytes32 role, address account, address where) public view virtual returns (bool) { return _roles[role].globalMembers.contains(account) || _roles[role].membersByContract[where].contains(account); } /** * @dev Returns the number of accounts that have `role` as global permission. Can be used * together with {getRoleGlobalMember} to enumerate all bearers of a role. */ function getRoleGlobalMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].globalMembers.length(); } /** * @dev Returns one of the accounts that have `role` across contracts. `index` must be a * value between 0 and {getRoleGlobalMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleGlobalMember} and {getRoleGlobalMemberCount}, 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 getRoleGlobalMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].globalMembers.at(index); } /** * @dev Returns the number of accounts that have `role` as global permission. Can be used * together with {getRoleGlobalMember} to enumerate all bearers of a role. */ function getRoleMemberCountByContract(bytes32 role, address where) public view returns (uint256) { return _roles[role].membersByContract[where].length(); } /** * @dev Returns one of the accounts that have `role` in contract `where`. `index` must be a * value between 0 and {getRoleMemberCountByContract}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMemberByContract} and {getRoleMemberCountByContract}, 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 getRoleMemberByContract(bytes32 role, uint256 index, address where) public view returns (address) { return _roles[role].membersByContract[where].at(index); } /** * @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 returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account` in specific contracts. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * - list of ``where``'s can't be empty */ function grantRole(bytes32 role, address account, address[] calldata where) public virtual { _require(where.length > 0, Errors.INPUT_LENGTH_MISMATCH); _require(hasRole(_roles[role].adminRole, msg.sender, GLOBAL_ROLE_ADMIN), Errors.GRANT_SENDER_NOT_ADMIN); for (uint256 i = 0; i < where.length; i++) { _grantRole(role, account, where[i]); } } /** * @dev Grants `role` to `account` in across all contracts. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRoleGlobally(bytes32 role, address account) public virtual { _require(hasRole(_roles[role].adminRole, msg.sender, GLOBAL_ROLE_ADMIN), Errors.GRANT_SENDER_NOT_ADMIN); _grantRoleGlobally(role, account); } /** * @dev Revokes `role` from `account` accross all. * * If `account` had already been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * - list of ``where``'s can't be empty */ function revokeRole(bytes32 role, address account, address[] calldata where) public virtual { _require(hasRole(_roles[role].adminRole, msg.sender, GLOBAL_ROLE_ADMIN), Errors.REVOKE_SENDER_NOT_ADMIN); _require(where.length > 0, Errors.INPUT_LENGTH_MISMATCH); _revokeRole(role, account, where); } /** * @dev Revokes `role` from `account` across all contracts. * * If `account` had already been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRoleGlobally(bytes32 role, address account) public virtual { _require(hasRole(_roles[role].adminRole, msg.sender, GLOBAL_ROLE_ADMIN), Errors.REVOKE_SENDER_NOT_ADMIN); _revokeRoleGlobally(role, account); } /** * @dev Revokes `role` from the calling account, for specific contracts. * * 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`. * - list of ``where``'s can't be empty */ function renounceRole(bytes32 role, address account,address[] calldata where) public virtual { _require(account == msg.sender, Errors.RENOUNCE_SENDER_NOT_ALLOWED); _revokeRole(role, account, where); } /** * @dev Revokes `role` from the calling account, for all contracts. * * 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 renounceRoleGlobally(bytes32 role, address account) public virtual { _require(account == msg.sender, Errors.RENOUNCE_SENDER_NOT_ALLOWED); _revokeRoleGlobally(role, account); } /** * @dev Grants `role` to `account`, globally for all contracts * * 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}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRoleGlobally(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account, address where) private { require(where != address(0), "Where can't be GLOBAL_ROLE_ADMIN"); if (_roles[role].membersByContract[where].add(account)) { emit RoleGranted(role, account, msg.sender, where); } } function _grantRoleGlobally(bytes32 role, address account) private { if (_roles[role].globalMembers.add(account)) { emit RoleGrantedGlobally(role, account, msg.sender); } } function _revokeRole(bytes32 role, address account, address[] calldata where) private { for (uint256 i = 0; i < where.length; i++) { if (_roles[role].membersByContract[where[i]].remove(account)) { emit RoleRevoked(role, account, msg.sender, where[i]); } } } function _revokeRoleGlobally(bytes32 role, address account) private { if (_roles[role].globalMembers.remove(account)) { emit RoleRevokedGlobally(role, account, msg.sender); } } }
/pkg/solidity-utils/contracts/openzeppelin/EnumerableSet.sol
// SPDX-License-Identifier: MIT // Based on the EnumerableSet library from OpenZeppelin Contracts, altered to remove the base private functions that // work on bytes32, replacing them with a native implementation for address and bytes32 values, to reduce bytecode // size and runtime costs. // The `unchecked_at` function was also added, which allows for more gas efficient data reads in some scenarios. pragma solidity ^0.7.0; import "../helpers/BalancerErrors.sol"; /** * @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 { // The original OpenZeppelin implementation uses a generic Set type with bytes32 values: this was replaced with // AddressSet, which uses address keys natively, resulting in more dense bytecode. struct AddressSet { // Storage of set values address[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(address => 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(AddressSet storage set, address value) internal 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(AddressSet storage set, address value) internal 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; // The swap is only necessary if we're not removing the last element if (toDeleteIndex != lastIndex) { address 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] = toDeleteIndex + 1; // All indexes are 1-based } // 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(AddressSet storage set, address value) internal view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function length(AddressSet storage set) internal 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(AddressSet storage set, uint256 index) internal view returns (address) { _require(set._values.length > index, Errors.OUT_OF_BOUNDS); return unchecked_at(set, index); } /** * @dev Same as {at}, except this doesn't revert if `index` it outside of the set (i.e. if it is equal or larger * than {length}). O(1). * * This function performs one less storage read than {at}, but should only be used when `index` is known to be * within bounds. */ function unchecked_at(AddressSet storage set, uint256 index) internal view returns (address) { return set._values[index]; } function rawIndexOf(AddressSet storage set, address value) internal view returns (uint256) { return set._indexes[value] - 1; } struct Bytes32Set { // 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(Bytes32Set storage set, bytes32 value) internal 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(Bytes32Set storage set, bytes32 value) internal 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; // The swap is only necessary if we're not removing the last element if (toDeleteIndex != lastIndex) { 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] = toDeleteIndex + 1; // All indexes are 1-based } // 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(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function length(Bytes32Set storage set) internal 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(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { _require(set._values.length > index, Errors.OUT_OF_BOUNDS); return unchecked_at(set, index); } /** * @dev Same as {at}, except this doesn't revert if `index` it outside of the set (i.e. if it is equal or larger * than {length}). O(1). * * This function performs one less storage read than {at}, but should only be used when `index` is known to be * within bounds. */ function unchecked_at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return set._values[index]; } function rawIndexOf(Bytes32Set storage set, bytes32 value) internal view returns (uint256) { return set._indexes[value] - 1; } }
/pkg/solidity-utils/contracts/openzeppelin/IERC20.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/pkg/vault/contracts/interfaces/IAuthorizer.sol
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; interface IAuthorizer { /** * @dev Returns true if `account` can perform the action described by `actionId` in the contract `where`. */ function canPerform( bytes32 actionId, address account, address where ) external view returns (bool); }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"admin","internalType":"address"}]},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"address","name":"where","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleGrantedGlobally","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"address","name":"where","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleRevokedGlobally","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"GLOBAL_ROLE_ADMIN","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"canPerform","inputs":[{"type":"bytes32","name":"actionId","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"where","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleGlobalMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleGlobalMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleMemberByContract","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"},{"type":"address","name":"where","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleMemberCountByContract","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"where","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"},{"type":"address[]","name":"where","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRoleGlobally","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRoles","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address","name":"account","internalType":"address"},{"type":"address[]","name":"where","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRolesGlobally","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRolesGloballyToMany","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address[]","name":"accounts","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRolesToMany","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address[]","name":"accounts","internalType":"address[]"},{"type":"address[]","name":"where","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"where","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"},{"type":"address[]","name":"where","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRoleGlobally","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"},{"type":"address[]","name":"where","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRoleGlobally","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRoles","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address","name":"account","internalType":"address"},{"type":"address[]","name":"where","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRolesFromMany","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address[]","name":"accounts","internalType":"address[]"},{"type":"address[]","name":"where","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRolesGlobally","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRolesGloballyFromMany","inputs":[{"type":"bytes32[]","name":"roles","internalType":"bytes32[]"},{"type":"address[]","name":"accounts","internalType":"address[]"}]}]
Contract Creation Code
0x60806040523480156200001157600080fd5b50604051620018a0380380620018a0833981810160405260208110156200003757600080fd5b5051620000466000826200004d565b506200014e565b6200005982826200005d565b5050565b6000828152602081815260409091206200008291839062001232620000c4821b17901c565b15620000595760405133906001600160a01b0383169084907f287e752593aea8255aeaa7ea93d3e06807273ef2426cde02d5572ee69f16e96990600090a45050565b6000620000d283836200012d565b6200012357508154600180820184556000848152602080822090930180546001600160a01b0319166001600160a01b0386169081179091558554908252828601909352604090209190915562000127565b5060005b92915050565b6001600160a01b031660009081526001919091016020526040902054151590565b611742806200015e6000396000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c80639aa167a2116100e3578063b5061e7a1161008c578063c7f0420311610066578063c7f0420314610be1578063cc4f673514610c0d578063cdb7e18714610d125761018d565b8063b5061e7a14610b04578063b52b585d14610b30578063b559c89d14610bb55761018d565b8063a217fddf116100bd578063a217fddf14610950578063a38ca39414610958578063abbb959214610a7f5761018d565b80639aa167a2146108f15780639be2a884146108f95780639dfea6a01461092d5761018d565b8063583b7497116101455780637bb6d8ac1161011f5780637bb6d8ac1461062c5780638f109636146107a457806393a4bfc4146107ec5761018d565b8063583b7497146104545780635b852f82146104d95780636d5848a3146105055761018d565b8063434a46c511610176578063434a46c51461020f57806343744f95146102bf57806350acdbd1146102dc5761018d565b806314f82b0d14610192578063248a9ca3146101e0575b600080fd5b6101c4600480360360608110156101a857600080fd5b50803590602081013590604001356001600160a01b0316610dc0565b604080516001600160a01b039092168252519081900360200190f35b6101fd600480360360208110156101f657600080fd5b5035610df5565b60408051918252519081900360200190f35b6102bd6004803603604081101561022557600080fd5b81019060208101813564010000000081111561024057600080fd5b82018360208201111561025257600080fd5b8035906020019184602083028401116401000000008311171561027457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b03169150610e0a9050565b005b6101fd600480360360208110156102d557600080fd5b5035610e40565b6102bd600480360360608110156102f257600080fd5b81019060208101813564010000000081111561030d57600080fd5b82018360208201111561031f57600080fd5b8035906020019184602083028401116401000000008311171561034157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561039157600080fd5b8201836020820111156103a357600080fd5b803590602001918460208302840111640100000000831117156103c557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561041557600080fd5b82018360208201111561042757600080fd5b8035906020019184602083028401116401000000008311171561044957600080fd5b509092509050610e5d565b6102bd6004803603606081101561046a57600080fd5b8135916001600160a01b036020820135169181019060608101604082013564010000000081111561049a57600080fd5b8201836020820111156104ac57600080fd5b803590602001918460208302840111640100000000831117156104ce57600080fd5b509092509050610eb6565b6102bd600480360360408110156104ef57600080fd5b50803590602001356001600160a01b0316610f28565b6102bd6004803603604081101561051b57600080fd5b81019060208101813564010000000081111561053657600080fd5b82018360208201111561054857600080fd5b8035906020019184602083028401116401000000008311171561056a57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156105ba57600080fd5b8201836020820111156105cc57600080fd5b803590602001918460208302840111640100000000831117156105ee57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610f62945050505050565b6102bd6004803603606081101561064257600080fd5b81019060208101813564010000000081111561065d57600080fd5b82018360208201111561066f57600080fd5b8035906020019184602083028401116401000000008311171561069157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156106e157600080fd5b8201836020820111156106f357600080fd5b8035906020019184602083028401116401000000008311171561071557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561076557600080fd5b82018360208201111561077757600080fd5b8035906020019184602083028401116401000000008311171561079957600080fd5b509092509050610fb2565b6107d8600480360360608110156107ba57600080fd5b508035906001600160a01b0360208201358116916040013516611004565b604080519115158252519081900360200190f35b6102bd6004803603606081101561080257600080fd5b81019060208101813564010000000081111561081d57600080fd5b82018360208201111561082f57600080fd5b8035906020019184602083028401116401000000008311171561085157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092956001600160a01b038535169590949093506040810192506020013590506401000000008111156108b257600080fd5b8201836020820111156108c457600080fd5b803590602001918460208302840111640100000000831117156108e657600080fd5b50909250905061104f565b6101c4611082565b6107d86004803603606081101561090f57600080fd5b508035906001600160a01b0360208201358116916040013516611087565b6101c46004803603604081101561094357600080fd5b5080359060200135611094565b6101fd611082565b6102bd6004803603604081101561096e57600080fd5b81019060208101813564010000000081111561098957600080fd5b82018360208201111561099b57600080fd5b803590602001918460208302840111640100000000831117156109bd57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050640100000000811115610a0d57600080fd5b820183602082011115610a1f57600080fd5b80359060200191846020830284011164010000000083111715610a4157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506110b3945050505050565b6102bd60048036036060811015610a9557600080fd5b8135916001600160a01b0360208201351691810190606081016040820135640100000000811115610ac557600080fd5b820183602082011115610ad757600080fd5b80359060200191846020830284011164010000000083111715610af957600080fd5b509092509050611103565b6102bd60048036036040811015610b1a57600080fd5b50803590602001356001600160a01b031661112c565b6102bd60048036036060811015610b4657600080fd5b8135916001600160a01b0360208201351691810190606081016040820135640100000000811115610b7657600080fd5b820183602082011115610b8857600080fd5b80359060200191846020830284011164010000000083111715610baa57600080fd5b50909250905061115a565b6101fd60048036036040811015610bcb57600080fd5b50803590602001356001600160a01b031661118b565b6102bd60048036036040811015610bf757600080fd5b50803590602001356001600160a01b03166111b7565b6102bd60048036036060811015610c2357600080fd5b810190602081018135640100000000811115610c3e57600080fd5b820183602082011115610c5057600080fd5b80359060200191846020830284011164010000000083111715610c7257600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092956001600160a01b03853516959094909350604081019250602001359050640100000000811115610cd357600080fd5b820183602082011115610ce557600080fd5b80359060200191846020830284011164010000000083111715610d0757600080fd5b5090925090506111ce565b6102bd60048036036040811015610d2857600080fd5b810190602081018135640100000000811115610d4357600080fd5b820183602082011115610d5557600080fd5b80359060200191846020830284011164010000000083111715610d7757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b031691506112019050565b6000838152602081815260408083206001600160a01b03851684526002019091528120610ded90846112a2565b949350505050565b60009081526020819052604090206003015490565b60005b8251811015610e3b57610e33838281518110610e2557fe5b602002602001015183610f28565b600101610e0d565b505050565b6000818152602081905260408120610e57906112be565b92915050565b610e69845184516112c2565b60005b8451811015610eaf57610ea7858281518110610e8457fe5b6020026020010151858381518110610e9857fe5b6020026020010151858561115a565b600101610e6c565b5050505050565b610ec381151560676112cb565b610eef610ee760008087815260200190815260200160002060030154336000611004565b6101a66112cb565b60005b81811015610eaf57610f208585858585818110610f0b57fe5b905060200201356001600160a01b03166112d9565b600101610ef2565b610f54610f4c60008085815260200190815260200160002060030154336000611004565b6101a76112cb565b610f5e82826113af565b5050565b610f6e825182516112c2565b60005b8251811015610e3b57610faa838281518110610f8957fe5b6020026020010151838381518110610f9d57fe5b602002602001015161112c565b600101610f71565b610fbe845184516112c2565b60005b8451811015610eaf57610ffc858281518110610fd957fe5b6020026020010151858381518110610fed57fe5b60200260200101518585610eb6565b600101610fc1565b600083815260208190526040812061101c9084611408565b80610ded57506000848152602081815260408083206001600160a01b03861684526002019091529020610ded9084611408565b60005b8451811015610eaf5761107a85828151811061106a57fe5b6020026020010151858585610eb6565b600101611052565b600081565b6000610ded848484611004565b60008281526020819052604081206110ac90836112a2565b9392505050565b6110bf825182516112c2565b60005b8251811015610e3b576110fb8382815181106110da57fe5b60200260200101518383815181106110ee57fe5b6020026020010151610f28565b6001016110c2565b61111a6001600160a01b03841633146101a86112cb565b61112684848484611429565b50505050565b611150610ee760008085815260200190815260200160002060030154336000611004565b610f5e828261150b565b61117e610f4c60008087815260200190815260200160002060030154336000611004565b61111a81151560676112cb565b6000828152602081815260408083206001600160a01b038516845260020190915281206110ac906112be565b610f546001600160a01b03821633146101a86112cb565b60005b8451811015610eaf576111f98582815181106111e957fe5b602002602001015185858561115a565b6001016111d1565b60005b8251811015610e3b5761122a83828151811061121c57fe5b60200260200101518361112c565b600101611204565b600061123e8383611408565b61129a575081546001808201845560008481526020808220909301805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915585549082528286019093526040902091909155610e57565b506000610e57565b81546000906112b490831060646112cb565b6110ac8383611564565b5490565b610f5e81831460675b81610f5e57610f5e81611591565b6001600160a01b038116611334576040805162461bcd60e51b815260206004820181905260248201527f57686572652063616e277420626520474c4f42414c5f524f4c455f41444d494e604482015290519081900360640190fd5b6000838152602081815260408083206001600160a01b038516845260020190915290206113619083611232565b15610e3b57604080516001600160a01b0383811682529151339285169186917fcaba87d53b293d545d69ab305284377793434c6fb5428e6244bfadcd434223709181900360200190a4505050565b60008281526020819052604090206113c790826115e4565b15610f5e5760405133906001600160a01b0383169084907fd8476cf9ac7354675e06297f0a3b1f57e056db7e4cefe100071b4ade0983641590600090a45050565b6001600160a01b031660009081526001919091016020526040902054151590565b60005b81811015610eaf5760008581526020819052604081206114969186916002019086868681811061145857fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b031681526020019081526020016000206115e490919063ffffffff16565b1561150357336001600160a01b038516867f473272920ac74dc08931f0d6687401dcb6dd700032e3935fc34aa5ab724595278686868181106114d457fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a45b60010161142c565b60008281526020819052604090206115239082611232565b15610f5e5760405133906001600160a01b0383169084907f287e752593aea8255aeaa7ea93d3e06807273ef2426cde02d5572ee69f16e96990600090a45050565b600082600001828154811061157557fe5b6000918252602090912001546001600160a01b03169392505050565b62461bcd60e51b6000908152602060045260076024526642414c23000030600a808404818106603090810160081b95839006959095019082900491820690940160101b939093010160c81b604452606490fd5b6001600160a01b03811660009081526001830160205260408120548015611702578354600019808301910180821461169d57600086600001828154811061162757fe5b60009182526020909120015487546001600160a01b039091169150819088908590811061165057fe5b6000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0394851617905592909116815260018881019092526040902090830190555b85548690806116a857fe5b600082815260208082208301600019908101805473ffffffffffffffffffffffffffffffffffffffff191690559092019092556001600160a01b0387168252600188810190915260408220919091559350610e5792505050565b6000915050610e5756fea264697066735822122097d2168b266b840d4b363c6fc56b961f8778c0af945754862728dccf511e71d864736f6c634300070300330000000000000000000000000dc437c879fada4ac7e5554b0f8f1ee78343c26b
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061018d5760003560e01c80639aa167a2116100e3578063b5061e7a1161008c578063c7f0420311610066578063c7f0420314610be1578063cc4f673514610c0d578063cdb7e18714610d125761018d565b8063b5061e7a14610b04578063b52b585d14610b30578063b559c89d14610bb55761018d565b8063a217fddf116100bd578063a217fddf14610950578063a38ca39414610958578063abbb959214610a7f5761018d565b80639aa167a2146108f15780639be2a884146108f95780639dfea6a01461092d5761018d565b8063583b7497116101455780637bb6d8ac1161011f5780637bb6d8ac1461062c5780638f109636146107a457806393a4bfc4146107ec5761018d565b8063583b7497146104545780635b852f82146104d95780636d5848a3146105055761018d565b8063434a46c511610176578063434a46c51461020f57806343744f95146102bf57806350acdbd1146102dc5761018d565b806314f82b0d14610192578063248a9ca3146101e0575b600080fd5b6101c4600480360360608110156101a857600080fd5b50803590602081013590604001356001600160a01b0316610dc0565b604080516001600160a01b039092168252519081900360200190f35b6101fd600480360360208110156101f657600080fd5b5035610df5565b60408051918252519081900360200190f35b6102bd6004803603604081101561022557600080fd5b81019060208101813564010000000081111561024057600080fd5b82018360208201111561025257600080fd5b8035906020019184602083028401116401000000008311171561027457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b03169150610e0a9050565b005b6101fd600480360360208110156102d557600080fd5b5035610e40565b6102bd600480360360608110156102f257600080fd5b81019060208101813564010000000081111561030d57600080fd5b82018360208201111561031f57600080fd5b8035906020019184602083028401116401000000008311171561034157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561039157600080fd5b8201836020820111156103a357600080fd5b803590602001918460208302840111640100000000831117156103c557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561041557600080fd5b82018360208201111561042757600080fd5b8035906020019184602083028401116401000000008311171561044957600080fd5b509092509050610e5d565b6102bd6004803603606081101561046a57600080fd5b8135916001600160a01b036020820135169181019060608101604082013564010000000081111561049a57600080fd5b8201836020820111156104ac57600080fd5b803590602001918460208302840111640100000000831117156104ce57600080fd5b509092509050610eb6565b6102bd600480360360408110156104ef57600080fd5b50803590602001356001600160a01b0316610f28565b6102bd6004803603604081101561051b57600080fd5b81019060208101813564010000000081111561053657600080fd5b82018360208201111561054857600080fd5b8035906020019184602083028401116401000000008311171561056a57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156105ba57600080fd5b8201836020820111156105cc57600080fd5b803590602001918460208302840111640100000000831117156105ee57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610f62945050505050565b6102bd6004803603606081101561064257600080fd5b81019060208101813564010000000081111561065d57600080fd5b82018360208201111561066f57600080fd5b8035906020019184602083028401116401000000008311171561069157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156106e157600080fd5b8201836020820111156106f357600080fd5b8035906020019184602083028401116401000000008311171561071557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561076557600080fd5b82018360208201111561077757600080fd5b8035906020019184602083028401116401000000008311171561079957600080fd5b509092509050610fb2565b6107d8600480360360608110156107ba57600080fd5b508035906001600160a01b0360208201358116916040013516611004565b604080519115158252519081900360200190f35b6102bd6004803603606081101561080257600080fd5b81019060208101813564010000000081111561081d57600080fd5b82018360208201111561082f57600080fd5b8035906020019184602083028401116401000000008311171561085157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092956001600160a01b038535169590949093506040810192506020013590506401000000008111156108b257600080fd5b8201836020820111156108c457600080fd5b803590602001918460208302840111640100000000831117156108e657600080fd5b50909250905061104f565b6101c4611082565b6107d86004803603606081101561090f57600080fd5b508035906001600160a01b0360208201358116916040013516611087565b6101c46004803603604081101561094357600080fd5b5080359060200135611094565b6101fd611082565b6102bd6004803603604081101561096e57600080fd5b81019060208101813564010000000081111561098957600080fd5b82018360208201111561099b57600080fd5b803590602001918460208302840111640100000000831117156109bd57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050640100000000811115610a0d57600080fd5b820183602082011115610a1f57600080fd5b80359060200191846020830284011164010000000083111715610a4157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506110b3945050505050565b6102bd60048036036060811015610a9557600080fd5b8135916001600160a01b0360208201351691810190606081016040820135640100000000811115610ac557600080fd5b820183602082011115610ad757600080fd5b80359060200191846020830284011164010000000083111715610af957600080fd5b509092509050611103565b6102bd60048036036040811015610b1a57600080fd5b50803590602001356001600160a01b031661112c565b6102bd60048036036060811015610b4657600080fd5b8135916001600160a01b0360208201351691810190606081016040820135640100000000811115610b7657600080fd5b820183602082011115610b8857600080fd5b80359060200191846020830284011164010000000083111715610baa57600080fd5b50909250905061115a565b6101fd60048036036040811015610bcb57600080fd5b50803590602001356001600160a01b031661118b565b6102bd60048036036040811015610bf757600080fd5b50803590602001356001600160a01b03166111b7565b6102bd60048036036060811015610c2357600080fd5b810190602081018135640100000000811115610c3e57600080fd5b820183602082011115610c5057600080fd5b80359060200191846020830284011164010000000083111715610c7257600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092956001600160a01b03853516959094909350604081019250602001359050640100000000811115610cd357600080fd5b820183602082011115610ce557600080fd5b80359060200191846020830284011164010000000083111715610d0757600080fd5b5090925090506111ce565b6102bd60048036036040811015610d2857600080fd5b810190602081018135640100000000811115610d4357600080fd5b820183602082011115610d5557600080fd5b80359060200191846020830284011164010000000083111715610d7757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b031691506112019050565b6000838152602081815260408083206001600160a01b03851684526002019091528120610ded90846112a2565b949350505050565b60009081526020819052604090206003015490565b60005b8251811015610e3b57610e33838281518110610e2557fe5b602002602001015183610f28565b600101610e0d565b505050565b6000818152602081905260408120610e57906112be565b92915050565b610e69845184516112c2565b60005b8451811015610eaf57610ea7858281518110610e8457fe5b6020026020010151858381518110610e9857fe5b6020026020010151858561115a565b600101610e6c565b5050505050565b610ec381151560676112cb565b610eef610ee760008087815260200190815260200160002060030154336000611004565b6101a66112cb565b60005b81811015610eaf57610f208585858585818110610f0b57fe5b905060200201356001600160a01b03166112d9565b600101610ef2565b610f54610f4c60008085815260200190815260200160002060030154336000611004565b6101a76112cb565b610f5e82826113af565b5050565b610f6e825182516112c2565b60005b8251811015610e3b57610faa838281518110610f8957fe5b6020026020010151838381518110610f9d57fe5b602002602001015161112c565b600101610f71565b610fbe845184516112c2565b60005b8451811015610eaf57610ffc858281518110610fd957fe5b6020026020010151858381518110610fed57fe5b60200260200101518585610eb6565b600101610fc1565b600083815260208190526040812061101c9084611408565b80610ded57506000848152602081815260408083206001600160a01b03861684526002019091529020610ded9084611408565b60005b8451811015610eaf5761107a85828151811061106a57fe5b6020026020010151858585610eb6565b600101611052565b600081565b6000610ded848484611004565b60008281526020819052604081206110ac90836112a2565b9392505050565b6110bf825182516112c2565b60005b8251811015610e3b576110fb8382815181106110da57fe5b60200260200101518383815181106110ee57fe5b6020026020010151610f28565b6001016110c2565b61111a6001600160a01b03841633146101a86112cb565b61112684848484611429565b50505050565b611150610ee760008085815260200190815260200160002060030154336000611004565b610f5e828261150b565b61117e610f4c60008087815260200190815260200160002060030154336000611004565b61111a81151560676112cb565b6000828152602081815260408083206001600160a01b038516845260020190915281206110ac906112be565b610f546001600160a01b03821633146101a86112cb565b60005b8451811015610eaf576111f98582815181106111e957fe5b602002602001015185858561115a565b6001016111d1565b60005b8251811015610e3b5761122a83828151811061121c57fe5b60200260200101518361112c565b600101611204565b600061123e8383611408565b61129a575081546001808201845560008481526020808220909301805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915585549082528286019093526040902091909155610e57565b506000610e57565b81546000906112b490831060646112cb565b6110ac8383611564565b5490565b610f5e81831460675b81610f5e57610f5e81611591565b6001600160a01b038116611334576040805162461bcd60e51b815260206004820181905260248201527f57686572652063616e277420626520474c4f42414c5f524f4c455f41444d494e604482015290519081900360640190fd5b6000838152602081815260408083206001600160a01b038516845260020190915290206113619083611232565b15610e3b57604080516001600160a01b0383811682529151339285169186917fcaba87d53b293d545d69ab305284377793434c6fb5428e6244bfadcd434223709181900360200190a4505050565b60008281526020819052604090206113c790826115e4565b15610f5e5760405133906001600160a01b0383169084907fd8476cf9ac7354675e06297f0a3b1f57e056db7e4cefe100071b4ade0983641590600090a45050565b6001600160a01b031660009081526001919091016020526040902054151590565b60005b81811015610eaf5760008581526020819052604081206114969186916002019086868681811061145857fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b031681526020019081526020016000206115e490919063ffffffff16565b1561150357336001600160a01b038516867f473272920ac74dc08931f0d6687401dcb6dd700032e3935fc34aa5ab724595278686868181106114d457fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a45b60010161142c565b60008281526020819052604090206115239082611232565b15610f5e5760405133906001600160a01b0383169084907f287e752593aea8255aeaa7ea93d3e06807273ef2426cde02d5572ee69f16e96990600090a45050565b600082600001828154811061157557fe5b6000918252602090912001546001600160a01b03169392505050565b62461bcd60e51b6000908152602060045260076024526642414c23000030600a808404818106603090810160081b95839006959095019082900491820690940160101b939093010160c81b604452606490fd5b6001600160a01b03811660009081526001830160205260408120548015611702578354600019808301910180821461169d57600086600001828154811061162757fe5b60009182526020909120015487546001600160a01b039091169150819088908590811061165057fe5b6000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0394851617905592909116815260018881019092526040902090830190555b85548690806116a857fe5b600082815260208082208301600019908101805473ffffffffffffffffffffffffffffffffffffffff191690559092019092556001600160a01b0387168252600188810190915260408220919091559350610e5792505050565b6000915050610e5756fea264697066735822122097d2168b266b840d4b363c6fc56b961f8778c0af945754862728dccf511e71d864736f6c63430007030033