Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
HORNS
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "../lib/helpers/Errors.sol";
import "../operator-filter-registry/upgradeable/DefaultOperatorFiltererUpgradeable.sol";
contract HORNS is Initializable, ERC721PausableUpgradeable, ReentrancyGuardUpgradeable, OwnableUpgradeable, IERC2981Upgradeable, DefaultOperatorFiltererUpgradeable {
using SafeMathUpgradeable for uint256;
// @dev: supply for collection
uint256 constant _max = 1000;
uint256 constant _maxUser = 900;
// @dev: handler
address public _admin;
address public _paramsAddress;
string public _algorithm;
uint256 public _counter;
string public _uri;
// @dev: mint condition
// base on PLAYER nft
address public _tokenAddrErc721;
// base on fee
uint256 public _fee;
struct Horn {
string nation;
string palletTop;
string palletBottom;
}
uint256 public _limit;
function initialize(
string memory name,
string memory symbol,
address admin,
address paramsAddress
) initializer public {
require(admin != address(0) && paramsAddress != address(0), Errors.INV_ADD);
__ERC721_init(name, symbol);
_paramsAddress = paramsAddress;
_admin = admin;
_limit = _maxUser;
__Ownable_init();
__DefaultOperatorFilterer_init();
__ReentrancyGuard_init();
__ERC721Pausable_init();
}
function changeAdmin(address newAdm) external {
require(msg.sender == _admin && newAdm != address(0) && _admin != newAdm, Errors.ONLY_ADMIN_ALLOWED);
_admin = newAdm;
}
function changeParam(address newP) external {
require(msg.sender == _admin && newP != address(0) && _paramsAddress != newP, Errors.ONLY_ADMIN_ALLOWED);
_paramsAddress = newP;
}
function changeToken(address sweet) external {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
_tokenAddrErc721 = sweet;
}
function setAlgo(string memory algo) public {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
_algorithm = algo;
}
function setFee(uint256 fee) public {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
_fee = fee;
}
function setLimit(uint256 limit) public {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
_limit = limit;
}
function pause() external {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
_pause();
}
function unpause() external {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
_unpause();
}
function withdraw() external nonReentrant {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
(bool success,) = msg.sender.call{value : address(this).balance}("");
require(success);
}
function seeding(uint256 id, string memory trait) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(trait, StringsUpgradeable.toString(id))));
}
/* @TRAITS: Get data for render
*/
function getNation(uint256 id) internal view returns (string memory) {
// 3% for each
string[32] memory _nations = [
"Qatar", "Ecuador", "Senegal", "Netherlands", // GA
"England", "IR Iran", "USA", "Wales", // GB
"Argentina", "Saudi Arabia", "Mexico", "Poland", // GC
"France", "Australia", "Denmark", "Tunisia", //GD
"Spain", "Costa Rica", "Germany", "Japan", //GE
"Belgium", "Canada", "Morocco", "Croatia", //GF
"Brazil", "Serbia", "Switzerland", "Cameroon", //GG
"Portugal", "Ghana", "Uruguay", "Korea Republic" // GH
];
return _nations[seeding(id, "nation") % _nations.length];
}
function getPaletteBottom(uint256 id) public view returns (string memory) {
string[35] memory colors = [
'#00A5E3', '#8DD7BF', '#FF96C5', '#FF5768', '#FFBF65',
'#FC6238', '#FFD872', '#F2D4CC', '#E77577', '#6C88C4',
'#C05780', '#FF828B', '#E7C582', '#00B0BA', '#0065A2',
'#00CDAC', '#FF6F68', '#FFDACC', '#FF60A8', '#CFF800',
'#FF5C77', '#4DD091', '#FFEC59', '#FFA23A', '#74737A',
'#FFF100', '#FF8C00', '#E81123', '#EC008C', '#68217A',
'#00188F', '#00BCF2', '#00B294', '#009E49', '#BAD80A'
];
return colors[seeding(id, "palletBottom") % colors.length];
}
function getPaletteTop(uint256 id) public view returns (string memory) {
string[25] memory colors = [
'#ABDEE6', '#CBAACB', '#FFFFB5', '#FFCCB6', '#F3B0C3',
'#C6DBDA', '#FEE1E8', '#FED7C3', '#F6EAC2', '#ECD5E3',
'#FF968A', '#FFAEA5', '#FFC5BF', '#FFD8BE', '#FFC8A2',
'#D4F0F0', '#8FCACA', '#CCE2CB', '#B6CFB6', '#97C1A9',
'#FCB9AA', '#FFDBCC', '#ECEAE4', '#A2E1DB', '#55CBCD'
];
return colors[seeding(id, "palletTop") % colors.length];
}
function getParamValues(uint256 tokenId) public view returns (Horn memory horn) {
horn = Horn(
getNation(tokenId),
getPaletteTop(tokenId),
getPaletteBottom(tokenId)
);
return horn;
}
/* @URI: control uri
*/
function _baseURI() internal view override returns (string memory) {
return _uri;
}
function changeBaseURI(string memory baseURI) public {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
_uri = baseURI;
}
/* @MINT mint nft
*/
function mintByToken(uint256 tokenIdGated) public {
require(_tokenAddrErc721 != address(0) && _limit > 0, Errors.INV_ADD);
// owner erc-721
IERC721Upgradeable token = IERC721Upgradeable(_tokenAddrErc721);
require(token.ownerOf(tokenIdGated) == msg.sender);
require(_counter < _maxUser && _counter < _limit);
_counter++;
_safeMint(msg.sender, _counter);
}
function mint() public payable {
require(_fee > 0 && msg.value >= _fee && _limit > 0, Errors.INV_FEE_PROJECT);
require(_counter < _maxUser && _counter < _limit);
_counter++;
_safeMint(msg.sender, _counter);
}
function ownerMint(uint256 id) public {
require(msg.sender == _admin, Errors.ONLY_ADMIN_ALLOWED);
require(id > _maxUser && id <= _max);
_safeMint(msg.sender, id);
}
/** @dev EIP2981 royalties implementation. */
// EIP2981 standard royalties return.
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view override
returns (address receiver, uint256 royaltyAmount)
{
receiver = _admin;
royaltyAmount = (_salePrice * 500) / 10000;
}
/* @notice: opensea operator filter registry
*/
function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
public
override
onlyAllowedOperator(from)
{
super.safeTransferFrom(from, to, tokenId, data);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
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 onlyInitializing {
}
function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
}
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 virtual 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 virtual override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)
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 onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
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);
_;
}
/**
* @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 virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @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 virtual {
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 virtual 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.
*
* May emit a {RoleGranted} event.
*/
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.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
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.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
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;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981Upgradeable is IERC165Upgradeable {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @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 proxied contracts do not make use of 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.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* 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.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
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 onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
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());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)
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 onlyInitializing {
__ERC721_init_unchained(name_, symbol_);
}
function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_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: address zero is not a valid owner");
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: invalid token ID");
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) {
_requireMinted(tokenId);
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 overridden 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 token owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_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: caller is not token 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: caller is not token 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) {
address owner = ERC721Upgradeable.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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);
_afterTokenTransfer(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);
_afterTokenTransfer(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 from incorrect owner");
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);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @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 {
/// @solidity memory-safe-assembly
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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[44] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC721Upgradeable.sol";
import "../../../utils/ContextUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @title ERC721 Burnable Token
* @dev ERC721 Token that can be burned (destroyed).
*/
abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
function __ERC721Burnable_init() internal onlyInitializing {
}
function __ERC721Burnable_init_unchained() internal onlyInitializing {
}
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
_burn(tokenId);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
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 onlyInitializing {
}
function __ERC721Enumerable_init_unchained() internal onlyInitializing {
}
// 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();
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[46] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)
pragma solidity ^0.8.0;
import "../ERC721Upgradeable.sol";
import "../../../security/PausableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev ERC721 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract ERC721PausableUpgradeable is Initializable, ERC721Upgradeable, PausableUpgradeable {
function __ERC721Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __ERC721Pausable_init_unchained() internal onlyInitializing {
}
/**
* @dev See {ERC721-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
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);
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
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 `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
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`.
*
* 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;
/**
* @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 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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol)
pragma solidity ^0.8.0;
import "../ERC721Upgradeable.sol";
import "../extensions/ERC721EnumerableUpgradeable.sol";
import "../extensions/ERC721BurnableUpgradeable.sol";
import "../extensions/ERC721PausableUpgradeable.sol";
import "../../../access/AccessControlEnumerableUpgradeable.sol";
import "../../../utils/ContextUpgradeable.sol";
import "../../../utils/CountersUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev {ERC721} token, including:
*
* - ability for holders to burn (destroy) their tokens
* - a minter role that allows for token minting (creation)
* - a pauser role that allows to stop all token transfers
* - token ID and URI autogeneration
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
*
* The account that deploys the contract will be granted the minter and pauser
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to other accounts.
*
* _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
*/
contract ERC721PresetMinterPauserAutoIdUpgradeable is
Initializable, ContextUpgradeable,
AccessControlEnumerableUpgradeable,
ERC721EnumerableUpgradeable,
ERC721BurnableUpgradeable,
ERC721PausableUpgradeable
{
function initialize(
string memory name,
string memory symbol,
string memory baseTokenURI
) public virtual initializer {
__ERC721PresetMinterPauserAutoId_init(name, symbol, baseTokenURI);
}
using CountersUpgradeable for CountersUpgradeable.Counter;
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
CountersUpgradeable.Counter private _tokenIdTracker;
string private _baseTokenURI;
/**
* @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the
* account that deploys the contract.
*
* Token URIs will be autogenerated based on `baseURI` and their token IDs.
* See {ERC721-tokenURI}.
*/
function __ERC721PresetMinterPauserAutoId_init(
string memory name,
string memory symbol,
string memory baseTokenURI
) internal onlyInitializing {
__ERC721_init_unchained(name, symbol);
__Pausable_init_unchained();
__ERC721PresetMinterPauserAutoId_init_unchained(name, symbol, baseTokenURI);
}
function __ERC721PresetMinterPauserAutoId_init_unchained(
string memory,
string memory,
string memory baseTokenURI
) internal onlyInitializing {
_baseTokenURI = baseTokenURI;
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
/**
* @dev Creates a new token for `to`. Its token ID will be automatically
* assigned (and available on the emitted {IERC721-Transfer} event), and the token
* URI autogenerated based on the base URI passed at construction.
*
* See {ERC721-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(address to) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint");
// We cannot just use balanceOf to create the new tokenId because tokens
// can be burned (destroyed), so we need a separate counter.
_mint(to, _tokenIdTracker.current());
_tokenIdTracker.increment();
}
/**
* @dev Pauses all token transfers.
*
* See {ERC721Pausable} and {Pausable-_pause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
_pause();
}
/**
* @dev Unpauses all token transfers.
*
* See {ERC721Pausable} and {Pausable-_unpause}.
*
* Requirements:
*
* - the caller must have the `PAUSER_ROLE`.
*/
function unpause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to unpause");
_unpause();
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721Upgradeable, ERC721EnumerableUpgradeable, ERC721PausableUpgradeable) {
super._beforeTokenTransfer(from, to, tokenId);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(AccessControlEnumerableUpgradeable, ERC721Upgradeable, ERC721EnumerableUpgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[48] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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 onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library CountersUpgradeable {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
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 onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface 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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMathUpgradeable {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @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);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
* ====
*/
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;
/// @solidity memory-safe-assembly
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;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
library Errors {
enum ReturnCode {
SUCCESS,
FAILED
}
string public constant SUCCESS = "0";
// common errors
string public constant INV_ADD = "100";
string public constant ONLY_ADMIN_ALLOWED = "101";
string public constant ONLY_CREATOR = "102";
// validation error
string public constant MISSING_NAME = "200";
string public constant INV_FEE_PROJECT = "201";
string public constant INV_PROJECT = "202";
string public constant REACH_MAX = "203";
string public constant INV_PARAMS = "204";
string public constant SEED_INV = "205";
string public constant SEED_INV_1 = "206";
string public constant SEED_INV_2 = "207";
string public constant INV_BOILERPLATE_ADD = "208";
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IOperatorFilterRegistry {
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
function register(address registrant) external;
function registerAndSubscribe(address registrant, address subscription) external;
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
function unregister(address addr) external;
function updateOperator(address registrant, address operator, bool filtered) external;
function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
function subscribe(address registrant, address registrantToSubscribe) external;
function unsubscribe(address registrant, bool copyExistingEntries) external;
function subscriptionOf(address addr) external returns (address registrant);
function subscribers(address registrant) external returns (address[] memory);
function subscriberAt(address registrant, uint256 index) external returns (address);
function copyEntriesOf(address registrant, address registrantToCopy) external;
function isOperatorFiltered(address registrant, address operator) external returns (bool);
function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
function filteredOperators(address addr) external returns (address[] memory);
function filteredCodeHashes(address addr) external returns (bytes32[] memory);
function filteredOperatorAt(address registrant, uint256 index) external returns (address);
function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
function isRegistered(address addr) external returns (bool);
function codeHashOf(address addr) external returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {OperatorFiltererUpgradeable} from "./OperatorFiltererUpgradeable.sol";
abstract contract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {
address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
function __DefaultOperatorFilterer_init() internal onlyInitializing {
OperatorFiltererUpgradeable.__OperatorFilterer_init(DEFAULT_SUBSCRIPTION, true);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IOperatorFilterRegistry} from "../IOperatorFilterRegistry.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
abstract contract OperatorFiltererUpgradeable is Initializable {
error OperatorNotAllowed(address operator);
IOperatorFilterRegistry constant operatorFilterRegistry =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe)
internal
onlyInitializing
{
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(operatorFilterRegistry).code.length > 0) {
if (!operatorFilterRegistry.isRegistered(address(this))) {
if (subscribe) {
operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
operatorFilterRegistry.register(address(this));
}
}
}
}
}
modifier onlyAllowedOperator(address from) virtual {
// Check registry code length to facilitate testing in environments without a deployed registry.
if (address(operatorFilterRegistry).code.length > 0) {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from == msg.sender) {
_;
return;
}
if (
!(
operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)
&& operatorFilterRegistry.isOperatorAllowed(address(this), from)
)
) {
revert OperatorNotAllowed(msg.sender);
}
}
_;
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"_admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_algorithm","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_counter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_limit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_paramsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_tokenAddrErc721","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdm","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"changeBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newP","type":"address"}],"name":"changeParam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sweet","type":"address"}],"name":"changeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPaletteBottom","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getPaletteTop","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getParamValues","outputs":[{"components":[{"internalType":"string","name":"nation","type":"string"},{"internalType":"string","name":"palletTop","type":"string"},{"internalType":"string","name":"palletBottom","type":"string"}],"internalType":"struct HORNS.Horn","name":"horn","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"paramsAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenIdGated","type":"uint256"}],"name":"mintByToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"algo","type":"string"}],"name":"setAlgo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50613be0806100206000396000f3fe60806040526004361061025c5760003560e01c806370a0823111610144578063a22cb465116100b6578063c87b56dd1161007a578063c87b56dd146106ee578063df2fb92c1461070e578063e653c65014610725578063e985e9c514610746578063f19e75d41461078f578063f2fde38b146107af57600080fd5b8063a22cb46514610649578063adfc7dae14610669578063b88d4fde1461068a578063c0dca239146106aa578063c5b37c22146106d757600080fd5b80638456cb59116101085780638456cb59146105ab5780638da5cb5b146105c05780638f15b414146105df5780638f283970146105ff57806395d89b411461061f578063a1bb1fcc1461063457600080fd5b806370a0823114610511578063715018a61461053f578063741149b1146105545780637cd49fde1461057457806380d953dd1461058b57600080fd5b80632a55205a116101dd5780635c975abb116101a15780635c975abb146104595780635d36b3ea146104715780636352211e1461049157806366829b16146104b157806369fe0e2d146104d15780636a2c3995146104f157600080fd5b80632a55205a146103b057806339a0c6f9146103ef5780633ccfd60b1461040f5780633f4ba83a1461042457806342842e0e1461043957600080fd5b8063095ea7b311610224578063095ea7b3146103335780630dccc9ad146103535780631249c58b1461036857806323b872dd1461037057806327ea6f2b1461039057600080fd5b806301bc45c91461026157806301ffc9a71461029f57806306fdde03146102cf5780630764da1d146102f1578063081812fc14610313575b600080fd5b34801561026d57600080fd5b5061015f54610282906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102ab57600080fd5b506102bf6102ba3660046134b2565b6107cf565b6040519015158152602001610296565b3480156102db57600080fd5b506102e4610821565b6040516102969190613527565b3480156102fd57600080fd5b5061031161030c3660046135e6565b6108b3565b005b34801561031f57600080fd5b5061028261032e36600461361b565b61091c565b34801561033f57600080fd5b5061031161034e366004613649565b610943565b34801561035f57600080fd5b506102e4610a59565b610311610ae8565b34801561037c57600080fd5b5061031161038b366004613675565b610b8f565b34801561039c57600080fd5b506103116103ab36600461361b565b610ce5565b3480156103bc57600080fd5b506103d06103cb3660046136b6565b610d33565b604080516001600160a01b039093168352602083019190915201610296565b3480156103fb57600080fd5b5061031161040a3660046135e6565b610d64565b34801561041b57600080fd5b50610311610dc0565b34801561043057600080fd5b50610311610ebd565b34801561044557600080fd5b50610311610454366004613675565b610f0d565b34801561046557600080fd5b5060975460ff166102bf565b34801561047d57600080fd5b506102e461048c36600461361b565b611058565b34801561049d57600080fd5b506102826104ac36600461361b565b6113c2565b3480156104bd57600080fd5b506103116104cc3660046136d8565b611422565b3480156104dd57600080fd5b506103116104ec36600461361b565b61148d565b3480156104fd57600080fd5b506102e461050c36600461361b565b6114db565b34801561051d57600080fd5b5061053161052c3660046136d8565b611972565b604051908152602001610296565b34801561054b57600080fd5b506103116119f8565b34801561056057600080fd5b5061031161056f3660046136d8565b611a0a565b34801561058057600080fd5b506105316101625481565b34801561059757600080fd5b506103116105a636600461361b565b611aa6565b3480156105b757600080fd5b50610311611bc9565b3480156105cc57600080fd5b5061012d546001600160a01b0316610282565b3480156105eb57600080fd5b506103116105fa3660046136f5565b611c19565b34801561060b57600080fd5b5061031161061a3660046136d8565b611de4565b34801561062b57600080fd5b506102e4611e80565b34801561064057600080fd5b506102e4611e8f565b34801561065557600080fd5b5061031161066436600461378c565b611e9d565b34801561067557600080fd5b5061016054610282906001600160a01b031681565b34801561069657600080fd5b506103116106a53660046137c5565b611ea8565b3480156106b657600080fd5b506106ca6106c536600461361b565b611ffa565b6040516102969190613845565b3480156106e357600080fd5b506105316101655481565b3480156106fa57600080fd5b506102e461070936600461361b565b612056565b34801561071a57600080fd5b506105316101665481565b34801561073157600080fd5b5061016454610282906001600160a01b031681565b34801561075257600080fd5b506102bf6107613660046138a6565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561079b57600080fd5b506103116107aa36600461361b565b6120bd565b3480156107bb57600080fd5b506103116107ca3660046136d8565b61212e565b60006001600160e01b031982166380ac58cd60e01b148061080057506001600160e01b03198216635b5e139f60e01b145b8061081b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060658054610830906138d4565b80601f016020809104026020016040519081016040528092919081815260200182805461085c906138d4565b80156108a95780601f1061087e576101008083540402835291602001916108a9565b820191906000526020600020905b81548152906001019060200180831161088c57829003601f168201915b5050505050905090565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146109035760405162461bcd60e51b81526004016108fa9190613527565b60405180910390fd5b50805161091890610161906020840190613403565b5050565b6000610927826121a4565b506000908152606960205260409020546001600160a01b031690565b600061094e826113c2565b9050806001600160a01b0316836001600160a01b031614156109bc5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108fa565b336001600160a01b03821614806109d857506109d88133610761565b610a4a5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016108fa565b610a548383612203565b505050565b6101638054610a67906138d4565b80601f0160208091040260200160405190810160405280929190818152602001828054610a93906138d4565b8015610ae05780601f10610ab557610100808354040283529160200191610ae0565b820191906000526020600020905b815481529060010190602001808311610ac357829003601f168201915b505050505081565b600061016554118015610afe5750610165543410155b8015610b0d5750600061016654115b6040518060400160405280600381526020016232303160e81b81525090610b475760405162461bcd60e51b81526004016108fa9190613527565b5061038461016254108015610b6157506101665461016254105b610b6a57600080fd5b6101628054906000610b7b83613925565b9190505550610b8d3361016254612271565b565b826daaeb6d7670e522a718067333cd4e3b15610cd4576001600160a01b038116331415610bc657610bc184848461228b565b610cdf565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610bf99030903390600401613940565b602060405180830381865afa158015610c16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3a919061395a565b8015610cb55750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610c749030908590600401613940565b602060405180830381865afa158015610c91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb5919061395a565b610cd457604051633b79c77360e21b81523360048201526024016108fa565b610cdf84848461228b565b50505050565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610d2c5760405162461bcd60e51b81526004016108fa9190613527565b5061016655565b61015f546001600160a01b03166000612710610d51846101f4613977565b610d5b91906139ac565b90509250929050565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610dab5760405162461bcd60e51b81526004016108fa9190613527565b50805161091890610163906020840190613403565b600260fb541415610e135760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108fa565b600260fb5561015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610e5f5760405162461bcd60e51b81526004016108fa9190613527565b50604051600090339047908381818185875af1925050503d8060008114610ea2576040519150601f19603f3d011682016040523d82523d6000602084013e610ea7565b606091505b5050905080610eb557600080fd5b50600160fb55565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610f045760405162461bcd60e51b81526004016108fa9190613527565b50610b8d6122bc565b826daaeb6d7670e522a718067333cd4e3b1561104d576001600160a01b038116331415610f3f57610bc184848461230e565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610f729030903390600401613940565b602060405180830381865afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb3919061395a565b801561102e5750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610fed9030908590600401613940565b602060405180830381865afa15801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e919061395a565b61104d57604051633b79c77360e21b81523360048201526024016108fa565b610cdf84848461230e565b6040805161036081018252600761032082018181526611a0a12222a29b60c91b6103408401528252825180840184528181526611a1a120a0a1a160c91b6020828101919091528084019190915283518085018552828152662346464646423560c81b8183015283850152835180850185528281526611a32321a1a11b60c91b8183015260608481019190915284518086018652838152662346334230433360c81b81840152608085015284518086018652838152662343364442444160c81b8184015260a085015284518086018652838152660468c8a8a628a760cb1b8184015260c085015284518086018652838152662346454437433360c81b8184015260e0850152845180860186528381526611a31b22a0a19960c91b8184015261010085015284518086018652838152662345434435453360c81b8184015261012085015284518086018652838152662346463936384160c81b8184015261014085015284518086018652838152662346464145413560c81b81840152610160850152845180860186528381526611a323219aa12360c91b8184015261018085015284518086018652838152662346464438424560c81b818401526101a0850152845180860186528381526611a323219c209960c91b818401526101c085015284518086018652838152660234434463046360cc1b818401526101e085015284518086018652838152662338464341434160c81b81840152610200850152845180860186528381526611a1a1a29921a160c91b81840152610220850152845180860186528381526611a11b21a3211b60c91b8184015261024085015284518086018652838152662339374331413960c81b8184015261026085015284518086018652838152662346434239414160c81b8184015261028085015284518086018652838152662346464442434360c81b818401526102a0850152845180860186528381526608d150d150514d60ca1b818401526102c0850152845180860186528381526611a0992298a22160c91b818401526102e0850152845180860186529283526608cd4d50d090d160ca1b8383015261030084019290925283518085019094526009845268070616c6c6574546f760bc1b9084015291819060199061139c908690612329565b6113a691906139c0565b601981106113b6576113b66139d4565b60200201519392505050565b6000818152606760205260408120546001600160a01b03168061081b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108fa565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146114695760405162461bcd60e51b81526004016108fa9190613527565b5061016480546001600160a01b0319166001600160a01b0392909216919091179055565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146114d45760405162461bcd60e51b81526004016108fa9190613527565b5061016555565b604080516104a08101825260076104608201818152662330304135453360c81b61048084015282528251808401845281815266119c22221ba12360c91b6020828101919091528084019190915283518085018552828152662346463936433560c81b818301528385015283518085018552828152660468c8c6a6e6c760cb1b8183015260608481019190915284518086018652838152662346464246363560c81b81840152608085015284518086018652838152660468c866c6466760cb1b8184015260a0850152845180860186528381526611a323221c1b9960c91b8184015260c085015284518086018652838152662346324434434360c81b8184015260e085015284518086018652838152662345373735373760c81b81840152610100850152845180860186528381526608cd90ce0e10cd60ca1b8184015261012085015284518086018652838152660234330353738360cc1b81840152610140850152845180860186528381526611a3231c191c2160c91b81840152610160850152845180860186528381526611a29ba19a9c1960c91b8184015261018085015284518086018652838152662330304230424160c81b818401526101a085015284518086018652838152661198181b1aa09960c91b818401526101c085015284518086018652838152662330304344414360c81b818401526101e085015284518086018652838152660468c8c6c8c6c760cb1b8184015261020085015284518086018652838152662346464441434360c81b8184015261022085015284518086018652838152660468c8c6c6082760cb1b8184015261024085015284518086018652838152660234346463830360cc1b8184015261026085015284518086018652838152662346463543373760c81b8184015261028085015284518086018652838152662334444430393160c81b818401526102a085015284518086018652838152662346464543353960c81b818401526102c085015284518086018652838152662346464132334160c81b818401526102e085015284518086018652838152662337343733374160c81b8184015261030085015284518086018652838152660234646463130360cc1b8184015261032085015284518086018652838152660234646384330360cc1b8184015261034085015284518086018652838152662345383131323360c81b8184015261036085015284518086018652838152662345433030384360c81b8184015261038085015284518086018652838152662336383231374160c81b818401526103a08501528451808601865283815266119818189c1c2360c91b818401526103c085015284518086018652838152661198182121a31960c91b818401526103e0850152845180860186528381526608cc0c108c8e4d60ca1b8184015261040085015284518086018652838152662330303945343960c81b8184015261042085015284518086018652928352662342414438304160c81b838301526104408401929092528351808501909452600c84526b70616c6c6574426f74746f6d60a01b90840152918190602390611958908690612329565b61196291906139c0565b602381106113b6576113b66139d4565b60006001600160a01b0382166119dc5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016108fa565b506001600160a01b031660009081526068602052604090205490565b611a00612365565b610b8d60006123c0565b61015f546001600160a01b031633148015611a2d57506001600160a01b03811615155b8015611a485750610160546001600160a01b03828116911614155b6040518060400160405280600381526020016231303160e81b81525090611a825760405162461bcd60e51b81526004016108fa9190613527565b5061016080546001600160a01b0319166001600160a01b0392909216919091179055565b610164546001600160a01b031615801590611ac45750600061016654115b6040518060400160405280600381526020016203130360ec1b81525090611afe5760405162461bcd60e51b81526004016108fa9190613527565b50610164546040516331a9108f60e11b8152600481018390526001600160a01b039091169033908290636352211e90602401602060405180830381865afa158015611b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7191906139ea565b6001600160a01b031614611b8457600080fd5b61038461016254108015611b9d57506101665461016254105b611ba657600080fd5b6101628054906000611bb783613925565b91905055506109183361016254612271565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314611c105760405162461bcd60e51b81526004016108fa9190613527565b50610b8d612413565b600054610100900460ff1615808015611c395750600054600160ff909116105b80611c535750303b158015611c53575060005460ff166001145b611cb65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108fa565b6000805460ff191660011790558015611cd9576000805461ff0019166101001790555b6001600160a01b03831615801590611cf957506001600160a01b03821615155b6040518060400160405280600381526020016203130360ec1b81525090611d335760405162461bcd60e51b81526004016108fa9190613527565b50611d3e8585612450565b61016080546001600160a01b038085166001600160a01b03199283161790925561015f80549286169290911691909117905561038461016655611d7f612481565b611d876124b0565b611d8f6124f6565b611d97612525565b8015611ddd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b61015f546001600160a01b031633148015611e0757506001600160a01b03811615155b8015611e22575061015f546001600160a01b03828116911614155b6040518060400160405280600381526020016231303160e81b81525090611e5c5760405162461bcd60e51b81526004016108fa9190613527565b5061015f80546001600160a01b0319166001600160a01b0392909216919091179055565b606060668054610830906138d4565b6101618054610a67906138d4565b610918338383612554565b836daaeb6d7670e522a718067333cd4e3b15611fee576001600160a01b038116331415611ee057611edb85858585612623565b611ddd565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611f139030903390600401613940565b602060405180830381865afa158015611f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f54919061395a565b8015611fcf5750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611f8e9030908590600401613940565b602060405180830381865afa158015611fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fcf919061395a565b611fee57604051633b79c77360e21b81523360048201526024016108fa565b611ddd85858585612623565b61201e60405180606001604052806060815260200160608152602001606081525090565b604051806060016040528061203284612655565b815260200161204084611058565b815260200161204e846114db565b905292915050565b6060612061826121a4565b600061206b612ab0565b9050600081511161208b57604051806020016040528060008152506120b6565b8061209584612ac0565b6040516020016120a6929190613a07565b6040516020818303038152906040525b9392505050565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146121045760405162461bcd60e51b81526004016108fa9190613527565b506103848111801561211857506103e88111155b61212157600080fd5b61212b3382612271565b50565b612136612365565b6001600160a01b03811661219b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108fa565b61212b816123c0565b6000818152606760205260409020546001600160a01b031661212b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108fa565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612238826113c2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610918828260405180602001604052806000815250612bc6565b6122953382612bf9565b6122b15760405162461bcd60e51b81526004016108fa90613a36565b610a54838383612c77565b6122c4612e1e565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610a5483838360405180602001604052806000815250611ea8565b60008161233584612ac0565b604051602001612346929190613a07565b60408051601f1981840301815291905280516020909101209392505050565b61012d546001600160a01b03163314610b8d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108fa565b61012d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61241b612e67565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122f13390565b600054610100900460ff166124775760405162461bcd60e51b81526004016108fa90613a84565b6109188282612ead565b600054610100900460ff166124a85760405162461bcd60e51b81526004016108fa90613a84565b610b8d612efb565b600054610100900460ff166124d75760405162461bcd60e51b81526004016108fa90613a84565b610b8d733cc6cdda760b79bafa08df41ecfa224f810dceb66001612f2b565b600054610100900460ff1661251d5760405162461bcd60e51b81526004016108fa90613a84565b610b8d6130bc565b600054610100900460ff1661254c5760405162461bcd60e51b81526004016108fa90613a84565b610b8d6130ea565b816001600160a01b0316836001600160a01b031614156125b65760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108fa565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61262d3383612bf9565b6126495760405162461bcd60e51b81526004016108fa90613a36565b610cdf8484848461311d565b6040805161044081018252600561040082018181526428b0ba30b960d91b61042084015282528251808401845260078082526622b1bab0b237b960c91b60208381019190915280850192909252845180860186528181526614d95b9959d85b60ca1b818401528486015284518086018652600b8082526a4e65746865726c616e647360a81b828501526060868101929092528651808801885283815266115b99db185b9960ca1b818601526080870152865180880188528381526624a91024b930b760c91b8186015260a087015286518088018852600381526255534160e81b8186015260c0870152865180880188528581526457616c657360d81b8186015260e087015286518088018852600980825268417267656e74696e6160b81b8287015261010088019190915287518089018952600c81526b53617564692041726162696160a01b81870152610120880152875180890189526006808252654d657869636f60d01b828801526101408901919091528851808a018a5281815265141bdb185b9960d21b818801526101608901528851808a018a52818152654672616e636560d01b818801526101808901528851808a018a52918252684175737472616c696160b81b828701526101a0880191909152875180890189528481526644656e6d61726b60c81b818701526101c0880152875180890189528481526654756e6973696160c81b818701526101e0880152875180890189528681526429b830b4b760d91b8187015261020088015287518089018952600a815269436f737461205269636160b01b8187015261022088015287518089018952848152664765726d616e7960c81b8187015261024088015287518089018952868152642530b830b760d91b81870152610260880152875180890189528481526642656c6769756d60c81b81870152610280880152875180890189528181526543616e61646160d01b818701526102a088015287518089018952848152664d6f726f63636f60c81b818701526102c0880152875180890189528481526643726f6174696160c81b818701526102e08801528751808901895281815265109c985e9a5b60d21b81870152610300880152875180890189528181526553657262696160d01b81870152610320880152875180890189529182526a14ddda5d1e995c9b185b9960aa1b828601526103408701919091528651808801885260088082526721b0b6b2b937b7b760c11b828701526103608801919091528751808901895290815267141bdc9d1d59d85b60c21b8186015261038087015286518088018852948552644768616e6160d81b858501526103a086019490945285518087018752918252665572756775617960c81b828401526103c085019190915284518086018652600e81526d4b6f7265612052657075626c696360901b818401526103e08501528451808601909552918452653730ba34b7b760d11b848201529092829190612a96908690612329565b612aa091906139c0565b602081106113b6576113b66139d4565b60606101638054610830906138d4565b606081612ae45750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612b0e5780612af881613925565b9150612b079050600a836139ac565b9150612ae8565b60008167ffffffffffffffff811115612b2957612b2961353a565b6040519080825280601f01601f191660200182016040528015612b53576020820181803683370190505b5090505b8415612bbe57612b68600183613acf565b9150612b75600a866139c0565b612b80906030613ae6565b60f81b818381518110612b9557612b956139d4565b60200101906001600160f81b031916908160001a905350612bb7600a866139ac565b9450612b57565b949350505050565b612bd08383613150565b612bdd600084848461329e565b610a545760405162461bcd60e51b81526004016108fa90613afe565b600080612c05836113c2565b9050806001600160a01b0316846001600160a01b03161480612c4c57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80612bbe5750836001600160a01b0316612c658461091c565b6001600160a01b031614949350505050565b826001600160a01b0316612c8a826113c2565b6001600160a01b031614612cee5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016108fa565b6001600160a01b038216612d505760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108fa565b612d5b83838361339c565b612d66600082612203565b6001600160a01b0383166000908152606860205260408120805460019290612d8f908490613acf565b90915550506001600160a01b0382166000908152606860205260408120805460019290612dbd908490613ae6565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60975460ff16610b8d5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108fa565b60975460ff1615610b8d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108fa565b600054610100900460ff16612ed45760405162461bcd60e51b81526004016108fa90613a84565b8151612ee7906065906020850190613403565b508051610a54906066906020840190613403565b600054610100900460ff16612f225760405162461bcd60e51b81526004016108fa90613a84565b610b8d336123c0565b600054610100900460ff16612f525760405162461bcd60e51b81526004016108fa90613a84565b6daaeb6d7670e522a718067333cd4e3b156109185760405163c3c5a54760e01b81523060048201526daaeb6d7670e522a718067333cd4e9063c3c5a547906024016020604051808303816000875af1158015612fb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd6919061395a565b61091857801561304957604051633e9f1edf60e11b81526daaeb6d7670e522a718067333cd4e90637d3e3dbe906130139030908690600401613940565b600060405180830381600087803b15801561302d57600080fd5b505af1158015613041573d6000803e3d6000fd5b505050505050565b6001600160a01b0382161561308b5760405163a0af290360e01b81526daaeb6d7670e522a718067333cd4e9063a0af2903906130139030908690600401613940565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401613013565b600054610100900460ff166130e35760405162461bcd60e51b81526004016108fa90613a84565b600160fb55565b600054610100900460ff166131115760405162461bcd60e51b81526004016108fa90613a84565b6097805460ff19169055565b613128848484612c77565b6131348484848461329e565b610cdf5760405162461bcd60e51b81526004016108fa90613afe565b6001600160a01b0382166131a65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108fa565b6000818152606760205260409020546001600160a01b03161561320b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108fa565b6132176000838361339c565b6001600160a01b0382166000908152606860205260408120805460019290613240908490613ae6565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561339157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906132e2903390899088908890600401613b50565b6020604051808303816000875af192505050801561331d575060408051601f3d908101601f1916820190925261331a91810190613b8d565b60015b613377573d80801561334b576040519150601f19603f3d011682016040523d82523d6000602084013e613350565b606091505b50805161336f5760405162461bcd60e51b81526004016108fa90613afe565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612bbe565b506001949350505050565b60975460ff1615610a545760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b60648201526084016108fa565b82805461340f906138d4565b90600052602060002090601f0160209004810192826134315760008555613477565b82601f1061344a57805160ff1916838001178555613477565b82800160010185558215613477579182015b8281111561347757825182559160200191906001019061345c565b50613483929150613487565b5090565b5b808211156134835760008155600101613488565b6001600160e01b03198116811461212b57600080fd5b6000602082840312156134c457600080fd5b81356120b68161349c565b60005b838110156134ea5781810151838201526020016134d2565b83811115610cdf5750506000910152565b600081518084526135138160208601602086016134cf565b601f01601f19169290920160200192915050565b6020815260006120b660208301846134fb565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561356b5761356b61353a565b604051601f8501601f19908116603f011681019082821181831017156135935761359361353a565b816040528093508581528686860111156135ac57600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126135d757600080fd5b6120b683833560208501613550565b6000602082840312156135f857600080fd5b813567ffffffffffffffff81111561360f57600080fd5b612bbe848285016135c6565b60006020828403121561362d57600080fd5b5035919050565b6001600160a01b038116811461212b57600080fd5b6000806040838503121561365c57600080fd5b823561366781613634565b946020939093013593505050565b60008060006060848603121561368a57600080fd5b833561369581613634565b925060208401356136a581613634565b929592945050506040919091013590565b600080604083850312156136c957600080fd5b50508035926020909101359150565b6000602082840312156136ea57600080fd5b81356120b681613634565b6000806000806080858703121561370b57600080fd5b843567ffffffffffffffff8082111561372357600080fd5b61372f888389016135c6565b9550602087013591508082111561374557600080fd5b50613752878288016135c6565b935050604085013561376381613634565b9150606085013561377381613634565b939692955090935050565b801515811461212b57600080fd5b6000806040838503121561379f57600080fd5b82356137aa81613634565b915060208301356137ba8161377e565b809150509250929050565b600080600080608085870312156137db57600080fd5b84356137e681613634565b935060208501356137f681613634565b925060408501359150606085013567ffffffffffffffff81111561381957600080fd5b8501601f8101871361382a57600080fd5b61383987823560208401613550565b91505092959194509250565b60208152600082516060602084015261386160808401826134fb565b90506020840151601f198085840301604086015261387f83836134fb565b925060408601519150808584030160608601525061389d82826134fb565b95945050505050565b600080604083850312156138b957600080fd5b82356138c481613634565b915060208301356137ba81613634565b600181811c908216806138e857607f821691505b6020821081141561390957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156139395761393961390f565b5060010190565b6001600160a01b0392831681529116602082015260400190565b60006020828403121561396c57600080fd5b81516120b68161377e565b60008160001904831182151516156139915761399161390f565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826139bb576139bb613996565b500490565b6000826139cf576139cf613996565b500690565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156139fc57600080fd5b81516120b681613634565b60008351613a198184602088016134cf565b835190830190613a2d8183602088016134cf565b01949350505050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082821015613ae157613ae161390f565b500390565b60008219821115613af957613af961390f565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613b83908301846134fb565b9695505050505050565b600060208284031215613b9f57600080fd5b81516120b68161349c56fea2646970667358221220d06b8606dcea04c79203660bbbfce3e2cf02dad57a4a778c8ee3c014d7d0073d64736f6c634300080c0033
Deployed Bytecode
0x60806040526004361061025c5760003560e01c806370a0823111610144578063a22cb465116100b6578063c87b56dd1161007a578063c87b56dd146106ee578063df2fb92c1461070e578063e653c65014610725578063e985e9c514610746578063f19e75d41461078f578063f2fde38b146107af57600080fd5b8063a22cb46514610649578063adfc7dae14610669578063b88d4fde1461068a578063c0dca239146106aa578063c5b37c22146106d757600080fd5b80638456cb59116101085780638456cb59146105ab5780638da5cb5b146105c05780638f15b414146105df5780638f283970146105ff57806395d89b411461061f578063a1bb1fcc1461063457600080fd5b806370a0823114610511578063715018a61461053f578063741149b1146105545780637cd49fde1461057457806380d953dd1461058b57600080fd5b80632a55205a116101dd5780635c975abb116101a15780635c975abb146104595780635d36b3ea146104715780636352211e1461049157806366829b16146104b157806369fe0e2d146104d15780636a2c3995146104f157600080fd5b80632a55205a146103b057806339a0c6f9146103ef5780633ccfd60b1461040f5780633f4ba83a1461042457806342842e0e1461043957600080fd5b8063095ea7b311610224578063095ea7b3146103335780630dccc9ad146103535780631249c58b1461036857806323b872dd1461037057806327ea6f2b1461039057600080fd5b806301bc45c91461026157806301ffc9a71461029f57806306fdde03146102cf5780630764da1d146102f1578063081812fc14610313575b600080fd5b34801561026d57600080fd5b5061015f54610282906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102ab57600080fd5b506102bf6102ba3660046134b2565b6107cf565b6040519015158152602001610296565b3480156102db57600080fd5b506102e4610821565b6040516102969190613527565b3480156102fd57600080fd5b5061031161030c3660046135e6565b6108b3565b005b34801561031f57600080fd5b5061028261032e36600461361b565b61091c565b34801561033f57600080fd5b5061031161034e366004613649565b610943565b34801561035f57600080fd5b506102e4610a59565b610311610ae8565b34801561037c57600080fd5b5061031161038b366004613675565b610b8f565b34801561039c57600080fd5b506103116103ab36600461361b565b610ce5565b3480156103bc57600080fd5b506103d06103cb3660046136b6565b610d33565b604080516001600160a01b039093168352602083019190915201610296565b3480156103fb57600080fd5b5061031161040a3660046135e6565b610d64565b34801561041b57600080fd5b50610311610dc0565b34801561043057600080fd5b50610311610ebd565b34801561044557600080fd5b50610311610454366004613675565b610f0d565b34801561046557600080fd5b5060975460ff166102bf565b34801561047d57600080fd5b506102e461048c36600461361b565b611058565b34801561049d57600080fd5b506102826104ac36600461361b565b6113c2565b3480156104bd57600080fd5b506103116104cc3660046136d8565b611422565b3480156104dd57600080fd5b506103116104ec36600461361b565b61148d565b3480156104fd57600080fd5b506102e461050c36600461361b565b6114db565b34801561051d57600080fd5b5061053161052c3660046136d8565b611972565b604051908152602001610296565b34801561054b57600080fd5b506103116119f8565b34801561056057600080fd5b5061031161056f3660046136d8565b611a0a565b34801561058057600080fd5b506105316101625481565b34801561059757600080fd5b506103116105a636600461361b565b611aa6565b3480156105b757600080fd5b50610311611bc9565b3480156105cc57600080fd5b5061012d546001600160a01b0316610282565b3480156105eb57600080fd5b506103116105fa3660046136f5565b611c19565b34801561060b57600080fd5b5061031161061a3660046136d8565b611de4565b34801561062b57600080fd5b506102e4611e80565b34801561064057600080fd5b506102e4611e8f565b34801561065557600080fd5b5061031161066436600461378c565b611e9d565b34801561067557600080fd5b5061016054610282906001600160a01b031681565b34801561069657600080fd5b506103116106a53660046137c5565b611ea8565b3480156106b657600080fd5b506106ca6106c536600461361b565b611ffa565b6040516102969190613845565b3480156106e357600080fd5b506105316101655481565b3480156106fa57600080fd5b506102e461070936600461361b565b612056565b34801561071a57600080fd5b506105316101665481565b34801561073157600080fd5b5061016454610282906001600160a01b031681565b34801561075257600080fd5b506102bf6107613660046138a6565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561079b57600080fd5b506103116107aa36600461361b565b6120bd565b3480156107bb57600080fd5b506103116107ca3660046136d8565b61212e565b60006001600160e01b031982166380ac58cd60e01b148061080057506001600160e01b03198216635b5e139f60e01b145b8061081b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060658054610830906138d4565b80601f016020809104026020016040519081016040528092919081815260200182805461085c906138d4565b80156108a95780601f1061087e576101008083540402835291602001916108a9565b820191906000526020600020905b81548152906001019060200180831161088c57829003601f168201915b5050505050905090565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146109035760405162461bcd60e51b81526004016108fa9190613527565b60405180910390fd5b50805161091890610161906020840190613403565b5050565b6000610927826121a4565b506000908152606960205260409020546001600160a01b031690565b600061094e826113c2565b9050806001600160a01b0316836001600160a01b031614156109bc5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108fa565b336001600160a01b03821614806109d857506109d88133610761565b610a4a5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016108fa565b610a548383612203565b505050565b6101638054610a67906138d4565b80601f0160208091040260200160405190810160405280929190818152602001828054610a93906138d4565b8015610ae05780601f10610ab557610100808354040283529160200191610ae0565b820191906000526020600020905b815481529060010190602001808311610ac357829003601f168201915b505050505081565b600061016554118015610afe5750610165543410155b8015610b0d5750600061016654115b6040518060400160405280600381526020016232303160e81b81525090610b475760405162461bcd60e51b81526004016108fa9190613527565b5061038461016254108015610b6157506101665461016254105b610b6a57600080fd5b6101628054906000610b7b83613925565b9190505550610b8d3361016254612271565b565b826daaeb6d7670e522a718067333cd4e3b15610cd4576001600160a01b038116331415610bc657610bc184848461228b565b610cdf565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610bf99030903390600401613940565b602060405180830381865afa158015610c16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3a919061395a565b8015610cb55750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610c749030908590600401613940565b602060405180830381865afa158015610c91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb5919061395a565b610cd457604051633b79c77360e21b81523360048201526024016108fa565b610cdf84848461228b565b50505050565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610d2c5760405162461bcd60e51b81526004016108fa9190613527565b5061016655565b61015f546001600160a01b03166000612710610d51846101f4613977565b610d5b91906139ac565b90509250929050565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610dab5760405162461bcd60e51b81526004016108fa9190613527565b50805161091890610163906020840190613403565b600260fb541415610e135760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108fa565b600260fb5561015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610e5f5760405162461bcd60e51b81526004016108fa9190613527565b50604051600090339047908381818185875af1925050503d8060008114610ea2576040519150601f19603f3d011682016040523d82523d6000602084013e610ea7565b606091505b5050905080610eb557600080fd5b50600160fb55565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314610f045760405162461bcd60e51b81526004016108fa9190613527565b50610b8d6122bc565b826daaeb6d7670e522a718067333cd4e3b1561104d576001600160a01b038116331415610f3f57610bc184848461230e565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610f729030903390600401613940565b602060405180830381865afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb3919061395a565b801561102e5750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610fed9030908590600401613940565b602060405180830381865afa15801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e919061395a565b61104d57604051633b79c77360e21b81523360048201526024016108fa565b610cdf84848461230e565b6040805161036081018252600761032082018181526611a0a12222a29b60c91b6103408401528252825180840184528181526611a1a120a0a1a160c91b6020828101919091528084019190915283518085018552828152662346464646423560c81b8183015283850152835180850185528281526611a32321a1a11b60c91b8183015260608481019190915284518086018652838152662346334230433360c81b81840152608085015284518086018652838152662343364442444160c81b8184015260a085015284518086018652838152660468c8a8a628a760cb1b8184015260c085015284518086018652838152662346454437433360c81b8184015260e0850152845180860186528381526611a31b22a0a19960c91b8184015261010085015284518086018652838152662345434435453360c81b8184015261012085015284518086018652838152662346463936384160c81b8184015261014085015284518086018652838152662346464145413560c81b81840152610160850152845180860186528381526611a323219aa12360c91b8184015261018085015284518086018652838152662346464438424560c81b818401526101a0850152845180860186528381526611a323219c209960c91b818401526101c085015284518086018652838152660234434463046360cc1b818401526101e085015284518086018652838152662338464341434160c81b81840152610200850152845180860186528381526611a1a1a29921a160c91b81840152610220850152845180860186528381526611a11b21a3211b60c91b8184015261024085015284518086018652838152662339374331413960c81b8184015261026085015284518086018652838152662346434239414160c81b8184015261028085015284518086018652838152662346464442434360c81b818401526102a0850152845180860186528381526608d150d150514d60ca1b818401526102c0850152845180860186528381526611a0992298a22160c91b818401526102e0850152845180860186529283526608cd4d50d090d160ca1b8383015261030084019290925283518085019094526009845268070616c6c6574546f760bc1b9084015291819060199061139c908690612329565b6113a691906139c0565b601981106113b6576113b66139d4565b60200201519392505050565b6000818152606760205260408120546001600160a01b03168061081b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108fa565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146114695760405162461bcd60e51b81526004016108fa9190613527565b5061016480546001600160a01b0319166001600160a01b0392909216919091179055565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146114d45760405162461bcd60e51b81526004016108fa9190613527565b5061016555565b604080516104a08101825260076104608201818152662330304135453360c81b61048084015282528251808401845281815266119c22221ba12360c91b6020828101919091528084019190915283518085018552828152662346463936433560c81b818301528385015283518085018552828152660468c8c6a6e6c760cb1b8183015260608481019190915284518086018652838152662346464246363560c81b81840152608085015284518086018652838152660468c866c6466760cb1b8184015260a0850152845180860186528381526611a323221c1b9960c91b8184015260c085015284518086018652838152662346324434434360c81b8184015260e085015284518086018652838152662345373735373760c81b81840152610100850152845180860186528381526608cd90ce0e10cd60ca1b8184015261012085015284518086018652838152660234330353738360cc1b81840152610140850152845180860186528381526611a3231c191c2160c91b81840152610160850152845180860186528381526611a29ba19a9c1960c91b8184015261018085015284518086018652838152662330304230424160c81b818401526101a085015284518086018652838152661198181b1aa09960c91b818401526101c085015284518086018652838152662330304344414360c81b818401526101e085015284518086018652838152660468c8c6c8c6c760cb1b8184015261020085015284518086018652838152662346464441434360c81b8184015261022085015284518086018652838152660468c8c6c6082760cb1b8184015261024085015284518086018652838152660234346463830360cc1b8184015261026085015284518086018652838152662346463543373760c81b8184015261028085015284518086018652838152662334444430393160c81b818401526102a085015284518086018652838152662346464543353960c81b818401526102c085015284518086018652838152662346464132334160c81b818401526102e085015284518086018652838152662337343733374160c81b8184015261030085015284518086018652838152660234646463130360cc1b8184015261032085015284518086018652838152660234646384330360cc1b8184015261034085015284518086018652838152662345383131323360c81b8184015261036085015284518086018652838152662345433030384360c81b8184015261038085015284518086018652838152662336383231374160c81b818401526103a08501528451808601865283815266119818189c1c2360c91b818401526103c085015284518086018652838152661198182121a31960c91b818401526103e0850152845180860186528381526608cc0c108c8e4d60ca1b8184015261040085015284518086018652838152662330303945343960c81b8184015261042085015284518086018652928352662342414438304160c81b838301526104408401929092528351808501909452600c84526b70616c6c6574426f74746f6d60a01b90840152918190602390611958908690612329565b61196291906139c0565b602381106113b6576113b66139d4565b60006001600160a01b0382166119dc5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016108fa565b506001600160a01b031660009081526068602052604090205490565b611a00612365565b610b8d60006123c0565b61015f546001600160a01b031633148015611a2d57506001600160a01b03811615155b8015611a485750610160546001600160a01b03828116911614155b6040518060400160405280600381526020016231303160e81b81525090611a825760405162461bcd60e51b81526004016108fa9190613527565b5061016080546001600160a01b0319166001600160a01b0392909216919091179055565b610164546001600160a01b031615801590611ac45750600061016654115b6040518060400160405280600381526020016203130360ec1b81525090611afe5760405162461bcd60e51b81526004016108fa9190613527565b50610164546040516331a9108f60e11b8152600481018390526001600160a01b039091169033908290636352211e90602401602060405180830381865afa158015611b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7191906139ea565b6001600160a01b031614611b8457600080fd5b61038461016254108015611b9d57506101665461016254105b611ba657600080fd5b6101628054906000611bb783613925565b91905055506109183361016254612271565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b03163314611c105760405162461bcd60e51b81526004016108fa9190613527565b50610b8d612413565b600054610100900460ff1615808015611c395750600054600160ff909116105b80611c535750303b158015611c53575060005460ff166001145b611cb65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108fa565b6000805460ff191660011790558015611cd9576000805461ff0019166101001790555b6001600160a01b03831615801590611cf957506001600160a01b03821615155b6040518060400160405280600381526020016203130360ec1b81525090611d335760405162461bcd60e51b81526004016108fa9190613527565b50611d3e8585612450565b61016080546001600160a01b038085166001600160a01b03199283161790925561015f80549286169290911691909117905561038461016655611d7f612481565b611d876124b0565b611d8f6124f6565b611d97612525565b8015611ddd576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b61015f546001600160a01b031633148015611e0757506001600160a01b03811615155b8015611e22575061015f546001600160a01b03828116911614155b6040518060400160405280600381526020016231303160e81b81525090611e5c5760405162461bcd60e51b81526004016108fa9190613527565b5061015f80546001600160a01b0319166001600160a01b0392909216919091179055565b606060668054610830906138d4565b6101618054610a67906138d4565b610918338383612554565b836daaeb6d7670e522a718067333cd4e3b15611fee576001600160a01b038116331415611ee057611edb85858585612623565b611ddd565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611f139030903390600401613940565b602060405180830381865afa158015611f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f54919061395a565b8015611fcf5750604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490611f8e9030908590600401613940565b602060405180830381865afa158015611fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fcf919061395a565b611fee57604051633b79c77360e21b81523360048201526024016108fa565b611ddd85858585612623565b61201e60405180606001604052806060815260200160608152602001606081525090565b604051806060016040528061203284612655565b815260200161204084611058565b815260200161204e846114db565b905292915050565b6060612061826121a4565b600061206b612ab0565b9050600081511161208b57604051806020016040528060008152506120b6565b8061209584612ac0565b6040516020016120a6929190613a07565b6040516020818303038152906040525b9392505050565b61015f5460408051808201909152600381526231303160e81b6020820152906001600160a01b031633146121045760405162461bcd60e51b81526004016108fa9190613527565b506103848111801561211857506103e88111155b61212157600080fd5b61212b3382612271565b50565b612136612365565b6001600160a01b03811661219b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108fa565b61212b816123c0565b6000818152606760205260409020546001600160a01b031661212b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108fa565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612238826113c2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610918828260405180602001604052806000815250612bc6565b6122953382612bf9565b6122b15760405162461bcd60e51b81526004016108fa90613a36565b610a54838383612c77565b6122c4612e1e565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610a5483838360405180602001604052806000815250611ea8565b60008161233584612ac0565b604051602001612346929190613a07565b60408051601f1981840301815291905280516020909101209392505050565b61012d546001600160a01b03163314610b8d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108fa565b61012d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61241b612e67565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122f13390565b600054610100900460ff166124775760405162461bcd60e51b81526004016108fa90613a84565b6109188282612ead565b600054610100900460ff166124a85760405162461bcd60e51b81526004016108fa90613a84565b610b8d612efb565b600054610100900460ff166124d75760405162461bcd60e51b81526004016108fa90613a84565b610b8d733cc6cdda760b79bafa08df41ecfa224f810dceb66001612f2b565b600054610100900460ff1661251d5760405162461bcd60e51b81526004016108fa90613a84565b610b8d6130bc565b600054610100900460ff1661254c5760405162461bcd60e51b81526004016108fa90613a84565b610b8d6130ea565b816001600160a01b0316836001600160a01b031614156125b65760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108fa565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61262d3383612bf9565b6126495760405162461bcd60e51b81526004016108fa90613a36565b610cdf8484848461311d565b6040805161044081018252600561040082018181526428b0ba30b960d91b61042084015282528251808401845260078082526622b1bab0b237b960c91b60208381019190915280850192909252845180860186528181526614d95b9959d85b60ca1b818401528486015284518086018652600b8082526a4e65746865726c616e647360a81b828501526060868101929092528651808801885283815266115b99db185b9960ca1b818601526080870152865180880188528381526624a91024b930b760c91b8186015260a087015286518088018852600381526255534160e81b8186015260c0870152865180880188528581526457616c657360d81b8186015260e087015286518088018852600980825268417267656e74696e6160b81b8287015261010088019190915287518089018952600c81526b53617564692041726162696160a01b81870152610120880152875180890189526006808252654d657869636f60d01b828801526101408901919091528851808a018a5281815265141bdb185b9960d21b818801526101608901528851808a018a52818152654672616e636560d01b818801526101808901528851808a018a52918252684175737472616c696160b81b828701526101a0880191909152875180890189528481526644656e6d61726b60c81b818701526101c0880152875180890189528481526654756e6973696160c81b818701526101e0880152875180890189528681526429b830b4b760d91b8187015261020088015287518089018952600a815269436f737461205269636160b01b8187015261022088015287518089018952848152664765726d616e7960c81b8187015261024088015287518089018952868152642530b830b760d91b81870152610260880152875180890189528481526642656c6769756d60c81b81870152610280880152875180890189528181526543616e61646160d01b818701526102a088015287518089018952848152664d6f726f63636f60c81b818701526102c0880152875180890189528481526643726f6174696160c81b818701526102e08801528751808901895281815265109c985e9a5b60d21b81870152610300880152875180890189528181526553657262696160d01b81870152610320880152875180890189529182526a14ddda5d1e995c9b185b9960aa1b828601526103408701919091528651808801885260088082526721b0b6b2b937b7b760c11b828701526103608801919091528751808901895290815267141bdc9d1d59d85b60c21b8186015261038087015286518088018852948552644768616e6160d81b858501526103a086019490945285518087018752918252665572756775617960c81b828401526103c085019190915284518086018652600e81526d4b6f7265612052657075626c696360901b818401526103e08501528451808601909552918452653730ba34b7b760d11b848201529092829190612a96908690612329565b612aa091906139c0565b602081106113b6576113b66139d4565b60606101638054610830906138d4565b606081612ae45750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612b0e5780612af881613925565b9150612b079050600a836139ac565b9150612ae8565b60008167ffffffffffffffff811115612b2957612b2961353a565b6040519080825280601f01601f191660200182016040528015612b53576020820181803683370190505b5090505b8415612bbe57612b68600183613acf565b9150612b75600a866139c0565b612b80906030613ae6565b60f81b818381518110612b9557612b956139d4565b60200101906001600160f81b031916908160001a905350612bb7600a866139ac565b9450612b57565b949350505050565b612bd08383613150565b612bdd600084848461329e565b610a545760405162461bcd60e51b81526004016108fa90613afe565b600080612c05836113c2565b9050806001600160a01b0316846001600160a01b03161480612c4c57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80612bbe5750836001600160a01b0316612c658461091c565b6001600160a01b031614949350505050565b826001600160a01b0316612c8a826113c2565b6001600160a01b031614612cee5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016108fa565b6001600160a01b038216612d505760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108fa565b612d5b83838361339c565b612d66600082612203565b6001600160a01b0383166000908152606860205260408120805460019290612d8f908490613acf565b90915550506001600160a01b0382166000908152606860205260408120805460019290612dbd908490613ae6565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60975460ff16610b8d5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108fa565b60975460ff1615610b8d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108fa565b600054610100900460ff16612ed45760405162461bcd60e51b81526004016108fa90613a84565b8151612ee7906065906020850190613403565b508051610a54906066906020840190613403565b600054610100900460ff16612f225760405162461bcd60e51b81526004016108fa90613a84565b610b8d336123c0565b600054610100900460ff16612f525760405162461bcd60e51b81526004016108fa90613a84565b6daaeb6d7670e522a718067333cd4e3b156109185760405163c3c5a54760e01b81523060048201526daaeb6d7670e522a718067333cd4e9063c3c5a547906024016020604051808303816000875af1158015612fb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd6919061395a565b61091857801561304957604051633e9f1edf60e11b81526daaeb6d7670e522a718067333cd4e90637d3e3dbe906130139030908690600401613940565b600060405180830381600087803b15801561302d57600080fd5b505af1158015613041573d6000803e3d6000fd5b505050505050565b6001600160a01b0382161561308b5760405163a0af290360e01b81526daaeb6d7670e522a718067333cd4e9063a0af2903906130139030908690600401613940565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401613013565b600054610100900460ff166130e35760405162461bcd60e51b81526004016108fa90613a84565b600160fb55565b600054610100900460ff166131115760405162461bcd60e51b81526004016108fa90613a84565b6097805460ff19169055565b613128848484612c77565b6131348484848461329e565b610cdf5760405162461bcd60e51b81526004016108fa90613afe565b6001600160a01b0382166131a65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108fa565b6000818152606760205260409020546001600160a01b03161561320b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108fa565b6132176000838361339c565b6001600160a01b0382166000908152606860205260408120805460019290613240908490613ae6565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561339157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906132e2903390899088908890600401613b50565b6020604051808303816000875af192505050801561331d575060408051601f3d908101601f1916820190925261331a91810190613b8d565b60015b613377573d80801561334b576040519150601f19603f3d011682016040523d82523d6000602084013e613350565b606091505b50805161336f5760405162461bcd60e51b81526004016108fa90613afe565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612bbe565b506001949350505050565b60975460ff1615610a545760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b60648201526084016108fa565b82805461340f906138d4565b90600052602060002090601f0160209004810192826134315760008555613477565b82601f1061344a57805160ff1916838001178555613477565b82800160010185558215613477579182015b8281111561347757825182559160200191906001019061345c565b50613483929150613487565b5090565b5b808211156134835760008155600101613488565b6001600160e01b03198116811461212b57600080fd5b6000602082840312156134c457600080fd5b81356120b68161349c565b60005b838110156134ea5781810151838201526020016134d2565b83811115610cdf5750506000910152565b600081518084526135138160208601602086016134cf565b601f01601f19169290920160200192915050565b6020815260006120b660208301846134fb565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561356b5761356b61353a565b604051601f8501601f19908116603f011681019082821181831017156135935761359361353a565b816040528093508581528686860111156135ac57600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126135d757600080fd5b6120b683833560208501613550565b6000602082840312156135f857600080fd5b813567ffffffffffffffff81111561360f57600080fd5b612bbe848285016135c6565b60006020828403121561362d57600080fd5b5035919050565b6001600160a01b038116811461212b57600080fd5b6000806040838503121561365c57600080fd5b823561366781613634565b946020939093013593505050565b60008060006060848603121561368a57600080fd5b833561369581613634565b925060208401356136a581613634565b929592945050506040919091013590565b600080604083850312156136c957600080fd5b50508035926020909101359150565b6000602082840312156136ea57600080fd5b81356120b681613634565b6000806000806080858703121561370b57600080fd5b843567ffffffffffffffff8082111561372357600080fd5b61372f888389016135c6565b9550602087013591508082111561374557600080fd5b50613752878288016135c6565b935050604085013561376381613634565b9150606085013561377381613634565b939692955090935050565b801515811461212b57600080fd5b6000806040838503121561379f57600080fd5b82356137aa81613634565b915060208301356137ba8161377e565b809150509250929050565b600080600080608085870312156137db57600080fd5b84356137e681613634565b935060208501356137f681613634565b925060408501359150606085013567ffffffffffffffff81111561381957600080fd5b8501601f8101871361382a57600080fd5b61383987823560208401613550565b91505092959194509250565b60208152600082516060602084015261386160808401826134fb565b90506020840151601f198085840301604086015261387f83836134fb565b925060408601519150808584030160608601525061389d82826134fb565b95945050505050565b600080604083850312156138b957600080fd5b82356138c481613634565b915060208301356137ba81613634565b600181811c908216806138e857607f821691505b6020821081141561390957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156139395761393961390f565b5060010190565b6001600160a01b0392831681529116602082015260400190565b60006020828403121561396c57600080fd5b81516120b68161377e565b60008160001904831182151516156139915761399161390f565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826139bb576139bb613996565b500490565b6000826139cf576139cf613996565b500690565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156139fc57600080fd5b81516120b681613634565b60008351613a198184602088016134cf565b835190830190613a2d8183602088016134cf565b01949350505050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082821015613ae157613ae161390f565b500390565b60008219821115613af957613af961390f565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613b83908301846134fb565b9695505050505050565b600060208284031215613b9f57600080fd5b81516120b68161349c56fea2646970667358221220d06b8606dcea04c79203660bbbfce3e2cf02dad57a4a778c8ee3c014d7d0073d64736f6c634300080c0033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.