Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
0 TNFT
Holders
323
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 TNFTLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
TellerNFT
Compiler Version
v0.8.3+commit.8d00100c
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; // Contracts import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; // Libraries import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; // Interfaces import "./ITellerNFT.sol"; /*****************************************************************************************************/ /** WARNING **/ /** THIS CONTRACT IS UPGRADEABLE! **/ /** --------------------------------------------------------------------------------------------- **/ /** Do NOT change the order of or PREPEND any storage variables to this or new versions of this **/ /** contract as this will cause the the storage slots to be overwritten on the proxy contract!! **/ /** **/ /** Visit https://docs.openzeppelin.com/upgrades/2.6/proxies#upgrading-via-the-proxy-pattern for **/ /** more information. **/ /*****************************************************************************************************/ /** * @notice This contract is used by borrowers to call Dapp functions (using delegate calls). * @notice This contract should only be constructed using it's upgradeable Proxy contract. * @notice In order to call a Dapp function, the Dapp must be added in the DappRegistry instance. * * @author [email protected] */ contract TellerNFT is ITellerNFT, ERC721Upgradeable, AccessControlUpgradeable { using Counters for Counters.Counter; using EnumerableSet for EnumerableSet.UintSet; using SafeMath for uint256; /* Constants */ bytes32 public constant ADMIN = keccak256("ADMIN"); bytes32 public constant MINTER = keccak256("MINTER"); /* State Variables */ // It holds the total number of tiers. Counters.Counter internal _tierCounter; // It holds the total number of tokens minted. Counters.Counter internal _tokenCounter; // It holds the information about a tier. mapping(uint256 => Tier) internal _tiers; // It holds which tier a token ID is in. mapping(uint256 => uint256) internal _tokenTier; // It holds a set of token IDs for an owner address. mapping(address => EnumerableSet.UintSet) internal _ownerTokenIDs; // Link to the contract metadata string private _metadataBaseURI; // Hash to the contract metadata located on the {_metadataBaseURI} string private _contractURIHash; /* Modifiers */ modifier onlyAdmin() { require(hasRole(ADMIN, _msgSender()), "TellerNFT: not admin"); _; } modifier onlyMinter() { require(hasRole(MINTER, _msgSender()), "TellerNFT: not minter"); _; } /* External Functions */ /** * @notice It returns information about a Tier for a token ID. * @param index Tier index to get info. */ function getTier(uint256 index) external view override returns (Tier memory tier_) { tier_ = _tiers[index]; } /** * @notice It returns information about a Tier for a token ID. * @param tokenId ID of the token to get Tier info. */ function getTokenTier(uint256 tokenId) external view override returns (uint256 index_, Tier memory tier_) { index_ = _tokenTier[tokenId]; tier_ = _tiers[index_]; } /** * @notice It returns an array of token IDs owned by an address. * @dev It uses a EnumerableSet to store values and loops over each element to add to the array. * @dev Can be costly if calling within a contract for address with many tokens. */ function getTierHashes(uint256 tierIndex) external view override returns (string[] memory hashes_) { hashes_ = _tiers[tierIndex].hashes; } /** * @notice It returns an array of token IDs owned by an address. * @dev It uses a EnumerableSet to store values and loops over each element to add to the array. * @dev Can be costly if calling within a contract for address with many tokens. */ function getOwnedTokens(address owner) external view override returns (uint256[] memory owned_) { EnumerableSet.UintSet storage set = _ownerTokenIDs[owner]; owned_ = new uint256[](set.length()); for (uint256 i; i < owned_.length; i++) { owned_[i] = set.at(i); } } /** * @notice The contract metadata URI. */ function contractURI() external view override returns (string memory) { return _contractURIHash; } /** * @notice The token URI is based on the token ID. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "TellerNFT: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, _tokenURIHash(tokenId))) : ""; } /** * @notice It mints a new token for a Tier index. * @param tierIndex Tier to mint token on. * @param owner The owner of the new token. * * Requirements: * - Caller must be an authorized minter */ function mint(uint256 tierIndex, address owner) external override onlyMinter { // Get the new token ID uint256 tokenId = _tokenCounter.current(); _tokenCounter.increment(); // Mint and set the token to the tier index _safeMint(owner, tokenId); _tokenTier[tokenId] = tierIndex; // Set owner _setOwner(owner, tokenId); } /** * @notice Adds a new Tier to be minted with the given information. * @dev It auto increments the index of the next tier to add. * @param newTier Information about the new tier to add. * * Requirements: * - Caller must have the {MINTER} role */ function addTier(Tier memory newTier) external override onlyMinter { Tier storage tier = _tiers[_tierCounter.current()]; tier.baseLoanSize = newTier.baseLoanSize; tier.hashes = newTier.hashes; tier.contributionAsset = newTier.contributionAsset; tier.contributionSize = newTier.contributionSize; tier.contributionMultiplier = newTier.contributionMultiplier; _tierCounter.increment(); } function removeMinter(address minter) external onlyMinter { revokeRole(MINTER, minter); } function addMinter(address minter) public onlyMinter { _setupRole(MINTER, minter); } /** * @notice Sets the contract level metadata URI hash. * @param contractURIHash The hash to the initial contract level metadata. */ function setContractURIHash(string memory contractURIHash) external override onlyAdmin { _contractURIHash = contractURIHash; } /** * @notice Initializes the TellerNFT. * @param minters The addresses that should allowed to mint tokens. */ function initialize(address[] calldata minters) external override initializer { __ERC721_init("Teller NFT", "TNFT"); __AccessControl_init(); for (uint256 i; i < minters.length; i++) { _setupRole(MINTER, minters[i]); } _metadataBaseURI = "https://gateway.pinata.cloud/ipfs/"; _contractURIHash = "QmWAfQFFwptzRUCdF2cBFJhcB2gfHJMd7TQt64dZUysk3R"; } function supportsInterface(bytes4 interfaceId) public view override(AccessControlUpgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(ITellerNFT).interfaceId || ERC721Upgradeable.supportsInterface(interfaceId) || AccessControlUpgradeable.supportsInterface(interfaceId); } /** * @notice It returns the hash to use for the token URI. */ function _tokenURIHash(uint256 tokenId) internal view returns (string memory) { string[] storage tierImageHashes = _tiers[_tokenTier[tokenId]].hashes; return tierImageHashes[tokenId.mod(tierImageHashes.length)]; } /** * @notice The base URI path where the token media is hosted. * @dev Base URI for computing {tokenURI}. */ function _baseURI() internal view override returns (string memory) { return _metadataBaseURI; } /** * @notice Moves token to new owner set and then transfers. */ function _transfer( address from, address to, uint256 tokenId ) internal override { _setOwner(to, tokenId); super._transfer(from, to, tokenId); } /** * @notice It removes the token from the current owner set and adds to new owner. */ function _setOwner(address newOwner, uint256 tokenId) internal { address currentOwner = ownerOf(tokenId); if (currentOwner != address(0)) { _ownerTokenIDs[currentOwner].remove(tokenId); } _ownerTokenIDs[newOwner].add(tokenId); } function _msgData() internal pure override returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { function hasRole(bytes32 role, address account) external view returns (bool); function getRoleAdmin(bytes32 role) external view returns (bytes32); function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; function renounceRole(bytes32 role, address account) external; } /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } struct RoleData { mapping (address => bool) members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev 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 {_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 See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override { require(hasRole(getRoleAdmin(role), _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override { require(hasRole(getRoleAdmin(role), _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, getRoleAdmin(role), adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; 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 a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "./extensions/IERC721EnumerableUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping (uint256 => address) private _owners; // Mapping owner address to token count mapping (address => uint256) private _balances; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden * in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721Upgradeable.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721Upgradeable.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { // solhint-disable-next-line no-inline-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` 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 { } uint256[44] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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"); // solhint-disable-next-line avoid-low-level-calls (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"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant alphabet = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = alphabet[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @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 pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. 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 Counters { 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; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT 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 no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @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 substraction 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. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * 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 pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(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) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // 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); } // 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)))); } // 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)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; // Interfaces import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; interface ITellerNFT { struct Tier { uint256 baseLoanSize; string[] hashes; address contributionAsset; uint256 contributionSize; uint8 contributionMultiplier; } /** * @notice The contract metadata URI. */ function contractURI() external view returns (string memory); /** * @notice It returns information about a Tier for a token ID. * @param index Tier index to get info. */ function getTier(uint256 index) external view returns (Tier memory tier_); /** * @notice It returns information about a Tier for a token ID. * @param tokenId ID of the token to get Tier info. */ function getTokenTier(uint256 tokenId) external view returns (uint256 index_, Tier memory tier_); /** * @notice It returns an array of token IDs owned by an address. * @dev It uses a EnumerableSet to store values and loops over each element to add to the array. * @dev Can be costly if calling within a contract for address with many tokens. */ function getTierHashes(uint256 tierIndex) external view returns (string[] memory hashes_); /** * @notice It returns an array of token IDs owned by an address. * @dev It uses a EnumerableSet to store values and loops over each element to add to the array. * @dev Can be costly if calling within a contract for address with many tokens. */ function getOwnedTokens(address owner) external view returns (uint256[] memory owned); /** * @notice It mints a new token for a Tier index. * * Requirements: * - Caller must be an authorized minter */ function mint(uint256 tierIndex, address owner) external; /** * @notice Adds a new Tier to be minted with the given information. * @dev It auto increments the index of the next tier to add. * @param newTier Information about the new tier to add. * * Requirements: * - Caller must have the {MINTER} role */ function addTier(Tier memory newTier) external; /** * @notice Sets the contract level metadata URI hash. * @param contractURIHash The hash to the initial contract level metadata. */ function setContractURIHash(string memory contractURIHash) external; /** * @notice Initializes the TellerNFT. * @param minters The addresses that should allowed to mint tokens. */ function initialize(address[] calldata minters) external; }
{ "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"addMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"baseLoanSize","type":"uint256"},{"internalType":"string[]","name":"hashes","type":"string[]"},{"internalType":"address","name":"contributionAsset","type":"address"},{"internalType":"uint256","name":"contributionSize","type":"uint256"},{"internalType":"uint8","name":"contributionMultiplier","type":"uint8"}],"internalType":"struct ITellerNFT.Tier","name":"newTier","type":"tuple"}],"name":"addTier","outputs":[],"stateMutability":"nonpayable","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":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getOwnedTokens","outputs":[{"internalType":"uint256[]","name":"owned_","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getTier","outputs":[{"components":[{"internalType":"uint256","name":"baseLoanSize","type":"uint256"},{"internalType":"string[]","name":"hashes","type":"string[]"},{"internalType":"address","name":"contributionAsset","type":"address"},{"internalType":"uint256","name":"contributionSize","type":"uint256"},{"internalType":"uint8","name":"contributionMultiplier","type":"uint8"}],"internalType":"struct ITellerNFT.Tier","name":"tier_","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tierIndex","type":"uint256"}],"name":"getTierHashes","outputs":[{"internalType":"string[]","name":"hashes_","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenTier","outputs":[{"internalType":"uint256","name":"index_","type":"uint256"},{"components":[{"internalType":"uint256","name":"baseLoanSize","type":"uint256"},{"internalType":"string[]","name":"hashes","type":"string[]"},{"internalType":"address","name":"contributionAsset","type":"address"},{"internalType":"uint256","name":"contributionSize","type":"uint256"},{"internalType":"uint8","name":"contributionMultiplier","type":"uint8"}],"internalType":"struct ITellerNFT.Tier","name":"tier_","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"minters","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":[{"internalType":"uint256","name":"tierIndex","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"removeMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"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":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"contractURIHash","type":"string"}],"name":"setContractURIHash","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"}]
Contract Creation Code
608060405234801561001057600080fd5b50612c37806100206000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c806395d89b411161010f578063c87b56dd116100a2578063d9d6165511610071578063d9d616551461047e578063e8a3d4851461049e578063e985e9c5146104a6578063fe6d8124146104e2576101f0565b8063c87b56dd14610425578063cbee53a314610438578063cf932b7c14610458578063d547741f1461046b576101f0565b8063a22cb465116100de578063a22cb465146103cb578063b88d4fde146103de578063baedc1c4146103f1578063c26b265f14610404576101f0565b806395d89b4114610395578063983b2d561461039d578063a217fddf146103b0578063a224cee7146103b8576101f0565b80633092afd5116101875780636352211e116101565780636352211e1461034957806370a082311461035c57806391d148541461036f57806394bf804d14610382576101f0565b80633092afd5146102f057806336568abe1461030357806342842e0e146103165780634f062c5a14610329576101f0565b806323b872dd116101c357806323b872dd14610272578063248a9ca3146102855780632a0acc6a146102b65780632f2ff15d146102dd576101f0565b806301ffc9a7146101f557806306fdde031461021d578063081812fc14610232578063095ea7b31461025d575b600080fd5b61020861020336600461258d565b6104f7565b60405190151581526020015b60405180910390f35b610225610533565b60405161021491906128ee565b610245610240366004612553565b6105c5565b6040516001600160a01b039091168152602001610214565b61027061026b3660046124ba565b61065f565b005b6102706102803660046123cc565b610775565b6102a8610293366004612553565b60009081526097602052604090206001015490565b604051908152602001610214565b6102a87fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b6102706102eb36600461256b565b6107a6565b6102706102fe366004612380565b610835565b61027061031136600461256b565b610884565b6102706103243660046123cc565b6108fe565b61033c610337366004612553565b610919565b6040516102149190612a21565b610245610357366004612553565b610a53565b6102a861036a366004612380565b610aca565b61020861037d36600461256b565b610b51565b6102706103903660046126f7565b610b7e565b610225610bf2565b6102706103ab366004612380565b610c01565b6102a8600081565b6102706103c63660046124e3565b610c4d565b6102706103d9366004612480565b610dd0565b6102706103ec366004612407565b610ea2565b6102706103ff3660046125c5565b610eda565b610417610412366004612553565b610f5a565b604051610214929190612a34565b610225610433366004612553565b61109a565b61044b610446366004612553565b611170565b6040516102149190612849565b6102706104663660046125f8565b61125f565b61027061047936600461256b565b61132a565b61049161048c366004612380565b6113aa565b60405161021491906128aa565b61022561147a565b6102086104b436600461239a565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6102a8600080516020612b9283398151915281565b60006001600160e01b03198216630d04cfd960e21b148061051c575061051c82611489565b8061052b575061052b826114d9565b90505b919050565b60606065805461054290612ad9565b80601f016020809104026020016040519081016040528092919081815260200182805461056e90612ad9565b80156105bb5780601f10610590576101008083540402835291602001916105bb565b820191906000526020600020905b81548152906001019060200180831161059e57829003601f168201915b5050505050905090565b6000818152606760205260408120546001600160a01b03166106435760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b600061066a82610a53565b9050806001600160a01b0316836001600160a01b031614156106d85760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161063a565b336001600160a01b03821614806106f457506106f481336104b4565b6107665760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161063a565b61077083836114fe565b505050565b61077f338261156c565b61079b5760405162461bcd60e51b815260040161063a906129d0565b610770838383611663565b6000828152609760205260409020600101546107c3905b3361037d565b6108275760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b606482015260840161063a565b6108318282611678565b5050565b61084d600080516020612b928339815191523361037d565b6108695760405162461bcd60e51b815260040161063a90612953565b610881600080516020612b928339815191528261132a565b50565b6001600160a01b03811633146108f45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161063a565b61083182826116fe565b61077083838360405180602001604052806000815250610ea2565b61092161215b565b60cb60008381526020019081526020016000206040518060a00160405290816000820154815260200160018201805480602002602001604051908101604052809291908181526020016000905b82821015610a1a57838290600052602060002001805461098d90612ad9565b80601f01602080910402602001604051908101604052809291908181526020018280546109b990612ad9565b8015610a065780601f106109db57610100808354040283529160200191610a06565b820191906000526020600020905b8154815290600101906020018083116109e957829003601f168201915b50505050508152602001906001019061096e565b5050509082525060028201546001600160a01b031660208201526003820154604082015260049091015460ff1660609091015292915050565b6000818152606760205260408120546001600160a01b03168061052b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161063a565b60006001600160a01b038216610b355760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161063a565b506001600160a01b031660009081526068602052604090205490565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b610b96600080516020612b928339815191523361037d565b610bb25760405162461bcd60e51b815260040161063a90612953565b6000610bbd60ca5490565b9050610bcd60ca80546001019055565b610bd78282611765565b600081815260cc60205260409020839055610770828261177f565b60606066805461054290612ad9565b610c19600080516020612b928339815191523361037d565b610c355760405162461bcd60e51b815260040161063a90612953565b610881600080516020612b9283398151915282610827565b600054610100900460ff1680610c66575060005460ff16155b610c825760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff16158015610ca4576000805461ffff19166101011790555b610cec6040518060400160405280600a81526020016915195b1b195c8813919560b21b815250604051806040016040528060048152602001631513919560e21b8152506117e1565b610cf4611868565b60005b82811015610d5d57610d4b600080516020612b92833981519152858584818110610d3157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d469190612380565b610827565b80610d5581612b14565b915050610cf7565b50604051806060016040528060228152602001612be0602291398051610d8b9160ce91602090910190612196565b506040518060600160405280602e8152602001612bb2602e91398051610db99160cf91602090910190612196565b508015610770576000805461ff0019169055505050565b6001600160a01b038216331415610e295760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161063a565b336000818152606a602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610e96911515815260200190565b60405180910390a35050565b610eac338361156c565b610ec85760405162461bcd60e51b815260040161063a906129d0565b610ed4848484846118eb565b50505050565b610f047fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec423361037d565b610f475760405162461bcd60e51b81526020600482015260146024820152732a32b63632b927232a1d103737ba1030b236b4b760611b604482015260640161063a565b80516108319060cf906020840190612196565b6000610f6461215b565b600083815260cc602090815260408083205480845260cb8352818420825160a0810184528154815260018201805485518188028101880190965280865293985090959194868101949391929084015b8282101561105f578382906000526020600020018054610fd290612ad9565b80601f0160208091040260200160405190810160405280929190818152602001828054610ffe90612ad9565b801561104b5780601f106110205761010080835404028352916020019161104b565b820191906000526020600020905b81548152906001019060200180831161102e57829003601f168201915b505050505081526020019060010190610fb3565b5050509082525060028201546001600160a01b031660208201526003820154604082015260049091015460ff16606090910152919391925050565b6000818152606760205260409020546060906001600160a01b03166111145760405162461bcd60e51b815260206004820152602a60248201527f54656c6c65724e46543a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b606482015260840161063a565b600061111e61191e565b9050600081511161113e5760405180602001604052806000815250611169565b806111488461192d565b6040516020016111599291906127dd565b6040516020818303038152906040525b9392505050565b606060cb6000838152602001908152602001600020600101805480602002602001604051908101604052809291908181526020016000905b828210156112545783829060005260206000200180546111c790612ad9565b80601f01602080910402602001604051908101604052809291908181526020018280546111f390612ad9565b80156112405780601f1061121557610100808354040283529160200191611240565b820191906000526020600020905b81548152906001019060200180831161122357829003601f168201915b5050505050815260200190600101906111a8565b505050509050919050565b611277600080516020612b928339815191523361037d565b6112935760405162461bcd60e51b815260040161063a90612953565b600060cb60006112a260c95490565b8152602080820192909252604001600020835181558382015180519193506112d192600185019291019061221a565b5060408201516002820180546001600160a01b0319166001600160a01b0390921691909117905560608201516003820155608082015160048201805460ff191660ff90921691909117905560c980546001019055610831565b600082815260976020526040902060010154611345906107bd565b6108f45760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b606482015260840161063a565b6001600160a01b038116600090815260cd602052604090206060906113ce81611a17565b67ffffffffffffffff8111156113f457634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561141d578160200160208202803683370190505b50915060005b8251811015611473576114368282611a21565b83828151811061145657634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061146b81612b14565b915050611423565b5050919050565b606060cf805461054290612ad9565b60006001600160e01b031982166380ac58cd60e01b14806114ba57506001600160e01b03198216635b5e139f60e01b145b8061052b57506301ffc9a760e01b6001600160e01b031983161461052b565b60006001600160e01b03198216637965db0b60e01b148061052b575061052b82611489565b600081815260696020526040902080546001600160a01b0319166001600160a01b038416908117909155819061153382610a53565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606760205260408120546001600160a01b03166115e55760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161063a565b60006115f083610a53565b9050806001600160a01b0316846001600160a01b0316148061162b5750836001600160a01b0316611620846105c5565b6001600160a01b0316145b8061165b57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b949350505050565b61166d828261177f565b610770838383611a2d565b6116828282610b51565b6108315760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556116ba3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6117088282610b51565b156108315760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610831828260405180602001604052806000815250611bcd565b600061178a82610a53565b90506001600160a01b038116156117bf576001600160a01b038116600090815260cd602052604090206117bd9083611c00565b505b6001600160a01b038316600090815260cd60205260409020610ed49083611c0c565b600054610100900460ff16806117fa575060005460ff16155b6118165760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff16158015611838576000805461ffff19166101011790555b611840611c18565b611848611c18565b6118528383611c82565b8015610770576000805461ff0019169055505050565b600054610100900460ff1680611881575060005460ff16155b61189d5760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff161580156118bf576000805461ffff19166101011790555b6118c7611c18565b6118cf611c18565b6118d7611c18565b8015610881576000805461ff001916905550565b6118f6848484611663565b61190284848484611d00565b610ed45760405162461bcd60e51b815260040161063a90612901565b606060ce805461054290612ad9565b600081815260cc6020908152604080832054835260cb9091529020600101805460609190819061195e908590611e0d565b8154811061197c57634e487b7160e01b600052603260045260246000fd5b90600052602060002001805461199190612ad9565b80601f01602080910402602001604051908101604052809291908181526020018280546119bd90612ad9565b8015611a0a5780601f106119df57610100808354040283529160200191611a0a565b820191906000526020600020905b8154815290600101906020018083116119ed57829003601f168201915b5050505050915050919050565b600061052b825490565b60006111698383611e19565b826001600160a01b0316611a4082610a53565b6001600160a01b031614611aa85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161063a565b6001600160a01b038216611b0a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161063a565b611b156000826114fe565b6001600160a01b0383166000908152606860205260408120805460019290611b3e908490612a96565b90915550506001600160a01b0382166000908152606860205260408120805460019290611b6c908490612a7e565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611bd78383611ead565b611be46000848484611d00565b6107705760405162461bcd60e51b815260040161063a90612901565b60006111698383611fef565b6000611169838361210c565b600054610100900460ff1680611c31575060005460ff16155b611c4d5760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff161580156118d7576000805461ffff19166101011790558015610881576000805461ff001916905550565b600054610100900460ff1680611c9b575060005460ff16155b611cb75760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff16158015611cd9576000805461ffff19166101011790555b8251611cec906065906020860190612196565b508151610db9906066906020850190612196565b60006001600160a01b0384163b15611e0257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611d4490339089908890889060040161280c565b602060405180830381600087803b158015611d5e57600080fd5b505af1925050508015611d8e575060408051601f3d908101601f19168201909252611d8b918101906125a9565b60015b611de8573d808015611dbc576040519150601f19603f3d011682016040523d82523d6000602084013e611dc1565b606091505b508051611de05760405162461bcd60e51b815260040161063a90612901565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061165b565b506001949350505050565b60006111698284612b2f565b81546000908210611e775760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840161063a565b826000018281548110611e9a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6001600160a01b038216611f035760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161063a565b6000818152606760205260409020546001600160a01b031615611f685760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063a565b6001600160a01b0382166000908152606860205260408120805460019290611f91908490612a7e565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008181526001830160205260408120548015612102576000612013600183612a96565b855490915060009061202790600190612a96565b9050600086600001828154811061204e57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061207f57634e487b7160e01b600052603260045260246000fd5b600091825260209091200155612096836001612a7e565b600082815260018901602052604090205586548790806120c657634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610b78565b6000915050610b78565b600081815260018301602052604081205461215357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b78565b506000610b78565b6040518060a00160405280600081526020016060815260200160006001600160a01b0316815260200160008152602001600060ff1681525090565b8280546121a290612ad9565b90600052602060002090601f0160209004810192826121c4576000855561220a565b82601f106121dd57805160ff191683800117855561220a565b8280016001018555821561220a579182015b8281111561220a5782518255916020019190600101906121ef565b50612216929150612273565b5090565b828054828255906000526020600020908101928215612267579160200282015b828111156122675782518051612257918491602090910190612196565b509160200191906001019061223a565b50612216929150612288565b5b808211156122165760008155600101612274565b8082111561221657600061229c82826122a5565b50600101612288565b5080546122b190612ad9565b6000825580601f106122c35750610881565b601f0160209004906000526020600020908101906108819190612273565b600067ffffffffffffffff8311156122fb576122fb612b65565b61230e601f8401601f1916602001612a4d565b905082815283838301111561232257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461052e57600080fd5b600082601f830112612360578081fd5b611169838335602085016122e1565b803560ff8116811461052e57600080fd5b600060208284031215612391578081fd5b61116982612339565b600080604083850312156123ac578081fd5b6123b583612339565b91506123c360208401612339565b90509250929050565b6000806000606084860312156123e0578081fd5b6123e984612339565b92506123f760208501612339565b9150604084013590509250925092565b6000806000806080858703121561241c578081fd5b61242585612339565b935061243360208601612339565b925060408501359150606085013567ffffffffffffffff811115612455578182fd5b8501601f81018713612465578182fd5b612474878235602084016122e1565b91505092959194509250565b60008060408385031215612492578182fd5b61249b83612339565b9150602083013580151581146124af578182fd5b809150509250929050565b600080604083850312156124cc578182fd5b6124d583612339565b946020939093013593505050565b600080602083850312156124f5578182fd5b823567ffffffffffffffff8082111561250c578384fd5b818501915085601f83011261251f578384fd5b81358181111561252d578485fd5b8660208260051b8501011115612541578485fd5b60209290920196919550909350505050565b600060208284031215612564578081fd5b5035919050565b6000806040838503121561257d578081fd5b823591506123c360208401612339565b60006020828403121561259e578081fd5b813561116981612b7b565b6000602082840312156125ba578081fd5b815161116981612b7b565b6000602082840312156125d6578081fd5b813567ffffffffffffffff8111156125ec578182fd5b61165b84828501612350565b6000602080838503121561260a578182fd5b823567ffffffffffffffff80821115612621578384fd5b9084019060a08287031215612634578384fd5b61263e60a0612a4d565b823581528383013582811115612652578586fd5b8301601f81018813612662578586fd5b80358381111561267457612674612b65565b612682868260051b01612a4d565b8181528681019450828701885b838110156126b8576126a68c8a8435880101612350565b8752958801959088019060010161268f565b505083870152506126cd905060408401612339565b6040820152606083013560608201526126e86080840161236f565b60808201529695505050505050565b6000806040838503121561257d578182fd5b60008151808452612721816020860160208601612aad565b601f01601f19169290920160200192915050565b600060a083018251845260208084015160a08287015282815180855260c08801915060c08160051b89010194508383019250855b818110156127975760bf19898703018352612785868551612709565b95509284019291840191600101612769565b505050505060408301516127b660408601826001600160a01b03169052565b506060830151606085015260808301516127d5608086018260ff169052565b509392505050565b600083516127ef818460208801612aad565b835190830190612803818360208801612aad565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061283f90830184612709565b9695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561289d57603f1988860301845261288b858351612709565b9450928501929085019060010161286f565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156128e2578351835292840192918401916001016128c6565b50909695505050505050565b6000602082526111696020830184612709565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252601590820152742a32b63632b927232a1d103737ba1036b4b73a32b960591b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000602082526111696020830184612735565b60008382526040602083015261165b6040830184612735565b604051601f8201601f1916810167ffffffffffffffff81118282101715612a7657612a76612b65565b604052919050565b60008219821115612a9157612a91612b4f565b500190565b600082821015612aa857612aa8612b4f565b500390565b60005b83811015612ac8578181015183820152602001612ab0565b83811115610ed45750506000910152565b600181811c90821680612aed57607f821691505b60208210811415612b0e57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612b2857612b28612b4f565b5060010190565b600082612b4a57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461088157600080fdfef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9516d5741665146467770747a5255436446326342464a686342326766484a4d64375451743634645a5579736b335268747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732fa26469706673582212202dc51e1ad2a1f02e5651bc637a026144cb0bd9c5e3dddd4eeb896087ca6e025364736f6c63430008030033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c806395d89b411161010f578063c87b56dd116100a2578063d9d6165511610071578063d9d616551461047e578063e8a3d4851461049e578063e985e9c5146104a6578063fe6d8124146104e2576101f0565b8063c87b56dd14610425578063cbee53a314610438578063cf932b7c14610458578063d547741f1461046b576101f0565b8063a22cb465116100de578063a22cb465146103cb578063b88d4fde146103de578063baedc1c4146103f1578063c26b265f14610404576101f0565b806395d89b4114610395578063983b2d561461039d578063a217fddf146103b0578063a224cee7146103b8576101f0565b80633092afd5116101875780636352211e116101565780636352211e1461034957806370a082311461035c57806391d148541461036f57806394bf804d14610382576101f0565b80633092afd5146102f057806336568abe1461030357806342842e0e146103165780634f062c5a14610329576101f0565b806323b872dd116101c357806323b872dd14610272578063248a9ca3146102855780632a0acc6a146102b65780632f2ff15d146102dd576101f0565b806301ffc9a7146101f557806306fdde031461021d578063081812fc14610232578063095ea7b31461025d575b600080fd5b61020861020336600461258d565b6104f7565b60405190151581526020015b60405180910390f35b610225610533565b60405161021491906128ee565b610245610240366004612553565b6105c5565b6040516001600160a01b039091168152602001610214565b61027061026b3660046124ba565b61065f565b005b6102706102803660046123cc565b610775565b6102a8610293366004612553565b60009081526097602052604090206001015490565b604051908152602001610214565b6102a87fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b6102706102eb36600461256b565b6107a6565b6102706102fe366004612380565b610835565b61027061031136600461256b565b610884565b6102706103243660046123cc565b6108fe565b61033c610337366004612553565b610919565b6040516102149190612a21565b610245610357366004612553565b610a53565b6102a861036a366004612380565b610aca565b61020861037d36600461256b565b610b51565b6102706103903660046126f7565b610b7e565b610225610bf2565b6102706103ab366004612380565b610c01565b6102a8600081565b6102706103c63660046124e3565b610c4d565b6102706103d9366004612480565b610dd0565b6102706103ec366004612407565b610ea2565b6102706103ff3660046125c5565b610eda565b610417610412366004612553565b610f5a565b604051610214929190612a34565b610225610433366004612553565b61109a565b61044b610446366004612553565b611170565b6040516102149190612849565b6102706104663660046125f8565b61125f565b61027061047936600461256b565b61132a565b61049161048c366004612380565b6113aa565b60405161021491906128aa565b61022561147a565b6102086104b436600461239a565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6102a8600080516020612b9283398151915281565b60006001600160e01b03198216630d04cfd960e21b148061051c575061051c82611489565b8061052b575061052b826114d9565b90505b919050565b60606065805461054290612ad9565b80601f016020809104026020016040519081016040528092919081815260200182805461056e90612ad9565b80156105bb5780601f10610590576101008083540402835291602001916105bb565b820191906000526020600020905b81548152906001019060200180831161059e57829003601f168201915b5050505050905090565b6000818152606760205260408120546001600160a01b03166106435760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b600061066a82610a53565b9050806001600160a01b0316836001600160a01b031614156106d85760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161063a565b336001600160a01b03821614806106f457506106f481336104b4565b6107665760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161063a565b61077083836114fe565b505050565b61077f338261156c565b61079b5760405162461bcd60e51b815260040161063a906129d0565b610770838383611663565b6000828152609760205260409020600101546107c3905b3361037d565b6108275760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b606482015260840161063a565b6108318282611678565b5050565b61084d600080516020612b928339815191523361037d565b6108695760405162461bcd60e51b815260040161063a90612953565b610881600080516020612b928339815191528261132a565b50565b6001600160a01b03811633146108f45760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161063a565b61083182826116fe565b61077083838360405180602001604052806000815250610ea2565b61092161215b565b60cb60008381526020019081526020016000206040518060a00160405290816000820154815260200160018201805480602002602001604051908101604052809291908181526020016000905b82821015610a1a57838290600052602060002001805461098d90612ad9565b80601f01602080910402602001604051908101604052809291908181526020018280546109b990612ad9565b8015610a065780601f106109db57610100808354040283529160200191610a06565b820191906000526020600020905b8154815290600101906020018083116109e957829003601f168201915b50505050508152602001906001019061096e565b5050509082525060028201546001600160a01b031660208201526003820154604082015260049091015460ff1660609091015292915050565b6000818152606760205260408120546001600160a01b03168061052b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161063a565b60006001600160a01b038216610b355760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161063a565b506001600160a01b031660009081526068602052604090205490565b60008281526097602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b610b96600080516020612b928339815191523361037d565b610bb25760405162461bcd60e51b815260040161063a90612953565b6000610bbd60ca5490565b9050610bcd60ca80546001019055565b610bd78282611765565b600081815260cc60205260409020839055610770828261177f565b60606066805461054290612ad9565b610c19600080516020612b928339815191523361037d565b610c355760405162461bcd60e51b815260040161063a90612953565b610881600080516020612b9283398151915282610827565b600054610100900460ff1680610c66575060005460ff16155b610c825760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff16158015610ca4576000805461ffff19166101011790555b610cec6040518060400160405280600a81526020016915195b1b195c8813919560b21b815250604051806040016040528060048152602001631513919560e21b8152506117e1565b610cf4611868565b60005b82811015610d5d57610d4b600080516020612b92833981519152858584818110610d3157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d469190612380565b610827565b80610d5581612b14565b915050610cf7565b50604051806060016040528060228152602001612be0602291398051610d8b9160ce91602090910190612196565b506040518060600160405280602e8152602001612bb2602e91398051610db99160cf91602090910190612196565b508015610770576000805461ff0019169055505050565b6001600160a01b038216331415610e295760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161063a565b336000818152606a602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610e96911515815260200190565b60405180910390a35050565b610eac338361156c565b610ec85760405162461bcd60e51b815260040161063a906129d0565b610ed4848484846118eb565b50505050565b610f047fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec423361037d565b610f475760405162461bcd60e51b81526020600482015260146024820152732a32b63632b927232a1d103737ba1030b236b4b760611b604482015260640161063a565b80516108319060cf906020840190612196565b6000610f6461215b565b600083815260cc602090815260408083205480845260cb8352818420825160a0810184528154815260018201805485518188028101880190965280865293985090959194868101949391929084015b8282101561105f578382906000526020600020018054610fd290612ad9565b80601f0160208091040260200160405190810160405280929190818152602001828054610ffe90612ad9565b801561104b5780601f106110205761010080835404028352916020019161104b565b820191906000526020600020905b81548152906001019060200180831161102e57829003601f168201915b505050505081526020019060010190610fb3565b5050509082525060028201546001600160a01b031660208201526003820154604082015260049091015460ff16606090910152919391925050565b6000818152606760205260409020546060906001600160a01b03166111145760405162461bcd60e51b815260206004820152602a60248201527f54656c6c65724e46543a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b606482015260840161063a565b600061111e61191e565b9050600081511161113e5760405180602001604052806000815250611169565b806111488461192d565b6040516020016111599291906127dd565b6040516020818303038152906040525b9392505050565b606060cb6000838152602001908152602001600020600101805480602002602001604051908101604052809291908181526020016000905b828210156112545783829060005260206000200180546111c790612ad9565b80601f01602080910402602001604051908101604052809291908181526020018280546111f390612ad9565b80156112405780601f1061121557610100808354040283529160200191611240565b820191906000526020600020905b81548152906001019060200180831161122357829003601f168201915b5050505050815260200190600101906111a8565b505050509050919050565b611277600080516020612b928339815191523361037d565b6112935760405162461bcd60e51b815260040161063a90612953565b600060cb60006112a260c95490565b8152602080820192909252604001600020835181558382015180519193506112d192600185019291019061221a565b5060408201516002820180546001600160a01b0319166001600160a01b0390921691909117905560608201516003820155608082015160048201805460ff191660ff90921691909117905560c980546001019055610831565b600082815260976020526040902060010154611345906107bd565b6108f45760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b606482015260840161063a565b6001600160a01b038116600090815260cd602052604090206060906113ce81611a17565b67ffffffffffffffff8111156113f457634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561141d578160200160208202803683370190505b50915060005b8251811015611473576114368282611a21565b83828151811061145657634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061146b81612b14565b915050611423565b5050919050565b606060cf805461054290612ad9565b60006001600160e01b031982166380ac58cd60e01b14806114ba57506001600160e01b03198216635b5e139f60e01b145b8061052b57506301ffc9a760e01b6001600160e01b031983161461052b565b60006001600160e01b03198216637965db0b60e01b148061052b575061052b82611489565b600081815260696020526040902080546001600160a01b0319166001600160a01b038416908117909155819061153382610a53565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606760205260408120546001600160a01b03166115e55760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161063a565b60006115f083610a53565b9050806001600160a01b0316846001600160a01b0316148061162b5750836001600160a01b0316611620846105c5565b6001600160a01b0316145b8061165b57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b949350505050565b61166d828261177f565b610770838383611a2d565b6116828282610b51565b6108315760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556116ba3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6117088282610b51565b156108315760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610831828260405180602001604052806000815250611bcd565b600061178a82610a53565b90506001600160a01b038116156117bf576001600160a01b038116600090815260cd602052604090206117bd9083611c00565b505b6001600160a01b038316600090815260cd60205260409020610ed49083611c0c565b600054610100900460ff16806117fa575060005460ff16155b6118165760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff16158015611838576000805461ffff19166101011790555b611840611c18565b611848611c18565b6118528383611c82565b8015610770576000805461ff0019169055505050565b600054610100900460ff1680611881575060005460ff16155b61189d5760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff161580156118bf576000805461ffff19166101011790555b6118c7611c18565b6118cf611c18565b6118d7611c18565b8015610881576000805461ff001916905550565b6118f6848484611663565b61190284848484611d00565b610ed45760405162461bcd60e51b815260040161063a90612901565b606060ce805461054290612ad9565b600081815260cc6020908152604080832054835260cb9091529020600101805460609190819061195e908590611e0d565b8154811061197c57634e487b7160e01b600052603260045260246000fd5b90600052602060002001805461199190612ad9565b80601f01602080910402602001604051908101604052809291908181526020018280546119bd90612ad9565b8015611a0a5780601f106119df57610100808354040283529160200191611a0a565b820191906000526020600020905b8154815290600101906020018083116119ed57829003601f168201915b5050505050915050919050565b600061052b825490565b60006111698383611e19565b826001600160a01b0316611a4082610a53565b6001600160a01b031614611aa85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161063a565b6001600160a01b038216611b0a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161063a565b611b156000826114fe565b6001600160a01b0383166000908152606860205260408120805460019290611b3e908490612a96565b90915550506001600160a01b0382166000908152606860205260408120805460019290611b6c908490612a7e565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611bd78383611ead565b611be46000848484611d00565b6107705760405162461bcd60e51b815260040161063a90612901565b60006111698383611fef565b6000611169838361210c565b600054610100900460ff1680611c31575060005460ff16155b611c4d5760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff161580156118d7576000805461ffff19166101011790558015610881576000805461ff001916905550565b600054610100900460ff1680611c9b575060005460ff16155b611cb75760405162461bcd60e51b815260040161063a90612982565b600054610100900460ff16158015611cd9576000805461ffff19166101011790555b8251611cec906065906020860190612196565b508151610db9906066906020850190612196565b60006001600160a01b0384163b15611e0257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611d4490339089908890889060040161280c565b602060405180830381600087803b158015611d5e57600080fd5b505af1925050508015611d8e575060408051601f3d908101601f19168201909252611d8b918101906125a9565b60015b611de8573d808015611dbc576040519150601f19603f3d011682016040523d82523d6000602084013e611dc1565b606091505b508051611de05760405162461bcd60e51b815260040161063a90612901565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061165b565b506001949350505050565b60006111698284612b2f565b81546000908210611e775760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b606482015260840161063a565b826000018281548110611e9a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6001600160a01b038216611f035760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161063a565b6000818152606760205260409020546001600160a01b031615611f685760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161063a565b6001600160a01b0382166000908152606860205260408120805460019290611f91908490612a7e565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008181526001830160205260408120548015612102576000612013600183612a96565b855490915060009061202790600190612a96565b9050600086600001828154811061204e57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061207f57634e487b7160e01b600052603260045260246000fd5b600091825260209091200155612096836001612a7e565b600082815260018901602052604090205586548790806120c657634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610b78565b6000915050610b78565b600081815260018301602052604081205461215357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b78565b506000610b78565b6040518060a00160405280600081526020016060815260200160006001600160a01b0316815260200160008152602001600060ff1681525090565b8280546121a290612ad9565b90600052602060002090601f0160209004810192826121c4576000855561220a565b82601f106121dd57805160ff191683800117855561220a565b8280016001018555821561220a579182015b8281111561220a5782518255916020019190600101906121ef565b50612216929150612273565b5090565b828054828255906000526020600020908101928215612267579160200282015b828111156122675782518051612257918491602090910190612196565b509160200191906001019061223a565b50612216929150612288565b5b808211156122165760008155600101612274565b8082111561221657600061229c82826122a5565b50600101612288565b5080546122b190612ad9565b6000825580601f106122c35750610881565b601f0160209004906000526020600020908101906108819190612273565b600067ffffffffffffffff8311156122fb576122fb612b65565b61230e601f8401601f1916602001612a4d565b905082815283838301111561232257600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461052e57600080fd5b600082601f830112612360578081fd5b611169838335602085016122e1565b803560ff8116811461052e57600080fd5b600060208284031215612391578081fd5b61116982612339565b600080604083850312156123ac578081fd5b6123b583612339565b91506123c360208401612339565b90509250929050565b6000806000606084860312156123e0578081fd5b6123e984612339565b92506123f760208501612339565b9150604084013590509250925092565b6000806000806080858703121561241c578081fd5b61242585612339565b935061243360208601612339565b925060408501359150606085013567ffffffffffffffff811115612455578182fd5b8501601f81018713612465578182fd5b612474878235602084016122e1565b91505092959194509250565b60008060408385031215612492578182fd5b61249b83612339565b9150602083013580151581146124af578182fd5b809150509250929050565b600080604083850312156124cc578182fd5b6124d583612339565b946020939093013593505050565b600080602083850312156124f5578182fd5b823567ffffffffffffffff8082111561250c578384fd5b818501915085601f83011261251f578384fd5b81358181111561252d578485fd5b8660208260051b8501011115612541578485fd5b60209290920196919550909350505050565b600060208284031215612564578081fd5b5035919050565b6000806040838503121561257d578081fd5b823591506123c360208401612339565b60006020828403121561259e578081fd5b813561116981612b7b565b6000602082840312156125ba578081fd5b815161116981612b7b565b6000602082840312156125d6578081fd5b813567ffffffffffffffff8111156125ec578182fd5b61165b84828501612350565b6000602080838503121561260a578182fd5b823567ffffffffffffffff80821115612621578384fd5b9084019060a08287031215612634578384fd5b61263e60a0612a4d565b823581528383013582811115612652578586fd5b8301601f81018813612662578586fd5b80358381111561267457612674612b65565b612682868260051b01612a4d565b8181528681019450828701885b838110156126b8576126a68c8a8435880101612350565b8752958801959088019060010161268f565b505083870152506126cd905060408401612339565b6040820152606083013560608201526126e86080840161236f565b60808201529695505050505050565b6000806040838503121561257d578182fd5b60008151808452612721816020860160208601612aad565b601f01601f19169290920160200192915050565b600060a083018251845260208084015160a08287015282815180855260c08801915060c08160051b89010194508383019250855b818110156127975760bf19898703018352612785868551612709565b95509284019291840191600101612769565b505050505060408301516127b660408601826001600160a01b03169052565b506060830151606085015260808301516127d5608086018260ff169052565b509392505050565b600083516127ef818460208801612aad565b835190830190612803818360208801612aad565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061283f90830184612709565b9695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561289d57603f1988860301845261288b858351612709565b9450928501929085019060010161286f565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156128e2578351835292840192918401916001016128c6565b50909695505050505050565b6000602082526111696020830184612709565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252601590820152742a32b63632b927232a1d103737ba1036b4b73a32b960591b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000602082526111696020830184612735565b60008382526040602083015261165b6040830184612735565b604051601f8201601f1916810167ffffffffffffffff81118282101715612a7657612a76612b65565b604052919050565b60008219821115612a9157612a91612b4f565b500190565b600082821015612aa857612aa8612b4f565b500390565b60005b83811015612ac8578181015183820152602001612ab0565b83811115610ed45750506000910152565b600181811c90821680612aed57607f821691505b60208210811415612b0e57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612b2857612b28612b4f565b5060010190565b600082612b4a57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461088157600080fdfef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9516d5741665146467770747a5255436446326342464a686342326766484a4d64375451743634645a5579736b335268747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732fa26469706673582212202dc51e1ad2a1f02e5651bc637a026144cb0bd9c5e3dddd4eeb896087ca6e025364736f6c63430008030033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.