Contract Address Details

0x37F736BB4C29c999D606Cb9B64A7c0f4698056F5

Fusel (FUSEL) Last Balance Update: Block #17918044
Created by 0xd91e3b–487b5d at 0xf66823–f70104

Balance

0 Fuse

Fetching tokens...

Contract name:
Fusel




Optimization enabled
true
Compiler version
v0.8.7+commit.e28d00a7




Optimization runs
200
EVM Version
default




Verified at
2021-09-27 20:28:40.608072Z

Contract source code

/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @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;
}
/**
* @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 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 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);
}
}
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
/**
* @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 {
(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(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 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);
}
function _batchMint(address to, uint256[] memory tokenIds)
internal
virtual
{
for (uint256 i; i < tokenIds.length; i++) {
_mint(to, tokenIds[i]);
}
}
/**
* @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();
}
}
contract Fusel is ERC721Enumerable, ReentrancyGuard, Ownable {
uint256 public price = 99000000000000000000; //99 FUSE
uint16 public totalTokens = 9999;
uint16 public total = 0;
mapping(uint16 => uint16) private tokenMatrix;
string[] private juices = [
"Orange juice",
"Pineapple juice",
"Lemon juice",
"Passion fruit juice",
"Lime Juice",
"Grapefruit Juice",
"Cherry Juice",
"Cranberry Juice",
"Banana nectar"
];
string[] private syrups = [
"Grenadine",
"Sugar syrup",
"Coconut syrup",
"Strawberry syrup",
"Almond syrup",
"Passion fruit syrup",
"Vanilla syrup",
"Blue Curacao syrup",
"Lime syrup",
"Mango syrup"
];
string[] private fillers = [
"Soda",
"Milk",
"Ginger Ale",
"Cola",
"Sparkling wine",
"Tonic water",
"Lemonade",
"Bitter Lemon",
"Mineral water",
"Lemon Squash"
];
function pluck(string memory keyPrefix, uint rand, string[] memory sourceArray) internal pure returns (string memory) {
string memory name = sourceArray[rand % sourceArray.length];
uint256 cl = getCl(keyPrefix, rand);
return string(abi.encodePacked(name, " - ", toString(cl), " cl"));
}
function pluckMapping(string memory keyPrefix, uint rand, mapping (uint => Alcohol) storage sourceMapping) internal view returns (string memory) {
string memory name = sourceMapping[rand % 10].name;
uint256 strength = sourceMapping[rand % 10].strength;
uint256 cl = getCl(keyPrefix, rand);
return string(abi.encodePacked(name, " (", toString(strength), "%) - ", toString(cl), " cl"));
}
function _getRandomNumber(string memory keyPrefix, uint256 tokenId) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(string(abi.encodePacked(keyPrefix, toString(tokenId))))));
}
struct RandomNumber {
uint256 spirit;
uint256 juice;
uint256 syrup;
uint256 liqueur;
uint256 filler;
uint256 stage;
}
function tokenURI(uint256 tokenId) override public view returns (string memory) {
RandomNumber memory randomNumber = RandomNumber({
spirit: _getRandomNumber("SPIRIT", tokenId),
juice: _getRandomNumber("JUICE", tokenId),
syrup: _getRandomNumber("SYRUP", tokenId),
liqueur: _getRandomNumber("LIQUEUR", tokenId),
filler: _getRandomNumber("FILLER", tokenId),
stage: _getRandomNumber("STAGE", tokenId)
});
uint256 bacSpirit = (((((getCl("SPIRIT", randomNumber.spirit) * 10))*spirits[randomNumber.spirit % 10].strength/100)*1000000)/125)/(80*0.7);
uint256 bacLiqueur = (((((getCl("LIQUEUR", randomNumber.liqueur) * 10))*liqueurs[randomNumber.liqueur % 10].strength/100)*1000000)/125)/(80*0.7);
uint256 bac = bacSpirit + bacLiqueur;
uint256 stage = getStage(bac);
string memory color = stages[stage].color;
string memory stageName = stages[stage].name;
string[17] memory parts;
parts[0] = string(abi.encodePacked('<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>@import url("https://fonts.googleapis.com/css?family=Monoton|Montserrat|Varela+Round"); .base-svg { font-family: "Varela Round", monospace; font-size: 14px;} .h1-svg { font-family: "Monoton", monospace; font-size: 24px;} .h2-svg { fill: #e2e2e2; font-family: "Montserrat", monospace; font-size: 8px;}</style><rect width="100%" height="100%" fill="#0a0a0a" /><text x="10" y="35" class="h1-svg" style="fill: ', color , ';">'));
parts[1] = string(abi.encodePacked('FUSEL #', toString(tokenId)));
parts[2] = string(abi.encodePacked('</text><text x="10" y="70" class="h2-svg">SPIRIT</text><text x="10" y="85" class="base-svg" style="fill: ', color , ';">'));
parts[3] = pluckMapping("SPIRIT", randomNumber.spirit, spirits);
parts[4] = string(abi.encodePacked('</text><text x="10" y="110" class="h2-svg">JUICE</text><text x="10" y="125" class="base-svg" style="fill: ', color , ';">'));
parts[5] = pluck("JUICE", randomNumber.juice, juices);
parts[6] = string(abi.encodePacked('</text><text x="10" y="150" class="h2-svg">SYRUP</text><text x="10" y="165" class="base-svg" style="fill: ', color , ';">'));
parts[7] = pluck("SYRUP", randomNumber.syrup, syrups);
parts[8] = string(abi.encodePacked('</text><text x="10" y="190" class="h2-svg">LIQUEUR</text><text x="10" y="205" class="base-svg" style="fill: ', color , ';">'));
parts[9] = pluckMapping("LIQUEUR", randomNumber.liqueur, liqueurs);
parts[10] = string(abi.encodePacked('</text><text x="10" y="230" class="h2-svg">FILLER</text><text x="10" y="245" class="base-svg" style="fill: ', color , ';">'));
parts[11] = pluck("SPIRIT", randomNumber.filler, fillers);
parts[12] = string(abi.encodePacked('</text><text x="10" y="270" class="h2-svg">DRUNKENNESS</text><text x="10" y="285" class="base-svg" style="fill: ', color , ';">'));
parts[13] = decimalString(bac, 4, false);
parts[14] = string(abi.encodePacked(' permille</text><text x="10" y="310" class="h2-svg">STAGE</text><text x="10" y="325" class="base-svg" style="fill: ', color , ';">'));
parts[15] = stageName;
parts[16] = '</text></svg>';
string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4]));
output = string(abi.encodePacked(output, parts[5], parts[6], parts[7], parts[8], parts[9]));
output = string(abi.encodePacked(output, parts[10], parts[11], parts[12], parts[13]));
output = string(abi.encodePacked(output, parts[14], parts[15], parts[16]));
string memory attributesString = string(abi.encodePacked("[" , traitString("Spirit", parts[3]), "," , traitString("Juice", parts[5])));
attributesString = string(abi.encodePacked(attributesString, "," , traitString("Syrup", parts[7]), "," , traitString("Liqueur", parts[9])));
attributesString = string(abi.encodePacked(attributesString, "," , traitString("Filler", parts[11]), "," , traitString("Stage", parts[15])));
attributesString = string(abi.encodePacked(attributesString, "," , traitNumber("Drunkenness", bac), "," , traitString("BAC", decimalString(bac, 4, false)), "]"));
string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "FUSEL #', toString(tokenId), '", "description": "Fusel is a common german colloquial term for bad, improperly distilled and cheap spirits or liquors. Create your own randomly generated cocktail on the FUSE blockchain.", "attributes": ', attributesString ,' ,"image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}'))));
output = string(abi.encodePacked('data:application/json;base64,', json));
return output;
}
function getStage(uint256 bac) internal pure returns (uint256) {
if(bac >= 10142) { return 5; }
if(bac < 10142 && bac >= 8570) { return 4; }
if(bac < 8570 && bac >= 7142) { return 3; }
if(bac < 7142 && bac >= 5856) { return 2; }
if(bac < 5856 && bac >= 4427) { return 1; }
return 0;
}
function getCl(string memory keyPrefix, uint256 randomItemNumber) internal pure returns (uint256) {
if (keccak256(abi.encodePacked(keyPrefix)) == keccak256(abi.encodePacked("SPIRIT")) || keccak256(abi.encodePacked(keyPrefix)) == keccak256(abi.encodePacked("LIQUEUR"))) {
return (randomItemNumber % 9) + 1;
}
if (keccak256(abi.encodePacked(keyPrefix)) == keccak256(abi.encodePacked("JUICE")) || keccak256(abi.encodePacked(keyPrefix)) == keccak256(abi.encodePacked("FILLER"))) {
return ((randomItemNumber % 4) + 1) * 3;
}
else {
return ((randomItemNumber % 2) + 1) * 2;
}
}
function traitString(string memory traitString, string memory traitValue) internal pure returns (string memory) {
return string(abi.encodePacked('{"trait_type": "', traitString ,'", "value": "', traitValue, '"}'));
}
function traitNumber(string memory traitString, uint256 traitValue) internal pure returns (string memory) {
return string(abi.encodePacked('{"trait_type": "', traitString ,'", "value": ', toString(traitValue), '}'));
}
function mintTokens(uint8 amount) external payable {
uint16 tokensLeft = totalTokens - total;
require(tokensLeft > 0, "No tokens left to be minted");
uint256 totalMintPrice = price * amount;
require(
msg.value >= totalMintPrice,
"Not enough Ether to mint the tokens"
);
uint256[] memory tokenIds = new uint256[](amount);
uint16 tmpTotalMintedTokens = total;
total += amount;
for (uint256 i; i < amount; i++) {
tokenIds[i] = _getTokenToBeMinted(tmpTotalMintedTokens);
tmpTotalMintedTokens++;
}
_batchMint(msg.sender, tokenIds);
}
function _getTokenToBeMinted(uint16 _totalMintedTokens)
private
returns (uint16)
{
uint16 maxIndex = totalTokens - _totalMintedTokens;
uint16 random = _getRandomToken(maxIndex, _totalMintedTokens);
uint16 tokenId = tokenMatrix[random];
if (tokenMatrix[random] == 0) {
tokenId = random;
}
tokenMatrix[maxIndex - 1] == 0
? tokenMatrix[random] = maxIndex - 1
: tokenMatrix[random] = tokenMatrix[maxIndex - 1];
return tokenId;
}
function _getRandomToken(uint16 _upper, uint16 _totalMintedTokens)
private
view
returns (uint16)
{
uint16 random = uint16(
uint256(
keccak256(
abi.encodePacked(
_totalMintedTokens,
blockhash(block.number - 1),
block.coinbase,
block.difficulty,
msg.sender
)
)
)
);
return random % _upper;
}
function withdraw(uint256 amountInFuse) public onlyOwner {
payable(owner()).transfer(amountInFuse * (1 ether));
}
function ownerMultiClaim(uint256[] memory tokenIds) public nonReentrant onlyOwner {
for (uint256 i = 0; i < tokenIds.length; i++) {
_safeMint(_msgSender(), tokenIds[i]);
}
}
function decimalString(uint256 number, uint8 decimals, bool isPercent) private pure returns(string memory){
uint8 percentBufferOffset = isPercent ? 1 : 0;
uint256 tenPowDecimals = 10 ** decimals;
uint256 temp = number;
uint8 digits;
uint8 numSigfigs;
while (temp != 0) {
if (numSigfigs > 0) {
// count all digits preceding least significant figure
numSigfigs++;
} else if (temp % 10 != 0) {
numSigfigs++;
}
digits++;
temp /= 10;
}
DecimalStringParams memory params;
params.isPercent = isPercent;
if((digits - numSigfigs) >= decimals) {
// no decimals, ensure we preserve all trailing zeros
params.sigfigs = number / tenPowDecimals;
params.sigfigIndex = digits - decimals;
params.bufferLength = params.sigfigIndex + percentBufferOffset;
} else {
// chop all trailing zeros for numbers with decimals
params.sigfigs = number / (10 ** (digits - numSigfigs));
if(tenPowDecimals > number){
// number is less tahn one
// in this case, there may be leading zeros after the decimal place
// that need to be added
// offset leading zeros by two to account for leading '0.'
params.zerosStartIndex = 2;
params.zerosEndIndex = decimals - digits + 2;
params.sigfigIndex = numSigfigs + params.zerosEndIndex;
params.bufferLength = params.sigfigIndex + percentBufferOffset;
params.isLessThanOne = true;
} else {
// In this case, there are digits before and
// after the decimal place
params.sigfigIndex = numSigfigs + 1;
params.decimalIndex = digits - decimals + 1;
}
}
params.bufferLength = params.sigfigIndex + percentBufferOffset;
return generateDecimalString(params);
}
// With modifications, the below taken
// from https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/libraries/NFTDescriptor.sol#L189-L231
struct DecimalStringParams {
// significant figures of decimal
uint256 sigfigs;
// length of decimal string
uint8 bufferLength;
// ending index for significant figures (funtion works backwards when copying sigfigs)
uint8 sigfigIndex;
// index of decimal place (0 if no decimal)
uint8 decimalIndex;
// start index for trailing/leading 0's for very small/large numbers
uint8 zerosStartIndex;
// end index for trailing/leading 0's for very small/large numbers
uint8 zerosEndIndex;
// true if decimal number is less than one
bool isLessThanOne;
// true if string should include "%"
bool isPercent;
}
function generateDecimalString(DecimalStringParams memory params) private pure returns (string memory) {
bytes memory buffer = new bytes(params.bufferLength);
if (params.isPercent) {
buffer[buffer.length - 1] = '%';
}
if (params.isLessThanOne) {
buffer[0] = '0';
buffer[1] = '.';
}
// add leading/trailing 0's
for (uint256 zerosCursor = params.zerosStartIndex; zerosCursor < params.zerosEndIndex; zerosCursor++) {
buffer[zerosCursor] = bytes1(uint8(48));
}
// add sigfigs
while (params.sigfigs > 0) {
if (params.decimalIndex > 0 && params.sigfigIndex == params.decimalIndex) {
buffer[--params.sigfigIndex] = '.';
}
buffer[--params.sigfigIndex] = bytes1(uint8(uint256(48) + (params.sigfigs % 10)));
params.sigfigs /= 10;
}
return string(buffer);
}
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT license
// 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);
}
struct Stage
{
string name;
string color;
}
struct Alcohol
{
string name;
uint256 strength;
}
mapping (uint256 => Stage) private stages;
mapping (uint256 => Alcohol) private spirits;
mapping (uint256 => Alcohol) private liqueurs;
constructor() ERC721("Fusel", "FUSEL") Ownable() {
stages[0] = Stage({name: "The First Sip", color: "#40b5e1"});
stages[1] = Stage({name: "The Buzz", color: "#ffcc18"});
stages[2] = Stage({name: "The Best Friend", color: "#fc5763"});
stages[3] = Stage({name: "The Song and Dance", color: "#aed23b"});
stages[4] = Stage({name: "The Hookup", color: "#a08dd8"});
stages[5] = Stage({name: "The Relentless Party Mode", color: "#ff7925"});
spirits[0] = Alcohol({name: "Vodka", strength: 40});
spirits[1] = Alcohol({name: "Gin", strength: 40});
spirits[2] = Alcohol({name: "Rum (brown)", strength: 38});
spirits[3] = Alcohol({name: "Tequila (silver)", strength: 38});
spirits[4] = Alcohol({name: "Cachaca", strength: 38});
spirits[5] = Alcohol({name: "Whiskey (bourbon)", strength: 45});
spirits[6] = Alcohol({name: "Rum", strength: 40});
spirits[7] = Alcohol({name: "Vermouth Dry", strength: 18});
spirits[8] = Alcohol({name: "Absinth", strength: 55});
spirits[9] = Alcohol({name: "Rum (white)", strength: 40});
liqueurs[0] = Alcohol({name: "Blue Curacao", strength: 20});
liqueurs[1] = Alcohol({name: "Orange liqueur", strength: 11});
liqueurs[2] = Alcohol({name: "Licor 43", strength: 31});
liqueurs[3] = Alcohol({name: "Peach liqueur", strength: 20});
liqueurs[4] = Alcohol({name: "Amaretto", strength: 30});
liqueurs[5] = Alcohol({name: "Coconut liqueur", strength: 21});
liqueurs[6] = Alcohol({name: "Apricot Brandy", strength: 24});
liqueurs[7] = Alcohol({name: "Curacao Triple Sec", strength: 40});
liqueurs[8] = Alcohol({name: "Coffee liqueur", strength: 20});
liqueurs[9] = Alcohol({name: "Irish cream liqueur", strength: 17});
}
}
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <brecht@loopring.org>
library Base64 {
bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
// Add some extra buffer at the end
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
} {
i := add(i, 3)
let input := and(mload(add(data, i)), 0xffffff)
let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
out := shl(224, out)
mstore(resultPtr, out)
resultPtr := add(resultPtr, 4)
}
switch mod(len, 3)
case 1 {
mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
}
case 2 {
mstore(sub(resultPtr, 1), shl(248, 0x3d))
}
mstore(result, encodedLen)
}
return string(result);
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"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":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","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":"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":"address","name":"","internalType":"address"}],"name":"getApproved","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":"payable","outputs":[],"name":"mintTokens","inputs":[{"type":"uint8","name":"amount","internalType":"uint8"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"ownerMultiClaim","inputs":[{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"price","inputs":[]},{"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":"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":"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":"uint16","name":"","internalType":"uint16"}],"name":"total","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"totalTokens","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":"withdraw","inputs":[{"type":"uint256","name":"amountInFuse","internalType":"uint256"}]}]
            

Deployed ByteCode

0x6080604052600436106101665760003560e01c80636352211e116100d157806395d89b411161008a578063b88d4fde11610064578063b88d4fde1461041b578063c87b56dd1461043b578063e985e9c51461045b578063f2fde38b146104a457600080fd5b806395d89b41146103d0578063a035b1fe146103e5578063a22cb465146103fb57600080fd5b80636352211e1461032f57806370a082311461034f578063715018a61461036f5780637e1c0c0914610384578063877a294a1461039f5780638da5cb5b146103b257600080fd5b80632ddbd13a116101235780632ddbd13a1461025b5780632e1a7d4d1461028f5780632f745c59146102af5780633f0a998b146102cf57806342842e0e146102ef5780634f6ccce71461030f57600080fd5b806301ffc9a71461016b57806306fdde03146101a0578063081812fc146101c2578063095ea7b3146101fa57806318160ddd1461021c57806323b872dd1461023b575b600080fd5b34801561017757600080fd5b5061018b6101863660046132e6565b6104c4565b60405190151581526020015b60405180910390f35b3480156101ac57600080fd5b506101b56104ef565b604051610197919061418c565b3480156101ce57600080fd5b506101e26101dd366004613320565b610581565b6040516001600160a01b039091168152602001610197565b34801561020657600080fd5b5061021a61021536600461320f565b61061b565b005b34801561022857600080fd5b506008545b604051908152602001610197565b34801561024757600080fd5b5061021a6102563660046130d7565b610731565b34801561026757600080fd5b50600d5461027c9062010000900461ffff1681565b60405161ffff9091168152602001610197565b34801561029b57600080fd5b5061021a6102aa366004613320565b610762565b3480156102bb57600080fd5b5061022d6102ca36600461320f565b6107d9565b3480156102db57600080fd5b5061021a6102ea366004613239565b61086f565b3480156102fb57600080fd5b5061021a61030a3660046130d7565b61093b565b34801561031b57600080fd5b5061022d61032a366004613320565b610956565b34801561033b57600080fd5b506101e261034a366004613320565b6109e9565b34801561035b57600080fd5b5061022d61036a366004613082565b610a60565b34801561037b57600080fd5b5061021a610ae7565b34801561039057600080fd5b50600d5461027c9061ffff1681565b61021a6103ad366004613339565b610b1d565b3480156103be57600080fd5b50600b546001600160a01b03166101e2565b3480156103dc57600080fd5b506101b5610cf0565b3480156103f157600080fd5b5061022d600c5481565b34801561040757600080fd5b5061021a6104163660046131d3565b610cff565b34801561042757600080fd5b5061021a610436366004613113565b610dc4565b34801561044757600080fd5b506101b5610456366004613320565b610dfc565b34801561046757600080fd5b5061018b6104763660046130a4565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156104b057600080fd5b5061021a6104bf366004613082565b6119e0565b60006001600160e01b0319821663780e9d6360e01b14806104e957506104e982611a7b565b92915050565b6060600080546104fe906144c9565b80601f016020809104026020016040519081016040528092919081815260200182805461052a906144c9565b80156105775780601f1061054c57610100808354040283529160200191610577565b820191906000526020600020905b81548152906001019060200180831161055a57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166105ff5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610626826109e9565b9050806001600160a01b0316836001600160a01b031614156106945760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016105f6565b336001600160a01b03821614806106b057506106b08133610476565b6107225760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016105f6565b61072c8383611acb565b505050565b61073b3382611b39565b6107575760405162461bcd60e51b81526004016105f690614226565b61072c838383611c30565b600b546001600160a01b0316331461078c5760405162461bcd60e51b81526004016105f6906141f1565b600b546001600160a01b03166108fc6107ad83670de0b6b3a7640000614404565b6040518115909202916000818181858888f193505050501580156107d5573d6000803e3d6000fd5b5050565b60006107e483610a60565b82106108465760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016105f6565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6002600a5414156108c25760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105f6565b6002600a55600b546001600160a01b031633146108f15760405162461bcd60e51b81526004016105f6906141f1565b60005b81518110156109325761092033838381518110610913576109136145d8565b6020026020010151611ddb565b8061092a81614526565b9150506108f4565b50506001600a55565b61072c83838360405180602001604052806000815250610dc4565b600061096160085490565b82106109c45760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016105f6565b600882815481106109d7576109d76145d8565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806104e95760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016105f6565b60006001600160a01b038216610acb5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016105f6565b506001600160a01b031660009081526003602052604090205490565b600b546001600160a01b03163314610b115760405162461bcd60e51b81526004016105f6906141f1565b610b1b6000611df5565b565b600d54600090610b399061ffff62010000820481169116614423565b905060008161ffff1611610b8f5760405162461bcd60e51b815260206004820152601b60248201527f4e6f20746f6b656e73206c65667420746f206265206d696e746564000000000060448201526064016105f6565b60008260ff16600c54610ba29190614404565b905080341015610c005760405162461bcd60e51b815260206004820152602360248201527f4e6f7420656e6f75676820457468657220746f206d696e742074686520746f6b604482015262656e7360e81b60648201526084016105f6565b60008360ff1667ffffffffffffffff811115610c1e57610c1e6145ee565b604051908082528060200260200182016040528015610c47578160200160208202803683370190505b50600d80549192506201000090910461ffff169060ff8616906002610c6c83856142a8565b92506101000a81548161ffff021916908361ffff16021790555060005b8560ff16811015610cde57610c9d82611e47565b61ffff16838281518110610cb357610cb36145d8565b602090810291909101015281610cc881614504565b9250508080610cd690614526565b915050610c89565b50610ce93383611f40565b5050505050565b6060600180546104fe906144c9565b6001600160a01b038216331415610d585760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016105f6565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610dce3383611b39565b610dea5760405162461bcd60e51b81526004016105f690614226565b610df684848484611f81565b50505050565b606060006040518060c00160405280610e336040518060400160405280600681526020016514d41254925560d21b81525086611fb4565b8152602001610e5f604051806040016040528060058152602001644a5549434560d81b81525086611fb4565b8152602001610e8b60405180604001604052806005815260200164053595255560dc1b81525086611fb4565b8152602001610eb9604051806040016040528060078152602001662624a8aaa2aaa960c91b81525086611fb4565b8152602001610ee6604051806040016040528060068152602001652324a62622a960d11b81525086611fb4565b8152602001610f1260405180604001604052806005815260200164535441474560d81b81525086611fb4565b815250905060006038607d606460136000600a8760000151610f349190614582565b815260200190815260200160002060010154610f726040518060400160405280600681526020016514d41254925560d21b815250876000015161200d565b610f7d90600a614404565b610f879190614404565b610f919190614302565b610f9e90620f4240614404565b610fa89190614302565b610fb29190614302565b905060006038607d606460146000600a8860600151610fd19190614582565b815260200190815260200160002060010154611010604051806040016040528060078152602001662624a8aaa2aaa960c91b815250886060015161200d565b61101b90600a614404565b6110259190614404565b61102f9190614302565b61103c90620f4240614404565b6110469190614302565b6110509190614302565b9050600061105e82846142c5565b9050600061106b826121d3565b60008181526012602052604081206001018054929350909161108c906144c9565b80601f01602080910402602001604051908101604052809291908181526020018280546110b8906144c9565b80156111055780601f106110da57610100808354040283529160200191611105565b820191906000526020600020905b8154815290600101906020018083116110e857829003601f168201915b50505060008581526012602052604081208054949550909390925061112a91506144c9565b80601f0160208091040260200160405190810160405280929190818152602001828054611156906144c9565b80156111a35780601f10611178576101008083540402835291602001916111a3565b820191906000526020600020905b81548152906001019060200180831161118657829003601f168201915b505050505090506111b261303e565b826040516020016111c39190613a99565b60408051808303601f1901815291905281526111de8a61226e565b6040516020016111ee9190613a6a565b60408051808303601f19018152918152602080840192909252516112149185910161409f565b60408051808303601f19018152918152828101919091528051808201909152600681526514d41254925560d21b602082015288516112549190601361236c565b606082015260405161126a908490602001613d20565b60408051808303601f1901815291815260808301919091528051808201825260058152644a5549434560d81b6020828101919091528a810151600f805485518185028101850190965280865261137795929360009084015b8282101561136e5783829060005260206000200180546112e1906144c9565b80601f016020809104026020016040519081016040528092919081815260200182805461130d906144c9565b801561135a5780601f1061132f5761010080835404028352916020019161135a565b820191906000526020600020905b81548152906001019060200180831161133d57829003601f168201915b5050505050815260200190600101906112c2565b5050505061248d565b60a082015260405161138d90849060200161379a565b60408051808303601f1901815291815260c0830191909152805180820182526005815264053595255560dc1b6020828101919091528a8301516010805485518185028101850190965280865261149195929360009084015b8282101561136e578382906000526020600020018054611404906144c9565b80601f0160208091040260200160405190810160405280929190818152602001828054611430906144c9565b801561147d5780601f106114525761010080835404028352916020019161147d565b820191906000526020600020905b81548152906001019060200180831161146057829003601f168201915b5050505050815260200190600101906113e5565b60e08201526040516114a79084906020016139b7565b60408051808303601f19018152918152610100830191909152805180820190915260078152662624a8aaa2aaa960c91b602082015260608901516114ed9190601461236c565b610120820152604051611504908490602001613905565b60408051808303601f1901815291815261014083019190915280518082018252600681526514d41254925560d21b60208281019190915260808b01516011805485518185028101850190965280865261160b95929360009084015b8282101561136e57838290600052602060002001805461157e906144c9565b80601f01602080910402602001604051908101604052809291908181526020018280546115aa906144c9565b80156115f75780601f106115cc576101008083540402835291602001916115f7565b820191906000526020600020905b8154815290600101906020018083116115da57829003601f168201915b50505050508152602001906001019061155f565b610160820152604051611622908490602001613e45565b60408051808303601f1901815291905261018082015261164585600460006124fc565b6101a082015260405161165c90849060200161384b565b60408051601f198184030181529181526101c08301919091526101e0820183905280518082018252600d81526c1e17ba32bc3a1f1e17b9bb339f60991b602080830191909152610200840191909152825181840151848401516060860151608087015195516000966116d096909101613446565b60408051808303601f190181529082905260a084015160c085015160e086015161010087015161012088015194965061170e958795906020016134b1565b60408051808303601f19018152908290526101408401516101608501516101808601516101a087015193955061174994869490602001613446565b60408051808303601f19018152908290526101c08401516101e085015161020086015192945061177e938593906020016133ef565b60408051601f19818403018152828201909152600682526514dc1a5c9a5d60d21b602083015291506000906117bb908460035b60200201516126f6565b6117ef604051806040016040528060058152602001644a7569636560d81b815250856005601181106117b1576117b16145d8565b604051602001611800929190613db7565b60408051601f198184030181528282019091526005825264053797275760dc1b602083015291508190611835908560076117b1565b6040805180820190915260078152662634b8bab2bab960c91b602082015261185f908660096117b1565b60405160200161187193929190613530565b60408051601f1981840301815282820190915260068252652334b63632b960d11b6020830152915081906118a79085600b6117b1565b604080518082019091526005815264537461676560d81b60208201526118cf9086600f6117b1565b6040516020016118e193929190613530565b60408051601f19818403018152828201909152600b82526a4472756e6b656e6e65737360a81b60208301529150819061191a9089612722565b61194b6040518060400160405280600381526020016242414360e81b8152506119468b600460006124fc565b6126f6565b60405160200161195d9392919061358a565b604051602081830303815290604052905060006119ac61197c8e61226e565b836119868661273f565b60405160200161199893929190613efc565b60405160208183030381529060405261273f565b9050806040516020016119bf9190613e00565b60408051601f198184030181529190529d9c50505050505050505050505050565b600b546001600160a01b03163314611a0a5760405162461bcd60e51b81526004016105f6906141f1565b6001600160a01b038116611a6f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f6565b611a7881611df5565b50565b60006001600160e01b031982166380ac58cd60e01b1480611aac57506001600160e01b03198216635b5e139f60e01b145b806104e957506301ffc9a760e01b6001600160e01b03198316146104e9565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611b00826109e9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611bb25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016105f6565b6000611bbd836109e9565b9050806001600160a01b0316846001600160a01b03161480611bf85750836001600160a01b0316611bed84610581565b6001600160a01b0316145b80611c2857506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611c43826109e9565b6001600160a01b031614611cab5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016105f6565b6001600160a01b038216611d0d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105f6565b611d188383836128a5565b611d23600082611acb565b6001600160a01b0383166000908152600360205260408120805460019290611d4c908490614446565b90915550506001600160a01b0382166000908152600360205260408120805460019290611d7a9084906142c5565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6107d582826040518060200160405280600081525061295d565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600d546000908190611e5e90849061ffff16614423565b90506000611e6c8285612990565b61ffff8082166000908152600e60205260409020549192501680611e8d5750805b600e6000611e9c600186614423565b61ffff90811682526020820192909252604001600020541615611f0757600e6000611ec8600186614423565b61ffff908116825260208083019390935260409182016000908120548683168252600e90945291909120805461ffff1916929091169182179055611f37565b611f12600184614423565b61ffff8381166000908152600e60205260409020805461ffff19169183169190911790555b50949350505050565b60005b815181101561072c57611f6f83838381518110611f6257611f626145d8565b6020026020010151612a10565b80611f7981614526565b915050611f43565b611f8c848484611c30565b611f9884848484612b5e565b610df65760405162461bcd60e51b81526004016105f69061419f565b600082611fc08361226e565b604051602001611fd19291906133c0565b60408051601f1981840301815290829052611fee916020016133a4565b60408051601f1981840301815291905280516020909101209392505050565b6040516514d41254925560d21b6020820152600090602601604051602081830303815290604052805190602001208360405160200161204c91906133a4565b6040516020818303038152906040528051906020012014806120be5750604051662624a8aaa2aaa960c91b602082015260270160405160208183030381529060405280519060200120836040516020016120a691906133a4565b60405160208183030381529060405280519060200120145b156120e0576120ce600983614582565b6120d99060016142c5565b90506104e9565b604051644a5549434560d81b6020820152602501604051602081830303815290604052805190602001208360405160200161211b91906133a4565b60405160208183030381529060405280519060200120148061218c5750604051652324a62622a960d11b6020820152602601604051602081830303815290604052805190602001208360405160200161217491906133a4565b60405160208183030381529060405280519060200120145b156121b25761219c600483614582565b6121a79060016142c5565b6120d9906003614404565b6121bd600283614582565b6121c89060016142c5565b6120d9906002614404565b600061279e82106121e657506005919050565b61279e821080156121f9575061217a8210155b1561220657506004919050565b61217a821080156122195750611be68210155b1561222657506003919050565b611be68210801561223957506116e08210155b1561224657506002919050565b6116e082108015612259575061114b8210155b1561226657506001919050565b506000919050565b6060816122925750506040805180820190915260018152600360fc1b602082015290565b8160005b81156122bc57806122a681614526565b91506122b59050600a83614302565b9150612296565b60008167ffffffffffffffff8111156122d7576122d76145ee565b6040519080825280601f01601f191660200182016040528015612301576020820181803683370190505b5090505b8415611c2857612316600183614446565b9150612323600a86614582565b61232e9060306142c5565b60f81b818381518110612343576123436145d8565b60200101906001600160f81b031916908160001a905350612365600a86614302565b9450612305565b60606000828161237d600a87614582565b81526020019081526020016000206000018054612399906144c9565b80601f01602080910402602001604051908101604052809291908181526020018280546123c5906144c9565b80156124125780601f106123e757610100808354040283529160200191612412565b820191906000526020600020905b8154815290600101906020018083116123f557829003601f168201915b505050505090506000836000600a8761242b9190614582565b8152602001908152602001600020600101549050600061244b878761200d565b9050826124578361226e565b6124608361226e565b60405160200161247293929190613640565b60405160208183030381529060405293505050509392505050565b606060008283518561249f9190614582565b815181106124af576124af6145d8565b6020026020010151905060006124c5868661200d565b9050816124d18261226e565b6040516020016124e29291906135f2565b604051602081830303815290604052925050509392505050565b606060008261250c57600061250f565b60015b9050600061251e85600a614359565b9050856000805b82156125845760ff811615612546578061253e81614541565b915050612564565b612551600a84614582565b15612564578061256081614541565b9150505b8161256e81614541565b925061257d9050600a84614302565b9250612525565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915287151560e082015260ff89166125d4838561445d565b60ff1610612614576125e6858b614302565b81526125f2898461445d565b60ff16604082018190526126079087906142dd565b60ff1660208201526126c7565b61261e828461445d565b61262990600a614359565b612633908b614302565b815289851115612696576002608082015261264e838a61445d565b6126599060026142dd565b60ff1660a0820181905261266d90836142dd565b60ff16604082018190526126829087906142dd565b60ff166020820152600160c08201526126c7565b6126a18260016142dd565b60ff1660408201526126b3898461445d565b6126be9060016142dd565b60ff1660608201525b8581604001516126d791906142dd565b60ff1660208201526126e881612c6b565b9a9950505050505050505050565b6060828260405160200161270b9291906136b4565b604051602081830303815290604052905092915050565b60608261272e8361226e565b60405160200161270b929190613728565b80516060908061275f575050604080516020810190915260008152919050565b6000600361276e8360026142c5565b6127789190614302565b612783906004614404565b905060006127928260206142c5565b67ffffffffffffffff8111156127aa576127aa6145ee565b6040519080825280601f01601f1916602001820160405280156127d4576020820181803683370190505b509050600060405180606001604052806040815260200161461b604091399050600181016020830160005b86811015612860576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b8352600490920191016127ff565b50600386066001811461287a576002811461288b57612897565b613d3d60f01b600119830152612897565b603d60f81b6000198301525b505050918152949350505050565b6001600160a01b038316612900576128fb81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612923565b816001600160a01b0316836001600160a01b031614612923576129238382612eae565b6001600160a01b03821661293a5761072c81612f4b565b826001600160a01b0316826001600160a01b03161461072c5761072c8282612ffa565b6129678383612a10565b6129746000848484612b5e565b61072c5760405162461bcd60e51b81526004016105f69061419f565b6000808261299f600143614446565b60405160f09290921b6001600160f01b031916602083015240602282015241606090811b6bffffffffffffffffffffffff1990811660428401524460568401523390911b166076820152608a0160408051601f1981840301815291905280516020909101209050611c288482614561565b6001600160a01b038216612a665760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016105f6565b6000818152600260205260409020546001600160a01b031615612acb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016105f6565b612ad7600083836128a5565b6001600160a01b0382166000908152600360205260408120805460019290612b009084906142c5565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15612c6057604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612ba290339089908890889060040161414f565b602060405180830381600087803b158015612bbc57600080fd5b505af1925050508015612bec575060408051601f3d908101601f19168201909252612be991810190613303565b60015b612c46573d808015612c1a576040519150601f19603f3d011682016040523d82523d6000602084013e612c1f565b606091505b508051612c3e5760405162461bcd60e51b81526004016105f69061419f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611c28565b506001949350505050565b60606000826020015160ff1667ffffffffffffffff811115612c8f57612c8f6145ee565b6040519080825280601f01601f191660200182016040528015612cb9576020820181803683370190505b5090508260e0015115612d0257602560f81b8160018351612cda9190614446565b81518110612cea57612cea6145d8565b60200101906001600160f81b031916908160001a9053505b8260c0015115612d6b57600360fc1b81600081518110612d2457612d246145d8565b60200101906001600160f81b031916908160001a905350601760f91b81600181518110612d5357612d536145d8565b60200101906001600160f81b031916908160001a9053505b608083015160ff165b8360a0015160ff16811015612dc357603060f81b828281518110612d9a57612d9a6145d8565b60200101906001600160f81b031916908160001a90535080612dbb81614526565b915050612d74565b505b8251156104e9576000836060015160ff16118015612df05750826060015160ff16836040015160ff16145b15612e3957601760f91b81846040018051612e0a906144ac565b60ff169081905281518110612e2157612e216145d8565b60200101906001600160f81b031916908160001a9053505b8251612e4790600a90614582565b612e529060306142c5565b60f81b81846040018051612e65906144ac565b60ff169081905281518110612e7c57612e7c6145d8565b60200101906001600160f81b031916908160001a905350600a83600001818151612ea69190614302565b905250612dc5565b60006001612ebb84610a60565b612ec59190614446565b600083815260076020526040902054909150808214612f18576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612f5d90600190614446565b60008381526009602052604081205460088054939450909284908110612f8557612f856145d8565b906000526020600020015490508060088381548110612fa657612fa66145d8565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612fde57612fde6145c2565b6001900381819060005260206000200160009055905550505050565b600061300583610a60565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6040518061022001604052806011905b606081526020019060019003908161304e5790505090565b80356001600160a01b038116811461307d57600080fd5b919050565b60006020828403121561309457600080fd5b61309d82613066565b9392505050565b600080604083850312156130b757600080fd5b6130c083613066565b91506130ce60208401613066565b90509250929050565b6000806000606084860312156130ec57600080fd5b6130f584613066565b925061310360208501613066565b9150604084013590509250925092565b6000806000806080858703121561312957600080fd5b61313285613066565b93506020613141818701613066565b935060408601359250606086013567ffffffffffffffff8082111561316557600080fd5b818801915088601f83011261317957600080fd5b81358181111561318b5761318b6145ee565b61319d601f8201601f19168501614277565b915080825289848285010111156131b357600080fd5b808484018584013760008482840101525080935050505092959194509250565b600080604083850312156131e657600080fd5b6131ef83613066565b91506020830135801515811461320457600080fd5b809150509250929050565b6000806040838503121561322257600080fd5b61322b83613066565b946020939093013593505050565b6000602080838503121561324c57600080fd5b823567ffffffffffffffff8082111561326457600080fd5b818501915085601f83011261327857600080fd5b81358181111561328a5761328a6145ee565b8060051b915061329b848301614277565b8181528481019084860184860187018a10156132b657600080fd5b600095505b838610156132d95780358352600195909501949186019186016132bb565b5098975050505050505050565b6000602082840312156132f857600080fd5b813561309d81614604565b60006020828403121561331557600080fd5b815161309d81614604565b60006020828403121561333257600080fd5b5035919050565b60006020828403121561334b57600080fd5b813560ff8116811461309d57600080fd5b60008151808452613374816020860160208601614480565b601f01601f19169290920160200192915050565b6000815161339a818560208601614480565b9290920192915050565b600082516133b6818460208701614480565b9190910192915050565b600083516133d2818460208801614480565b8351908301906133e6818360208801614480565b01949350505050565b60008551613401818460208a01614480565b855190830190613415818360208a01614480565b8551910190613428818360208901614480565b845191019061343b818360208801614480565b019695505050505050565b60008651613458818460208b01614480565b86519083019061346c818360208b01614480565b865191019061347f818360208a01614480565b8551910190613492818360208901614480565b84519101906134a5818360208801614480565b01979650505050505050565b6000875160206134c48285838d01614480565b8851918401916134d78184848d01614480565b88519201916134e98184848c01614480565b87519201916134fb8184848b01614480565b865192019161350d8184848a01614480565b855192019161351f8184848901614480565b919091019998505050505050505050565b60008451613542818460208901614480565b8083019050600b60fa1b8082528551613562816001850160208a01614480565b6001920191820152835161357d816002840160208801614480565b0160020195945050505050565b6000845161359c818460208901614480565b8083019050600b60fa1b80825285516135bc816001850160208a01614480565b600192019182015283516135d7816002840160208801614480565b605d60f81b6002929091019182015260030195945050505050565b60008351613604818460208801614480565b6201016960ed1b9083019081528351613624816003840160208801614480565b620818db60ea1b60039290910191820152600601949350505050565b60008451613652818460208901614480565b61040560f31b9083019081528451613671816002840160208901614480565b64012949016960dd1b600292909101918201528351613697816007840160208801614480565b620818db60ea1b60079290910191820152600a0195945050505050565b6f3d913a3930b4ba2fba3cb832911d101160811b815282516000906136e0816010850160208801614480565b6c111610113b30b63ab2911d101160991b601091840191820152835161370d81601d840160208801614480565b61227d60f01b601d9290910191820152601f01949350505050565b6f3d913a3930b4ba2fba3cb832911d101160811b81528251600090613754816010850160208801614480565b6b0111610113b30b63ab2911d160a51b601091840191820152835161378081601c840160208801614480565b607d60f81b601c9290910191820152601d01949350505050565b7f3c2f746578743e3c7465787420783d2231302220793d223135302220636c617381527f733d2268322d737667223e53595255503c2f746578743e3c7465787420783d2260208201527f31302220793d223136352220636c6173733d22626173652d7376672220737479604082015269036329e913334b6361d160b51b60608201526000825161383181606a850160208701614480565b621d911f60e91b606a939091019283015250606d01919050565b7f207065726d696c6c653c2f746578743e3c7465787420783d2231302220793d2281527f3331302220636c6173733d2268322d737667223e53544147453c2f746578743e60208201527f3c7465787420783d2231302220793d223332352220636c6173733d2262617365604082015272016b9bb33911039ba3cb6329e913334b6361d1606d1b6060820152600082516138eb816073850160208701614480565b621d911f60e91b6073939091019283015250607601919050565b7f3c2f746578743e3c7465787420783d2231302220793d223233302220636c617381527f733d2268322d737667223e46494c4c45523c2f746578743e3c7465787420783d60208201527f2231302220793d223234352220636c6173733d22626173652d7376672220737460408201526a03cb6329e913334b6361d160ad1b60608201526000825161399d81606b850160208701614480565b621d911f60e91b606b939091019283015250606e01919050565b7f3c2f746578743e3c7465787420783d2231302220793d223139302220636c617381527f733d2268322d737667223e4c4951554555523c2f746578743e3c74657874207860208201527f3d2231302220793d223230352220636c6173733d22626173652d73766722207360408201526b03a3cb6329e913334b6361d160a51b606082015260008251613a5081606c850160208701614480565b621d911f60e91b606c939091019283015250606f01919050565b66465553454c202360c81b815260008251613a8c816007850160208701614480565b9190910160070192915050565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f73766722207072657365727665417370656374526174696f3d22784d6960208201527f6e594d696e206d656574222076696577426f783d22302030203335302033353060408201527f223e3c7374796c653e40696d706f72742075726c282268747470733a2f2f666f60608201527f6e74732e676f6f676c65617069732e636f6d2f6373733f66616d696c793d4d6f60808201527f6e6f746f6e7c4d6f6e747365727261747c566172656c612b526f756e6422293b60a08201527f202e626173652d737667207b20666f6e742d66616d696c793a2022566172656c60c08201527f6120526f756e64222c206d6f6e6f73706163653b20666f6e742d73697a653a2060e08201527f313470783b7d202e68312d737667207b20666f6e742d66616d696c793a20224d6101008201527f6f6e6f746f6e222c206d6f6e6f73706163653b20666f6e742d73697a653a20326101208201527f3470783b7d202e68322d737667207b2066696c6c3a20236532653265323b20666101408201527f6f6e742d66616d696c793a20224d6f6e74736572726174222c206d6f6e6f73706101608201527f6163653b20666f6e742d73697a653a203870783b7d3c2f7374796c653e3c72656101808201527f63742077696474683d223130302522206865696768743d2231303025222066696101a08201527f6c6c3d222330613061306122202f3e3c7465787420783d2231302220793d22336101c08201527f352220636c6173733d2268312d73766722207374796c653d2266696c6c3a20006101e0820152600061309d613d116101ff840185613388565b621d911f60e91b815260030190565b7f3c2f746578743e3c7465787420783d2231302220793d223131302220636c617381527f733d2268322d737667223e4a554943453c2f746578743e3c7465787420783d2260208201527f31302220793d223132352220636c6173733d22626173652d7376672220737479604082015269036329e913334b6361d160b51b60608201526000825161383181606a850160208701614480565b605b60f81b815260008351613dd3816001850160208801614480565b600b60fa1b6001918401918201528351613df4816002840160208801614480565b01600201949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251613e3881601d850160208701614480565b91909101601d0192915050565b7f3c2f746578743e3c7465787420783d2231302220793d223237302220636c617381527f733d2268322d737667223e4452554e4b454e4e4553533c2f746578743e3c746560208201527f787420783d2231302220793d223238352220636c6173733d22626173652d737660408201526f033911039ba3cb6329e913334b6361d160851b606082015260008251613ee2816070850160208701614480565b621d911f60e91b6070939091019283015250607301919050565b707b226e616d65223a2022465553454c202360781b81528351600090613f29816011850160208901614480565b7f222c20226465736372697074696f6e223a2022467573656c206973206120636f6011918401918201527f6d6d6f6e206765726d616e20636f6c6c6f717569616c207465726d20666f722060318201527f6261642c20696d70726f7065726c792064697374696c6c656420616e6420636860518201527f6561702073706972697473206f72206c6971756f72732e20437265617465207960718201527f6f7572206f776e2072616e646f6d6c792067656e65726174656420636f636b7460918201527f61696c206f6e20746865204655534520626c6f636b636861696e2e222c20226160b18201526b03a3a3934b13aba32b9911d160a51b60d182015284516140398160dd840160208901614480565b61409461408661408060dd848601017f202c22696d616765223a2022646174613a696d6167652f7376672b786d6c3b62815265185cd94d8d0b60d21b602082015260260190565b87613388565b61227d60f01b815260020190565b979650505050505050565b7f3c2f746578743e3c7465787420783d2231302220793d2237302220636c61737381527f3d2268322d737667223e5350495249543c2f746578743e3c7465787420783d2260208201527f31302220793d2238352220636c6173733d22626173652d73766722207374796c6040820152680329e913334b6361d160bd1b606082015260008251614135816069850160208701614480565b621d911f60e91b6069939091019283015250606c01919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906141829083018461335c565b9695505050505050565b60208152600061309d602083018461335c565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff811182821017156142a0576142a06145ee565b604052919050565b600061ffff8083168185168083038211156133e6576133e6614596565b600082198211156142d8576142d8614596565b500190565b600060ff821660ff84168060ff038211156142fa576142fa614596565b019392505050565b600082614311576143116145ac565b500490565b600181815b8085111561435157816000190482111561433757614337614596565b8085161561434457918102915b93841c939080029061431b565b509250929050565b600061309d60ff841683600082614372575060016104e9565b8161437f575060006104e9565b8160018114614395576002811461439f576143bb565b60019150506104e9565b60ff8411156143b0576143b0614596565b50506001821b6104e9565b5060208310610133831016604e8410600b84101617156143de575081810a6104e9565b6143e88383614316565b80600019048211156143fc576143fc614596565b029392505050565b600081600019048311821515161561441e5761441e614596565b500290565b600061ffff8381169083168181101561443e5761443e614596565b039392505050565b60008282101561445857614458614596565b500390565b600060ff821660ff84168082101561447757614477614596565b90039392505050565b60005b8381101561449b578181015183820152602001614483565b83811115610df65750506000910152565b600060ff8216806144bf576144bf614596565b6000190192915050565b600181811c908216806144dd57607f821691505b602082108114156144fe57634e487b7160e01b600052602260045260246000fd5b50919050565b600061ffff8083168181141561451c5761451c614596565b6001019392505050565b600060001982141561453a5761453a614596565b5060010190565b600060ff821660ff81141561455857614558614596565b60010192915050565b600061ffff80841680614576576145766145ac565b92169190910692915050565b600082614591576145916145ac565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114611a7857600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212202ec6e05f0f939497894a153963e72884d9cf74418aba82fc64c7fb3f7d69749f64736f6c63430008070033