Address Details
contract
0x7eBa7E2E9e55d718896A46bA957a90587954b160
- Contract Name
- Sway
- Creator
- 0x5394e0–a8d0d7 at 0x0493e3–6f43b9
- 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
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 12017553
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Sway
- Optimization enabled
- true
- Compiler version
- v0.8.4+commit.c7e474f2
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2023-02-06T13:47:34.223887Z
src/Sway.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "./SwayAdmin.sol"; contract Sway is Initializable, UUPSUpgradeable, ERC721EnumerableUpgradeable, SwayAdmin { using StringsUpgradeable for uint256; // used to generate new ids uint256 private lastId; // Base token URI string private _baseURIextendend; // Base token URI extension string private _baseURIExtension; // EventId for each token mapping(uint256 => uint256) public tokenEvent; // events event EventToken(uint256 eventId, uint256 tokenId); /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} function initialize( string memory __name, string memory __symbol, string memory __baseURI, string memory __baseURIExtension, address governor ) public initializer { _baseURIextendend = __baseURI; _baseURIExtension = __baseURIExtension; __SwayAdmin_init(governor); __ERC721_init_unchained(__name, __symbol); __ERC721Enumerable_init_unchained(); // UUPSUpgradeable __ERC1967Upgrade_init_unchained(); __UUPSUpgradeable_init_unchained(); } function _authorizeUpgrade(address) internal override onlyGovernor {} function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable) returns (bool) { return ERC721EnumerableUpgradeable.supportsInterface(interfaceId) || AccessControlEnumerableUpgradeable.supportsInterface(interfaceId); } function setBaseURI(string memory baseURI) public onlyGovernor whenNotPaused { _baseURIextendend = baseURI; } function setBaseURIExtension(string memory baseURIExtension) public onlyGovernor whenNotPaused { _baseURIExtension = baseURIExtension; } /** * @dev Gets the token ID at a given index of the tokens list of the requested owner * @param owner address owning the tokens list to be accessed * @param index uint256 representing the index to be accessed of the requested tokens list */ function tokenDetailsOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId, uint256 eventId) { tokenId = tokenOfOwnerByIndex(owner, index); eventId = tokenEvent[tokenId]; } /** * @dev Gets the token uri * @return string representing the token uri */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "Sway: URI query for nonexistent token"); uint256 eventId = tokenEvent[tokenId]; return string( abi.encodePacked( _baseURI(), eventId.toString(), "/", tokenId.toString(), _baseURIExtension ) ); } /** * @dev Function to mint tokens * @param eventId EventId for the new token * @param to The address that will receive the minted tokens. * @return A boolean that indicates if the operation was successful. */ function mintToken(uint256 eventId, address to) public whenNotPaused onlyEventMinter(eventId) returns (bool) { lastId += 1; return _mintToken(eventId, lastId, to); } /** * @dev Function to mint tokens with a specific id * @param eventId EventId for the new token * @param tokenId TokenId for the new token * @param to The address that will receive the minted tokens. * @return A boolean that indicates if the operation was successful. */ function mintToken( uint256 eventId, uint256 tokenId, address to ) public whenNotPaused onlyEventMinter(eventId) returns (bool) { return _mintToken(eventId, tokenId, to); } function burn(uint256 tokenId) public { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "Sway: caller is not owner nor approved" ); _burn(tokenId); } function _baseURI() internal view override returns (string memory) { return _baseURIextendend; } /** * @dev Internal function to burn a specific token * Reverts if the token does not exist * * @param tokenId uint256 ID of the token being burned by the msg.sender */ function _burn(uint256 tokenId) internal override { super._burn(tokenId); delete tokenEvent[tokenId]; } /** * @dev Function to mint tokens * @param eventId EventId for the new token * @param tokenId The token id to mint. * @param to The address that will receive the minted tokens. * @return A boolean that indicates if the operation was successful. */ function _mintToken( uint256 eventId, uint256 tokenId, address to ) internal returns (bool) { _mint(to, tokenId); tokenEvent[tokenId] = eventId; emit EventToken(eventId, tokenId); return true; } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721EnumerableUpgradeable) { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "Sway: token transfer while paused"); } uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).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) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {revokeRole} to track enumerable memberships */ function revokeRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {renounceRole} to track enumerable memberships */ function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.renounceRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {_setupRole} to track enumerable memberships */ function _setupRole(bytes32 role, address account) internal virtual override { super._setupRole(role, account); _roleMembers[role].add(account); } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } 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(IAccessControlUpgradeable).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 ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.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 granted `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}. * ==== */ 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); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @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); }
/_openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @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; }
/_openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal initializer { __ERC1967Upgrade_init_unchained(); } function __ERC1967Upgrade_init_unchained() internal initializer { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; _functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
/_openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal initializer { __ERC1967Upgrade_init_unchained(); __UUPSUpgradeable_init_unchained(); } function __UUPSUpgradeable_init_unchained() internal initializer { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal initializer { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal initializer { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} uint256[44] private __gap; }
/_openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
/_openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/_openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Enumerable_init_unchained(); } function __ERC721Enumerable_init_unchained() internal initializer { } // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721Upgradeable.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } uint256[46] private __gap; }
/_openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
/_openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 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); } } } }
/_openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
/_openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { 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); } }
/_openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT 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 IERC165Upgradeable { /** * @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); }
/_openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT 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 EnumerableSetUpgradeable { // 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; } }
/src/SwayAdmin.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; interface ISwayDrop { function addEvent(uint256 _eventId, bytes32 _roothash) external; } contract SwayAdmin is Initializable, AccessControlEnumerableUpgradeable, PausableUpgradeable { using StringsUpgradeable for uint256; bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE"); mapping(uint256 => bytes32) public eventRoleMapping; // Last event id (used to generate new ids) uint256 public lastEventId; // events event EventAdded( uint256 indexed eventId, address indexed minter, bytes32 indexed role ); event EventMinterAdded(uint256 indexed eventId, address indexed account); event EventMinterRemoved(uint256 indexed eventId, address indexed account); event GovernorAdded(address indexed account); event GovernorRemoved(address indexed account); function __SwayAdmin_init(address governor) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); // access control __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); // pausable __Pausable_init_unchained(); __SwayAdmin_init_unchained(governor); } function __SwayAdmin_init_unchained(address governor) internal initializer { _setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE); _setupRole(GOVERNOR_ROLE, governor); emit GovernorAdded(governor); } function _addEventMinter(uint256 eventId, address account) internal { require(eventRoleMapping[eventId] != bytes32(0), "SwayAdmin: eventId not found"); grantRole(eventRoleMapping[eventId], account); emit EventMinterAdded(eventId, account); } function _removeEventMinter(uint256 eventId, address account) internal { require(eventRoleMapping[eventId] != bytes32(0), "SwayAdmin: eventId not found"); renounceRole(eventRoleMapping[eventId], account); emit EventMinterRemoved(eventId, account); } function _addGovernor(address account) internal { grantRole(GOVERNOR_ROLE, account); emit GovernorAdded(account); } function _removeGovernor(address account) internal { renounceRole(GOVERNOR_ROLE, account); emit GovernorRemoved(account); } function _createEvent(address minter) internal { // increment the last id lastEventId += 1; // setup the event role bytes32 eventRole = keccak256(abi.encodePacked(lastEventId.toString())); _setRoleAdmin(eventRole, GOVERNOR_ROLE); // save the role identifier to mapping eventRoleMapping[lastEventId] = eventRole; emit EventAdded(lastEventId, minter, eventRole); // add initial minter _addEventMinter(lastEventId, minter); } /** * @dev called by the governor to pause, triggers stopped state */ function pause() public onlyGovernor whenNotPaused { _pause(); } /** * @dev called by the governor to unpause, returns to normal state */ function unpause() public onlyGovernor whenPaused { _unpause(); } function isGovernor(address _addr) public view returns (bool) { return hasRole(GOVERNOR_ROLE, _addr); } function isEventMinter(uint256 eventId, address _addr) public view returns (bool) { return hasRole(eventRoleMapping[eventId], _addr) || isGovernor(_addr); } modifier onlyGovernor() { require(isGovernor(msg.sender), "SwayAdmin: sender does not have Governor Role"); _; } modifier onlyEventMinter(uint256 eventId) { require( isEventMinter(eventId, msg.sender), "SwayAdmin: sender does not have Minter Role in Event" ); _; } function createEvent(address minter) public onlyGovernor { _createEvent(minter); } function addEventMinter(uint256 eventId, address account) public onlyGovernor { _addEventMinter(eventId, account); } function removeEventMinter(uint256 eventId, address account) public onlyGovernor { _removeEventMinter(eventId, account); } function addGovernor(address account) public onlyGovernor { _addGovernor(account); } function removeGovernor(address account) public onlyGovernor { _removeGovernor(account); } function addEventDrop( uint256 eventId, bytes32 rootHash, ISwayDrop drop ) public onlyGovernor { require( address(drop) != address(0), "SwayAdmin: drop address should not be zero" ); require(rootHash != bytes32(0), "SwayAdmin: rootHash is zero"); require(eventRoleMapping[eventId] != bytes32(0), "SwayAdmin: eventId not found"); // add event root hash in SwayDrop drop.addEvent(eventId, rootHash); // add SwayDrop as minter _addEventMinter(eventId, address(drop)); } uint256[50] private __gap; }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EventAdded","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256","indexed":true},{"type":"address","name":"minter","internalType":"address","indexed":true},{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"EventMinterAdded","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EventMinterRemoved","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EventToken","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256","indexed":false},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"GovernorAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"GovernorRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"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}],"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}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","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":"bytes32","name":"","internalType":"bytes32"}],"name":"GOVERNOR_ROLE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addEventDrop","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256"},{"type":"bytes32","name":"rootHash","internalType":"bytes32"},{"type":"address","name":"drop","internalType":"contract ISwayDrop"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addEventMinter","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addGovernor","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createEvent","inputs":[{"type":"address","name":"minter","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"eventRoleMapping","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"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":"getRoleMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","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":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"string","name":"__name","internalType":"string"},{"type":"string","name":"__symbol","internalType":"string"},{"type":"string","name":"__baseURI","internalType":"string"},{"type":"string","name":"__baseURIExtension","internalType":"string"},{"type":"address","name":"governor","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isEventMinter","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256"},{"type":"address","name":"_addr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isGovernor","inputs":[{"type":"address","name":"_addr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastEventId","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"mintToken","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"mintToken","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeEventMinter","inputs":[{"type":"uint256","name":"eventId","internalType":"uint256"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeGovernor","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","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":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseURI","inputs":[{"type":"string","name":"baseURI","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseURIExtension","inputs":[{"type":"string","name":"baseURIExtension","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"eventId","internalType":"uint256"}],"name":"tokenDetailsOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenEvent","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]}]
Contract Creation Code
0x60a06040523060601b6080523480156200001857600080fd5b50600054610100900460ff168062000033575060005460ff16155b6200009b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000be576000805461ffff19166101011790555b8015620000d1576000805461ff00191690555b5060805160601c613edc6200010660003960008181610d9401528181610dd401528181610fe901526110290152613edc6000f3fe6080604052600436106102935760003560e01c80635c975abb1161015a578063a22cb465116100c1578063d547741f1161007a578063d547741f14610807578063d890c8e214610827578063e43581b814610847578063e5458e2014610867578063e985e9c514610887578063eecdac88146108d057600080fd5b8063a22cb46514610737578063b2c50b1214610757578063b88d4fde14610785578063c87b56dd146107a5578063ca15c873146107c5578063ccc57490146107e557600080fd5b80639010d07c116101135780639010d07c1461068d57806391d14854146106ad57806395d89b41146106cd5780639cd3cad6146106e2578063a140ae2314610702578063a217fddf1461072257600080fd5b80635c975abb146105ca5780636352211e146105e357806367e971ce1461060357806370a0823114610638578063787b8d47146106585780638456cb591461067857600080fd5b80632f2ff15d116101fe57806342842e0e116101b757806342842e0e1461051757806342966c6814610537578063467de36c146105575780634f1ef286146105775780634f6ccce71461058a57806355f804b3146105aa57600080fd5b80632f2ff15d146104625780632f745c591461048257806336568abe146104a25780633659cfe6146104c25780633c4a25d0146104e25780633f4ba83a1461050257600080fd5b8063166c4b0511610250578063166c4b051461039c57806318160ddd146103bc57806323b872dd146103d1578063248a9ca3146103f157806328db38b4146104225780632e6400241461044257600080fd5b806301ffc9a714610298578063054e9507146102cd57806306fdde03146102f2578063081812fc14610314578063095ea7b31461034c578063127a52981461036e575b600080fd5b3480156102a457600080fd5b506102b86102b3366004613705565b6108f0565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e46101c45481565b6040519081526020016102c4565b3480156102fe57600080fd5b50610307610910565b6040516102c49190613a45565b34801561032057600080fd5b5061033461032f3660046136a8565b6109a2565b6040516001600160a01b0390911681526020016102c4565b34801561035857600080fd5b5061036c61036736600461367d565b610a3c565b005b34801561037a57600080fd5b506102e46103893660046136a8565b6101fa6020526000908152604090205481565b3480156103a857600080fd5b5061036c6103b73660046136c0565b610b52565b3480156103c857600080fd5b5060fd546102e4565b3480156103dd57600080fd5b5061036c6103ec366004613554565b610b85565b3480156103fd57600080fd5b506102e461040c3660046136a8565b600090815261012d602052604090206001015490565b34801561042e57600080fd5b506102b861043d3660046136c0565b610bb7565b34801561044e57600080fd5b5061036c61045d366004613770565b610be7565b34801561046e57600080fd5b5061036c61047d3660046136c0565b610cad565b34801561048e57600080fd5b506102e461049d36600461367d565b610cd0565b3480156104ae57600080fd5b5061036c6104bd3660046136c0565b610d66565b3480156104ce57600080fd5b5061036c6104dd366004613500565b610d89565b3480156104ee57600080fd5b5061036c6104fd366004613500565b610e52565b34801561050e57600080fd5b5061036c610e80565b34801561052357600080fd5b5061036c610532366004613554565b610ef9565b34801561054357600080fd5b5061036c6105523660046136a8565b610f14565b34801561056357600080fd5b5061036c61057236600461373d565b610f81565b61036c61058536600461362f565b610fde565b34801561059657600080fd5b506102e46105a53660046136a8565b611094565b3480156105b657600080fd5b5061036c6105c536600461373d565b611135565b3480156105d657600080fd5b506101915460ff166102b8565b3480156105ef57600080fd5b506103346105fe3660046136a8565b611192565b34801561060f57600080fd5b5061062361061e36600461367d565b611209565b604080519283526020830191909152016102c4565b34801561064457600080fd5b506102e4610653366004613500565b611231565b34801561066457600080fd5b5061036c610673366004613500565b6112b8565b34801561068457600080fd5b5061036c6112e6565b34801561069957600080fd5b506103346106a83660046136e4565b611337565b3480156106b957600080fd5b506102b86106c83660046136c0565b611350565b3480156106d957600080fd5b5061030761137c565b3480156106ee57600080fd5b5061036c6106fd3660046136c0565b61138b565b34801561070e57600080fd5b506102b861071d3660046136c0565b6113ba565b34801561072e57600080fd5b506102e4600081565b34801561074357600080fd5b5061036c6107523660046135fe565b61143e565b34801561076357600080fd5b506102e46107723660046136a8565b6101c36020526000908152604090205481565b34801561079157600080fd5b5061036c6107a0366004613594565b611503565b3480156107b157600080fd5b506103076107c03660046136a8565b61153b565b3480156107d157600080fd5b506102e46107e03660046136a8565b611607565b3480156107f157600080fd5b506102e4600080516020613e6083398151915281565b34801561081357600080fd5b5061036c6108223660046136c0565b61161f565b34801561083357600080fd5b506102b861084236600461382d565b611629565b34801561085357600080fd5b506102b8610862366004613500565b611690565b34801561087357600080fd5b5061036c61088236600461382d565b6116aa565b34801561089357600080fd5b506102b86108a236600461351c565b6001600160a01b03918216600090815260ce6020908152604080832093909416825291909152205460ff1690565b3480156108dc57600080fd5b5061036c6108eb366004613500565b61181c565b60006108fb8261184a565b8061090a575061090a8261186f565b92915050565b606060c9805461091f90613d88565b80601f016020809104026020016040519081016040528092919081815260200182805461094b90613d88565b80156109985780601f1061096d57610100808354040283529160200191610998565b820191906000526020600020905b81548152906001019060200180831161097b57829003601f168201915b5050505050905090565b600081815260cb60205260408120546001600160a01b0316610a205760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260cd60205260409020546001600160a01b031690565b6000610a4782611192565b9050806001600160a01b0316836001600160a01b03161415610ab55760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a17565b336001600160a01b0382161480610ad15750610ad181336108a2565b610b435760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a17565b610b4d8383611894565b505050565b610b5b33611690565b610b775760405162461bcd60e51b8152600401610a1790613c96565b610b818282611902565b5050565b610b90335b82611982565b610bac5760405162461bcd60e51b8152600401610a1790613c45565b610b4d838383611a75565b60008281526101c36020526040812054610bd19083611350565b80610be05750610be082611690565b9392505050565b600054610100900460ff1680610c00575060005460ff16155b610c1c5760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015610c3e576000805461ffff19166101011790555b8351610c52906101f89060208701906133e0565b508251610c67906101f99060208601906133e0565b50610c7182611c20565b610c7b8686611cbd565b610c83611d52565b610c8b611d52565b610c93611d52565b8015610ca5576000805461ff00191690555b505050505050565b610cb78282611dbd565b600082815261015f60205260409020610b4d9082611de4565b6000610cdb83611231565b8210610d3d5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610a17565b506001600160a01b0391909116600090815260fb60209081526040808320938352929052205490565b610d708282611df9565b600082815261015f60205260409020610b4d9082611e73565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610dd25760405162461bcd60e51b8152600401610a1790613afe565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610e04611e88565b6001600160a01b031614610e2a5760405162461bcd60e51b8152600401610a1790613b4a565b610e3381611eb6565b60408051600080825260208201909252610e4f91839190611edb565b50565b610e5b33611690565b610e775760405162461bcd60e51b8152600401610a1790613c96565b610e4f81612026565b610e8933611690565b610ea55760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff16610eef5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a17565b610ef7612075565b565b610b4d83838360405180602001604052806000815250611503565b610f1d33610b8a565b610f785760405162461bcd60e51b815260206004820152602660248201527f537761793a2063616c6c6572206973206e6f74206f776e6572206e6f722061706044820152651c1c9bdd995960d21b6064820152608401610a17565b610e4f8161210a565b610f8a33611690565b610fa65760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff1615610fca5760405162461bcd60e51b8152600401610a1790613bcd565b8051610b81906101f99060208401906133e0565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156110275760405162461bcd60e51b8152600401610a1790613afe565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611059611e88565b6001600160a01b03161461107f5760405162461bcd60e51b8152600401610a1790613b4a565b61108882611eb6565b610b8182826001611edb565b600061109f60fd5490565b82106111025760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a17565b60fd828154811061112357634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b61113e33611690565b61115a5760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff161561117e5760405162461bcd60e51b8152600401610a1790613bcd565b8051610b81906101f89060208401906133e0565b600081815260cb60205260408120546001600160a01b03168061090a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a17565b6000806112168484610cd0565b60008181526101fa6020526040902054909590945092505050565b60006001600160a01b03821661129c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a17565b506001600160a01b0316600090815260cc602052604090205490565b6112c133611690565b6112dd5760405162461bcd60e51b8152600401610a1790613c96565b610e4f81612125565b6112ef33611690565b61130b5760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff161561132f5760405162461bcd60e51b8152600401610a1790613bcd565b610ef76121ea565b600082815261015f60205260408120610be09083612244565b600091825261012d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060ca805461091f90613d88565b61139433611690565b6113b05760405162461bcd60e51b8152600401610a1790613c96565b610b818282612250565b60006113c96101915460ff1690565b156113e65760405162461bcd60e51b8152600401610a1790613bcd565b826113f18133610bb7565b61140d5760405162461bcd60e51b8152600401610a1790613a58565b60016101f760008282546114219190613ce3565b92505081905550611436846101f754856122d0565b949350505050565b6001600160a01b0382163314156114975760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a17565b33600081815260ce602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61150d3383611982565b6115295760405162461bcd60e51b8152600401610a1790613c45565b61153584848484612332565b50505050565b600081815260cb60205260409020546060906001600160a01b03166115b05760405162461bcd60e51b815260206004820152602560248201527f537761793a2055524920717565727920666f72206e6f6e6578697374656e74206044820152643a37b5b2b760d91b6064820152608401610a17565b60008281526101fa60205260409020546115c8612365565b6115d182612375565b6115da85612375565b6101f96040516020016115f094939291906138ad565b604051602081830303815290604052915050919050565b600081815261015f6020526040812061090a9061248f565b610d708282612499565b60006116386101915460ff1690565b156116555760405162461bcd60e51b8152600401610a1790613bcd565b836116608133610bb7565b61167c5760405162461bcd60e51b8152600401610a1790613a58565b6116878585856122d0565b95945050505050565b600061090a600080516020613e6083398151915283611350565b6116b333611690565b6116cf5760405162461bcd60e51b8152600401610a1790613c96565b6001600160a01b0381166117385760405162461bcd60e51b815260206004820152602a60248201527f5377617941646d696e3a2064726f7020616464726573732073686f756c64206e6044820152696f74206265207a65726f60b01b6064820152608401610a17565b816117855760405162461bcd60e51b815260206004820152601b60248201527f5377617941646d696e3a20726f6f7448617368206973207a65726f00000000006044820152606401610a17565b60008381526101c360205260409020546117b15760405162461bcd60e51b8152600401610a1790613b96565b6040516330dde7eb60e21b815260048101849052602481018390526001600160a01b0382169063c3779fac90604401600060405180830381600087803b1580156117fa57600080fd5b505af115801561180e573d6000803e3d6000fd5b50505050610b4d8382612250565b61182533611690565b6118415760405162461bcd60e51b8152600401610a1790613c96565b610e4f816124c0565b60006001600160e01b0319821663780e9d6360e01b148061090a575061090a8261250f565b60006001600160e01b03198216635a05180f60e01b148061090a575061090a8261255f565b600081815260cd6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118c982611192565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008281526101c3602052604090205461192e5760405162461bcd60e51b8152600401610a1790613b96565b60008281526101c360205260409020546119489082610d66565b6040516001600160a01b0382169083907fb6882c4d609d560f6d57e78e73dd96027f0d9852739b0b922537a6dd3c8e944c90600090a35050565b600081815260cb60205260408120546001600160a01b03166119fb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a17565b6000611a0683611192565b9050806001600160a01b0316846001600160a01b03161480611a415750836001600160a01b0316611a36846109a2565b6001600160a01b0316145b8061143657506001600160a01b03808216600090815260ce602090815260408083209388168352929052205460ff16611436565b826001600160a01b0316611a8882611192565b6001600160a01b031614611af05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610a17565b6001600160a01b038216611b525760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a17565b611b5d838383612584565b611b68600082611894565b6001600160a01b038316600090815260cc60205260408120805460019290611b91908490613d2e565b90915550506001600160a01b038216600090815260cc60205260408120805460019290611bbf908490613ce3565b9091555050600081815260cb602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600054610100900460ff1680611c39575060005460ff16155b611c555760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015611c77576000805461ffff19166101011790555b611c7f611d52565b611c87611d52565b611c8f611d52565b611c97611d52565b611c9f6125ed565b611ca882612663565b8015610b81576000805461ff00191690555050565b600054610100900460ff1680611cd6575060005460ff16155b611cf25760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015611d14576000805461ffff19166101011790555b8251611d279060c99060208601906133e0565b508151611d3b9060ca9060208501906133e0565b508015610b4d576000805461ff0019169055505050565b600054610100900460ff1680611d6b575060005460ff16155b611d875760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015611da9576000805461ffff19166101011790555b8015610e4f576000805461ff001916905550565b600082815261012d6020526040902060010154611dda8133612733565b610b4d8383612797565b6000610be0836001600160a01b03841661281e565b6001600160a01b0381163314611e695760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a17565b610b81828261286d565b6000610be0836001600160a01b0384166128d5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b611ebf33611690565b610e4f5760405162461bcd60e51b8152600401610a1790613c96565b6000611ee5611e88565b9050611ef0846129f2565b600083511180611efd5750815b15611f0e57611f0c8484612a97565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff1661201f57805460ff191660011781556040516001600160a01b0383166024820152611f8d90869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b179052612a97565b50805460ff19168155611f9e611e88565b6001600160a01b0316826001600160a01b0316146120165760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610a17565b61201f85612b79565b5050505050565b61203e600080516020613e6083398151915282610cad565b6040516001600160a01b038216907fdc5a48d79e2e147530ff63ecdbed5a5a66adb9d5cf339384d5d076da197c40b590600090a250565b6101915460ff166120bf5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a17565b610191805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61211381612bb9565b60009081526101fa6020526040812055565b60016101c460008282546121399190613ce3565b92505081905550600061214e6101c454612375565b60405160200161215e9190613891565b60405160208183030381529060405280519060200120905061218e81600080516020613e60833981519152612c60565b6101c4805460009081526101c360205260408082208490559154915183926001600160a01b0386169290917f613e137a89b79c7d1e214c39381dfac9f62e1f202a0e2e8c17d44d7d689cd8ea9190a4610b816101c45483612250565b6101915460ff161561220e5760405162461bcd60e51b8152600401610a1790613bcd565b610191805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120ed3390565b6000610be08383612cac565b60008281526101c3602052604090205461227c5760405162461bcd60e51b8152600401610a1790613b96565b60008281526101c360205260409020546122969082610cad565b6040516001600160a01b0382169083907fe1bd660d9f7c60e6fb12dd6479fdde12d21fc96385dc7b9b022c0b2f319e739190600090a35050565b60006122dc8284612ce4565b60008381526101fa602090815260409182902086905581518681529081018590527f4b3711cd7ece062b0828c1b6e08d814a72d4c003383a016c833cbb1b45956e34910160405180910390a15060019392505050565b61233d848484611a75565b61234984848484612e32565b6115355760405162461bcd60e51b8152600401610a1790613aac565b60606101f8805461091f90613d88565b6060816123995750506040805180820190915260018152600360fc1b602082015290565b8160005b81156123c357806123ad81613dc3565b91506123bc9050600a83613cfb565b915061239d565b60008167ffffffffffffffff8111156123ec57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612416576020820181803683370190505b5090505b84156114365761242b600183613d2e565b9150612438600a86613dde565b612443906030613ce3565b60f81b81838151811061246657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612488600a86613cfb565b945061241a565b600061090a825490565b600082815261012d60205260409020600101546124b68133612733565b610b4d838361286d565b6124d8600080516020613e6083398151915282610d66565b6040516001600160a01b038216907f1ebe834e73d60a5fec822c1e1727d34bc79f2ad977ed504581cc1822fe20fb5b90600090a250565b60006001600160e01b031982166380ac58cd60e01b148061254057506001600160e01b03198216635b5e139f60e01b145b8061090a57506301ffc9a760e01b6001600160e01b031983161461090a565b60006001600160e01b03198216637965db0b60e01b148061090a575061090a8261184a565b61258f838383612f3f565b6101915460ff1615610b4d5760405162461bcd60e51b815260206004820152602160248201527f537761793a20746f6b656e207472616e73666572207768696c652070617573656044820152601960fa1b6064820152608401610a17565b600054610100900460ff1680612606575060005460ff16155b6126225760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015612644576000805461ffff19166101011790555b610191805460ff191690558015610e4f576000805461ff001916905550565b600054610100900460ff168061267c575060005460ff16155b6126985760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff161580156126ba576000805461ffff19166101011790555b6126d2600080516020613e6083398151915280612c60565b6126ea600080516020613e6083398151915283612ff7565b6040516001600160a01b038316907fdc5a48d79e2e147530ff63ecdbed5a5a66adb9d5cf339384d5d076da197c40b590600090a28015610b81576000805461ff00191690555050565b61273d8282611350565b610b8157612755816001600160a01b03166014613001565b612760836020613001565b604051602001612771929190613993565b60408051601f198184030181529082905262461bcd60e51b8252610a1791600401613a45565b6127a18282611350565b610b8157600082815261012d602090815260408083206001600160a01b03851684529091529020805460ff191660011790556127da3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008181526001830160205260408120546128655750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561090a565b50600061090a565b6128778282611350565b15610b8157600082815261012d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600081815260018301602052604081205480156129e85760006128f9600183613d2e565b855490915060009061290d90600190613d2e565b905081811461298e57600086600001828154811061293b57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061296c57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b85548690806129ad57634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061090a565b600091505061090a565b803b612a565760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a17565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b612af65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610a17565b600080846001600160a01b031684604051612b119190613891565b600060405180830381855af49150503d8060008114612b4c576040519150601f19603f3d011682016040523d82523d6000602084013e612b51565b606091505b50915091506116878282604051806060016040528060278152602001613e80602791396131e3565b612b82816129f2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6000612bc482611192565b9050612bd281600084612584565b612bdd600083611894565b6001600160a01b038116600090815260cc60205260408120805460019290612c06908490613d2e565b9091555050600082815260cb602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600082815261012d6020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000826000018281548110612cd157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6001600160a01b038216612d3a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a17565b600081815260cb60205260409020546001600160a01b031615612d9f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a17565b612dab60008383612584565b6001600160a01b038216600090815260cc60205260408120805460019290612dd4908490613ce3565b9091555050600081815260cb602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15612f3457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612e76903390899088908890600401613a08565b602060405180830381600087803b158015612e9057600080fd5b505af1925050508015612ec0575060408051601f3d908101601f19168201909252612ebd91810190613721565b60015b612f1a573d808015612eee576040519150601f19603f3d011682016040523d82523d6000602084013e612ef3565b606091505b508051612f125760405162461bcd60e51b8152600401610a1790613aac565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611436565b506001949350505050565b6001600160a01b038316612f9a57612f958160fd8054600083815260fe60205260408120829055600182018355919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800155565b612fbd565b816001600160a01b0316836001600160a01b031614612fbd57612fbd838261321c565b6001600160a01b038216612fd457610b4d816132b9565b826001600160a01b0316826001600160a01b031614610b4d57610b4d8282613392565b610cb782826133d6565b60606000613010836002613d0f565b61301b906002613ce3565b67ffffffffffffffff81111561304157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561306b576020820181803683370190505b509050600360fc1b8160008151811061309457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106130d157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006130f5846002613d0f565b613100906001613ce3565b90505b6001811115613194576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061314257634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061316657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361318d81613d71565b9050613103565b508315610be05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a17565b606083156131f2575081610be0565b8251156132025782518084602001fd5b8160405162461bcd60e51b8152600401610a179190613a45565b6000600161322984611231565b6132339190613d2e565b600083815260fc6020526040902054909150808214613286576001600160a01b038416600090815260fb60209081526040808320858452825280832054848452818420819055835260fc90915290208190555b50600091825260fc602090815260408084208490556001600160a01b03909416835260fb81528383209183525290812055565b60fd546000906132cb90600190613d2e565b600083815260fe602052604081205460fd805493945090928490811061330157634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060fd838154811061333057634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260fe909152604080822084905585825281205560fd80548061337657634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061339d83611231565b6001600160a01b03909316600090815260fb60209081526040808320868452825280832085905593825260fc9052919091209190915550565b610b818282612797565b8280546133ec90613d88565b90600052602060002090601f01602090048101928261340e5760008555613454565b82601f1061342757805160ff1916838001178555613454565b82800160010185558215613454579182015b82811115613454578251825591602001919060010190613439565b50613460929150613464565b5090565b5b808211156134605760008155600101613465565b600082601f830112613489578081fd5b813567ffffffffffffffff808211156134a4576134a4613e1e565b604051601f8301601f19908116603f011681019082821181831017156134cc576134cc613e1e565b816040528381528660208588010111156134e4578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215613511578081fd5b8135610be081613e34565b6000806040838503121561352e578081fd5b823561353981613e34565b9150602083013561354981613e34565b809150509250929050565b600080600060608486031215613568578081fd5b833561357381613e34565b9250602084013561358381613e34565b929592945050506040919091013590565b600080600080608085870312156135a9578081fd5b84356135b481613e34565b935060208501356135c481613e34565b925060408501359150606085013567ffffffffffffffff8111156135e6578182fd5b6135f287828801613479565b91505092959194509250565b60008060408385031215613610578182fd5b823561361b81613e34565b915060208301358015158114613549578182fd5b60008060408385031215613641578182fd5b823561364c81613e34565b9150602083013567ffffffffffffffff811115613667578182fd5b61367385828601613479565b9150509250929050565b6000806040838503121561368f578182fd5b823561369a81613e34565b946020939093013593505050565b6000602082840312156136b9578081fd5b5035919050565b600080604083850312156136d2578182fd5b82359150602083013561354981613e34565b600080604083850312156136f6578182fd5b50508035926020909101359150565b600060208284031215613716578081fd5b8135610be081613e49565b600060208284031215613732578081fd5b8151610be081613e49565b60006020828403121561374e578081fd5b813567ffffffffffffffff811115613764578182fd5b61143684828501613479565b600080600080600060a08688031215613787578283fd5b853567ffffffffffffffff8082111561379e578485fd5b6137aa89838a01613479565b965060208801359150808211156137bf578485fd5b6137cb89838a01613479565b955060408801359150808211156137e0578485fd5b6137ec89838a01613479565b94506060880135915080821115613801578283fd5b5061380e88828901613479565b925050608086013561381f81613e34565b809150509295509295909350565b600080600060608486031215613841578081fd5b8335925060208401359150604084013561385a81613e34565b809150509250925092565b6000815180845261387d816020860160208601613d45565b601f01601f19169290920160200192915050565b600082516138a3818460208701613d45565b9190910192915050565b6000855160206138c08285838b01613d45565b8651918401916138d38184848b01613d45565b602f60f81b920191825285516001906138f181838601858b01613d45565b8654930192849080831c8382168061390a57607f821691505b85821081141561392857634e487b7160e01b88526022600452602488fd5b80801561393c576001811461395157613981565b60ff1984168887015282880186019450613981565b60008b815260209020895b848110156139775781548a820189015290870190880161395c565b5050858389010194505b50929c9b505050505050505050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516139cb816017850160208801613d45565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516139fc816028840160208801613d45565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613a3b90830184613865565b9695505050505050565b602081526000610be06020830184613865565b60208082526034908201527f5377617941646d696e3a2073656e64657220646f6573206e6f74206861766520604082015273135a5b9d195c88149bdb19481a5b88115d995b9d60621b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252601c908201527f5377617941646d696e3a206576656e744964206e6f7420666f756e6400000000604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602d908201527f5377617941646d696e3a2073656e64657220646f6573206e6f7420686176652060408201526c476f7665726e6f7220526f6c6560981b606082015260800190565b60008219821115613cf657613cf6613df2565b500190565b600082613d0a57613d0a613e08565b500490565b6000816000190483118215151615613d2957613d29613df2565b500290565b600082821015613d4057613d40613df2565b500390565b60005b83811015613d60578181015183820152602001613d48565b838111156115355750506000910152565b600081613d8057613d80613df2565b506000190190565b600181811c90821680613d9c57607f821691505b60208210811415613dbd57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613dd757613dd7613df2565b5060010190565b600082613ded57613ded613e08565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e4f57600080fd5b6001600160e01b031981168114610e4f57600080fdfe7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212200d478cc349040ab1ebe30ed8acb9a2e47476c76948c37da99993de29168ab01c64736f6c63430008040033
Deployed ByteCode
0x6080604052600436106102935760003560e01c80635c975abb1161015a578063a22cb465116100c1578063d547741f1161007a578063d547741f14610807578063d890c8e214610827578063e43581b814610847578063e5458e2014610867578063e985e9c514610887578063eecdac88146108d057600080fd5b8063a22cb46514610737578063b2c50b1214610757578063b88d4fde14610785578063c87b56dd146107a5578063ca15c873146107c5578063ccc57490146107e557600080fd5b80639010d07c116101135780639010d07c1461068d57806391d14854146106ad57806395d89b41146106cd5780639cd3cad6146106e2578063a140ae2314610702578063a217fddf1461072257600080fd5b80635c975abb146105ca5780636352211e146105e357806367e971ce1461060357806370a0823114610638578063787b8d47146106585780638456cb591461067857600080fd5b80632f2ff15d116101fe57806342842e0e116101b757806342842e0e1461051757806342966c6814610537578063467de36c146105575780634f1ef286146105775780634f6ccce71461058a57806355f804b3146105aa57600080fd5b80632f2ff15d146104625780632f745c591461048257806336568abe146104a25780633659cfe6146104c25780633c4a25d0146104e25780633f4ba83a1461050257600080fd5b8063166c4b0511610250578063166c4b051461039c57806318160ddd146103bc57806323b872dd146103d1578063248a9ca3146103f157806328db38b4146104225780632e6400241461044257600080fd5b806301ffc9a714610298578063054e9507146102cd57806306fdde03146102f2578063081812fc14610314578063095ea7b31461034c578063127a52981461036e575b600080fd5b3480156102a457600080fd5b506102b86102b3366004613705565b6108f0565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e46101c45481565b6040519081526020016102c4565b3480156102fe57600080fd5b50610307610910565b6040516102c49190613a45565b34801561032057600080fd5b5061033461032f3660046136a8565b6109a2565b6040516001600160a01b0390911681526020016102c4565b34801561035857600080fd5b5061036c61036736600461367d565b610a3c565b005b34801561037a57600080fd5b506102e46103893660046136a8565b6101fa6020526000908152604090205481565b3480156103a857600080fd5b5061036c6103b73660046136c0565b610b52565b3480156103c857600080fd5b5060fd546102e4565b3480156103dd57600080fd5b5061036c6103ec366004613554565b610b85565b3480156103fd57600080fd5b506102e461040c3660046136a8565b600090815261012d602052604090206001015490565b34801561042e57600080fd5b506102b861043d3660046136c0565b610bb7565b34801561044e57600080fd5b5061036c61045d366004613770565b610be7565b34801561046e57600080fd5b5061036c61047d3660046136c0565b610cad565b34801561048e57600080fd5b506102e461049d36600461367d565b610cd0565b3480156104ae57600080fd5b5061036c6104bd3660046136c0565b610d66565b3480156104ce57600080fd5b5061036c6104dd366004613500565b610d89565b3480156104ee57600080fd5b5061036c6104fd366004613500565b610e52565b34801561050e57600080fd5b5061036c610e80565b34801561052357600080fd5b5061036c610532366004613554565b610ef9565b34801561054357600080fd5b5061036c6105523660046136a8565b610f14565b34801561056357600080fd5b5061036c61057236600461373d565b610f81565b61036c61058536600461362f565b610fde565b34801561059657600080fd5b506102e46105a53660046136a8565b611094565b3480156105b657600080fd5b5061036c6105c536600461373d565b611135565b3480156105d657600080fd5b506101915460ff166102b8565b3480156105ef57600080fd5b506103346105fe3660046136a8565b611192565b34801561060f57600080fd5b5061062361061e36600461367d565b611209565b604080519283526020830191909152016102c4565b34801561064457600080fd5b506102e4610653366004613500565b611231565b34801561066457600080fd5b5061036c610673366004613500565b6112b8565b34801561068457600080fd5b5061036c6112e6565b34801561069957600080fd5b506103346106a83660046136e4565b611337565b3480156106b957600080fd5b506102b86106c83660046136c0565b611350565b3480156106d957600080fd5b5061030761137c565b3480156106ee57600080fd5b5061036c6106fd3660046136c0565b61138b565b34801561070e57600080fd5b506102b861071d3660046136c0565b6113ba565b34801561072e57600080fd5b506102e4600081565b34801561074357600080fd5b5061036c6107523660046135fe565b61143e565b34801561076357600080fd5b506102e46107723660046136a8565b6101c36020526000908152604090205481565b34801561079157600080fd5b5061036c6107a0366004613594565b611503565b3480156107b157600080fd5b506103076107c03660046136a8565b61153b565b3480156107d157600080fd5b506102e46107e03660046136a8565b611607565b3480156107f157600080fd5b506102e4600080516020613e6083398151915281565b34801561081357600080fd5b5061036c6108223660046136c0565b61161f565b34801561083357600080fd5b506102b861084236600461382d565b611629565b34801561085357600080fd5b506102b8610862366004613500565b611690565b34801561087357600080fd5b5061036c61088236600461382d565b6116aa565b34801561089357600080fd5b506102b86108a236600461351c565b6001600160a01b03918216600090815260ce6020908152604080832093909416825291909152205460ff1690565b3480156108dc57600080fd5b5061036c6108eb366004613500565b61181c565b60006108fb8261184a565b8061090a575061090a8261186f565b92915050565b606060c9805461091f90613d88565b80601f016020809104026020016040519081016040528092919081815260200182805461094b90613d88565b80156109985780601f1061096d57610100808354040283529160200191610998565b820191906000526020600020905b81548152906001019060200180831161097b57829003601f168201915b5050505050905090565b600081815260cb60205260408120546001600160a01b0316610a205760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260cd60205260409020546001600160a01b031690565b6000610a4782611192565b9050806001600160a01b0316836001600160a01b03161415610ab55760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a17565b336001600160a01b0382161480610ad15750610ad181336108a2565b610b435760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a17565b610b4d8383611894565b505050565b610b5b33611690565b610b775760405162461bcd60e51b8152600401610a1790613c96565b610b818282611902565b5050565b610b90335b82611982565b610bac5760405162461bcd60e51b8152600401610a1790613c45565b610b4d838383611a75565b60008281526101c36020526040812054610bd19083611350565b80610be05750610be082611690565b9392505050565b600054610100900460ff1680610c00575060005460ff16155b610c1c5760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015610c3e576000805461ffff19166101011790555b8351610c52906101f89060208701906133e0565b508251610c67906101f99060208601906133e0565b50610c7182611c20565b610c7b8686611cbd565b610c83611d52565b610c8b611d52565b610c93611d52565b8015610ca5576000805461ff00191690555b505050505050565b610cb78282611dbd565b600082815261015f60205260409020610b4d9082611de4565b6000610cdb83611231565b8210610d3d5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610a17565b506001600160a01b0391909116600090815260fb60209081526040808320938352929052205490565b610d708282611df9565b600082815261015f60205260409020610b4d9082611e73565b306001600160a01b037f0000000000000000000000007eba7e2e9e55d718896a46ba957a90587954b160161415610dd25760405162461bcd60e51b8152600401610a1790613afe565b7f0000000000000000000000007eba7e2e9e55d718896a46ba957a90587954b1606001600160a01b0316610e04611e88565b6001600160a01b031614610e2a5760405162461bcd60e51b8152600401610a1790613b4a565b610e3381611eb6565b60408051600080825260208201909252610e4f91839190611edb565b50565b610e5b33611690565b610e775760405162461bcd60e51b8152600401610a1790613c96565b610e4f81612026565b610e8933611690565b610ea55760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff16610eef5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a17565b610ef7612075565b565b610b4d83838360405180602001604052806000815250611503565b610f1d33610b8a565b610f785760405162461bcd60e51b815260206004820152602660248201527f537761793a2063616c6c6572206973206e6f74206f776e6572206e6f722061706044820152651c1c9bdd995960d21b6064820152608401610a17565b610e4f8161210a565b610f8a33611690565b610fa65760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff1615610fca5760405162461bcd60e51b8152600401610a1790613bcd565b8051610b81906101f99060208401906133e0565b306001600160a01b037f0000000000000000000000007eba7e2e9e55d718896a46ba957a90587954b1601614156110275760405162461bcd60e51b8152600401610a1790613afe565b7f0000000000000000000000007eba7e2e9e55d718896a46ba957a90587954b1606001600160a01b0316611059611e88565b6001600160a01b03161461107f5760405162461bcd60e51b8152600401610a1790613b4a565b61108882611eb6565b610b8182826001611edb565b600061109f60fd5490565b82106111025760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a17565b60fd828154811061112357634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b61113e33611690565b61115a5760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff161561117e5760405162461bcd60e51b8152600401610a1790613bcd565b8051610b81906101f89060208401906133e0565b600081815260cb60205260408120546001600160a01b03168061090a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a17565b6000806112168484610cd0565b60008181526101fa6020526040902054909590945092505050565b60006001600160a01b03821661129c5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a17565b506001600160a01b0316600090815260cc602052604090205490565b6112c133611690565b6112dd5760405162461bcd60e51b8152600401610a1790613c96565b610e4f81612125565b6112ef33611690565b61130b5760405162461bcd60e51b8152600401610a1790613c96565b6101915460ff161561132f5760405162461bcd60e51b8152600401610a1790613bcd565b610ef76121ea565b600082815261015f60205260408120610be09083612244565b600091825261012d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060ca805461091f90613d88565b61139433611690565b6113b05760405162461bcd60e51b8152600401610a1790613c96565b610b818282612250565b60006113c96101915460ff1690565b156113e65760405162461bcd60e51b8152600401610a1790613bcd565b826113f18133610bb7565b61140d5760405162461bcd60e51b8152600401610a1790613a58565b60016101f760008282546114219190613ce3565b92505081905550611436846101f754856122d0565b949350505050565b6001600160a01b0382163314156114975760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a17565b33600081815260ce602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61150d3383611982565b6115295760405162461bcd60e51b8152600401610a1790613c45565b61153584848484612332565b50505050565b600081815260cb60205260409020546060906001600160a01b03166115b05760405162461bcd60e51b815260206004820152602560248201527f537761793a2055524920717565727920666f72206e6f6e6578697374656e74206044820152643a37b5b2b760d91b6064820152608401610a17565b60008281526101fa60205260409020546115c8612365565b6115d182612375565b6115da85612375565b6101f96040516020016115f094939291906138ad565b604051602081830303815290604052915050919050565b600081815261015f6020526040812061090a9061248f565b610d708282612499565b60006116386101915460ff1690565b156116555760405162461bcd60e51b8152600401610a1790613bcd565b836116608133610bb7565b61167c5760405162461bcd60e51b8152600401610a1790613a58565b6116878585856122d0565b95945050505050565b600061090a600080516020613e6083398151915283611350565b6116b333611690565b6116cf5760405162461bcd60e51b8152600401610a1790613c96565b6001600160a01b0381166117385760405162461bcd60e51b815260206004820152602a60248201527f5377617941646d696e3a2064726f7020616464726573732073686f756c64206e6044820152696f74206265207a65726f60b01b6064820152608401610a17565b816117855760405162461bcd60e51b815260206004820152601b60248201527f5377617941646d696e3a20726f6f7448617368206973207a65726f00000000006044820152606401610a17565b60008381526101c360205260409020546117b15760405162461bcd60e51b8152600401610a1790613b96565b6040516330dde7eb60e21b815260048101849052602481018390526001600160a01b0382169063c3779fac90604401600060405180830381600087803b1580156117fa57600080fd5b505af115801561180e573d6000803e3d6000fd5b50505050610b4d8382612250565b61182533611690565b6118415760405162461bcd60e51b8152600401610a1790613c96565b610e4f816124c0565b60006001600160e01b0319821663780e9d6360e01b148061090a575061090a8261250f565b60006001600160e01b03198216635a05180f60e01b148061090a575061090a8261255f565b600081815260cd6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118c982611192565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008281526101c3602052604090205461192e5760405162461bcd60e51b8152600401610a1790613b96565b60008281526101c360205260409020546119489082610d66565b6040516001600160a01b0382169083907fb6882c4d609d560f6d57e78e73dd96027f0d9852739b0b922537a6dd3c8e944c90600090a35050565b600081815260cb60205260408120546001600160a01b03166119fb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a17565b6000611a0683611192565b9050806001600160a01b0316846001600160a01b03161480611a415750836001600160a01b0316611a36846109a2565b6001600160a01b0316145b8061143657506001600160a01b03808216600090815260ce602090815260408083209388168352929052205460ff16611436565b826001600160a01b0316611a8882611192565b6001600160a01b031614611af05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610a17565b6001600160a01b038216611b525760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a17565b611b5d838383612584565b611b68600082611894565b6001600160a01b038316600090815260cc60205260408120805460019290611b91908490613d2e565b90915550506001600160a01b038216600090815260cc60205260408120805460019290611bbf908490613ce3565b9091555050600081815260cb602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600054610100900460ff1680611c39575060005460ff16155b611c555760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015611c77576000805461ffff19166101011790555b611c7f611d52565b611c87611d52565b611c8f611d52565b611c97611d52565b611c9f6125ed565b611ca882612663565b8015610b81576000805461ff00191690555050565b600054610100900460ff1680611cd6575060005460ff16155b611cf25760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015611d14576000805461ffff19166101011790555b8251611d279060c99060208601906133e0565b508151611d3b9060ca9060208501906133e0565b508015610b4d576000805461ff0019169055505050565b600054610100900460ff1680611d6b575060005460ff16155b611d875760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015611da9576000805461ffff19166101011790555b8015610e4f576000805461ff001916905550565b600082815261012d6020526040902060010154611dda8133612733565b610b4d8383612797565b6000610be0836001600160a01b03841661281e565b6001600160a01b0381163314611e695760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610a17565b610b81828261286d565b6000610be0836001600160a01b0384166128d5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b611ebf33611690565b610e4f5760405162461bcd60e51b8152600401610a1790613c96565b6000611ee5611e88565b9050611ef0846129f2565b600083511180611efd5750815b15611f0e57611f0c8484612a97565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff1661201f57805460ff191660011781556040516001600160a01b0383166024820152611f8d90869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b179052612a97565b50805460ff19168155611f9e611e88565b6001600160a01b0316826001600160a01b0316146120165760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610a17565b61201f85612b79565b5050505050565b61203e600080516020613e6083398151915282610cad565b6040516001600160a01b038216907fdc5a48d79e2e147530ff63ecdbed5a5a66adb9d5cf339384d5d076da197c40b590600090a250565b6101915460ff166120bf5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a17565b610191805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61211381612bb9565b60009081526101fa6020526040812055565b60016101c460008282546121399190613ce3565b92505081905550600061214e6101c454612375565b60405160200161215e9190613891565b60405160208183030381529060405280519060200120905061218e81600080516020613e60833981519152612c60565b6101c4805460009081526101c360205260408082208490559154915183926001600160a01b0386169290917f613e137a89b79c7d1e214c39381dfac9f62e1f202a0e2e8c17d44d7d689cd8ea9190a4610b816101c45483612250565b6101915460ff161561220e5760405162461bcd60e51b8152600401610a1790613bcd565b610191805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120ed3390565b6000610be08383612cac565b60008281526101c3602052604090205461227c5760405162461bcd60e51b8152600401610a1790613b96565b60008281526101c360205260409020546122969082610cad565b6040516001600160a01b0382169083907fe1bd660d9f7c60e6fb12dd6479fdde12d21fc96385dc7b9b022c0b2f319e739190600090a35050565b60006122dc8284612ce4565b60008381526101fa602090815260409182902086905581518681529081018590527f4b3711cd7ece062b0828c1b6e08d814a72d4c003383a016c833cbb1b45956e34910160405180910390a15060019392505050565b61233d848484611a75565b61234984848484612e32565b6115355760405162461bcd60e51b8152600401610a1790613aac565b60606101f8805461091f90613d88565b6060816123995750506040805180820190915260018152600360fc1b602082015290565b8160005b81156123c357806123ad81613dc3565b91506123bc9050600a83613cfb565b915061239d565b60008167ffffffffffffffff8111156123ec57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612416576020820181803683370190505b5090505b84156114365761242b600183613d2e565b9150612438600a86613dde565b612443906030613ce3565b60f81b81838151811061246657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612488600a86613cfb565b945061241a565b600061090a825490565b600082815261012d60205260409020600101546124b68133612733565b610b4d838361286d565b6124d8600080516020613e6083398151915282610d66565b6040516001600160a01b038216907f1ebe834e73d60a5fec822c1e1727d34bc79f2ad977ed504581cc1822fe20fb5b90600090a250565b60006001600160e01b031982166380ac58cd60e01b148061254057506001600160e01b03198216635b5e139f60e01b145b8061090a57506301ffc9a760e01b6001600160e01b031983161461090a565b60006001600160e01b03198216637965db0b60e01b148061090a575061090a8261184a565b61258f838383612f3f565b6101915460ff1615610b4d5760405162461bcd60e51b815260206004820152602160248201527f537761793a20746f6b656e207472616e73666572207768696c652070617573656044820152601960fa1b6064820152608401610a17565b600054610100900460ff1680612606575060005460ff16155b6126225760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff16158015612644576000805461ffff19166101011790555b610191805460ff191690558015610e4f576000805461ff001916905550565b600054610100900460ff168061267c575060005460ff16155b6126985760405162461bcd60e51b8152600401610a1790613bf7565b600054610100900460ff161580156126ba576000805461ffff19166101011790555b6126d2600080516020613e6083398151915280612c60565b6126ea600080516020613e6083398151915283612ff7565b6040516001600160a01b038316907fdc5a48d79e2e147530ff63ecdbed5a5a66adb9d5cf339384d5d076da197c40b590600090a28015610b81576000805461ff00191690555050565b61273d8282611350565b610b8157612755816001600160a01b03166014613001565b612760836020613001565b604051602001612771929190613993565b60408051601f198184030181529082905262461bcd60e51b8252610a1791600401613a45565b6127a18282611350565b610b8157600082815261012d602090815260408083206001600160a01b03851684529091529020805460ff191660011790556127da3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008181526001830160205260408120546128655750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561090a565b50600061090a565b6128778282611350565b15610b8157600082815261012d602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600081815260018301602052604081205480156129e85760006128f9600183613d2e565b855490915060009061290d90600190613d2e565b905081811461298e57600086600001828154811061293b57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061296c57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b85548690806129ad57634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061090a565b600091505061090a565b803b612a565760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a17565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b612af65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610a17565b600080846001600160a01b031684604051612b119190613891565b600060405180830381855af49150503d8060008114612b4c576040519150601f19603f3d011682016040523d82523d6000602084013e612b51565b606091505b50915091506116878282604051806060016040528060278152602001613e80602791396131e3565b612b82816129f2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6000612bc482611192565b9050612bd281600084612584565b612bdd600083611894565b6001600160a01b038116600090815260cc60205260408120805460019290612c06908490613d2e565b9091555050600082815260cb602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600082815261012d6020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000826000018281548110612cd157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6001600160a01b038216612d3a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a17565b600081815260cb60205260409020546001600160a01b031615612d9f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a17565b612dab60008383612584565b6001600160a01b038216600090815260cc60205260408120805460019290612dd4908490613ce3565b9091555050600081815260cb602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15612f3457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612e76903390899088908890600401613a08565b602060405180830381600087803b158015612e9057600080fd5b505af1925050508015612ec0575060408051601f3d908101601f19168201909252612ebd91810190613721565b60015b612f1a573d808015612eee576040519150601f19603f3d011682016040523d82523d6000602084013e612ef3565b606091505b508051612f125760405162461bcd60e51b8152600401610a1790613aac565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611436565b506001949350505050565b6001600160a01b038316612f9a57612f958160fd8054600083815260fe60205260408120829055600182018355919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800155565b612fbd565b816001600160a01b0316836001600160a01b031614612fbd57612fbd838261321c565b6001600160a01b038216612fd457610b4d816132b9565b826001600160a01b0316826001600160a01b031614610b4d57610b4d8282613392565b610cb782826133d6565b60606000613010836002613d0f565b61301b906002613ce3565b67ffffffffffffffff81111561304157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561306b576020820181803683370190505b509050600360fc1b8160008151811061309457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106130d157634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006130f5846002613d0f565b613100906001613ce3565b90505b6001811115613194576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061314257634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061316657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361318d81613d71565b9050613103565b508315610be05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610a17565b606083156131f2575081610be0565b8251156132025782518084602001fd5b8160405162461bcd60e51b8152600401610a179190613a45565b6000600161322984611231565b6132339190613d2e565b600083815260fc6020526040902054909150808214613286576001600160a01b038416600090815260fb60209081526040808320858452825280832054848452818420819055835260fc90915290208190555b50600091825260fc602090815260408084208490556001600160a01b03909416835260fb81528383209183525290812055565b60fd546000906132cb90600190613d2e565b600083815260fe602052604081205460fd805493945090928490811061330157634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060fd838154811061333057634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260fe909152604080822084905585825281205560fd80548061337657634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061339d83611231565b6001600160a01b03909316600090815260fb60209081526040808320868452825280832085905593825260fc9052919091209190915550565b610b818282612797565b8280546133ec90613d88565b90600052602060002090601f01602090048101928261340e5760008555613454565b82601f1061342757805160ff1916838001178555613454565b82800160010185558215613454579182015b82811115613454578251825591602001919060010190613439565b50613460929150613464565b5090565b5b808211156134605760008155600101613465565b600082601f830112613489578081fd5b813567ffffffffffffffff808211156134a4576134a4613e1e565b604051601f8301601f19908116603f011681019082821181831017156134cc576134cc613e1e565b816040528381528660208588010111156134e4578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215613511578081fd5b8135610be081613e34565b6000806040838503121561352e578081fd5b823561353981613e34565b9150602083013561354981613e34565b809150509250929050565b600080600060608486031215613568578081fd5b833561357381613e34565b9250602084013561358381613e34565b929592945050506040919091013590565b600080600080608085870312156135a9578081fd5b84356135b481613e34565b935060208501356135c481613e34565b925060408501359150606085013567ffffffffffffffff8111156135e6578182fd5b6135f287828801613479565b91505092959194509250565b60008060408385031215613610578182fd5b823561361b81613e34565b915060208301358015158114613549578182fd5b60008060408385031215613641578182fd5b823561364c81613e34565b9150602083013567ffffffffffffffff811115613667578182fd5b61367385828601613479565b9150509250929050565b6000806040838503121561368f578182fd5b823561369a81613e34565b946020939093013593505050565b6000602082840312156136b9578081fd5b5035919050565b600080604083850312156136d2578182fd5b82359150602083013561354981613e34565b600080604083850312156136f6578182fd5b50508035926020909101359150565b600060208284031215613716578081fd5b8135610be081613e49565b600060208284031215613732578081fd5b8151610be081613e49565b60006020828403121561374e578081fd5b813567ffffffffffffffff811115613764578182fd5b61143684828501613479565b600080600080600060a08688031215613787578283fd5b853567ffffffffffffffff8082111561379e578485fd5b6137aa89838a01613479565b965060208801359150808211156137bf578485fd5b6137cb89838a01613479565b955060408801359150808211156137e0578485fd5b6137ec89838a01613479565b94506060880135915080821115613801578283fd5b5061380e88828901613479565b925050608086013561381f81613e34565b809150509295509295909350565b600080600060608486031215613841578081fd5b8335925060208401359150604084013561385a81613e34565b809150509250925092565b6000815180845261387d816020860160208601613d45565b601f01601f19169290920160200192915050565b600082516138a3818460208701613d45565b9190910192915050565b6000855160206138c08285838b01613d45565b8651918401916138d38184848b01613d45565b602f60f81b920191825285516001906138f181838601858b01613d45565b8654930192849080831c8382168061390a57607f821691505b85821081141561392857634e487b7160e01b88526022600452602488fd5b80801561393c576001811461395157613981565b60ff1984168887015282880186019450613981565b60008b815260209020895b848110156139775781548a820189015290870190880161395c565b5050858389010194505b50929c9b505050505050505050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516139cb816017850160208801613d45565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516139fc816028840160208801613d45565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613a3b90830184613865565b9695505050505050565b602081526000610be06020830184613865565b60208082526034908201527f5377617941646d696e3a2073656e64657220646f6573206e6f74206861766520604082015273135a5b9d195c88149bdb19481a5b88115d995b9d60621b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252601c908201527f5377617941646d696e3a206576656e744964206e6f7420666f756e6400000000604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602d908201527f5377617941646d696e3a2073656e64657220646f6573206e6f7420686176652060408201526c476f7665726e6f7220526f6c6560981b606082015260800190565b60008219821115613cf657613cf6613df2565b500190565b600082613d0a57613d0a613e08565b500490565b6000816000190483118215151615613d2957613d29613df2565b500290565b600082821015613d4057613d40613df2565b500390565b60005b83811015613d60578181015183820152602001613d48565b838111156115355750506000910152565b600081613d8057613d80613df2565b506000190190565b600181811c90821680613d9c57607f821691505b60208210811415613dbd57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613dd757613dd7613df2565b5060010190565b600082613ded57613ded613e08565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e4f57600080fd5b6001600160e01b031981168114610e4f57600080fdfe7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212200d478cc349040ab1ebe30ed8acb9a2e47476c76948c37da99993de29168ab01c64736f6c63430008040033