Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
- Contract name:
- HorseNFT
- Optimization enabled
- true
- Compiler version
- v0.8.2+commit.661d1103
- Optimization runs
- 999999
- EVM Version
- default
- Verified at
- 2023-04-12 04:10:07.782692Z
Contract source code
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
/**
* @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);
}
/**
* @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;
}
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @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);
}
/**
* @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);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
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
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/**
* @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 ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings 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.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.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(ERC721.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(ERC721.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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @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);
}
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
// 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. 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;
}
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
abstract contract OwnerOperator is Ownable {
mapping(address => bool) public operators;
constructor() Ownable() {}
modifier operatorOrOwner() {
require(operators[msg.sender] || owner() == msg.sender, "OwnerOperator: !operator, !owner");
_;
}
modifier onlyOperator() {
require(operators[msg.sender], "OwnerOperator: !operator");
_;
}
function addOperator(address operator) external virtual onlyOwner {
require(operator != address(0), "OwnerOperator: operator is the zero address");
operators[operator] = true;
}
function removeOperator(address operator) external virtual onlyOwner {
require(operator != address(0), "OwnerOperator: operator is the zero address");
operators[operator] = false;
}
}
/**
* @dev BytesLibrary operations.
*/
library BytesLibrary {
function toString(bytes32 value) internal pure returns (string memory) {
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(64);
for (uint256 i = 0; i < 32; i++) {
str[i * 2] = alphabet[uint8(value[i] >> 4)];
str[1 + i * 2] = alphabet[uint8(value[i] & 0x0f)];
}
return string(str);
}
}
library UintLibrary {
using SafeMath for uint256;
function toString(uint256 i) internal pure returns (string memory) {
if (i == 0) {
return "0";
}
uint256 j = i;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
for (uint256 k = len; k > 0; k--) {
bstr[k - 1] = bytes1(uint8(48 + (i % 10)));
i /= 10;
}
return string(bstr);
}
function bp(uint256 value, uint256 bpValue) internal pure returns (uint256) {
return value.mul(bpValue).div(10000);
}
}
library StringLibrary {
using UintLibrary for uint256;
function append(string memory a, string memory b) internal pure returns (string memory) {
bytes memory ba = bytes(a);
bytes memory bb = bytes(b);
bytes memory bab = new bytes(ba.length + bb.length);
uint256 k = 0;
for (uint256 i = 0; i < ba.length; i++) bab[k++] = ba[i];
for (uint256 i = 0; i < bb.length; i++) bab[k++] = bb[i];
return string(bab);
}
function append(
string memory a,
string memory b,
string memory c
) internal pure returns (string memory) {
bytes memory ba = bytes(a);
bytes memory bb = bytes(b);
bytes memory bc = bytes(c);
bytes memory bbb = new bytes(ba.length + bb.length + bc.length);
uint256 k = 0;
for (uint256 i = 0; i < ba.length; i++) bbb[k++] = ba[i];
for (uint256 i = 0; i < bb.length; i++) bbb[k++] = bb[i];
for (uint256 i = 0; i < bc.length; i++) bbb[k++] = bc[i];
return string(bbb);
}
function recover(
string memory message,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
bytes memory msgBytes = bytes(message);
bytes memory fullMessage = concat(
bytes("\x19Ethereum Signed Message:\n"),
bytes(msgBytes.length.toString()),
msgBytes,
new bytes(0),
new bytes(0),
new bytes(0),
new bytes(0)
);
return ecrecover(keccak256(fullMessage), v, r, s);
}
function concat(
bytes memory ba,
bytes memory bb,
bytes memory bc,
bytes memory bd,
bytes memory be,
bytes memory bf,
bytes memory bg
) internal pure returns (bytes memory) {
bytes memory resultBytes = new bytes(ba.length + bb.length + bc.length + bd.length + be.length + bf.length + bg.length);
uint256 k = 0;
for (uint256 i = 0; i < ba.length; i++) resultBytes[k++] = ba[i];
for (uint256 i = 0; i < bb.length; i++) resultBytes[k++] = bb[i];
for (uint256 i = 0; i < bc.length; i++) resultBytes[k++] = bc[i];
for (uint256 i = 0; i < bd.length; i++) resultBytes[k++] = bd[i];
for (uint256 i = 0; i < be.length; i++) resultBytes[k++] = be[i];
for (uint256 i = 0; i < bf.length; i++) resultBytes[k++] = bf[i];
for (uint256 i = 0; i < bg.length; i++) resultBytes[k++] = bg[i];
return resultBytes;
}
}
interface IHorseNFT is IERC721Enumerable {
event AddNewToken(uint256 indexed tokenId, address indexed owner);
event RemoveToken(uint256 indexed tokenId, address indexed caller);
event MintSign(address indexed owner, address indexed caller, address indexed signer, string none);
struct Metadata {
uint256 id;
string metaUrl;
}
struct MintData {
address owner;
uint256 blockExpired;
uint256[] ids;
string[] metaUrls;
string none;
uint8 v;
bytes32 r;
bytes32 s;
}
function mint(
address to,
uint256 tokenId,
string memory metaUrl
) external;
function burn(uint256 tokenId) external;
function isExists(uint256 tokenId) external view returns (bool);
}
contract HorseNFT is OwnerOperator, ERC721Enumerable, Pausable, IHorseNFT {
using SafeMath for uint256;
using StringLibrary for string;
using BytesLibrary for bytes32;
// Base URI of all token
string public baseTokenURI;
// Mapping from token ID to token metadata
mapping(uint256 => Metadata) private metadatas;
// Mapping from meta url to check url used
mapping(string => bool) private usedUrl;
// Mapping from meta url to token id
mapping(string => uint256) private idOfUrl;
uint256 public maxMinSize = 10;
constructor() OwnerOperator() Pausable() ERC721("HorseNFT", "HOR") {}
/**
* @dev Pauses all token transfers. See {Pausable-_pause}.
*/
function pause() external virtual onlyOwner {
_pause();
}
/**
* @dev Unpauses all token transfers. See {Pausable-_unpause}.
*/
function unpause() external virtual onlyOwner {
_unpause();
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function setBaseURI(string memory baseURI) external virtual onlyOwner {
baseTokenURI = baseURI;
}
function setMaxMinSize(uint256 max) external virtual onlyOwner {
maxMinSize = max;
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*
* See {ERC721-_baseURI}.
*/
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
function isExists(uint256 tokenId) external view virtual override returns (bool) {
return _exists(tokenId);
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "HorseNFT: URI query for nonexistent token");
string memory base = _baseURI();
string memory metaUrl = metadatas[tokenId].metaUrl;
return
bytes(base).length > 0
? (
bytes(metaUrl).length > 0
? string(abi.encodePacked(base, metadatas[tokenId].metaUrl))
: string(abi.encodePacked(base, metadatas[tokenId].id))
)
: "";
}
/**
* @dev Get token matadata of token id
*/
function getTokenMetadata(uint256 tokenId) external view virtual returns (Metadata memory) {
require(_exists(tokenId), "HorseNFT: Metadata query for nonexistent token");
return metadatas[tokenId];
}
/**
* @dev Get token matadata of token id
*/
function tokenIdOfMetaUrl(string memory metaUrl) external view virtual returns (uint256) {
require(usedUrl[metaUrl], "HorseNFT: nonexistent token");
return idOfUrl[metaUrl];
}
/**
* @dev See {ERC721-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "HorseNFT: token transfer while paused");
}
function _mintInternal(
address to,
uint256 tokenId,
string memory metaUrl
) internal virtual {
require(!usedUrl[metaUrl], "HorseNFT: metaUrl existed");
usedUrl[metaUrl] = true;
idOfUrl[metaUrl] = tokenId;
metadatas[tokenId] = Metadata({id: tokenId, metaUrl: metaUrl});
_safeMint(to, tokenId);
emit AddNewToken(tokenId, to);
}
/**
* @dev Creates `amount` new token for `to`. See {ERC721-_safeMint}.
*/
function mint(
address to,
uint256 tokenId,
string memory metaUrl
) external virtual override operatorOrOwner {
_mintInternal(to, tokenId, metaUrl);
}
/**
* @dev Admin mint multi token for `to`. See {ERC721-_safeMint}.
*/
function multiMint(
address to,
uint256[] memory ids,
string[] memory metaUrls
) external virtual operatorOrOwner {
uint256 len = ids.length;
require(len == metaUrls.length, "HorseNFT: metaUrls.length != ids.length");
for (uint256 i = 0; i < len; i++) {
_mintInternal(to, ids[i], metaUrls[i]);
}
}
/**
* @dev Admin mint multi token for `list to`. See {ERC721-_safeMint}.
*/
function multiMintToMultiAddress(
address[] memory to,
uint256[] memory ids,
string[] memory metaUrls
) external virtual operatorOrOwner{
uint256 len = ids.length;
require(to.length == len, "HorseNFT: addressToLen != idsLen");
require(len == metaUrls.length, "HorseNFT: metaUrls.length != ids.length");
for(uint256 i = 0; i < len; i++) {
_mintInternal(to[i], ids[i], metaUrls[i]);
}
}
/**
* @dev multi transfer token `to`. See {ERC721-_safeTransferFrom}.
*/
function multiTransfer(address to, uint256[] memory ids) external virtual {
uint256 len = ids.length;
for (uint256 i = 0; i < len; i++) {
safeTransferFrom(msg.sender, to, ids[i]);
}
}
/**
* @dev Update metadata to upgrade NFT properties
*/
function updateMetaUrl(uint256 tokenId, string memory metaUrl) external virtual operatorOrOwner {
require(_exists(tokenId), "HorseNFT: nonexistent token");
require(!usedUrl[metaUrl], "HorseNFT: metaUrl existed");
delete usedUrl[metadatas[tokenId].metaUrl];
usedUrl[metaUrl] = true;
delete idOfUrl[metadatas[tokenId].metaUrl];
idOfUrl[metaUrl] = tokenId;
metadatas[tokenId].metaUrl = metaUrl;
}
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*/
function burn(uint256 tokenId) external virtual override {
// solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "HorseNFT: caller is not owner nor approved");
delete usedUrl[metadatas[tokenId].metaUrl];
delete idOfUrl[metadatas[tokenId].metaUrl];
_burn(tokenId);
emit RemoveToken(tokenId, _msgSender());
}
//////////////////Mint Functions//////////////////
// Checking sign message
mapping(bytes32 => bool) public mintCompleted;
// Mapping from none to mintData
mapping(string => MintData) public mintData;
// Mapping from user address to mint count
mapping(address => uint256) public mintCountOf;
// Mapping from user address to numbers of minted item
mapping(address => uint256) public mintQuantityOf;
// Mapping from user address and mint index to mint none
mapping(address => mapping(uint256 => string)) public mintNoneOf;
function mintSign(MintData memory data) external virtual {
uint256 len = data.ids.length;
require(len <= maxMinSize, "HorseNFT: limit item mint");
require(len == data.metaUrls.length, "HorseNFT: metaUrls.length != ids.length");
require(_msgSender() == data.owner || operators[_msgSender()], "HorseNFT: sender is not owner or operator");
(bytes32 message, address signer) = _verifyMint(data);
mintCompleted[message] = true;
mintQuantityOf[data.owner] = mintQuantityOf[data.owner].add(len);
mintData[data.none] = data;
mintNoneOf[data.owner][mintCountOf[data.owner]] = data.none;
mintCountOf[data.owner] = mintCountOf[data.owner].add(1);
for (uint256 i = 0; i < len; i++) {
_mintInternal(data.owner, data.ids[i], data.metaUrls[i]);
}
emit MintSign(data.owner, _msgSender(), signer, data.none);
}
function _generateKeyForMint(
address owner,
uint256 blockExpired,
uint256[] memory ids,
string[] memory metaUrls,
string memory none
) internal pure returns (bytes32) {
return keccak256(abi.encode(owner, blockExpired, ids, metaUrls, none));
}
function _verifyMint(MintData memory data) internal view returns (bytes32, address) {
bytes32 message = _generateKeyForMint(data.owner, data.blockExpired, data.ids, data.metaUrls, data.none);
address signer = message.toString().recover(data.v, data.r, data.s);
require(operators[signer], "HorseNFT: mint not verify");
require(block.number < data.blockExpired, "HorseNFT: mint expired");
require(!mintCompleted[message], "HorseNFT: mint completed");
require(mintData[data.none].owner == address(0), "HorseNFT: none existed");
return (message, signer);
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"AddNewToken","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"address","name":"owner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"MintSign","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"caller","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":true},{"type":"string","name":"none","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RemoveToken","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"address","name":"caller","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"baseTokenURI","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct IHorseNFT.Metadata","components":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"string","name":"metaUrl","internalType":"string"}]}],"name":"getTokenMetadata","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExists","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxMinSize","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"metaUrl","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"mintCompleted","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"mintCountOf","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"string","name":"none","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}],"name":"mintData","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"mintNoneOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"mintQuantityOf","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mintSign","inputs":[{"type":"tuple","name":"data","internalType":"struct IHorseNFT.MintData","components":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"},{"type":"string[]","name":"metaUrls","internalType":"string[]"},{"type":"string","name":"none","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"multiMint","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"},{"type":"string[]","name":"metaUrls","internalType":"string[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"multiMintToMultiAddress","inputs":[{"type":"address[]","name":"to","internalType":"address[]"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"},{"type":"string[]","name":"metaUrls","internalType":"string[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"multiTransfer","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"operators","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseURI","inputs":[{"type":"string","name":"baseURI","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxMinSize","inputs":[{"type":"uint256","name":"max","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenIdOfMetaUrl","inputs":[{"type":"string","name":"metaUrl","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateMetaUrl","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"metaUrl","internalType":"string"}]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106102f45760003560e01c80638456cb5911610191578063b9602803116100e3578063d5b4f0a111610097578063f01e737711610071578063f01e737714610696578063f2fde38b146106a9578063fcfdccc6146106bc576102f4565b8063d5b4f0a114610615578063ddaf164714610628578063e985e9c51461064d576102f4565b8063ce17930d116100c8578063ce17930d146105e7578063d3fc9864146105fa578063d547cfb71461060d576102f4565b8063b9602803146105cb578063c87b56dd146105d4576102f4565b80639870d7fe11610145578063ac8a584a1161011f578063ac8a584a14610582578063b616bc9c14610595578063b88d4fde146105b8576102f4565b80639870d7fe146105495780639d36788e1461055c578063a22cb4651461056f576102f4565b80638da5cb5b116101765780638da5cb5b146105105780639452c1b31461052e57806395d89b4114610541576102f4565b80638456cb59146104e85780638771be8a146104f0576102f4565b806342842e0e1161024a5780635c975abb116101fe57806370a08231116101d857806370a08231146104ad578063715018a6146104c057806377a24796146104c8576102f4565b80635c975abb1461046f578063603168011461047a5780636352211e1461049a576102f4565b80634f6ccce71161022f5780634f6ccce71461043657806355f804b31461044957806356dfc93b1461045c576102f4565b806342842e0e1461041057806342966c6814610423576102f4565b806317b7649f116102ac5780632cc460a2116102865780632cc460a2146103e25780632f745c59146103f55780633f4ba83a14610408576102f4565b806317b7649f146103a657806318160ddd146103c757806323b872dd146103cf576102f4565b8063081812fc116102dd578063081812fc14610336578063095ea7b31461036e57806313e7c9d814610383576102f4565b806301ffc9a7146102f957806306fdde0314610321575b600080fd5b61030c6103073660046154e4565b6106cf565b60405190151581526020015b60405180910390f35b61032961072d565b6040516103189190615997565b6103496103443660046154cc565b6107bf565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610318565b61038161037c3660046153af565b61089e565b005b61030c6103913660046151b8565b60016020526000908152604090205460ff1681565b6103b96103b436600461551c565b610a2b565b604051908152602001610318565b600a546103b9565b6103816103dd366004615204565b610adc565b6103816103f036600461554f565b610b7e565b6103b96104033660046153af565b611101565b6103816111d0565b61038161041e366004615204565b61125b565b6103816104313660046154cc565b611276565b6103b96104443660046154cc565b6113ce565b61038161045736600461551c565b6114b3565b61038161046a3660046154cc565b61154b565b600c5460ff1661030c565b61048d6104883660046154cc565b6115d1565b60405161031891906159aa565b6103496104a83660046154cc565b611761565b6103b96104bb3660046151b8565b611813565b6103816118e1565b6103b96104d63660046151b8565b60156020526000908152604090205481565b61038161196c565b6103b96104fe3660046151b8565b60146020526000908152604090205481565b60005473ffffffffffffffffffffffffffffffffffffffff16610349565b61032961053c3660046153af565b6119f5565b610329611a9a565b6103816105573660046151b8565b611aa9565b61030c61056a3660046154cc565b611c1f565b61038161057d366004615375565b611c4b565b6103816105903660046151b8565b611d7c565b61030c6105a33660046154cc565b60126020526000908152604090205460ff1681565b6103816105c636600461523f565b611eec565b6103b960115481565b6103296105e23660046154cc565b611f94565b6103816105f5366004615423565b612191565b6103816106083660046153d8565b612426565b6103296124e8565b610381610623366004615304565b6124f5565b61063b61063636600461551c565b612698565b60405161031896959493929190615941565b61030c61065b3660046151d2565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260076020908152604080832093909416825291909152205460ff1690565b6103816106a4366004615647565b61277d565b6103816106b73660046151b8565b612a6e565b6103816106ca3660046152b8565b612b9e565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d63000000000000000000000000000000000000000000000000000000001480610725575061072582612c08565b90505b919050565b60606002805461073c90615b23565b80601f016020809104026020016040519081016040528092919081815260200182805461076890615b23565b80156107b55780601f1061078a576101008083540402835291602001916107b5565b820191906000526020600020905b81548152906001019060200180831161079857829003601f168201915b5050505050905090565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff16610875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060009081526006602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006108a982611761565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610967576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161086c565b3373ffffffffffffffffffffffffffffffffffffffff821614806109905750610990813361065b565b610a1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161086c565b610a268383612ceb565b505050565b6000600f82604051610a3d919061579b565b9081526040519081900360200190205460ff16610ab6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f486f7273654e46543a206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161086c565b601082604051610ac6919061579b565b9081526020016040518091039020549050919050565b610ae7335b82612d8b565b610b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161086c565b610a26838383612ef7565b604081015151601154811115610bf0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f486f7273654e46543a206c696d6974206974656d206d696e7400000000000000604482015260640161086c565b8160600151518114610c84576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f486f7273654e46543a206d65746155726c732e6c656e67746820213d2069647360448201527f2e6c656e67746800000000000000000000000000000000000000000000000000606482015260840161086c565b815173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610cce57503360009081526001602052604090205460ff165b610d5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f486f7273654e46543a2073656e646572206973206e6f74206f776e6572206f7260448201527f206f70657261746f720000000000000000000000000000000000000000000000606482015260840161086c565b600080610d6684613169565b600082815260126020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055885173ffffffffffffffffffffffffffffffffffffffff16835260159091529020549193509150610dd190846133f1565b845173ffffffffffffffffffffffffffffffffffffffff166000908152601560205260409081902091909155608085015190518591601391610e13919061579b565b9081526040805160209281900383019020835181547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9091161781558383015160018201559083015180519192610e8892600285019290910190614ea8565b5060608201518051610ea4916003840191602090910190614ef3565b5060808201518051610ec0916004840191602090910190614f4c565b5060a08201516005820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff90921691909117905560c0820151600682015560e0909101516007909101556080840151845173ffffffffffffffffffffffffffffffffffffffff908116600090815260166020908152604080832089519094168352601482528083205483529281529190208251610f6793919290910190614f4c565b50835173ffffffffffffffffffffffffffffffffffffffff16600090815260146020526040902054610f9a9060016133f1565b845173ffffffffffffffffffffffffffffffffffffffff166000908152601460205260408120919091555b8381101561107657611064856000015186604001518381518110611012577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015187606001518481518110611057577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151613404565b8061106e81615b77565b915050610fc5565b5073ffffffffffffffffffffffffffffffffffffffff81163373ffffffffffffffffffffffffffffffffffffffff16856000015173ffffffffffffffffffffffffffffffffffffffff167f44ca890b6fe15d61b0bc9daf9f6f9ac97dd8a3ff35367721531f62ce8b38492087608001516040516110f39190615997565b60405180910390a450505050565b600061110c83611813565b821061119a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e6473000000000000000000000000000000000000000000606482015260840161086c565b5073ffffffffffffffffffffffffffffffffffffffff919091166000908152600860209081526040808320938352929052205490565b60005473ffffffffffffffffffffffffffffffffffffffff163314611251576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b611259613591565b565b610a2683838360405180602001604052806000815250611eec565b61127f33610ae1565b61130b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f486f7273654e46543a2063616c6c6572206973206e6f74206f776e6572206e6f60448201527f7220617070726f76656400000000000000000000000000000000000000000000606482015260840161086c565b600f600e60008381526020019081526020016000206001016040516113309190615800565b90815260408051918290036020908101832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556000848152600e909152206010916113839160010190615800565b90815260200160405180910390206000905561139e81613672565b604051339082907fcadf6fd3968e653eef0f298763a80925d054059a599c46fadf9d319d9653bd8690600090a350565b60006113d9600a5490565b8210611467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e64730000000000000000000000000000000000000000606482015260840161086c565b600a82815481106114a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611534576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b805161154790600d906020840190614f4c565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146115cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b601155565b6040805180820190915260008152606060208201526116148260009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff16151590565b6116a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f486f7273654e46543a204d6574616461746120717565727920666f72206e6f6e60448201527f6578697374656e7420746f6b656e000000000000000000000000000000000000606482015260840161086c565b600e6000838152602001908152602001600020604051806040016040529081600082015481526020016001820180546116d890615b23565b80601f016020809104026020016040519081016040528092919081815260200182805461170490615b23565b80156117515780601f1061172657610100808354040283529160200191611751565b820191906000526020600020905b81548152906001019060200180831161173457829003601f168201915b5050505050815250509050919050565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610725576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e0000000000000000000000000000000000000000000000606482015260840161086c565b600073ffffffffffffffffffffffffffffffffffffffff82166118b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f206164647265737300000000000000000000000000000000000000000000606482015260840161086c565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526005602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff163314611962576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b611259600061374b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146119ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b6112596137c0565b601660209081526000928352604080842090915290825290208054611a1990615b23565b80601f0160208091040260200160405190810160405280929190818152602001828054611a4590615b23565b8015611a925780601f10611a6757610100808354040283529160200191611a92565b820191906000526020600020905b815481529060010190602001808311611a7557829003601f168201915b505050505081565b60606003805461073c90615b23565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b73ffffffffffffffffffffffffffffffffffffffff8116611bcd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f2061646472657373000000000000000000000000000000000000000000606482015260840161086c565b73ffffffffffffffffffffffffffffffffffffffff16600090815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff161515610725565b73ffffffffffffffffffffffffffffffffffffffff8216331415611ccb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161086c565b33600081815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925290912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168415151790559073ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d70911515815260200190565b60405180910390a35050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611dfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b73ffffffffffffffffffffffffffffffffffffffff8116611ea0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f2061646472657373000000000000000000000000000000000000000000606482015260840161086c565b73ffffffffffffffffffffffffffffffffffffffff16600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b611ef63383612d8b565b611f82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161086c565b611f8e84848484613880565b50505050565b60008181526004602052604090205460609073ffffffffffffffffffffffffffffffffffffffff16612048576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f486f7273654e46543a2055524920717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e0000000000000000000000000000000000000000000000606482015260840161086c565b6000612052613923565b6000848152600e602052604081206001018054929350909161207390615b23565b80601f016020809104026020016040519081016040528092919081815260200182805461209f90615b23565b80156120ec5780601f106120c1576101008083540402835291602001916120ec565b820191906000526020600020905b8154815290600101906020018083116120cf57829003601f168201915b5050505050905060008251116121115760405180602001604052806000815250612189565b6000815111612151576000848152600e602090815260409182902054915161213d9285929091016157de565b604051602081830303815290604052612189565b81600e60008681526020019081526020016000206001016040516020016121799291906157b7565b6040516020818303038152906040525b949350505050565b3360009081526001602052604090205460ff16806121e25750336121ca60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b612248576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e6572604482015260640161086c565b8151835181146122b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f486f7273654e46543a2061646472657373546f4c656e20213d206964734c656e604482015260640161086c565b81518114612344576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f486f7273654e46543a206d65746155726c732e6c656e67746820213d2069647360448201527f2e6c656e67746800000000000000000000000000000000000000000000000000606482015260840161086c565b60005b8181101561241f5761240d85828151811061238b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518583815181106123cc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151858481518110611057577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8061241781615b77565b915050612347565b5050505050565b3360009081526001602052604090205460ff168061247757503361245f60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b6124dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e6572604482015260640161086c565b610a26838383613404565b600d8054611a1990615b23565b3360009081526001602052604090205460ff168061254657503361252e60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b6125ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e6572604482015260640161086c565b81518151811461263e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f486f7273654e46543a206d65746155726c732e6c656e67746820213d2069647360448201527f2e6c656e67746800000000000000000000000000000000000000000000000000606482015260840161086c565b60005b8181101561241f57612686858583815181106123cc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8061269081615b77565b915050612641565b805160208183018101805160138252928201919093012091528054600182015460048301805473ffffffffffffffffffffffffffffffffffffffff9093169391926126e290615b23565b80601f016020809104026020016040519081016040528092919081815260200182805461270e90615b23565b801561275b5780601f106127305761010080835404028352916020019161275b565b820191906000526020600020905b81548152906001019060200180831161273e57829003601f168201915b5050505060058301546006840154600790940154929360ff9091169290915086565b3360009081526001602052604090205460ff16806127ce5750336127b660005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b612834576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e6572604482015260640161086c565b60008281526004602052604090205473ffffffffffffffffffffffffffffffffffffffff166128bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f486f7273654e46543a206e6f6e6578697374656e7420746f6b656e0000000000604482015260640161086c565b600f816040516128cf919061579b565b9081526040519081900360200190205460ff1615612949576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f486f7273654e46543a206d65746155726c206578697374656400000000000000604482015260640161086c565b600f600e600084815260200190815260200160002060010160405161296e9190615800565b90815260405190819003602001812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600190600f906129b490849061579b565b908152604080516020928190038301812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016941515949094179093556000858152600e9092529020601091612a0f9160010190615800565b90815260200160405180910390206000905581601082604051612a32919061579b565b90815260200160405180910390208190555080600e60008481526020019081526020016000206001019080519060200190610a26929190614f4c565b60005473ffffffffffffffffffffffffffffffffffffffff163314612aef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086c565b73ffffffffffffffffffffffffffffffffffffffff8116612b92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161086c565b612b9b8161374b565b50565b805160005b81811015611f8e57612bf63385858481518110612be9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015161125b565b80612c0081615b77565b915050612ba3565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480612c9b57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061072557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610725565b600081815260066020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091558190612d4582611761565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff16612e3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e0000000000000000000000000000000000000000606482015260840161086c565b6000612e4783611761565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612eb657508373ffffffffffffffffffffffffffffffffffffffff16612e9e846107bf565b73ffffffffffffffffffffffffffffffffffffffff16145b80612189575073ffffffffffffffffffffffffffffffffffffffff80821660009081526007602090815260408083209388168352929052205460ff16612189565b8273ffffffffffffffffffffffffffffffffffffffff16612f1782611761565b73ffffffffffffffffffffffffffffffffffffffff1614612fba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e0000000000000000000000000000000000000000000000606482015260840161086c565b73ffffffffffffffffffffffffffffffffffffffff821661305c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161086c565b613067838383613932565b613072600082612ceb565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604081208054600192906130a8908490615aab565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526005602052604081208054600192906130e3908490615a42565b909155505060008181526004602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600080600061318f846000015185602001518660400151876060015188608001516139d0565b905060006131b68560a001518660c001518760e001516131ae86613a0c565b929190613cdb565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205490915060ff16613248576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f486f7273654e46543a206d696e74206e6f742076657269667900000000000000604482015260640161086c565b846020015143106132b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f486f7273654e46543a206d696e74206578706972656400000000000000000000604482015260640161086c565b60008281526012602052604090205460ff161561332e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f486f7273654e46543a206d696e7420636f6d706c657465640000000000000000604482015260640161086c565b600073ffffffffffffffffffffffffffffffffffffffff166013866080015160405161335a919061579b565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff16146133e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f486f7273654e46543a206e6f6e65206578697374656400000000000000000000604482015260640161086c565b9092509050915091565b60006133fd8284615a42565b9392505050565b600f81604051613414919061579b565b9081526040519081900360200190205460ff161561348e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f486f7273654e46543a206d65746155726c206578697374656400000000000000604482015260640161086c565b6001600f826040516134a0919061579b565b90815260405190819003602001812080549215157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff009093169290921790915582906010906134ef90849061579b565b90815260408051602092819003830181209390935582810181528483528183018481526000868152600e8452919091208351815590518051919261353b92600185019290910190614f4c565b509050506135498383613dee565b60405173ffffffffffffffffffffffffffffffffffffffff84169083907f43d5d4444dc5e9f82dd4c5ed11e5b4d182ca8af92bc2c124fdf55f49f057dff890600090a3505050565b600c5460ff166135fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161086c565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b600061367d82611761565b905061368b81600084613932565b613696600083612ceb565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604081208054600192906136cc908490615aab565b909155505060008281526004602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555183919073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600c5460ff161561382d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161086c565b600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586136483390565b61388b848484612ef7565b61389784848484613e08565b611f8e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161086c565b6060600d805461073c90615b23565b61393d838383614004565b600c5460ff1615610a26576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f486f7273654e46543a20746f6b656e207472616e73666572207768696c65207060448201527f6175736564000000000000000000000000000000000000000000000000000000606482015260840161086c565b600085858585856040516020016139eb959493929190615855565b60405160208183030381529060405280519060200120905095945050505050565b604080518082018252601081527f30313233343536373839616263646566000000000000000000000000000000006020820152815182815260608181018452926000919060208201818036833701905050905060005b6020811015613cd357826004868360208110613aa7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff1681518110613b0c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001682613b3f836002615a6e565b81518110613b76577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082858260208110613bdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b825191901a600f16908110613c1d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001682613c50836002615a6e565b613c5b906001615a42565b81518110613c92577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080613ccb81615b77565b915050613a62565b509392505050565b6000808590506000613d536040518060400160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a000000000000815250613d26845161410f565b604080516000808252602082018181528284018281526060840192835260808401909452889390916142a4565b90506001818051906020012087878760405160008152602001604052604051613d98949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015613dba573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b611547828260405180602001604052806000815250614a0b565b600073ffffffffffffffffffffffffffffffffffffffff84163b15613ffc576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290613e7f90339089908890889060040161580c565b602060405180830381600087803b158015613e9957600080fd5b505af1925050508015613ee7575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252613ee491810190615500565b60015b613fb1573d808015613f15576040519150601f19603f3d011682016040523d82523d6000602084013e613f1a565b606091505b508051613fa9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161086c565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050612189565b506001612189565b73ffffffffffffffffffffffffffffffffffffffff831661406c5761406781600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b6140a9565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146140a9576140a98382614aae565b73ffffffffffffffffffffffffffffffffffffffff82166140d2576140cd81614b65565b610a26565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610a2657610a268282614c89565b606081614150575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610728565b8160005b811561417a578061416481615b77565b91506141739050600a83615a5a565b9150614154565b60008167ffffffffffffffff8111156141bc577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156141e6576020820181803683370190505b509050815b801561429b576141fc600a87615bb0565b614207906030615a42565b60f81b82614216600184615aab565b8151811061424d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350614287600a87615a5a565b95508061429381615aee565b9150506141eb565b50949350505050565b6060600082518451865188518a518c518e516142c09190615a42565b6142ca9190615a42565b6142d49190615a42565b6142de9190615a42565b6142e89190615a42565b6142f29190615a42565b67ffffffffffffffff811115614331577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561435b576020820181803683370190505b5090506000805b8a51811015614450578a81815181106143a4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001683836143d681615b77565b94508151811061440f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061444881615b77565b915050614362565b5060005b895181101561454257898181518110614496577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001683836144c881615b77565b945081518110614501577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061453a81615b77565b915050614454565b5060005b885181101561463457888181518110614588577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001683836145ba81615b77565b9450815181106145f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061462c81615b77565b915050614546565b5060005b87518110156147265787818151811061467a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001683836146ac81615b77565b9450815181106146e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061471e81615b77565b915050614638565b5060005b86518110156148185786818151811061476c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361479e81615b77565b9450815181106147d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061481081615b77565b91505061472a565b5060005b855181101561490a5785818151811061485e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361489081615b77565b9450815181106148c9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061490281615b77565b91505061481c565b5060005b84518110156149fc57848181518110614950577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361498281615b77565b9450815181106149bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806149f481615b77565b91505061490e565b50909998505050505050505050565b614a158383614cda565b614a226000848484613e08565b610a26576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161086c565b60006001614abb84611813565b614ac59190615aab565b600083815260096020526040902054909150808214614b255773ffffffffffffffffffffffffffffffffffffffff841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b50600091825260096020908152604080842084905573ffffffffffffffffffffffffffffffffffffffff9094168352600881528383209183525290812055565b600a54600090614b7790600190615aab565b6000838152600b6020526040812054600a8054939450909284908110614bc6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080600a8381548110614c0e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a805480614c6d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000614c9483611813565b73ffffffffffffffffffffffffffffffffffffffff9093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b73ffffffffffffffffffffffffffffffffffffffff8216614d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161086c565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1615614de3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161086c565b614def60008383613932565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600560205260408120805460019290614e25908490615a42565b909155505060008181526004602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054828255906000526020600020908101928215614ee3579160200282015b82811115614ee3578251825591602001919060010190614ec8565b50614eef929150614fbf565b5090565b828054828255906000526020600020908101928215614f40579160200282015b82811115614f405782518051614f30918491602090910190614f4c565b5091602001919060010190614f13565b50614eef929150614fd4565b828054614f5890615b23565b90600052602060002090601f016020900481019282614f7a5760008555614ee3565b82601f10614f9357805160ff1916838001178555614ee3565b82800160010185558215614ee35791820182811115614ee3578251825591602001919060010190614ec8565b5b80821115614eef5760008155600101614fc0565b80821115614eef576000614fe88282614ff1565b50600101614fd4565b508054614ffd90615b23565b6000825580601f1061500f5750612b9b565b601f016020900490600052602060002090810190612b9b9190614fbf565b600067ffffffffffffffff83111561504757615047615c22565b61507860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116016159cf565b905082815283838301111561508c57600080fd5b828260208301376000602084830101529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461072857600080fd5b600082601f8301126150d7578081fd5b813560206150ec6150e783615a1e565b6159cf565b82815281810190858301855b858110156151215761510f898684358b0101615188565b845292840192908401906001016150f8565b5090979650505050505050565b600082601f83011261513e578081fd5b8135602061514e6150e783615a1e565b828152818101908583018385028701840188101561516a578586fd5b855b858110156151215781358452928401929084019060010161516c565b600082601f830112615198578081fd5b6133fd8383356020850161502d565b803560ff8116811461072857600080fd5b6000602082840312156151c9578081fd5b6133fd826150a3565b600080604083850312156151e4578081fd5b6151ed836150a3565b91506151fb602084016150a3565b90509250929050565b600080600060608486031215615218578081fd5b615221846150a3565b925061522f602085016150a3565b9150604084013590509250925092565b60008060008060808587031215615254578081fd5b61525d856150a3565b935061526b602086016150a3565b925060408501359150606085013567ffffffffffffffff81111561528d578182fd5b8501601f8101871361529d578182fd5b6152ac8782356020840161502d565b91505092959194509250565b600080604083850312156152ca578182fd5b6152d3836150a3565b9150602083013567ffffffffffffffff8111156152ee578182fd5b6152fa8582860161512e565b9150509250929050565b600080600060608486031215615318578081fd5b615321846150a3565b9250602084013567ffffffffffffffff8082111561533d578283fd5b6153498783880161512e565b9350604086013591508082111561535e578283fd5b5061536b868287016150c7565b9150509250925092565b60008060408385031215615387578182fd5b615390836150a3565b9150602083013580151581146153a4578182fd5b809150509250929050565b600080604083850312156153c1578182fd5b6153ca836150a3565b946020939093013593505050565b6000806000606084860312156153ec578081fd5b6153f5846150a3565b925060208401359150604084013567ffffffffffffffff811115615417578182fd5b61536b86828701615188565b600080600060608486031215615437578081fd5b833567ffffffffffffffff8082111561544e578283fd5b818601915086601f830112615461578283fd5b813560206154716150e783615a1e565b82815281810190858301838502870184018c101561548d578788fd5b8796505b848710156154b6576154a2816150a3565b835260019690960195918301918301615491565b509750508701359250508082111561533d578283fd5b6000602082840312156154dd578081fd5b5035919050565b6000602082840312156154f5578081fd5b81356133fd81615c51565b600060208284031215615511578081fd5b81516133fd81615c51565b60006020828403121561552d578081fd5b813567ffffffffffffffff811115615543578182fd5b61218984828501615188565b600060208284031215615560578081fd5b813567ffffffffffffffff80821115615577578283fd5b818401915061010080838703121561558d578384fd5b615596816159cf565b90506155a1836150a3565b8152602083013560208201526040830135828111156155be578485fd5b6155ca8782860161512e565b6040830152506060830135828111156155e1578485fd5b6155ed878286016150c7565b606083015250608083013582811115615604578485fd5b61561087828601615188565b60808301525061562260a084016151a7565b60a082015260c083013560c082015260e083013560e082015280935050505092915050565b60008060408385031215615659578182fd5b82359150602083013567ffffffffffffffff811115615676578182fd5b6152fa85828601615188565b6000815180845261569a816020860160208601615ac2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8054600090600281046001808316806156e657607f831692505b602080841082141561571f577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b81801561573357600181146157625761578f565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0086168952848901965061578f565b60008881526020902060005b868110156157875781548b82015290850190830161576e565b505084890196505b50505050505092915050565b600082516157ad818460208701615ac2565b9190910192915050565b600083516157c9818460208801615ac2565b6157d5818401856156cc565b95945050505050565b600083516157f0818460208801615ac2565b9190910191825250602001919050565b60006133fd82846156cc565b600073ffffffffffffffffffffffffffffffffffffffff80871683528086166020840152508360408301526080606083015261584b6080830184615682565b9695505050505050565b600060a0820173ffffffffffffffffffffffffffffffffffffffff881683526020878185015260a0604085015281875180845260c0860191508289019350845b818110156158b157845183529383019391830191600101615895565b505084810360608601528651808252828201935082810282018301838901865b8381101561591d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe085840301875261590b838351615682565b968601969250908501906001016158d1565b505086810360808801526159318189615682565b9c9b505050505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff8816825286602083015260c0604083015261597660c0830187615682565b60ff95909516606083015250608081019290925260a0909101529392505050565b6000602082526133fd6020830184615682565b6000602082528251602083015260208301516040808401526121896060840182615682565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715615a1657615a16615c22565b604052919050565b600067ffffffffffffffff821115615a3857615a38615c22565b5060209081020190565b60008219821115615a5557615a55615bc4565b500190565b600082615a6957615a69615bf3565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615aa657615aa6615bc4565b500290565b600082821015615abd57615abd615bc4565b500390565b60005b83811015615add578181015183820152602001615ac5565b83811115611f8e5750506000910152565b600081615afd57615afd615bc4565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b600281046001821680615b3757607f821691505b60208210811415615b71577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415615ba957615ba9615bc4565b5060010190565b600082615bbf57615bbf615bf3565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114612b9b57600080fdfea2646970667358221220f242b485a0e6ba7e5d42f287aeec06f8ad984462be97fac2a70041b59916c4d364736f6c63430008020033